One command line for Gateweave: deploy Track or ID into your own Cloudflare account and check the deployment.
Status: early. The automated tests fake Wrangler, git and pnpm. In a separate Cloudflare
rehearsal account, we deployed Track and ID and ran gateweave connect id track twice on Windows.
The second run reused the existing registration and left the Worker version unchanged. The
rehearsal verified Track's sign-in button and ID's issuer. Run the CLI with npx gateweave
(see Install).
| Command | Purpose |
|---|---|
gateweave deploy track |
Create what Track needs in your Cloudflare account, set its secrets, apply migrations, deploy, and check the result from outside |
gateweave deploy id |
The same for ID: Worker, D1 database, logout Queue and RateLimiter Durable Object |
gateweave doctor track |
Say what is wrong with a Track deployment, in words |
gateweave doctor id |
Say what is wrong with an ID deployment; Track-only checks say they are not checked for ID |
gateweave update track |
Bring a Track deployment to a newer release, keeping the names of its Worker, database and bucket |
gateweave update id |
Bring an ID deployment to a newer release, keeping the names of its Worker, database and queue |
gateweave connect id track |
Set up ID's provider, register Track and configure Track to sign people in through ID |
connect id track is described in the package's README.
gateweave deploy track [--name <name>] [--release vX.Y.Z] [--account <id>] [--no-attachments] [--no-account-name] [--yes] [--json]
It needs Node 22 or newer with npm, git, and Wrangler signed in (npx wrangler login, or
CLOUDFLARE_API_TOKEN). It installs nothing globally and writes nothing into the folder you run it
from.
- Looks, changing nothing: the account (with several, it stops and lists them: choose one with
--accountorCLOUDFLARE_ACCOUNT_ID), whether R2 is on, Track's newest release (or--release), and that no Worker, D1 database or R2 bucket of the planned names exists. A name in use that this tool did not make stops it. - Shows the plan and waits for a yes: the account, the release, the Worker and the D1 database
(
<name>, defaultgateweave-track), the R2 bucket (<name>-files, none with--no-attachments), the Durable ObjectsWorkspaceDOandRateLimiter, and the secretBETTER_AUTH_SECRETby name.--yesanswers for you; without a terminal and without--yesit stops at once. - Fetches the release into your cache folder, installs it with the pnpm version Track names,
and writes the names into its
wrangler.jsonc. - Runs Track's own
pnpm run deploy, which creates the database, the bucket and the Durable Objects, setsBETTER_AUTH_SECRETto a value nobody sees, and applies the migrations. Its output goes to stderr. - Checks the address from outside for up to two minutes: the sign-in page is Track's, accounts are looked up, and the sync gateway and MCP turn away a request without a session or token.
- Says what it created and what to do next: open the address and create the first account,
which owns the server; MCP stays off until
BETTER_AUTH_URLis set.
It keeps a record in %APPDATA%\gateweave on Windows, and elsewhere in $XDG_CONFIG_HOME/gateweave,
or in ~/.config/gateweave when that is unset. The file deployments.json holds the account's id
and name, the release, the names of the Worker, database and bucket, the database's id, the address,
two flags (workerCreated and bucketCreated), the steps done and a time; no secrets. Run the same
command again and it only checks a deployment that is done.
What it reuses is narrow. A database counts as its own only while its id matches the record. A Worker or bucket counts when its flag is set, or when the record's deploy finished; after that a Worker or bucket of the same name is accepted by name alone. The flag is set when the name was free at the last look before the deploy and, after it, a listing shows the Worker; for a bucket, its creation line in the deploy's output or such a listing is enough. That is evidence, not proof. A successful deploy can record a Worker or bucket that someone else made after that last look, and a bucket's creation line in the output is enough even when the listing after it failed. Once the Worker it deployed is gone the record is ignored.
After a failed deploy it records less. A database is recorded, with its id, only when its name was
free at the last look, the output on stdout has Wrangler's creation lines for it, and a listing
afterwards returns it. A bucket is recorded only when its name was free, stdout has its creation
line, and a listing afterwards shows it. The Worker is never recorded then, because Wrangler prints
"Uploaded" when it updates a Worker too. So a rerun stops with the name-in-use error (exit 6) and
changes nothing when the Worker is already there, or when a database or bucket exists without such a
record. Otherwise it runs the deploy again. What the failed run made stays in your account: choose
another --name.
With --json, stdout holds one object: the result, or { "ok": false, "code", "reason" }.
In the result, account is { "id", "name" } and nothing else of Wrangler's account record.
Cloudflare often names an account <email>'s Account. With --no-account-name, the human output
and the JSON result carry only the account id, so output pasted into an issue does not carry that
address; the JSON account is then { "id" }.
| Exit code | Meaning |
|---|---|
| 0 | Deployed, or already deployed, and every check passed |
| 1 | Something unexpected; the reason says what |
| 2 | Wrong usage: an unknown command or option, a bad name, a release that does not exist |
| 3 | A requirement is missing: Node, git, npm, a Wrangler sign-in, or a list it could not read |
| 4 | The account: several to choose from, or the one named is not reachable |
| 5 | R2 is off in the account: turn it on, or use --no-attachments |
| 6 | A planned name is taken by something this tool did not make; nothing was changed |
| 7 | No yes: declined, or no terminal and no --yes; nothing was created |
| 8 | Fetching, installing or Track's deploy failed; a rerun may stop with 6, as said above |
| 9 | Deployed, but a check from outside failed, or the address is unknown |
gateweave deploy id [--name <name>] [--release vX.Y.Z] [--account <id>] [--no-account-name] [--yes] [--json]
The same flow as deploy track, with the resources ID's release describes: the Worker and D1
database named <name> (default gateweave-id), the logout Queue <name>-logouts, and the
RateLimiter Durable Object. The plan lists the queue before anything is created, and a queue name
already in use stops the command before it changes anything. The next step is different on purpose:
open <address>/signup at once, because until the server has an account, whoever reaches it first
owns it.
doctor id and update id use the same deployment record and release description. A check that
exists only for Track, such as its MCP endpoint, is reported as not checked for ID rather than
being guessed.
packages/cli/src/products.ts holds one small description for each product: its repository and raw
file base, its default deployment name, and the resource kinds it has (D1, an optional R2 bucket or
Queue, with the wrangler.jsonc binding and the suffix of the generated name). The release itself
remains the source of the pinned pnpm and Wrangler versions, required secrets and Durable Object
classes. Adding the next product starts there, with tests in packages/cli/test/ for the resources
that product adds.
gateweave update track [--name <name>] [--to vX.Y.Z] [--account <id>] [--yes] [--json]
[--from vX.Y.Z --worker <name> --database <name> (--bucket <name> | --no-attachments)]
Brings a Track deployment to a newer release. It needs git, npm's npx and the same Wrangler
sign-in as deploy track, and Node 22 or newer, or the higher minimum the target release names. It
uses the Wrangler and pnpm versions the target release names. It takes the newest stable release,
or --to, and the account as deploy track does.
- Finds the deployment. From the record
deploy trackkeeps, by account and--name(defaultgateweave-track), or, for an unrecorded deployment, from the names you give (below). A record missing the deployed step is refused with exit 3: finish it withdeploy track. A record whose deploy reached that step but whose checks from outside failed can be updated or retried. - Looks, for a newer target, at the Worker, the D1 database and the R2 bucket, if there is one: a missing one, or a lookup that fails, stops it with exit 3, and R2 turned off in the account while a bucket is configured with exit 5. A recorded database id must match the database found, or it stops with exit 6.
- Reads the target release into your cache, with the names and the id of the database it found
written into its
wrangler.jsonc. It then lists the migration files the database has not applied: one query asks whether the migrations table exists and, if it does, a second reads the names applied. A missing table is not created: every regular.sqlfile in the configured migrations directory then counts as pending. While it prepares an upgrade the command leaves the Cloudflare account and the record as they are, and it writes the checkout in your cache; the install it runs has no limit on where it writes. - Shows the plan and waits for a yes: the account, both releases, the Worker, database and
bucket marked as kept, the pending migrations and, when the target's
CHANGELOG.mdcan be read, its sections headed## [X.Y.Z]after the present release up to the target. It asks "Update it?".--yesanswers for you. A no stops with exit 7 and "Nothing was changed."; with no terminal and no--yesit also exits 7, with a message that starts "Nothing was changed: there is no terminal to answer on." - Looks again after the yes. If the Worker, or the bucket if there is one, is missing, or the database is missing or has another id, it stops with exit 3 and deploys nothing. A Worker or bucket replaced under the same name is not noticed.
- Runs the target's own
pnpm run deployin the cache. This tool runs no migration itself. - Saves the record, then checks the address from outside as
deploy trackdoes. The address is the first text matchinghttps://<Worker>.<subdomain>.workers.devin Track's output (stdout, then stderr), else the recorded address. If a check fails or there is no address it exits 9, and the record then has the new release without the mark that the checks passed.
A release older than the deployed one is refused with exit 2, because migrations are append-only;
that happens before any resource is looked up. At the target already, nothing is deployed and the
command exits 0, unless a check is due. After choosing the account and finding the record, a record
that is not marked as checked runs the checks first and exits 9 if one fails; if it also has no
address, it exits 9 without an outside probe and without looking for an address. To retry after exit 9, run the
same update again with the same target (--to, if the newest has moved) and --name set to the
actual Worker, and without --from, --worker, --database and --bucket: given with a value,
they cause exit 2 once there is a record. --no-attachments alone is accepted and ignored for a recorded
update, which keeps the recorded bucket. If Track's own deploy fails, it exits 8; an existing record
keeps the old release, and a deployment without one gets none.
For an unrecorded deployment, name what already exists instead of letting the command guess:
--worker, --database, --bucket (or --no-attachments, which wins over --bucket) and its
present release with --from, which must be a published release. Missing ones exit 2. It trusts
those names and that release. With --from equal to the target it exits 0 after checking the
release tags and the target's requirements, choosing the account and looking for a record, but
before looking up the named resources, probing an address or saving a record, so names that do not
exist pass. For a newer target it goes on as above, and only after a successful deploy does it save
a record, marked as one it did not make, so deploy track does not count its resources as its own.
Later updates select that record with --name set to that Worker.
The command does not look at where a deployment came from. A copy made with the Deploy button
deploys from its own Git repository: update that copy with scripts/update-copy.mjs, as Track's
self-hosting guide says.
When it runs the update with --json, stdout holds one object: the result, or an error such as
{"ok":false,"code":"declined","reason":"Nothing was changed."}; --help and --version print
their own text. The plan and the streamed clone, install and deploy output go to stderr. The
release list and Wrangler's answers are captured, and an error's reason can include a diagnostic
from one of them. The result has from, to, account, address, worker, database,
bucket, updatedNow, migrations and checks. updatedNow is false when nothing was deployed;
a retry of the checks has checks filled.
Exit codes: 0 done, or nothing to do; 1 unexpected; 2 usage (an invalid --name, a --to or
--from that is not a published release, missing or conflicting options, an older target; an empty
--to= means the newest stable release, and with no release tags at all the command exits 3
before either is checked); 3 a requirement (Node, sign-in, the release list, a required file of the
target release that does not answer 200, missing or unrecognized tool pins in readable release
metadata, a lookup, a record missing the
deployed step, a missing resource, or after the yes a missing resource or a changed database id, unreadable
migrations); 4 an account to choose, or one that cannot be reached; 5 R2 off while a bucket is
configured; 6 the database found at the first lookup has another id than the record's; 7 no yes; 8
clone, install or Track's deploy failed; 9 a check from outside failed, or the address is unknown.
deploy track and doctor track reject --to, --from, --worker, --database and --bucket
with exit 2. update track has no --no-account-name; the option is refused with exit 2, and the
plan of an upgrade and the JSON result show the account's name.
gateweave update id takes the same flags for such a deployment, except that ID has no bucket: it
takes --queue <name> (the existing logout Queue) in place of --bucket and --no-attachments.
The Queue is named, never inferred from the Worker's name, and is read by its exact name before
anything is deployed. A deployment this tool recorded refuses --worker, --database, --queue
and --from.
gateweave doctor track [--name <name>] [--url <address>] [--account <id>] [--json]
Says what is wrong with a Track deployment, in words. It reads and changes nothing in your
Cloudflare account, prints names and never a secret's value, and needs the same sign-in as
deploy track. It works from the record deploy track keeps, or, for a deployment made another
way (the Deploy button, a clone), from --name (the Worker, and a D1 database of the same name)
and --url.
Each finding is ok, warn or fail, with one sentence and the fix, a command or a link to
Track's self-hosting guide:
| Finding id | What it says |
|---|---|
worker |
The Worker exists in the account, shown by name and id. If not, nothing else is tried. |
secret-<name> |
One for each secret in secrets.required of the release's wrangler.jsonc: set, or missing (fail) |
release |
Against the newest tag of Track: older is a warn. A deployment this tool did not make has an unknown release. |
migrations |
Migrations not applied yet (fail, or warn when the release is only guessed to be the newest) |
sign-up |
Open is a warn, by invitation is ok. From the sign-in page when it says so, else one fixed SELECT on the deployment's own D1 |
first-account |
No account yet is a warn: whoever opens the address first owns the server |
mcp |
BETTER_AUTH_URL unset: MCP is off, a warn with the command |
outside-<check> |
The checks deploy track ends with, tried once each |
Without --url and without a record, nothing can be checked from outside and outside says so.
The migrations and the sign-up query run in the release's files in the cache folder (the
checkout deploy track made, or a shallow clone of the release when there is none), with the
deployment's names in its wrangler.jsonc, written again on every run. Everything run against
Cloudflare reads: whoami, secret list, d1 list, that one d1 execute and, only when it
finds Wrangler's migrations table, d1 migrations list (Wrangler would create the table if it were
missing, so a database without it gets a warn and is left alone).
With --json, stdout is an array of { "id", "status", "message", "fix" }. The exit code is 0
without a fail and 1 with one; a sign-in or an account to choose stops it earlier with the exit
codes 3 and 4 above, and a usage error with 2.
Run it from npm, with Node 22 or newer and nothing else installed:
npx --yes gateweave --versionEach release is published to npm from a v<version> tag by a GitHub workflow that npm trusts. The
workflow signs in with an OIDC token, not an npm token, and the package carries provenance. Each
release is also a tarball on pkg.gateweave.com, the mirror, which npx runs from its address.
Whichever of the two is written second is compared with the first, and a difference stops it. Two
releases running at the same moment are not covered by that check:
npx --yes https://pkg.gateweave.com/cli/<version>/gateweave-<version>.tgz --versioncli/latest.json names the newest stable release (a
prerelease never changes it) with its address, SHA-256, the integrity that npm keeps in a lockfile and the commit it was built from. Each
release's folder has a SHA256SUMS too, so a download checks with sha256sum -c SHA256SUMS. A
release never changes once it is there. The mirror isn't a registry, so npm update,
Dependabot and Renovate don't see a new version there: change the address to move to it.
- A thin layer over Wrangler and each product's own repository at a release tag. A product stays deployable without this tool.
- It shows the account and every resource it will create before it creates anything, and never binds to, changes or deletes something that already exists unless you name it.
- No secret is printed, logged or written into the working directory.
- Every command has
--jsonand exits non-zero with a reason an agent can act on.
packages/cli the command line (TypeScript, Node 22 or newer, bin `gateweave`)
pnpm install
pnpm verify # Biome, typecheck, tests, build
node packages/cli/dist/bin.js deploy track --helpThe tests fake Wrangler, git and pnpm and never reach Cloudflare. Rehearse a real deploy only in a separate, empty Cloudflare account.
See CONTRIBUTING.md. Report security problems as described in SECURITY.md.