CLI Commands

Complete reference for every command available in the Flagify CLI.

flagify auth

Manage sign-in profiles. Every set of credentials lives under a named profile in ~/.flagify/config.json, so you can keep work and personal accounts side by side.

flagify auth login

Authenticate via the browser. Tokens are stored under a named profile in ~/.flagify/config.json, so re-running does not invalidate an existing sign-in — pass --profile to create or refresh a second identity alongside the first.

flagify auth login
flagify auth login --profile work
Opening browser to authorize...
✓ Logged in as Jane Doe ([email protected])
OptionRequiredDefaultDescription
--profileNocurrent profile, or default on first loginCreate or refresh a named profile

flagify auth list

flagify auth list
flagify auth list --format json
  PROFILE   EMAIL                  SCOPE                     STATUS
● work      [email protected]          acme / api / development  logged in
  personal  —                      — / — / —                 logged out

The marks the active profile.

flagify auth switch

flagify auth switch personal

flagify auth logout

flagify auth logout
flagify auth logout --profile work
flagify auth logout --all

flagify auth remove

Delete a profile entirely, including any repo bindings that point to it.

flagify auth remove work
flagify auth remove work --yes

flagify auth rename

Rename a profile and update local bindings.

flagify auth rename work acme

flagify auth whoami

Alias of flagify whoami.

flagify whoami

Show the currently resolved user and the profile the invocation is using.

flagify whoami
flagify whoami --format json
✓ Jane Doe ([email protected])  profile: work
OptionAliasRequiredDefaultDescription
--formatNotableOutput format: table, json

If no profile is signed in, the command fails with an error directing you to run flagify auth login.

flagify status

Show the resolved context for this invocation — which profile is active, which workspace/project/environment the CLI will use, and where each value came from.

flagify status
flagify status --format json
  Profile       work            (profile-default)
  User          Jane Doe <[email protected]>    (profile)
  Workspace     acme (ws_01J...)            (project-file)
  Project       api (pr_01J...)             (project-file)
  Environment   staging                     (flag)
  API URL       https://api.flagify.dev     (profile-default)
  Console URL   https://console.flagify.dev (default)
  Project file  /repo/.flagify/project.json
  Global store  ~/.flagify/config.json

In JSON mode, each field carries a source whose value is one of flag, env, project-file, binding, profile-default, or default.

flagify init

Write .flagify/project.json for the current repo — a committable file pinning the workspace, project, and environment the repo should use. It never contains tokens.

flagify init --workspace-id ws_01J... --project-id pr_01J... --environment development
flagify init --print
flagify init --force

Re-running with the same scope says Already initialized and does not touch the file. Re-running with a different scope prompts for confirmation in a TTY and errors in CI unless --force is passed.

OptionRequiredDefaultDescription
--workspace-idEither this or --workspaceWorkspace ULID
--workspaceEither this or --workspace-idWorkspace slug
--project-idEither this or --projectProject ULID
--projectEither this or --project-idProject slug
--environmentNodevelopmentEnvironment key
--preferred-profileNoResolved profileProfile hint written to .flagify/project.json
--printNofalsePrint the JSON without writing to disk
--forceNofalseOverwrite an existing project file without prompting

flagify project

Inspect and update the committable project file for the current repo.

flagify project bind

Bind the current repo to a local profile. Recorded in ~/.flagify/config.json under bindings; never written to the committable project file.

flagify project bind --profile work

flagify project status

Alias of flagify status.

flagify project set

Update a single field of .flagify/project.json in place.

flagify project set environment staging
flagify project set preferred-profile work

Valid fields: environment, project, project-id, workspace, workspace-id, preferred-profile.

flagify flags list

List all flags in a project.

flagify flags list --project <project-id>
KEY                NAME               TYPE       ENVIRONMENTS
checkout-redesign  Checkout Redesign  boolean    dev:on, staging:off, prod:off
beta-dashboard     Beta Dashboard     boolean    dev:on, staging:on, prod:off

Output as JSON for scripts and AI tools:

flagify flags list --project <project-id> --format json
OptionAliasRequiredDefaultDescription
--project-pYesProject ID
--formatNotableOutput format: table, json

flagify flags get

Get details for a specific flag, including status per environment.

flagify flags get my-flag --project <project-id>
Key          my-flag
Name         my-flag
Type         boolean

ENVIRONMENT   STATUS   VARIANTS
development   ON       -
staging       OFF      -
production    OFF      -
flagify flags get my-flag --project <project-id> --format json
OptionAliasRequiredDefaultDescription
--project-pYesProject ID
--formatNotableOutput format: table, json

flagify flags create

Create a new feature flag. The flag is automatically provisioned across all environments in the project. Flag keys must be kebab-case (e.g., my-flag).

flagify flags create my-flag --project <project-id> --type boolean
Created flag "my-flag" (boolean) with 3 environments
OptionAliasRequiredDefaultDescription
--project-pYesProject ID
--type-tNobooleanFlag type: boolean, string, number, json
--descriptionNoHuman-readable description

flagify flags toggle

Toggle a flag on or off. Flips the current state in a specific environment, or in all environments with --all. If no flag key is provided, an interactive picker lets you select from existing flags.

flagify flags toggle checkout-redesign --project <project-id> --environment staging

Run without a key to pick interactively:

flagify flags toggle --project <project-id>
✓ Flag checkout-redesign is now ON in staging

Toggle in all environments at once:

flagify flags toggle dark-mode --project <project-id> --all
✓ Flag dark-mode is now OFF in development
✓ Flag dark-mode is now OFF in staging
✓ Flag dark-mode is now OFF in production
OptionAliasRequiredDefaultDescription
--project-pYesProject ID
--environment-eNodevelopmentTarget environment
--all-aNoToggle in all environments at once

flagify flags health

Scan the project for flag configuration issues. Surfaces two classes of problem:

  • env_mismatch — flag is on in production but off in the preceding environment (untested config in prod), or value drift between prod and the preceding env.
  • rule_value_matches_default — a targeting rule’s valueOverride equals the flag’s defaultValue, making the rule a no-op. Users outside the rollout fall through to defaultValue and receive the same value the rule would serve.
flagify flags health --project <project-id>
Flag           Environment  Severity  Type                         Message
new-checkout   —            critical  env_mismatch                 Active in production but inactive in Staging — untested config in prod
new-checkout   production   warning   rule_value_matches_default   Rule serves true but defaultValue is also true — users outside the rollout fall through to defaultValue, so this rule has no visible effect.

2 issue(s) detected. Fix hints available in JSON output (--format json).

JSON output includes a fix hint with a one-line remediation suggestion:

flagify flags health --project <project-id> --format json
OptionAliasRequiredDefaultDescription
--project-pYesProject ID
--formatNotableOutput format (table, json)

flagify workspaces list

List all workspaces you belong to.

flagify workspaces list
flagify workspaces list --format json
ID                          NAME        SLUG          PLAN
01J5K8RQXHNZ4VMKD3GY7PSABET  Acme Corp   acme-corp     pro
01J5K9FWQM3TR8JXNE2PV7CDLHW  Side Proj   side-project  free
OptionAliasRequiredDefaultDescription
--formatNotableOutput format: table, json

flagify workspaces pick

Interactively select a default workspace. The selection is saved to ~/.flagify/config.json so you don’t need to pass --workspace on every command.

flagify workspaces pick
? Select a workspace
> Acme Corp (acme-corp)
  Side Proj (side-project)

✓ Workspace set to Acme Corp

flagify projects list

List all projects in a workspace.

flagify projects list --workspace <workspace-id>
flagify projects list --format json
ID                          NAME         SLUG
01J5KBC3XPQR7WFMN4HY6TDASEV  Web App      web-app
01J5KBD9ZMSV2JXLR8GT5NFHQAW  Mobile App   mobile-app
OptionAliasRequiredDefaultDescription
--workspace-wFalls back to config defaultWorkspace ID
--formatNotableOutput format: table, json

flagify projects pick

Interactively select a default project. The selection is saved to ~/.flagify/config.json.

flagify projects pick
? Select a project
> Web App (web-app)
  Mobile App (mobile-app)

✓ Project set to Web App

If no workspace is saved, the CLI will prompt you to pick one first.

flagify environments pick

Interactively select a default environment. The selection is saved to ~/.flagify/config.json.

flagify environments pick
? Select an environment
> Development (development)
  Staging (staging)
  Production (production)

✓ Environment set to Development

If no project is saved, the CLI will prompt you to pick workspace and project first.

flagify projects get

Show project details including environments.

flagify projects get <project-id>
flagify projects get <project-id> --format json
ID:        01J5KBC3XPQR7WFMN4HY6TDASEV
Name:      Web App
Slug:      web-app

Environments:
  ID                          KEY          NAME
  01J5KBF7YNPT4QJRK2DX8MHGWCV  development  Development
  01J5KBG2ZMRW5HXLN3FY9PKJTDS  staging      Staging
  01J5KBH8XKQS6DVMR4GZ7NFCWET  production   Production
OptionAliasRequiredDefaultDescription
--formatNotableOutput format: table, json

flagify projects delete

Delete a project along with all its environments, flags, segments, and API keys. Requires the admin role or higher on the workspace. The command asks for confirmation unless you pass --yes.

flagify projects delete <project-id>
flagify projects delete <project-id> --yes
⚠ Delete project 01J5KBC3XPQR7WFMN4HY6TDASEV? This will also delete all its environments, flags, segments, and API keys. This cannot be undone. [y/N]
✓ Deleted project 01J5KBC3XPQR7WFMN4HY6TDASEV
OptionAliasRequiredDescription
--yes-yNoSkip the confirmation prompt

flagify keys generate

Generate an API key pair (publishable + secret) for an environment. These keys are required for SDK integration (@flagify/node, @flagify/react).

flagify keys generate --project <project-id> --environment development
flagify keys generate --project <project-id> --environment development --format json
✓ Generated API keys for development

  Publishable:  pk_dev_abc123_xxxxxxxx
  Secret:       sk_dev_abc123_xxxxxxxx

⚠ Save these keys now — the secret key won't be shown again.
OptionAliasRequiredDefaultDescription
--project-pYesProject ID
--environment-eYesEnvironment key (must match the slug configured in the API for this project)
--formatNotableOutput format: table, json — JSON returns {environment, publishableKey, secretKey}

flagify keys list

List all API keys for an environment, showing prefix, type, creation date, and status.

flagify keys list --project <project-id> --environment development
flagify keys list --project <project-id> --environment development --format json
PREFIX            TYPE          CREATED            STATUS
pk_dev_abc123     publishable   2026-03-29 10:00   active
sk_dev_abc123     secret        2026-03-29 10:00   active
OptionAliasRequiredDefaultDescription
--project-pYesProject ID
--environment-eYesEnvironment key (must match the slug configured in the API for this project)
--formatNotableOutput format: table, json

flagify keys revoke

Revoke a single API key by its prefix (or --id), or revoke every active key in the environment with --all. [prefix], --id, and --all are mutually exclusive, and passing none of them is treated as an error so the destructive form is always explicit.

Revoke one key — copy the prefix from flagify keys list:

flagify keys revoke pk_dev_abc --project <project-id> --environment development
✓ Revoked API key pk_dev_abc in development

Revoke a specific key by ULID — use when two keys share a prefix:

flagify keys revoke --id key_01J... --project <project-id> --environment development

Revoke every active key in the environment (explicit opt-in):

flagify keys revoke --all --project <project-id> --environment staging
✓ Revoked all API keys for staging
OptionAliasRequiredDescription
[prefix]NoPrefix of the key to revoke
--idNoULID of the key to revoke (use when prefixes collide)
--allNoRevoke every active API key in the environment
--project-pYesProject ID
--environment-eYesTarget environment
--yes-yNoSkip the confirmation prompt

flagify ai-setup

Generate AI tool config files for your project. Creates config files so AI coding tools understand your Flagify setup.

flagify ai-setup

Generate for a specific tool:

flagify ai-setup --tool cursor

By default, generated configs instruct the AI tool to run flagify flags list for live data and include a reference to the Flagify integrations catalogue (GitHub Actions and more) so the AI knows which first-party tools are available. Use --include-flags to also embed a point-in-time snapshot:

flagify ai-setup --include-flags
✓ Generated claude CLAUDE.md + .claude/commands/
✓ Generated cursor .cursorrules
✓ Generated copilot .github/copilot-instructions.md
✓ Generated windsurf .windsurfrules

● 4 config file(s) created. Commit them to your repo.
OptionRequiredDefaultDescription
--toolNoGenerate for a specific tool: claude, cursor, copilot, windsurf
--include-flagsNofalseEmbed a snapshot of current flags (marked as potentially outdated)

Files generated per tool:

ToolFiles created
Claude CodeCLAUDE.md (appends section), .claude/commands/flagify-create.md, .claude/commands/flagify-toggle.md, .claude/commands/flagify-list.md
Cursor.cursorrules
GitHub Copilot.github/copilot-instructions.md
Windsurf.windsurfrules

flagify types

Generate a source file with every flag key in the current project exported as a typed constant. Use the output to catch typos in flag names at compile time instead of at runtime.

Exactly one of --typescript or --go is required.

TypeScript:

flagify types --typescript
✓ Generated flagify.ts (12 flags)

The command writes a file like this:

// Auto-generated by Flagify CLI — do not edit manually
// Project: Web App
// Generated: 2026-04-19T00:00:00Z

export const FLAG_KEYS = {
  "dark-mode": "dark-mode",
  "new-checkout-flow": "new-checkout-flow",
  "onboarding-v2": "onboarding-v2",
} as const;

export type FlagKey = keyof typeof FLAG_KEYS;

Import it in application code:

import { FLAG_KEYS, type FlagKey } from './flagify'

flagify.isEnabled(FLAG_KEYS['new-checkout-flow'])

Go:

flagify types --go --package myflags
✓ Generated flagify.go (12 flags)
// Auto-generated by Flagify CLI — do not edit manually
// Project: Web App
// Generated: 2026-04-19T00:00:00Z

package myflags

const (
	FlagDarkMode        = "dark-mode"
	FlagNewCheckoutFlow = "new-checkout-flow"
	FlagOnboardingV2    = "onboarding-v2"
)

Kebab-case keys become Flag + PascalCase — new-checkout-flowFlagNewCheckoutFlow. Initialisms stay title-cased (so api-key-rotation becomes FlagApiKeyRotation, not FlagAPIKeyRotation) to keep the conversion deterministic.

Pick a custom output path:

flagify types --typescript --output src/generated/flags.ts
OptionAliasRequiredDefaultDescription
--typescript-tOne of --typescript or --goEmit TypeScript
--go-gOne of --typescript or --goEmit Go
--output-oNoflagify.<ext> in cwdOutput file path
--packageNoflagifyGo package name (only with --go)
--project-pYesfrom configProject ID (falls back to projectId in ~/.flagify/config.json)

Existing output files that start with the // Auto-generated by Flagify CLI header are overwritten silently. Any other existing file at --output triggers a confirmation prompt (skipped with --yes) so a hand-authored flags.ts is not clobbered on first run.


flagify segments list

List all user segments defined in a project. Segments are reusable groups of users (for example, “Pro users” or “EU customers”) that targeting rules can reference.

flagify segments list --project <project-id>
flagify segments list --project <project-id> --format json
NAME          MATCH   RULES     ID
Pro users     ALL     2 rules   01J6ABCXYZPRSEGMENT001
EU customers  ANY     1 rules   01J6ABCXYZPRSEGMENT002
OptionAliasRequiredDefaultDescription
--project-pFalls back to config defaultProject ID
--formatNotableOutput format: table, json

flagify segments create

Create a new segment with a name, match type, and optional rules expressed as a JSON array.

flagify segments create "Pro users" \
  --project <project-id> \
  --match ALL \
  --rules '[{"attribute":"plan","operator":"equals","value":"pro"}]'
✓ Created segment Pro users (ALL) with 1 rules
OptionRequiredDefaultDescription
--projectFalls back to config defaultProject ID
--matchNoALLMatch mode: ALL (every rule must match) or ANY (at least one rule must match)
--rulesNoRules as a JSON array of {attribute, operator, value} objects
--yesNoSkip the confirmation prompt

flagify segments delete

Delete a segment by ID. Targeting rules that reference the segment will need to be updated separately.

flagify segments delete 01J6ABCXYZPRSEGMENT001
⚠ Delete segment 01J6ABCXYZPRSEGMENT001? This cannot be undone. [y/N]
✓ Deleted segment 01J6ABCXYZPRSEGMENT001
OptionRequiredDescription
--yesNoSkip the confirmation prompt

flagify targeting list

Show the targeting rules for a flag in a specific environment. Rules are listed in priority order — the first matching rule wins.

flagify targeting list <flag-key> \
  --project <project-id> \
  --environment production
flagify targeting list <flag-key> --environment production --format json
#  TARGET                     VALUE   ROLLOUT   STATUS
1  segment:01J6...SEGMENT001  true    100%      on
2  2 conditions               true    50%       on
3  catch-all                          0%        off

JSON output shape (also returned when the flag has zero rules — rules is simply an empty array). Each rule includes its server-assigned id, plus either segmentId or conditions (or both):

{
  "flag": "checkout-redesign",
  "environment": "production",
  "rules": [
    {
      "id": "01J6...RULE001",
      "priority": 1,
      "enabled": true,
      "segmentId": "01J6...SEGMENT001",
      "valueOverride": true,
      "rolloutPercentage": 100
    },
    {
      "id": "01J6...RULE002",
      "priority": 2,
      "enabled": true,
      "conditions": [
        { "attribute": "country", "operator": "equals", "value": "US" }
      ],
      "valueOverride": true,
      "rolloutPercentage": 50
    }
  ]
}
OptionAliasRequiredDefaultDescription
--project-pFalls back to config defaultProject ID
--environment-eNodevelopmentEnvironment key (must match the slug configured in the API for this project)
--formatNotableOutput format: table, json

Exit codes & errors:

The CLI wraps lookup failures with a sentinel suffix so scripts can branch on the failure mode without parsing the human prefix. The sentinels are also surfaced as wrapped errors (errors.Is) for Go callers that import the CLI as a library.

ExitWhenMessage (stderr)
0Rules fetched (may be empty)Table or JSON output
1<flag-key> is missingmissing flag key. Usage: flagify targeting list <flag-key>
1Flag does not exist in the projectflag "<key>" not found in project: flag not found. Run \flagify flags list` to see available flag keys`
1Flag exists but the environment has no flag configenvironment "<env>" not configured for flag "<key>": environment not found for flag. Run \flagify projects get` to see environments configured for this project`

flagify targeting set

Replace all targeting rules for a flag in one environment with a JSON array of rules. Existing rules are removed — pass the full desired rule set.

flagify targeting set <flag-key> \
  --project <project-id> \
  --environment production \
  --rules '[
    {"priority":1,"enabled":true,"segmentId":"01J6...SEGMENT001","valueOverride":true,"rolloutPercentage":100},
    {"priority":2,"enabled":true,"conditions":[{"attribute":"country","operator":"equals","value":"US"}],"valueOverride":true,"rolloutPercentage":50}
  ]'
⚠ Replace all targeting rules for checkout-redesign in production with 2 rules? [y/N]
✓ Set 2 targeting rules for checkout-redesign in production
OptionAliasRequiredDefaultDescription
--project-pFalls back to config defaultProject ID
--environment-eNodevelopmentEnvironment key (must match the slug configured in the API for this project)
--rulesYesRules as a JSON array (see schema below)
--formatNotableOutput format: table, json — JSON returns {flag, environment, rules} with the saved rules
--yes-yNoSkip the confirmation prompt

Rule object schema:

FieldTypeDescription
prioritynumberEvaluation order (lower runs first)
enabledbooleanWhether the rule is active
segmentIdstring (optional)Segment to target
conditionsarray (optional)Inline conditions {attribute, operator, value}
valueOverrideanyValue returned when the rule matches
rolloutPercentagenumber (optional)Percentage of matched users to include (0–100)

flagify config

Show the current CLI configuration — auth status, URLs, scope, and config file location. Values are grouped into Configuration (auth, URLs) and Scope (workspace, project, environment).

flagify config
flagify config --format json
OptionAliasRequiredDefaultDescription
--formatNotableOutput format: table, json. JSON omits tokens/secrets.
  Configuration

  Logged in:    yes
  API URL:      https://api.flagify.dev (default)
  Console URL:  https://console.flagify.dev

  Scope

  Workspace:    acme-corp (01J5K8RQXHNZ4VMKD3GY7PSABET)
  Project:      web-app (01J5KBC3XPQR7WFMN4HY6TDASEV)
  Environment:  development

  Config file:  /Users/jane/.flagify/config.json

flagify config set

Set a configuration value. Shows the previous and new value on update.

flagify config set environment staging
✓ environment updated: development → staging
flagify config set api-url https://api.custom.dev
✓ api-url set to https://api.custom.dev
OptionRequiredDescription
keyYesConfig key: api-url, workspace, project, environment
valueYesValue to set

flagify config get

Get a single configuration value. Prints the raw value, useful for scripts.

flagify config get project
web-app
flagify config get environment
development
OptionRequiredDescription
keyYesConfig key: api-url, workspace, project, environment

flagify version

Print the CLI version and commit hash.

flagify version
flagify 0.0.2 (a1b2c3d)

flagify completion

Generate shell completion scripts for autocompletion.

Zsh (macOS default):

flagify completion zsh > "${fpath[1]}/_flagify"

Bash:

flagify completion bash > /usr/local/etc/bash_completion.d/flagify

Fish:

flagify completion fish > ~/.config/fish/completions/flagify.fish

PowerShell:

flagify completion powershell > flagify.ps1

Restart your shell after installing completions.

Global flags

These flags are available on all commands:

FlagAliasDescription
--workspace-wWorkspace ID (overrides config default)
--project-pProject ID (overrides config default)
--environment-eEnvironment key (overrides config default)
--yes-ySkip confirmation prompts
--help-hHelp for any command

Confirmation prompts

Destructive commands (flags create, flags toggle, keys generate, keys revoke) ask for confirmation before executing. Skip with --yes:

flagify flags toggle my-flag -y