flipt

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Flipt Feature Flag Management

Flipt功能标志管理

Use this skill to manage Flipt feature flags for controlled feature rollouts.
使用此技能来管理Flipt功能标志,以实现可控的功能发布。

Running Commands

运行命令

Use the included script:
bash
node .claude/skills/flipt/flipt.mjs <command> [options]
使用附带的脚本:
bash
node .claude/skills/flipt/flipt.mjs <command> [options]

Commands

命令

CommandDescription
list
List all flags
get <key>
Get details for a specific flag
create <key>
Create a new boolean flag
enable <key>
Enable a flag (set to true)
disable <key>
Disable a flag (set to false)
delete <key>
Delete a flag (requires confirmation)
命令描述
list
列出所有标志
get <key>
获取特定标志的详细信息
create <key>
创建一个新的布尔型标志
enable <key>
启用标志(设置为true)
disable <key>
禁用标志(设置为false)
delete <key>
删除标志(需要确认)

Options

选项

FlagDescription
--description <text>
,
-d
Description for new flag
--enabled
Create flag as enabled (default: disabled)
--json
Output results as JSON
--quiet
,
-q
Minimal output
--force
,
-f
Skip confirmation prompts
标志描述
--description <text>
,
-d
新标志的描述
--enabled
创建已启用的标志(默认:禁用)
--json
以JSON格式输出结果
--quiet
,
-q
精简输出
--force
,
-f
跳过确认提示

Examples

示例

bash
undefined
bash
undefined

List all flags

列出所有标志

node .claude/skills/flipt/flipt.mjs list
node .claude/skills/flipt/flipt.mjs list

Get a specific flag

获取特定标志

node .claude/skills/flipt/flipt.mjs get gift-card-vendor-waifu-way
node .claude/skills/flipt/flipt.mjs get gift-card-vendor-waifu-way

Create a new flag (disabled by default)

创建新标志(默认禁用)

node .claude/skills/flipt/flipt.mjs create my-new-feature -d "Enable new feature for testing"
node .claude/skills/flipt/flipt.mjs create my-new-feature -d "Enable new feature for testing"

Create a flag that's enabled immediately

创建立即启用的标志

node .claude/skills/flipt/flipt.mjs create my-feature --enabled -d "Already enabled feature"
node .claude/skills/flipt/flipt.mjs create my-feature --enabled -d "Already enabled feature"

Enable a flag

启用标志

node .claude/skills/flipt/flipt.mjs enable my-new-feature
node .claude/skills/flipt/flipt.mjs enable my-new-feature

Disable a flag

禁用标志

node .claude/skills/flipt/flipt.mjs disable my-new-feature
node .claude/skills/flipt/flipt.mjs disable my-new-feature

Delete a flag (with confirmation)

删除标志(需要确认)

node .claude/skills/flipt/flipt.mjs delete old-flag
node .claude/skills/flipt/flipt.mjs delete old-flag

Delete without confirmation

无需确认直接删除

node .claude/skills/flipt/flipt.mjs delete old-flag --force
node .claude/skills/flipt/flipt.mjs delete old-flag --force

JSON output for scripting

以JSON格式输出用于脚本编写

node .claude/skills/flipt/flipt.mjs list --json
undefined
node .claude/skills/flipt/flipt.mjs list --json
undefined

GitOps Integration

GitOps集成

Flipt uses GitOps - flags are stored in the
civitai/flipt-state
repository. Changes made via the API are temporary and will be overwritten on the next Git sync (every 30 seconds).
For permanent changes, edit the repository directly:
bash
undefined
Flipt采用GitOps方式——标志存储在
civitai/flipt-state
仓库中。通过API进行的更改是临时的,会在下次Git同步(每30秒一次)时被覆盖。
要进行永久更改,请直接编辑仓库:
bash
undefined

Clone the state repo

克隆状态仓库

gh repo clone civitai/flipt-state /tmp/flipt-state
gh repo clone civitai/flipt-state /tmp/flipt-state

Edit civitai-app/default/features.yaml

编辑civitai-app/default/features.yaml

Add your flag under the
flags:
section

flags:
部分下添加你的标志

Commit and push

提交并推送

cd /tmp/flipt-state git add -A && git commit -m "Add new feature flag" && git push
undefined
cd /tmp/flipt-state git add -A && git commit -m "Add new feature flag" && git push
undefined

Flag Format in YAML

YAML中的标志格式

yaml
flags:
  - key: my-feature-flag
    name: my-feature-flag
    type: BOOLEAN_FLAG_TYPE
    description: Description of what this flag controls
    enabled: false
    # Optional: rollout rules
    rollouts:
      - threshold:
          percentage: 50
          value: true
      - segment:
          keys:
            - moderators
          operator: OR_SEGMENT_OPERATOR
          value: true
yaml
flags:
  - key: my-feature-flag
    name: my-feature-flag
    type: BOOLEAN_FLAG_TYPE
    description: Description of what this flag controls
    enabled: false
    # 可选:发布规则
    rollouts:
      - threshold:
          percentage: 50
          value: true
      - segment:
          keys:
            - moderators
          operator: OR_SEGMENT_OPERATOR
          value: true

Safety Notes

安全注意事项

  1. API changes are temporary: The Git repo is the source of truth
  2. Test before enabling: Use segments for gradual rollout
  3. Coordinate with team: Others may be editing the same flags
  1. API更改是临时的:Git仓库是事实来源
  2. 启用前测试:使用分段进行逐步发布
  3. 与团队协作:其他人可能正在编辑相同的标志

Environment Setup

环境设置

Copy
.env.example
to
.env
and configure:
bash
cp .claude/skills/flipt/.env.example .claude/skills/flipt/.env
The skill needs
FLIPT_URL
and
FLIPT_API_TOKEN
to connect to Flipt.
复制
.env.example
.env
并进行配置:
bash
cp .claude/skills/flipt/.env.example .claude/skills/flipt/.env
该技能需要
FLIPT_URL
FLIPT_API_TOKEN
来连接到Flipt。