cws-release

Publish Chrome extensions from the terminal, your CI, or an AI agent.

English · 简体中文

Stop clicking through the developer dashboard for every release. cws uploads your zip, submits it for review, and reports the store’s real state — or the exact reason it refused. One Node CLI, no dependencies.

npm i -D cws-release     # in your extension repository
npx cws-release init     # once: writes .cws.json and the agent skill
npx cws-release check    # proves the credentials work, in three seconds
npx cws-release release  # upload -> submit for review -> print the state

What it does

Command What it does
cws init Write a .cws.json template and the agent skill into a repository
cws check Exchange the token and call fetchStatus; separates “the secret is set” from “the secret works”
cws upload [zip] Upload the package, then wait for asynchronous processing
cws publish Submit the uploaded package for review
cws release [zip] upload → publish → status, in one step
cws status Published and submitted revision state
cws cancel Cancel a submission that is under review

The API cannot create a new item: the first upload and the listing, privacy and visibility tabs are done by hand in the Developer Dashboard. Everything after that is scriptable.

Why this one

No dependencies. Node ≥ 22 signs the service-account JWT with node:crypto and uses the built-in fetch. There is nothing to install, and nothing to audit beyond the 15 files you can read.

Service account, not a refresh token. One key, added once in the Web Store dashboard, covers every item under that publisher and does not expire. No browser round trip, no token refresh plumbing.

Honest output. publish returns a review state, not “live”. The CLI prints the store’s state instead of inventing one, so status is a trustworthy answer to “is it live yet?”.

Built for agents. One command installs the skill, and the CLI underneath answers in JSON with stable error codes — see Using it with an AI agent.

$ cws release --json 2>err.log
cws:json {"ok":false,"error":{"code":"PUBLISHER_FORBIDDEN","status":403,
  "reason":"PERMISSION_DENIED","message":"HTTP 403: …",
  "hint":"Add the service-account email in the Developer Dashboard under Settings, in the Management section, then check publisherId in .cws.json."}}

A skill, not just a CLI. SKILL.md ships the procedure and the guardrails an agent needs — when to stop, what never to retry, which states mean “wait for a human”.

Install

Your setup Use Where the version is pinned
Several extensions npm i -D cws-release, then npx cws-release <cmd> package.json + lockfile, per repo
One extension, or trying it npm i -g cws-release your machine
A release pipeline uses: XCreativeStudio/cws-release@v1 the tag

With a dev dependency, each repository pins its own version, so upgrading one extension never changes another and CI installs exactly what you tested. A global install pins nothing — every project on that machine shares one version.

Credentials

Identifiers go in .cws.json, committed; the key never does:

{
  "publisherId": "…",
  "itemId": "…",
  "zip": ".output/*-chrome.zip"
}
export CWS_SERVICE_ACCOUNT_FILE="$HOME/.config/cws/service-account.json"   # local
export CWS_SERVICE_ACCOUNT="$(cat key.json)"                               # CI secret

One-time setup

Once per publisher account, not per extension. Four pieces of state must line up, and any mismatch shows up as the same PUBLISHER_FORBIDDEN (403) — so work through them in this order:

  1. Enable the Chrome Web Store API in a Google Cloud project: https://console.cloud.google.com/apis/library/chromewebstore.googleapis.com. Select the project first; disabled, calls fail at the API rather than at authentication.

    The Chrome Web Store API product page with its Enable button

  2. Create a service account with no IAM roles, then Keys → Add key → JSON. Keep it outside the repository: ~/.config/cws/, directory 700, file 600.

  3. Authorize it in the Developer Dashboard, under Settings → Management (not Account → Profile, which holds the display name and contact email). Paste the …@….iam.gserviceaccount.com email. This is the step that grants access.

    The Settings page with the Service account table in the Management section

  4. Copy both identifiers from the same Settings page — the Publisher ID under Profile, and the 32-character item ID. They are per-publisher; never reuse another project’s values.

    The Settings page showing the Publisher ID field under Profile

The publisher account needs 2FA, and one publisher accepts one service account. The key is a long-lived credential for every item under the publisher: never commit it, never put it in .cws.json, and if it may have leaked, delete it in Google Cloud and create a new one — the dashboard entry is keyed by email, so it needs no change.

Menu labels follow your console language, and Google rearranges these pages from time to time; if a layout differs, look for the API name, the Management block and the Profile fields rather than the exact pixel positions.

Using it with an AI agent

Step 1 — install the skill

npx skills add XCreativeStudio/cws-release

skills is the skill installer that works across Claude Code, Codex, Cursor, Copilot and 70+ other agents. It clones the repository into .agents/skills/chrome-web-store-publish/ and symlinks it for each agent it detects. Nothing else to configure.

This installs two things at once: SKILL.md (the procedure and guardrails the agent reads) and a working copy of the CLI at .agents/skills/chrome-web-store-publish/cws.mjs. The agent can run it offline:

node .agents/skills/chrome-web-store-publish/cws.mjs check

Prefer the npm route? npm i -D cws-release && npx cws-release init writes the same skill into the same directory, for projects that would rather not clone the repository.

Step 2 — the agent gets JSON, not logs

Every command accepts --json. Success goes to stdout as an envelope; progress goes to stderr.

{ "ok": true, "command": "release", "data": { "upload": {…}, "publish": {…}, "status": {…} } }

On failure exactly one line goes to stderr, prefixed so it can be found among the progress text:

cws:json {"ok":false,"error":{"code":"PUBLISHER_FORBIDDEN","status":403,
  "reason":"PERMISSION_DENIED","message":"HTTP 403: …",
  "hint":"Add the service-account email in the Developer Dashboard under Settings, in the Management section, then check publisherId in .cws.json."}}

The agent extracts it with sed -n 's/^cws:json //p' and branches on error.code, which never changes meaning:

code Usual fix
NO_CREDENTIALS Set CWS_SERVICE_ACCOUNT_FILE or CWS_ACCESS_TOKEN
PUBLISHER_FORBIDDEN Add the service account in the dashboard; check publisherId
UPLOAD_REJECTED Raise the manifest version above the published one

Step 3 — the guards that stop bad releases

SKILL.md tells the agent what never to do: never retry a package the store rejected, never re-upload after a timeout (it can double-submit), never report “live” unless fetchStatus says PUBLISHED, and never print the key.

The full list of 14 codes, with meanings and retry guidance: error codes.

CI

As a GitHub Action — it installs the CLI, checks the Node version, and exposes the JSON envelope as result and the failure code as code:

- uses: actions/checkout@v4
- uses: actions/setup-node@v4
  with:
    node-version: 22
- uses: XCreativeStudio/cws-release@v1
  with:
    command: release
    zip: .output/*-chrome.zip
  env:
    CWS_SERVICE_ACCOUNT: $

Credentials are not inputs: keep them in the step env so they never appear in the action’s resolved inputs. Other CI systems, failure handling and pinning: CI setup.

What it does not do

The v2 API offers more than this CLI calls. Not implemented: fetchReviews, getRatingSummary, queryMetrics, rollback, setPublishedDeployPercentage.

Also out of the API’s reach, so dashboard-only: creating a new item, editing the listing, screenshots, privacy answers, visibility and pricing.

Roadmap

Status Item
✅ v2 API, service-account auth, upload / publish / release / status / cancel
✅ --json on every command with 14 stable error codes
✅ GitHub Action with result / code outputs
✅ cws init: repository config and agent skill in one step
Next metrics, reviews, rating (needs live credentials to verify fields)
Later deploy-percentage with staged rollout

Not planned: rollback — it can break a live listing, and a wrong rollback is worse than a manual one.

API version. This talks to the Chrome Web Store API v2 only (chromewebstore.googleapis.com/v2), which is the current API. If you are evaluating an older tool, check which API it targets before it fails on you.