Pular para o conteúdo

Changelog

New updates and improvements at Cloudflare.

Manage Flagship from the command line with Wrangler

Wrangler now includes wrangler flagship, a command suite for managing Flagship apps and feature flags from your terminal.

Create an app and, if you use it from a Worker, add it to your wrangler.json or wrangler.jsonc file as a binding:

wrangler flagship apps create "My Worker App" \
  --binding FLAGS \
  --update-config

Then create flags for the behavior you want to control. Flags can be booleans, strings, numbers, or JSON values:

wrangler flagship flags create <APP_ID> new-checkout

wrangler flagship flags create <APP_ID> checkout-flow \
  --variation control=old-checkout \
  --variation treatment=new-checkout \
  --default control \
  --type string

After a flag exists, change its default variation or use enable and disable commands as kill switches. Existing targeting rules continue to apply unless you change or clear them explicitly:

wrangler flagship flags update <APP_ID> checkout-flow --default treatment
wrangler flagship flags disable <APP_ID> checkout-flow
wrangler flagship flags enable <APP_ID> checkout-flow

For release workflows, use rollout, split, and rules to change exposure without redeploying your Worker:

wrangler flagship flags rollout <APP_ID> new-checkout \
  --to on \
  --percentage 25 \
  --by user_id

wrangler flagship flags split <APP_ID> checkout-flow \
  --weight control=80 \
  --weight treatment=20 \
  --by user_id

wrangler flagship flags rules update <APP_ID> checkout-flow \
  --priority 1 \
  --when "country equals US"

These commands can also be used from CI/CD pipelines, scripts, and AI agents to inspect Flagship state, update flag behavior, or roll back changes through Wrangler.

Refer to the wrangler flagship command reference for the full command guide.

Flagship API reference now available

The Flagship API reference is now available. You can use the Cloudflare API to create and update apps, and to create, update, delete, and list feature flags without using the dashboard.

For example, create a new boolean flag with the API:

curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/flagship/apps/$APP_ID/flags \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  -d '{
    "key": "new-checkout",
    "enabled": true,
    "default_variation": "off",
    "variations": {
      "off": false,
      "on": true
    },
    "rules": []
  }'

To create an API token, go to Account API Tokens in the Cloudflare dashboard and search for Flagship.

The API reference includes endpoints for Flagship apps, flags, changelog entries, and flag evaluation. Agents can also use the Flagship reference in the Cloudflare skill to create and manage Flagship resources.

Refer to the Flagship documentation to learn more about evaluating feature flags from your applications.

Flagship now in public beta

Flagship is now in public beta. Evaluate feature flags directly from Cloudflare Workers with no outbound HTTP calls, using globally distributed flag configuration backed by Workers KV and Durable Objects. Flagship supports typed flag values, targeting rules, percentage rollouts, audit history, and OpenFeature-compatible SDKs.

Evaluate a flag from a Worker in a few lines of code:

src/index.jsjs
export default {
	async fetch(request, env) {
		const showNewCheckout = await env.FLAGS.getBooleanValue(
			"new-checkout",
			false,
		);

		return new Response(showNewCheckout ? "New checkout" : "Standard checkout");
	},
};
src/index.tsts
export default {
	async fetch(request: Request, env: Env): Promise<Response> {
		const showNewCheckout = await env.FLAGS.getBooleanValue("new-checkout", false);

		return new Response(
			showNewCheckout ? "New checkout" : "Standard checkout",
		);
	},
} satisfies ExportedHandler<Env>;

Start creating flags from the Cloudflare dashboard today. Refer to the Flagship documentation to get started.