Wrangler commands (6)·续1
Remove a rollout from a rule:
wrangler flagship flags rules update <APP_ID> premium-banner \
--priority 1 \
--clear-rollout
Delete one rule
Use rules delete to remove one rule by priority:
wrangler flagship flags rules delete <APP_ID> premium-banner --priority 2
After deleting a rule, Wrangler renumbers the remaining rules so priorities stay contiguous.
Run releases and kill switches
Note
After you change a flag, it can take up to 30 seconds for the updated value to reflect globally. During this propagation window, some evaluations may still return the previous flag value.
Enable and disable
Disabling a flag is an immediate kill switch. A disabled flag ignores targeting rules and serves its default variation.
wrangler flagship flags disable <APP_ID> new-checkout
wrangler flagship flags enable <APP_ID> new-checkout
Enable or disable multiple flags in an app by passing the app ID followed by multiple keys:
wrangler flagship flags disable <APP_ID> new-checkout dark-mode premium-banner
wrangler flagship flags enable <APP_ID> new-checkout dark-mode premium-banner
Roll out one variation
Use rollout to serve one variation to a percentage of traffic.
wrangler flagship flags rollout <APP_ID> new-checkout \
--to on \
--percentage 25 \
--by user_id
Use --from-variation (alias --from) to choose the fallback variation for the remaining traffic. A rollout percentage of 0 removes the rollout rule and keeps the flag's current default variation unchanged.
rollout sends the percentage you provide directly to Flagship. For example, --percentage 25 --to on serves the on variation to 25% of bucketed traffic. The remaining traffic falls through to the flag's default variation.
Split traffic across variations
Use split for A/B tests or multi-way traffic allocation. Wrangler converts weights into cumulative rollout thresholds.
wrangler flagship flags split <APP_ID> checkout-flow \
--weight v1=80 \
--weight v2=20 \
--by user_id
-w is an alias for --weight. Each variation can only be weighted once, and weights must be finite, non-negative numbers.
Weights are relative. Wrangler totals the weights, converts each one into a percentage of the total, and sends cumulative thresholds to Flagship. For example, --weight v1=80 --weight v2=20 sends two generated rules: one for v1 with a rollout percentage of 80, and one for v2 with a rollout percentage of 100. This creates bucket ranges of 0-80 for v1 and 80-100 for v2.
With three weights, --weight a=50 --weight b=30 --weight c=20 becomes cumulative thresholds of 50, 80, and 100. Zero-weight variations are skipped.
Use --default with split to choose the fallback variation when bucketing cannot run:
wrangler flagship flags split <APP_ID> checkout-flow \
--weight v1=80 \
--weight v2=20 \
--default v1 \
--by user_id
Caution
rollout and split replace the flag's entire rule set with the rollout or split rules they generate. If the flag has other targeting rules built with --rule, --rule-json, --add-rule, or rules update (rules with real conditions, not just a previous rollout or split), Wrangler asks for confirmation before overwriting them. Pass --force (-y) to skip the prompt, or use --json with --force in scripts. Rules with no conditions, such as ones created by an earlier rollout or split call, are replaced without a prompt.
wrangler flagship flags rollout <APP_ID> new-checkout --to on --percentage 100 --force
Evaluate flags
Evaluate a flag from the CLI to verify what a specific context receives.
wrangler flagship flags evaluate <APP_ID> new-checkout
wrangler flagship flags evaluate <APP_ID> new-checkout \
--targeting-key user-42
wrangler flagship flags evaluate <APP_ID> premium-banner \
--context plan=enterprise \
--context country=US \
--targeting-key user-99
Use --targeting-key for stable percentage rollout bucketing. Pass each context attribute with --context name=value. wrangler flagship flags eval is an alias for flags evaluate.
--context can be repeated. --ctx and -C are aliases:
wrangler flagship flags evaluate <APP_ID> premium-banner \
-C plan=enterprise \
-C country=US \
--targeting-key user-99
Context values are sent to the evaluation endpoint as strings. Use the same attribute names that your targeting rules expect.
JSON-looking --context values remain strings. Wrangler does not create nested objects or arrays from these values.
Evaluation output includes:
| Field | Description |
|---|---|
value |
The flag value returned for the context. |
variant |
The variation selected for the context. |
reason |
Why the value was returned: STATIC, TARGETING_MATCH, DEFAULT, DISABLED, or SPLIT. |
Audit changes
Flagship records create, update, and delete events for each flag. View changelog history newest first:
wrangler flagship flags changelog <APP_ID> new-checkout
Use pagination controls for long histories:
wrangler flagship flags changelog <APP_ID> new-checkout --limit 10
wrangler flagship flags changelog <APP_ID> new-checkout --cursor <CURSOR>
wrangler flagship flags changelog <APP_ID> new-checkout --all
wrangler flagship flags history is an alias for flags changelog.
Delete flags
wrangler flagship flags delete <APP_ID> coming-soon
Use --force or -y to skip the confirmation prompt. If you also use --json, you must pass --force so the confirmation prompt cannot appear in JSON output.
wrangler flagship flags delete <APP_ID> coming-soon --force
wrangler flagship flags rm is an alias for flags delete.
Delete multiple flags by passing the app ID followed by multiple keys:
wrangler flagship flags delete <APP_ID> coming-soon old-checkout temporary-banner --force
Automate with JSON output
Every wrangler flagship command accepts --json. JSON output suppresses the Wrangler banner and is intended for scripts.
Delete commands require --force with --json to keep stdout valid JSON. rollout and split also require --force with --json if they would replace existing targeting rules that have conditions.
Bulk commands, such as flags delete, flags enable, and flags disable, continue processing remaining flags if one flag fails. In JSON mode, partial failures return a JSON error object containing successful results and per-flag failures.
Commands that can update wrangler.json or wrangler.jsonc, such as apps create --binding, do not prompt for or update configuration when --json is used.
Create an app, capture its ID, then create a flag:
APP_ID=$(wrangler flagship apps create checkout-service --json | jq -r '.id')
wrangler flagship flags create "$APP_ID" new-checkout --json
Delete several apps in a loop:
for app_id in <APP_ID_1> <APP_ID_2> <APP_ID_3>; do
wrangler flagship apps delete "$app_id" --force
done
Or pass the app IDs directly:
wrangler flagship apps delete <APP_ID_1> <APP_ID_2> <APP_ID_3> --force
Command reference
The following reference is generated from Wrangler's flagship command definitions.
flagship apps create
Create a Flagship app
npmyarnpnpm
npx wrangler flagship apps create <NAME>
yarn wrangler flagship apps create <NAME>
pnpm wrangler flagship apps create <NAME>
<NAME>stringrequired
The name of the app
- --json boolean default: false
Return output as JSON
- --use-remote boolean Use a remote binding when adding the newly created resource to your config
- --update-config boolean Automatically update your config file with the newly added resource
- --binding string The binding name of this resource in your Worker
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
flagship apps list
List Flagship apps
npmyarnpnpm
npx wrangler flagship apps list
yarn wrangler flagship apps list
pnpm wrangler flagship apps list
--jsonbooleandefault: false
Return output as JSON
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
flagship apps get
Get a Flagship app
npmyarnpnpm
npx wrangler flagship apps get <APP-ID>
yarn wrangler flagship apps get <APP-ID>
pnpm wrangler flagship apps get <APP-ID>
<APP-ID>stringrequired
The ID of the app
- --json boolean default: false
Return output as JSON
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
flagship apps update
Update a Flagship app
npmyarnpnpm
npx wrangler flagship apps update <APP-ID>
yarn wrangler flagship apps update <APP-ID>
pnpm wrangler flagship apps update <APP-ID>
<APP-ID>stringrequired
The ID of the app
- --name string required
The new name of the app
- --json boolean default: false
Return output as JSON
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
flagship apps delete
Delete a Flagship app
npmyarnpnpm
npx wrangler flagship apps delete <APP-ID>
yarn wrangler flagship apps delete <APP-ID>
pnpm wrangler flagship apps delete <APP-ID>
<APP-ID>stringrequired
One or more app IDs to delete
- --force boolean alias: --ydefault: false
Skip the confirmation prompt
- --json boolean default: false
Return output as JSON
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
Path to Wrangler configuration file - <code>--env</code><code>string</code> alias: --e
Environment to use for operations, and for selecting .env and .dev.vars files - <code>--env-file</code><code>string</code>Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files - <code>--install-skills</code><code>boolean</code> default: false
Install Cloudflare skills for detected AI coding agents before running the command - <code>--profile</code><code>string</code>Use a specific auth profile
</details>
flagship flags create
Create a feature flag in a Flagship app
npmyarnpnpm
npx wrangler flagship flags create <APP-ID> <KEY>
yarn wrangler flagship flags create <APP-ID> <KEY>
pnpm wrangler flagship flags create <APP-ID> <KEY>
<APP-ID>stringrequired
The ID of the app
- <KEY> string required
The key of the flag
- --variation string alias: --V
A flag variation, in the form "name=value" (repeatable)
- --default-variation string alias: --default
The name of the variation to serve by default (defaults to off for boolean flags, otherwise the first variation)
- --type string alias: --t
The variation value type (inferred when omitted)
- --description string alias: --d
A description of the flag
- --disabled boolean default: false
Create the flag in a disabled state
- --rule string A targeting rule, e.g. "serve=on; when=plan equals pro AND region in [US,CA]; rollout=30%@user_id". Conditions support AND/OR; priority is optional and defaults to declaration order (repeatable)
- --rule-json string A targeting rule as a JSON object (repeatable)
- --json boolean default: false
Return output as JSON
- --local boolean Use the local flag store instead of the remote app
- --remote boolean Use the remote app instead of the local flag store
- --persist-to string Specify directory to use for local persistence
<details>
<summary>
Global flags
</summary>
- <code>--v</code><code>boolean</code> alias: --version
Show version number - <code>--cwd</code><code>string</code>Run as if Wrangler was started in the specified directory instead of the current working directory - <code>--config</code><code>string</code> alias: --c
