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])
| Option | Required | Default | Description |
|---|---|---|---|
--profile | No | current profile, or default on first login | Create 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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--format | No | table | Output 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.
| Option | Required | Default | Description |
|---|---|---|---|
--workspace-id | Either this or --workspace | — | Workspace ULID |
--workspace | Either this or --workspace-id | — | Workspace slug |
--project-id | Either this or --project | — | Project ULID |
--project | Either this or --project-id | — | Project slug |
--environment | No | development | Environment key |
--preferred-profile | No | Resolved profile | Profile hint written to .flagify/project.json |
--print | No | false | Print the JSON without writing to disk |
--force | No | false | Overwrite 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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--project | -p | Yes | — | Project ID |
--format | No | table | Output 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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--project | -p | Yes | — | Project ID |
--format | No | table | Output 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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--project | -p | Yes | — | Project ID |
--type | -t | No | boolean | Flag type: boolean, string, number, json |
--description | No | — | Human-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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--project | -p | Yes | — | Project ID |
--environment | -e | No | development | Target environment |
--all | -a | No | — | Toggle 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’svalueOverrideequals the flag’sdefaultValue, making the rule a no-op. Users outside the rollout fall through todefaultValueand 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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--project | -p | Yes | — | Project ID |
--format | No | table | Output 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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--format | No | table | Output 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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--workspace | -w | Falls back to config default | — | Workspace ID |
--format | No | table | Output 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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--format | No | table | Output 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
| Option | Alias | Required | Description |
|---|---|---|---|
--yes | -y | No | Skip 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.
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--project | -p | Yes | — | Project ID |
--environment | -e | Yes | — | Environment key (must match the slug configured in the API for this project) |
--format | No | table | Output 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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--project | -p | Yes | — | Project ID |
--environment | -e | Yes | — | Environment key (must match the slug configured in the API for this project) |
--format | No | table | Output 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
| Option | Alias | Required | Description |
|---|---|---|---|
[prefix] | No | Prefix of the key to revoke | |
--id | No | ULID of the key to revoke (use when prefixes collide) | |
--all | No | Revoke every active API key in the environment | |
--project | -p | Yes | Project ID |
--environment | -e | Yes | Target environment |
--yes | -y | No | Skip 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.
| Option | Required | Default | Description |
|---|---|---|---|
--tool | No | — | Generate for a specific tool: claude, cursor, copilot, windsurf |
--include-flags | No | false | Embed a snapshot of current flags (marked as potentially outdated) |
Files generated per tool:
| Tool | Files created |
|---|---|
| Claude Code | CLAUDE.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-flow → FlagNewCheckoutFlow. 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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--typescript | -t | One of --typescript or --go | — | Emit TypeScript |
--go | -g | One of --typescript or --go | — | Emit Go |
--output | -o | No | flagify.<ext> in cwd | Output file path |
--package | — | No | flagify | Go package name (only with --go) |
--project | -p | Yes | from config | Project 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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--project | -p | Falls back to config default | — | Project ID |
--format | No | table | Output 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
| Option | Required | Default | Description |
|---|---|---|---|
--project | Falls back to config default | — | Project ID |
--match | No | ALL | Match mode: ALL (every rule must match) or ANY (at least one rule must match) |
--rules | No | — | Rules as a JSON array of {attribute, operator, value} objects |
--yes | No | — | Skip 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
| Option | Required | Description |
|---|---|---|
--yes | No | Skip 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
}
]
}
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--project | -p | Falls back to config default | — | Project ID |
--environment | -e | No | development | Environment key (must match the slug configured in the API for this project) |
--format | No | table | Output 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.
| Exit | When | Message (stderr) |
|---|---|---|
0 | Rules fetched (may be empty) | Table or JSON output |
1 | <flag-key> is missing | missing flag key. Usage: flagify targeting list <flag-key> |
1 | Flag does not exist in the project | flag "<key>" not found in project: flag not found. Run \flagify flags list` to see available flag keys` |
1 | Flag exists but the environment has no flag config | environment "<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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--project | -p | Falls back to config default | — | Project ID |
--environment | -e | No | development | Environment key (must match the slug configured in the API for this project) |
--rules | Yes | — | Rules as a JSON array (see schema below) | |
--format | No | table | Output format: table, json — JSON returns {flag, environment, rules} with the saved rules | |
--yes | -y | No | — | Skip the confirmation prompt |
Rule object schema:
| Field | Type | Description |
|---|---|---|
priority | number | Evaluation order (lower runs first) |
enabled | boolean | Whether the rule is active |
segmentId | string (optional) | Segment to target |
conditions | array (optional) | Inline conditions {attribute, operator, value} |
valueOverride | any | Value returned when the rule matches |
rolloutPercentage | number (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
| Option | Alias | Required | Default | Description |
|---|---|---|---|---|
--format | No | table | Output 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
| Option | Required | Description |
|---|---|---|
key | Yes | Config key: api-url, workspace, project, environment |
value | Yes | Value 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
| Option | Required | Description |
|---|---|---|
key | Yes | Config 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:
| Flag | Alias | Description |
|---|---|---|
--workspace | -w | Workspace ID (overrides config default) |
--project | -p | Project ID (overrides config default) |
--environment | -e | Environment key (overrides config default) |
--yes | -y | Skip confirmation prompts |
--help | -h | Help 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