Skip to content

非公式本サイトは非公式の日本語ドキュメントであり、Cloudflare 公式サイトではありません。最新情報はdevelopers.cloudflare.comをご確認ください。

Wrangler コマンド

最終更新 Markdown で表示Agent セットアップ

wrangler flagship を使い、コマンドラインから Flagship アプリとフィーチャーフラグを管理します。すべての wrangler flagship flags コマンドは、最初の引数にアプリ ID を取ります。ほとんどのサブコマンドは続けてフラグキーを取ります。例: wrangler flagship flags get <APP_ID> <KEY>wrangler flagship flags list <APP_ID> のような一覧系コマンドは、アプリ ID だけを取ります。

始める前に

Wrangler を認証する

wrangler flagship は Cloudflare API を呼び出します。コマンドを実行する前に Wrangler を認証します。

wrangler login

自動化では、適切な Flagship 権限を持つ API トークンCLOUDFLARE_API_TOKEN に設定します。

権限 用途
flagship:read アプリの一覧、アプリの取得、フラグの一覧、フラグの確認、フラグの評価、変更履歴の読み取り。
flagship:write アプリの作成、アプリの更新、アプリの削除、フラグの作成、フラグの更新、デフォルトの変更、ロールアウト、スプリット、有効化 / 無効化、フラグの削除。

既存フラグを変更するコマンドの多くは、まず現在のフラグを読み取り、更新後の定義を書き戻します。こうしたワークフローでは、flagship:readflagship:write の両方を付与します。

Worker に Flagship をバインドする

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 lsapps list のエイリアスです。wrangler flagship apps rmapps 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 FLAGS

Wrangler は --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-checkoutpricing-page-layoutupload-limit

boolean フラグ

バリエーションを省略すると、Wrangler は on=trueoff=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

サポートする値の型は booleanstringnumberjson です。--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"

条件の組み合わせには ANDOR を使います。ANDOR より優先度が高いです。

# 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"

引用符で囲んだ値やリストの外に現れる ANDOR は、論理演算子として予約されています。値に ANDOR;, などの予約語や区切り文字が含まれる場合は、単一引用符または二重引用符で囲みます。

--rule 'serve=on; when=title equals "WAR AND PEACE" OR title equals "tom; jerry"'
--rule 'serve=on; when=country in ["US","CA"]'

innot_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-checkout

wrangler flagship flags lsflags list のエイリアスです。wrangler flagship flags inspectflags 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=500

Wrangler は、結果のバリエーション集合が単一の値の型であること、およびデフォルトバリエーションとターゲティングルールが既知のバリエーションを参照し続けていることを検証します。

flags update でもフラグの有効化と無効化ができます。キルスイッチの操作には、より短い flags enableflags disable もあります。

wrangler flagship flags update <APP_ID> new-checkout --disable
wrangler flagship flags update <APP_ID> new-checkout --enable

デフォルトバリエーションを変更する

wrangler 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-banner

ルールを並べ替える

Flagship は昇順の priority でルールを評価し、最初に一致したルールが採用されます。既存ルールを並べ替えるには、条件をすべて書き直さずに rules reorder を使います。

既存の優先度を、新しい順で渡します。Wrangler はその順で 1..n に番号を付け直します。

wrangler flagship flags rules reorder <APP_ID> rate-limit-tier --order 2,1

既存の優先度が 1=strict2=relaxed だった場合、これで relaxed が優先度 1strict が優先度 2 になります。

ルールを 1 件変更する

ルール集合の残りを保ったまま、優先度で 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 件削除する

優先度を指定して 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 つのバリエーションをロールアウトする

トラフィックの一定割合へ 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 はロールアウト割合 80v2 はロールアウト割合 100 です。これにより v10-80v280-100 のバケット範囲になります。

重みが 3 つの場合、--weight a=50 --weight b=30 --weight c=20 は累積しきい値 5080100 になります。重み 0 のバリエーションはスキップされます。

バケットできないときのフォールバックバリエーションは、split--default で選びます。

wrangler flagship flags split <APP_ID> checkout-flow \
	--weight v1=80 \
	--weight v2=20 \
	--default v1 \
	--by user_id
wrangler 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 evalflags 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_MATCHDEFAULTDISABLED、または 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 --all

wrangler flagship flags historyflags changelog のエイリアスです。

フラグを削除する

wrangler flagship flags delete <APP_ID> coming-soon

確認プロンプトを省略するには --force または -y を使います。--json も使う場合は、JSON 出力に確認プロンプトが出ないよう --force を渡す必要があります。

wrangler flagship flags delete <APP_ID> coming-soon --force

wrangler flagship flags rmflags delete のエイリアスです。

アプリ ID のあとに複数のキーを渡すと、複数のフラグを削除できます。

wrangler flagship flags delete <APP_ID> coming-soon old-checkout temporary-banner --force

JSON 出力で自動化する

すべての wrangler flagship コマンドは --json を受け付けます。JSON 出力は Wrangler のバナーを出さず、スクリプト向けです。

削除コマンドは、stdout を有効な JSON に保つため --json と一緒に --force が必要です。rolloutsplit も、条件付きの既存ターゲティングルールを置き換える場合は --json と一緒に --force が必要です。

flags deleteflags enableflags 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]
  • [NAME]string required

    The name of the app

  • --jsonboolean default: false

    Return output as JSON

  • --use-remoteboolean

    Use a remote binding when adding the newly created resource to your config

  • --update-configboolean

    Automatically update your config file with the newly added resource

  • --bindingstring

    The binding name of this resource in your Worker

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship apps list

List Flagship apps

npx wrangler flagship apps list
  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship apps get

Get a Flagship app

npx wrangler flagship apps get [APP-ID]
  • [APP-ID]string required

    The ID of the app

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship apps update

Update a Flagship app

npx wrangler flagship apps update [APP-ID]
  • [APP-ID]string required

    The ID of the app

  • --namestring required

    The new name of the app

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship apps delete

Delete a Flagship app

npx wrangler flagship apps delete [APP-ID]
  • [APP-ID]string required

    One or more app IDs to delete

  • --forceboolean alias: --ydefault: false

    Skip the confirmation prompt

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags create

Create a feature flag in a Flagship app

npx wrangler flagship flags create [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    The key of the flag

  • --variationstring alias: --V

    A flag variation, in the form "name=value" (repeatable)

  • --default-variationstring alias: --default

    The name of the variation to serve by default (defaults to off for boolean flags, otherwise the first variation)

  • --typestring alias: --t

    The variation value type (inferred when omitted)

  • --descriptionstring alias: --d

    A description of the flag

  • --disabledboolean default: false

    Create the flag in a disabled state

  • --rulestring

    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-jsonstring

    A targeting rule as a JSON object (repeatable)

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags list

List feature flags in a Flagship app

npx wrangler flagship flags list [APP-ID]
  • [APP-ID]string required

    The ID of the app

  • --limitnumber

    The maximum number of flags to return (1-200)

  • --cursorstring

    The pagination cursor from a previous list call

  • --allboolean default: false

    Fetch every flag, following pagination automatically

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags get

Get a feature flag from a Flagship app

npx wrangler flagship flags get [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    The key of the flag

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags update

Update a feature flag in a Flagship app

npx wrangler flagship flags update [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    The key of the flag

  • --enableboolean

    Enable the flag

  • --disableboolean

    Disable the flag

  • --descriptionstring alias: --d

    A new description for the flag (pass "" to clear it)

  • --default-variationstring alias: --default

    The name of the variation to serve by default

  • --typestring alias: --t

    The value type used to coerce --set-variation values

  • --set-variationstring

    Add or replace a variation, in the form "name=value"

  • --remove-variationstring

    Remove a variation by name

  • --rulestring

    Replace the flag's targeting rules (repeatable)

  • --rule-jsonstring

    Replace the flag's targeting rules using JSON (repeatable)

  • --add-rulestring

    Append a targeting rule, keeping the existing rules (repeatable)

  • --add-rule-jsonstring

    Append a targeting rule using JSON, keeping the existing rules (repeatable)

  • --clear-rulesboolean default: false

    Remove all targeting rules

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags set

Set the default variation served by a feature flag

npx wrangler flagship flags set [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    The key of the flag

  • --variationstring aliases: --variant, --Vrequired

    The variation to serve by default

  • --clear-rulesboolean default: false

    Clear targeting rules so this variation is always served

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags rules list

List targeting rules for a feature flag

npx wrangler flagship flags rules list [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    The key of the flag

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use 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]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    The key of the flag

  • --prioritynumber required

    The priority of the rule to update

  • --servestring

    The variation to serve when this rule matches

  • --whenstring

    The rule conditions, using the same syntax as --rule when=...

  • --clear-conditionsboolean default: false

    Remove conditions so the rule matches all contexts

  • --rolloutstring

    The rollout, in the form "percentage" or "percentage%@attribute"

  • --clear-rolloutboolean default: false

    Remove the rollout from this rule

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use 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]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    The key of the flag

  • --prioritynumber required

    The priority of the rule to delete

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags rules reorder

Reorder targeting rules for a feature flag

npx wrangler flagship flags rules reorder [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    The key of the flag

  • --orderstring required

    Comma-separated existing rule priorities in their new order, for example 2,1,3

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags split

Split traffic across variations by percentage

npx wrangler flagship flags split [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    The key of the flag

  • --weightstring alias: --w

    A variation weight, in the form "variation=weight" (repeatable)

  • --bystring

    Context attribute used for sticky bucketing

  • --default-variationstring alias: --default

    Fallback variation when bucketing cannot run

  • --forceboolean alias: --ydefault: false

    Skip the confirmation prompt when this split replaces existing targeting rules

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags rollout

Roll out one variation to a percentage of traffic

npx wrangler flagship flags rollout [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    The key of the flag

  • --tostring required

    Variation to roll out

  • --percentagenumber required

    Percentage of traffic to serve the rollout variation (0-100)

  • --bystring

    Context attribute used for sticky bucketing

  • --from-variationstring alias: --from

    Fallback variation for the remaining traffic

  • --forceboolean alias: --ydefault: false

    Skip the confirmation prompt when this rollout replaces existing targeting rules

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags enable

Enable a feature flag

npx wrangler flagship flags enable [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    One or more flag keys to enable

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags disable

Disable a feature flag

npx wrangler flagship flags disable [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    One or more flag keys to disable

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags evaluate

Evaluate a feature flag with optional context

npx wrangler flagship flags evaluate [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    The key of the flag

  • --contextstring aliases: --ctx, --C

    Evaluation context, in the form "name=value" (repeatable)

  • --targeting-keystring

    Stable bucketing key for percentage rollouts

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags delete

Delete a feature flag from a Flagship app

npx wrangler flagship flags delete [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    One or more flag keys to delete

  • --forceboolean alias: --ydefault: false

    Skip the confirmation prompt

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

flagship flags changelog

Show the changelog for a feature flag

npx wrangler flagship flags changelog [APP-ID] [KEY]
  • [APP-ID]string required

    The ID of the app

  • [KEY]string required

    The key of the flag

  • --limitnumber

    The maximum number of entries to return (1-200)

  • --cursorstring

    The pagination cursor from a previous changelog call

  • --allboolean default: false

    Fetch every entry, following pagination automatically

  • --jsonboolean default: false

    Return output as JSON

Global flags

  • --vboolean alias: --version

    Show version number

  • --cwdstring

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --configstring alias: --c

    Path to Wrangler configuration file

  • --envstring alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-filestring

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provisionboolean aliases: --x-provisiondefault: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-createboolean alias: --x-auto-createdefault: true

    Automatically provision draft bindings with new resources

  • --install-skillsboolean default: false

    Install Cloudflare skills for detected AI coding agents before running the command

  • --profilestring

    Use a specific auth profile

役に立ちましたか?