Wrangler CLI
Wrangler commands and configuration evolve quickly. Use the installed version,
its help output, the local configuration schema, and current first-party docs as
the contract; do not rely on a copied command catalog.
Resolve the local contract
- Inspect the project package manager, installed Wrangler version, config file,
selected environment, and relevant package scripts.
- Prefer the project-local Wrangler invocation (
npx, pnpm, yarn, or an
existing script) over an unrelated global installation.
- Read
wrangler <command> --help and the installed
node_modules/wrangler/config-schema.json for exact syntax.
- Retrieve current docs for commands, flags, lifecycle rules, limits, or product
behavior that can change.
Start at:
Install or upgrade Wrangler only when the requested command requires it and the
user's project dependency policy permits the change.
Resolve the target before mutation
For a write, identify the account, Worker or resource, environment, config file,
and whether the command addresses local or remote state. Environment bindings,
variables, and secrets are not automatically inherited, so inspect the selected
environment explicitly.
Distinguish read-only inspection, local development, upload, traffic deployment,
resource mutation, data mutation, and deletion. The user's request must authorize
the mutation actually performed. Use dry-run or readback when supported, but do
not represent dry-run as live success.
After an ambiguous response to a write, inspect provider state before retrying;
the operation may have completed.
Handle credentials and secrets
- Prefer scoped API tokens or the project's established authentication profile.
- Never print credentials or place secret values in command arguments, source,
checked-in config, or shell history.
- Use interactive secret input, supported bulk-secret input, or the existing CI
secret mechanism.
- Keep local
.dev.vars* and .env* files out of version control.
Configuration changes
Use the format already established by the repository unless a current feature
requires migration. After changing bindings or configuration, regenerate types
when the project relies on generated environment types and run the narrow build
or typecheck that consumes them.
Do not invent resource IDs, binding names, compatibility dates, routes, or
environment inheritance. Resolve them from current project and provider state.
Verify precisely
Report the facts separately: command validated, local behavior passed, resource
created or changed, version uploaded, traffic deployed, migration applied, and
live application verified. Include exact non-secret resource or version identity
when it matters to the user's operation.
1---2name: wrangler3description: Resolve, construct, review, or run an exact Cloudflare Wrangler command or `wrangler.jsonc` change. Use when the user names Wrangler, asks for a Cloudflare CLI operation, or needs environment, binding, authentication, secret, migration, deployment, or resource-management syntax. Do not trigger for general Cloudflare architecture or application code that does not require Wrangler.4---56# Wrangler CLI78Wrangler commands and configuration evolve quickly. Use the installed version,9its help output, the local configuration schema, and current first-party docs as10the contract; do not rely on a copied command catalog.1112## Resolve the local contract13141. Inspect the project package manager, installed Wrangler version, config file,15 selected environment, and relevant package scripts.162. Prefer the project-local Wrangler invocation (`npx`, `pnpm`, `yarn`, or an17 existing script) over an unrelated global installation.183. Read `wrangler <command> --help` and the installed19 `node_modules/wrangler/config-schema.json` for exact syntax.204. Retrieve current docs for commands, flags, lifecycle rules, limits, or product21 behavior that can change.2223Start at:2425- [Wrangler documentation](https://developers.cloudflare.com/workers/wrangler/)26- [Commands](https://developers.cloudflare.com/workers/wrangler/commands/)27- [Configuration](https://developers.cloudflare.com/workers/wrangler/configuration/)28- [Environments](https://developers.cloudflare.com/workers/wrangler/environments/)2930Install or upgrade Wrangler only when the requested command requires it and the31user's project dependency policy permits the change.3233## Resolve the target before mutation3435For a write, identify the account, Worker or resource, environment, config file,36and whether the command addresses local or remote state. Environment bindings,37variables, and secrets are not automatically inherited, so inspect the selected38environment explicitly.3940Distinguish read-only inspection, local development, upload, traffic deployment,41resource mutation, data mutation, and deletion. The user's request must authorize42the mutation actually performed. Use dry-run or readback when supported, but do43not represent dry-run as live success.4445After an ambiguous response to a write, inspect provider state before retrying;46the operation may have completed.4748## Handle credentials and secrets4950- Prefer scoped API tokens or the project's established authentication profile.51- Never print credentials or place secret values in command arguments, source,52 checked-in config, or shell history.53- Use interactive secret input, supported bulk-secret input, or the existing CI54 secret mechanism.55- Keep local `.dev.vars*` and `.env*` files out of version control.5657## Configuration changes5859Use the format already established by the repository unless a current feature60requires migration. After changing bindings or configuration, regenerate types61when the project relies on generated environment types and run the narrow build62or typecheck that consumes them.6364Do not invent resource IDs, binding names, compatibility dates, routes, or65environment inheritance. Resolve them from current project and provider state.6667## Verify precisely6869Report the facts separately: command validated, local behavior passed, resource70created or changed, version uploaded, traffic deployed, migration applied, and71live application verified. Include exact non-secret resource or version identity72when it matters to the user's operation.