wrangler flagship を使い、コマンドラインから Flagship アプリとフィーチャーフラグを管理します。すべての wrangler flagship flags コマンドは、最初の引数にアプリ ID を取ります。ほとんどのサブコマンドは続けてフラグキーを取ります。例: wrangler flagship flags get <APP_ID> <KEY>。wrangler flagship flags list <APP_ID> のような一覧系コマンドは、アプリ ID だけを取ります。
wrangler flagship は Cloudflare API を呼び出します。コマンドを実行する前に Wrangler を認証します。
wrangler login自動化では、適切な Flagship 権限を持つ API トークン を CLOUDFLARE_API_TOKEN に設定します。
| 権限 | 用途 |
|---|---|
flagship:read |
アプリの一覧、アプリの取得、フラグの一覧、フラグの確認、フラグの評価、変更履歴の読み取り。 |
flagship:write |
アプリの作成、アプリの更新、アプリの削除、フラグの作成、フラグの更新、デフォルトの変更、ロールアウト、スプリット、有効化 / 無効化、フラグの削除。 |
既存フラグを変更するコマンドの多くは、まず現在のフラグを読み取り、更新後の定義を書き戻します。こうしたワークフローでは、flagship:read と flagship:write の両方を付与します。
Worker プロジェクトに Flagship バインディングを追加すると、ランタイムで低レイテンシにフラグを評価できます。
{
"$schema": "./node_modules/wrangler/config-schema.json",
"flagship": [
{
"binding": "FLAGS",
"app_id": "<APP_ID>"
}
]
}[[flagship]]
binding = "FLAGS"
app_id = "<APP_ID>"boolean フラグを作成し、ユーザー向けに評価し、キルスイッチとして無効にします。
# With no variations, Wrangler creates on=true, off=false,
# and serves off by default.
wrangler flagship flags create <APP_ID> new-checkout
# Evaluate the flag for a user.
wrangler flagship flags evaluate <APP_ID> new-checkout --targeting-key user-42
# Disable the flag instantly. Disabled flags always serve their default variation.
wrangler flagship flags disable <APP_ID> new-checkoutアプリは関連するフラグをまとめます。よくあるパターンは、サービス、Worker、またはプロダクト面ごとに 1 アプリです。
| 作業 | コマンド |
|---|---|
| アプリを作成する | wrangler flagship apps create <NAME> |
| アプリを一覧する | wrangler flagship apps list |
| アプリを取得する | wrangler flagship apps get <APP_ID> |
| アプリをリネームする | wrangler flagship apps update <APP_ID> --name <NAME> |
| アプリを削除する | wrangler flagship apps delete <APP_ID> |
wrangler flagship apps ls は apps list のエイリアスです。wrangler flagship apps rm は apps delete のエイリアスです。
wrangler flagship apps list はページネーションを自動でたどり、アカウント内のすべてのアプリを表示します。
アプリを作成するとアプリ ID が返り、Wrangler 設定へ追加するバインディングのスニペットが表示されます。
wrangler flagship apps create checkout-service新しいアプリを Worker バインディングとして wrangler.json または wrangler.jsonc に追加するには、--binding を渡します。
wrangler flagship apps create checkout-service --binding FLAGSWrangler は --update-config もサポートします。バインディング名の入力を求めたあと、JSON または JSONC の設定を更新します。
JSON 以外の設定ファイルでは、Wrangler はバインディングのスニペットを表示しますが、ファイルは自動では編集しません。
--json を使うと、apps create は作成したアプリを JSON で出力し、設定の確認や更新は行いません。
スクリプトでは、JSON 出力からアプリ ID を取得します。
APP_ID=$(wrangler flagship apps create checkout-service --json | jq -r '.id')アプリを削除すると、そのフラグと変更履歴もすべて削除されます。Worker が Flagship バインディング経由でアプリを参照している場合、API はアプリ削除を拒否します。
削除の確認プロンプトを省略するには、--force または -y を使います。--json も使う場合は、JSON 出力に確認プロンプトが出ないよう --force を渡す必要があります。
wrangler flagship apps delete <APP_ID> --force複数のアプリ ID を渡すと、複数のアプリを削除できます。
wrangler flagship apps delete <APP_ID_1> <APP_ID_2> <APP_ID_3> --forceフラグキーはアプリ内で一意です。制御する振る舞いを表す安定したキーを使います。例: new-checkout、pricing-page-layout、upload-limit。
バリエーションを省略すると、Wrangler は on=true、off=false、デフォルトバリエーション off の boolean フラグを作成します。
wrangler flagship flags create <APP_ID> new-checkout--variation(-V)で、各バリエーションを name=value として追加します。フォールバックのバリエーションは --default で選びます。
# String flag.
wrangler flagship flags create <APP_ID> checkout-flow \
-V v1=old-checkout \
-V v2=new-checkout \
--default v1 \
--type string
# Number flag.
wrangler flagship flags create <APP_ID> upload-limit \
-V free=10 \
-V pro=100 \
-V enterprise=1000 \
--default free \
--type number
# JSON flag.
wrangler flagship flags create <APP_ID> theme-config \
-V 'light={"bg":"#ffffff","fg":"#111111"}' \
-V 'dark={"bg":"#111111","fg":"#ffffff"}' \
--default light \
--type jsonサポートする値の型は boolean、string、number、json です。--type を省略すると、Wrangler は各値のスカラー型を独立して推定します。
1 つのフラグ上のバリエーションは、すべて同じ値の型である必要があります。boolean と number が混在するなど、型が混ざるフラグは、リクエスト送信前に Wrangler が拒否します。すべてのバリエーションを同じ型へ揃えるには、--type を明示します。
フラグの目的を記録するには --description(-d)を使います。
wrangler flagship flags create <APP_ID> checkout-flow \
-V v1=old-checkout \
-V v2=new-checkout \
--default v1 \
--type string \
--description "Controls which checkout experience is served"フラグキーとバリエーション名には、英字、数字、ハイフン、アンダースコアを使えます。アプリケーションコードはキーでフラグを評価するため、キーは安定させてください。
--disabled を使うと、有効化するまでデフォルトバリエーションを返すフラグを作成できます。
wrangler flagship flags create <APP_ID> coming-soon \
-V on=true \
-V off=false \
--default off \
--disabledターゲティングルールは、評価コンテキストに対してどのバリエーションを返すかを決めます。ルールは --rule または --rule-json で渡します。
短い --rule 構文は、セミコロン区切りのセグメントを使います。
serve=<VARIATION>; when=<CONDITIONS>; rollout=<PERCENT>%@<ATTRIBUTE>; priority=<NUMBER>| セグメント | 必須 | 説明 |
|---|---|---|
serve |
はい | ルールが一致したときに返すバリエーション。既存のバリエーションを参照する必要があります。 |
when |
いいえ | 評価コンテキストと照合する条件。省略すると、ルールはすべてのコンテキストに一致します。 |
rollout |
いいえ | 一致したトラフィックのうち、そのバリエーションを受け取る割合。属性はスティッキーバケットを制御します。 |
priority |
いいえ | 評価順。数値が小さいほど先に実行されます。省略すると、Wrangler が並び順で優先度を割り当てます。 |
wrangler flagship flags create <APP_ID> premium-banner \
-V on=true \
-V off=false \
--default off \
--rule "serve=on; when=plan equals enterprise AND country in [US,CA]; rollout=25%@user_id"条件は、評価コンテキストの属性をルールの値と比較します。短い構文は、すべての Flagship 演算子 をサポートします。
--rule "serve=on; when=plan equals pro"
--rule "serve=on; when=country in [US,CA,UK]"
--rule "serve=off; when=email ends_with @example.com"
--rule "serve=strict; when=score less_than 20"条件の組み合わせには AND と OR を使います。AND は OR より優先度が高いです。
# Both conditions must match.
--rule "serve=on; when=plan equals pro AND country equals US"
# Either condition can match.
--rule "serve=on; when=plan equals enterprise OR plan equals team"
# Equivalent to: (plan=pro AND country=US) OR plan=enterprise.
--rule "serve=on; when=plan equals pro AND country equals US OR plan equals enterprise"引用符で囲んだ値やリストの外に現れる AND と OR は、論理演算子として予約されています。値に AND、OR、;、, などの予約語や区切り文字が含まれる場合は、単一引用符または二重引用符で囲みます。
--rule 'serve=on; when=title equals "WAR AND PEACE" OR title equals "tom; jerry"'
--rule 'serve=on; when=country in ["US","CA"]'in と not_in では、角括弧のリストを渡します。不正なリスト、空のリスト項目、閉じられていない引用、括弧の不一致は、リクエスト送信前に Wrangler が拒否します。
深く入れ子になった論理グループや、API のルール形をそのまま渡したい場合は --rule-json を使います。Wrangler は --rule-json を Flagship のルールスキーマに対して検証し、未知または矛盾するフィールドを拒否します。
wrangler flagship flags create <APP_ID> beta-features \
-V on=true \
-V off=false \
--default off \
--rule-json '{"serve_variation":"on","conditions":[{"logical_operator":"OR","clauses":[{"attribute":"beta","operator":"equals","value":true},{"attribute":"plan","operator":"equals","value":"enterprise"}]}]}'--rule または --rule-json を繰り返すと、複数のルールを宣言できます。ルールは優先度順に評価され、最初に一致したルールが採用されます。
wrangler flagship flags create <APP_ID> rate-limit-tier \
-V strict=50 \
-V normal=200 \
-V relaxed=1000 \
--default normal \
--type number \
--rule "serve=strict; when=score less_than 20" \
--rule "serve=relaxed; when=score greater_than_or_equals 90"重複するルール優先度、重複するバリエーション名、不正なリスト、Infinity などの有限でない数値、未知のバリエーション名は、リクエスト送信前に Wrangler が検証します。
アプリ内のフラグを一覧します。
wrangler flagship flags list <APP_ID>一覧コマンドはページネーションされます。手動ページネーションには --limit と --cursor を使い、全ページを取得するには --all を使います。
wrangler flagship flags list <APP_ID> --limit 50
wrangler flagship flags list <APP_ID> --cursor <CURSOR>
wrangler flagship flags list <APP_ID> --allフラグ定義の全体を確認します。
wrangler flagship flags get <APP_ID> new-checkoutwrangler flagship flags ls は flags list のエイリアスです。wrangler flagship flags inspect は flags get のエイリアスです。
wrangler flagship flags update は現在のフラグを読み取り、変更を適用し、フラグ定義の全体を API へ書き戻します。
wrangler flagship flags update <APP_ID> new-checkout \
--description "Redesigned checkout experience"
wrangler flagship flags update <APP_ID> upload-limit \
--set-variation team=500
wrangler flagship flags update <APP_ID> upload-limit \
--remove-variation team既存フラグへバリアントを追加するには、新しいバリエーション名と値を設定します。
wrangler flagship flags update <APP_ID> checkout-flow \
--set-variation experiment=new-checkout-v2説明を空文字にすると、説明を消せます。
wrangler flagship flags update <APP_ID> new-checkout --description ""既存フラグへバリエーションを追加または置き換えるとき、新しい値を特定の型へ揃えたい場合は --type を使います。
wrangler flagship flags update <APP_ID> upload-limit \
--type number \
--set-variation team=500Wrangler は、結果のバリエーション集合が単一の値の型であること、およびデフォルトバリエーションとターゲティングルールが既知のバリエーションを参照し続けていることを検証します。
flags update でもフラグの有効化と無効化ができます。キルスイッチの操作には、より短い flags enable と flags disable もあります。
wrangler flagship flags update <APP_ID> new-checkout --disable
wrangler flagship flags update <APP_ID> new-checkout --enablewrangler flagship flags set <APP_ID> checkout-flow --variation v2新しいデフォルトを全員に返したい場合は --clear-rules を使います。
wrangler flagship flags set <APP_ID> checkout-flow --variation v2 --clear-rules--rule または --rule-json で、ルール集合の全体を置き換えます。
wrangler flagship flags update <APP_ID> premium-banner \
--rule "serve=on; when=plan equals pro AND country not_in [CN,RU]"既存ルールを変えずに追加するには、--add-rule または --add-rule-json を使います。
wrangler flagship flags update <APP_ID> premium-banner \
--add-rule "serve=off; when=account_age less_than 7"
wrangler flagship flags update <APP_ID> premium-banner \
--add-rule-json '{"serve_variation":"off","conditions":[{"attribute":"country","operator":"in","value":["CN","RU"]}]}'すべてのルールを削除します。
wrangler flagship flags update <APP_ID> premium-banner --clear-rulesルール固有のコマンドで指定できる優先度を確認するには、rules list を使います。
wrangler flagship flags rules list <APP_ID> premium-bannerFlagship は昇順の priority でルールを評価し、最初に一致したルールが採用されます。既存ルールを並べ替えるには、条件をすべて書き直さずに rules reorder を使います。
既存の優先度を、新しい順で渡します。Wrangler はその順で 1..n に番号を付け直します。
wrangler flagship flags rules reorder <APP_ID> rate-limit-tier --order 2,1既存の優先度が 1=strict と 2=relaxed だった場合、これで relaxed が優先度 1、strict が優先度 2 になります。
ルール集合の残りを保ったまま、優先度で 1 件だけ編集するには rules update を使います。
ロールアウトの割合だけを変更します。
wrangler flagship flags rules update <APP_ID> premium-banner \
--priority 1 \
--rollout 50%@user_idルールが返すバリエーションを変更します。
wrangler flagship flags rules update <APP_ID> premium-banner \
--priority 1 \
--serve offルールの条件を変更します。
wrangler flagship flags rules update <APP_ID> premium-banner \
--priority 1 \
--when "plan equals enterprise OR plan equals team"ルールから条件を外し、すべての評価コンテキストに一致させます。
wrangler flagship flags rules update <APP_ID> premium-banner \
--priority 1 \
--clear-conditionsルールからロールアウトを外します。
wrangler flagship flags rules update <APP_ID> premium-banner \
--priority 1 \
--clear-rollout優先度を指定して 1 件削除するには rules delete を使います。
wrangler flagship flags rules delete <APP_ID> premium-banner --priority 2ルールを削除したあと、Wrangler は残りのルールに番号を付け直し、優先度が連続するようにします。
フラグの無効化は、即時のキルスイッチです。無効なフラグはターゲティングルールを無視し、デフォルトバリエーションを返します。
wrangler flagship flags disable <APP_ID> new-checkout
wrangler flagship flags enable <APP_ID> new-checkoutアプリ ID のあとに複数のキーを渡すと、同じアプリ内の複数フラグを有効化または無効化できます。
wrangler flagship flags disable <APP_ID> new-checkout dark-mode premium-banner
wrangler flagship flags enable <APP_ID> new-checkout dark-mode premium-bannerトラフィックの一定割合へ 1 つのバリエーションを返すには rollout を使います。
wrangler flagship flags rollout <APP_ID> new-checkout \
--to on \
--percentage 25 \
--by user_id残りのトラフィック向けのフォールバックバリエーションは --from-variation(エイリアス --from)で選びます。ロールアウト割合が 0 の場合、ロールアウトルールは削除され、フラグの現在のデフォルトバリエーションはそのままです。
rollout は指定した割合をそのまま Flagship へ送ります。たとえば --percentage 25 --to on は、バケットされたトラフィックの 25% に on バリエーションを返します。残りはフラグのデフォルトバリエーションへフォールスルーします。
A/B テストや多方向のトラフィック配分には split を使います。Wrangler は重みを累積ロールアウトしきい値へ変換します。
wrangler flagship flags split <APP_ID> checkout-flow \
--weight v1=80 \
--weight v2=20 \
--by user_id-w は --weight のエイリアスです。各バリエーションの重みは 1 回だけ指定でき、重みは有限の非負数である必要があります。
重みは相対値です。Wrangler は重みの合計を取り、それぞれを合計に対する割合へ変換し、累積しきい値を Flagship へ送ります。たとえば --weight v1=80 --weight v2=20 は、生成ルールを 2 件送ります。v1 はロールアウト割合 80、v2 はロールアウト割合 100 です。これにより v1 は 0-80、v2 は 80-100 のバケット範囲になります。
重みが 3 つの場合、--weight a=50 --weight b=30 --weight c=20 は累積しきい値 50、80、100 になります。重み 0 のバリエーションはスキップされます。
バケットできないときのフォールバックバリエーションは、split の --default で選びます。
wrangler flagship flags split <APP_ID> checkout-flow \
--weight v1=80 \
--weight v2=20 \
--default v1 \
--by user_idwrangler flagship flags rollout <APP_ID> new-checkout --to on --percentage 100 --force特定のコンテキストが何を受け取るかを確認するには、CLI からフラグを評価します。
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安定した割合ロールアウトのバケットには --targeting-key を使います。コンテキスト属性は --context name=value で渡します。wrangler flagship flags eval は flags evaluate のエイリアスです。
--context は繰り返せます。--ctx と -C はエイリアスです。
wrangler flagship flags evaluate <APP_ID> premium-banner \
-C plan=enterprise \
-C country=US \
--targeting-key user-99コンテキストの値は、評価エンドポイントへ文字列として送られます。ターゲティングルールが想定する属性名と同じ名前を使います。
評価出力には次のフィールドが含まれます。
| フィールド | 説明 |
|---|---|
value |
そのコンテキストで返されたフラグ値。 |
variant |
そのコンテキストで選ばれたバリエーション。 |
reason |
値が返された理由: TARGETING_MATCH、DEFAULT、DISABLED、または SPLIT。 |
Flagship は、各フラグの作成、更新、削除イベントを記録します。変更履歴は新しい順で表示します。
wrangler flagship flags changelog <APP_ID> new-checkout長い履歴には、ページネーションの制御を使います。
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 --allwrangler flagship flags history は flags changelog のエイリアスです。
wrangler flagship flags delete <APP_ID> coming-soon確認プロンプトを省略するには --force または -y を使います。--json も使う場合は、JSON 出力に確認プロンプトが出ないよう --force を渡す必要があります。
wrangler flagship flags delete <APP_ID> coming-soon --forcewrangler flagship flags rm は flags delete のエイリアスです。
アプリ ID のあとに複数のキーを渡すと、複数のフラグを削除できます。
wrangler flagship flags delete <APP_ID> coming-soon old-checkout temporary-banner --forceすべての wrangler flagship コマンドは --json を受け付けます。JSON 出力は Wrangler のバナーを出さず、スクリプト向けです。
削除コマンドは、stdout を有効な JSON に保つため --json と一緒に --force が必要です。rollout と split も、条件付きの既存ターゲティングルールを置き換える場合は --json と一緒に --force が必要です。
flags delete、flags enable、flags disable などの一括コマンドは、1 件失敗しても残りのフラグの処理を続けます。JSON モードでは、部分失敗は成功した results とフラグごとの failures を含む JSON エラーオブジェクトを返します。
apps create --binding のように wrangler.json または wrangler.jsonc を更新できるコマンドは、--json 使用時に設定の確認や更新を行いません。
アプリを作成し、ID を取得してからフラグを作成します。
APP_ID=$(wrangler flagship apps create checkout-service --json | jq -r '.id')
wrangler flagship flags create "$APP_ID" new-checkout --jsonループで複数のアプリを削除します。
for app_id in <APP_ID_1> <APP_ID_2> <APP_ID_3>; do
wrangler flagship apps delete "$app_id" --force
doneまたは、アプリ ID を直接渡します。
wrangler flagship apps delete <APP_ID_1> <APP_ID_2> <APP_ID_3> --force次のリファレンスは、Wrangler の flagship コマンド定義から生成されます。
flagship apps create
Create a Flagship app
npx wrangler flagship apps create [NAME]yarn wrangler flagship apps create [NAME]pnpm wrangler flagship apps create [NAME][NAME]stringrequiredThe name of the app
--jsonbooleandefault: falseReturn output as JSON
--use-remotebooleanUse a remote binding when adding the newly created resource to your config
--update-configbooleanAutomatically update your config file with the newly added resource
--bindingstringThe binding name of this resource in your Worker
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship apps list
List Flagship apps
npx wrangler flagship apps listyarn wrangler flagship apps listpnpm wrangler flagship apps list--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship apps get
Get a Flagship app
npx wrangler flagship apps get [APP-ID]yarn wrangler flagship apps get [APP-ID]pnpm wrangler flagship apps get [APP-ID][APP-ID]stringrequiredThe ID of the app
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship apps update
Update a Flagship app
npx wrangler flagship apps update [APP-ID]yarn wrangler flagship apps update [APP-ID]pnpm wrangler flagship apps update [APP-ID][APP-ID]stringrequiredThe ID of the app
--namestringrequiredThe new name of the app
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship apps delete
Delete a Flagship app
npx wrangler flagship apps delete [APP-ID]yarn wrangler flagship apps delete [APP-ID]pnpm wrangler flagship apps delete [APP-ID][APP-ID]stringrequiredOne or more app IDs to delete
--forcebooleanalias: --ydefault: falseSkip the confirmation prompt
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags create
Create a feature flag in a Flagship app
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]stringrequiredThe ID of the app
[KEY]stringrequiredThe key of the flag
--variationstringalias: --VA flag variation, in the form "name=value" (repeatable)
--default-variationstringalias: --defaultThe name of the variation to serve by default (defaults to off for boolean flags, otherwise the first variation)
--typestringalias: --tThe variation value type (inferred when omitted)
--descriptionstringalias: --dA description of the flag
--disabledbooleandefault: falseCreate the flag in a disabled state
--rulestringA 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-jsonstringA targeting rule as a JSON object (repeatable)
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags list
List feature flags in a Flagship app
npx wrangler flagship flags list [APP-ID]yarn wrangler flagship flags list [APP-ID]pnpm wrangler flagship flags list [APP-ID][APP-ID]stringrequiredThe ID of the app
--limitnumberThe maximum number of flags to return (1-200)
--cursorstringThe pagination cursor from a previous list call
--allbooleandefault: falseFetch every flag, following pagination automatically
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags get
Get a feature flag from a Flagship app
npx wrangler flagship flags get [APP-ID] [KEY]yarn wrangler flagship flags get [APP-ID] [KEY]pnpm wrangler flagship flags get [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredThe key of the flag
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags update
Update a feature flag in a Flagship app
npx wrangler flagship flags update [APP-ID] [KEY]yarn wrangler flagship flags update [APP-ID] [KEY]pnpm wrangler flagship flags update [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredThe key of the flag
--enablebooleanEnable the flag
--disablebooleanDisable the flag
--descriptionstringalias: --dA new description for the flag (pass "" to clear it)
--default-variationstringalias: --defaultThe name of the variation to serve by default
--typestringalias: --tThe value type used to coerce --set-variation values
--set-variationstringAdd or replace a variation, in the form "name=value"
--remove-variationstringRemove a variation by name
--rulestringReplace the flag's targeting rules (repeatable)
--rule-jsonstringReplace the flag's targeting rules using JSON (repeatable)
--add-rulestringAppend a targeting rule, keeping the existing rules (repeatable)
--add-rule-jsonstringAppend a targeting rule using JSON, keeping the existing rules (repeatable)
--clear-rulesbooleandefault: falseRemove all targeting rules
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags set
Set the default variation served by a feature flag
npx wrangler flagship flags set [APP-ID] [KEY]yarn wrangler flagship flags set [APP-ID] [KEY]pnpm wrangler flagship flags set [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredThe key of the flag
--variationstringaliases: --variant, --VrequiredThe variation to serve by default
--clear-rulesbooleandefault: falseClear targeting rules so this variation is always served
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags rules list
List targeting rules for a feature flag
npx wrangler flagship flags rules list [APP-ID] [KEY]yarn wrangler flagship flags rules list [APP-ID] [KEY]pnpm wrangler flagship flags rules list [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredThe key of the flag
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags rules update
Update one targeting rule for a feature flag
npx wrangler flagship flags rules update [APP-ID] [KEY]yarn wrangler flagship flags rules update [APP-ID] [KEY]pnpm wrangler flagship flags rules update [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredThe key of the flag
--prioritynumberrequiredThe priority of the rule to update
--servestringThe variation to serve when this rule matches
--whenstringThe rule conditions, using the same syntax as --rule when=...
--clear-conditionsbooleandefault: falseRemove conditions so the rule matches all contexts
--rolloutstringThe rollout, in the form "percentage" or "percentage%@attribute"
--clear-rolloutbooleandefault: falseRemove the rollout from this rule
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags rules delete
Delete one targeting rule from a feature flag
npx wrangler flagship flags rules delete [APP-ID] [KEY]yarn wrangler flagship flags rules delete [APP-ID] [KEY]pnpm wrangler flagship flags rules delete [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredThe key of the flag
--prioritynumberrequiredThe priority of the rule to delete
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags rules reorder
Reorder targeting rules for a feature flag
npx wrangler flagship flags rules reorder [APP-ID] [KEY]yarn wrangler flagship flags rules reorder [APP-ID] [KEY]pnpm wrangler flagship flags rules reorder [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredThe key of the flag
--orderstringrequiredComma-separated existing rule priorities in their new order, for example 2,1,3
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags split
Split traffic across variations by percentage
npx wrangler flagship flags split [APP-ID] [KEY]yarn wrangler flagship flags split [APP-ID] [KEY]pnpm wrangler flagship flags split [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredThe key of the flag
--weightstringalias: --wA variation weight, in the form "variation=weight" (repeatable)
--bystringContext attribute used for sticky bucketing
--default-variationstringalias: --defaultFallback variation when bucketing cannot run
--forcebooleanalias: --ydefault: falseSkip the confirmation prompt when this split replaces existing targeting rules
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags rollout
Roll out one variation to a percentage of traffic
npx wrangler flagship flags rollout [APP-ID] [KEY]yarn wrangler flagship flags rollout [APP-ID] [KEY]pnpm wrangler flagship flags rollout [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredThe key of the flag
--tostringrequiredVariation to roll out
--percentagenumberrequiredPercentage of traffic to serve the rollout variation (0-100)
--bystringContext attribute used for sticky bucketing
--from-variationstringalias: --fromFallback variation for the remaining traffic
--forcebooleanalias: --ydefault: falseSkip the confirmation prompt when this rollout replaces existing targeting rules
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags enable
Enable a feature flag
npx wrangler flagship flags enable [APP-ID] [KEY]yarn wrangler flagship flags enable [APP-ID] [KEY]pnpm wrangler flagship flags enable [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredOne or more flag keys to enable
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags disable
Disable a feature flag
npx wrangler flagship flags disable [APP-ID] [KEY]yarn wrangler flagship flags disable [APP-ID] [KEY]pnpm wrangler flagship flags disable [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredOne or more flag keys to disable
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags evaluate
Evaluate a feature flag with optional context
npx wrangler flagship flags evaluate [APP-ID] [KEY]yarn wrangler flagship flags evaluate [APP-ID] [KEY]pnpm wrangler flagship flags evaluate [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredThe key of the flag
--contextstringaliases: --ctx, --CEvaluation context, in the form "name=value" (repeatable)
--targeting-keystringStable bucketing key for percentage rollouts
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags delete
Delete a feature flag from a Flagship app
npx wrangler flagship flags delete [APP-ID] [KEY]yarn wrangler flagship flags delete [APP-ID] [KEY]pnpm wrangler flagship flags delete [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredOne or more flag keys to delete
--forcebooleanalias: --ydefault: falseSkip the confirmation prompt
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile
flagship flags changelog
Show the changelog for a feature flag
npx wrangler flagship flags changelog [APP-ID] [KEY]yarn wrangler flagship flags changelog [APP-ID] [KEY]pnpm wrangler flagship flags changelog [APP-ID] [KEY][APP-ID]stringrequiredThe ID of the app
[KEY]stringrequiredThe key of the flag
--limitnumberThe maximum number of entries to return (1-200)
--cursorstringThe pagination cursor from a previous changelog call
--allbooleandefault: falseFetch every entry, following pagination automatically
--jsonbooleandefault: falseReturn output as JSON
Global flags
--vbooleanalias: --versionShow version number
--cwdstringRun as if Wrangler was started in the specified directory instead of the current working directory
--configstringalias: --cPath to Wrangler configuration file
--envstringalias: --eEnvironment to use for operations, and for selecting .env and .dev.vars files
--env-filestringPath to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files
--experimental-provisionbooleanaliases: --x-provisiondefault: trueExperimental: Enable automatic resource provisioning
--experimental-auto-createbooleanalias: --x-auto-createdefault: trueAutomatically provision draft bindings with new resources
--install-skillsbooleandefault: falseInstall Cloudflare skills for detected AI coding agents before running the command
--profilestringUse a specific auth profile