kata-configure-settings

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<objective> Allow users to toggle workflow agents on/off and select model profile via interactive settings.
Updates
.planning/config.json
with workflow preferences and model profile selection.
Handles missing config keys: If config.json is missing any expected keys (e.g.,
pr_workflow
,
commit_docs
), prompts user for preferences and adds them. </objective>
<process>
<objective> 允许用户通过交互式设置开启/关闭工作流Agent,并选择模型配置文件。
将工作流偏好和模型配置文件选择更新至
.planning/config.json
处理缺失的配置键: 如果config.json缺少任何预期的键(如
pr_workflow
commit_docs
),会提示用户设置偏好并添加这些键。 </objective>
<process>

1. Validate Environment

1. 验证环境

bash
ls .planning/config.json 2>/dev/null
If not found: Error - run
/kata-new-project
first.
bash
ls .planning/config.json 2>/dev/null
若未找到: 错误 - 请先运行
/kata-new-project

2. Read Current Config and Detect Missing Keys

2. 读取当前配置并检测缺失的键

bash
cat .planning/config.json
Parse current values with defaults:
  • mode
    — yolo or interactive (default:
    yolo
    )
  • depth
    — quick, standard, or comprehensive (default:
    standard
    )
  • parallelization
    — run agents in parallel (default:
    true
    )
  • model_profile
    — which model each agent uses (default:
    balanced
    )
  • commit_docs
    — commit planning artifacts to git (default:
    true
    )
  • pr_workflow
    — use PR-based release workflow (default:
    false
    )
  • display.statusline
    — show Kata statusline (default:
    true
    )
  • workflow.research
    — spawn researcher during phase-plan (default:
    true
    )
  • workflow.plan_check
    — spawn plan checker during phase-plan (default:
    true
    )
  • workflow.verifier
    — spawn verifier during phase-execute (default:
    true
    )
Detect missing keys:
Check if these keys exist in config.json:
  • commit_docs
  • pr_workflow
  • display.statusline
If any are missing, note them for step 3.
bash
cat .planning/config.json
使用默认值解析当前配置:
  • mode
    — yolo或interactive(默认值:
    yolo
  • depth
    — quick、standard或comprehensive(默认值:
    standard
  • parallelization
    — 并行运行Agent(默认值:
    true
  • model_profile
    — 各Agent使用的模型(默认值:
    balanced
  • commit_docs
    — 将规划产物提交至Git(默认值:
    true
  • pr_workflow
    — 使用基于PR的发布工作流(默认值:
    false
  • display.statusline
    — 显示Kata状态行(默认值:
    true
  • workflow.research
    — 在规划阶段启动研究员Agent(默认值:
    true
  • workflow.plan_check
    — 在规划阶段启动规划检查器Agent(默认值:
    true
  • workflow.verifier
    — 在执行阶段启动验证器Agent(默认值:
    true
检测缺失的键:
检查config.json中是否存在以下键:
  • commit_docs
  • pr_workflow
  • display.statusline
若有任何键缺失,记录下来用于步骤3。

3. Present Settings (Including New Options)

3. 展示设置(包含新选项)

If missing keys were detected:
Display notification:
⚠️  New config options available: {list missing keys}
   Adding these to your settings...
Use AskUserQuestion with current values shown:
AskUserQuestion([
  {
    question: "Which model profile for agents?",
    header: "Model",
    multiSelect: false,
    options: [
      { label: "Quality", description: "Opus everywhere except verification (highest cost)" },
      { label: "Balanced (Recommended)", description: "Opus for planning, Sonnet for execution/verification" },
      { label: "Budget", description: "Sonnet for writing, Haiku for research/verification (lowest cost)" }
    ]
  },
  {
    question: "Commit planning docs to git?",
    header: "Commit Docs",
    multiSelect: false,
    options: [
      { label: "Yes (Recommended)", description: "Track planning artifacts in git history" },
      { label: "No", description: "Keep planning private (add .planning/ to .gitignore)" }
    ]
  },
  {
    question: "Use PR-based release workflow?",
    header: "PR Workflow",
    multiSelect: false,
    options: [
      { label: "Yes (Recommended)", description: "Protect main, create PRs, tag via GitHub Release" },
      { label: "No", description: "Commit directly to main, create tags locally" }
    ]
  },
  {
    question: "Spawn Plan Researcher? (researches domain before planning)",
    header: "Research",
    multiSelect: false,
    options: [
      { label: "Yes", description: "Research phase goals before planning" },
      { label: "No", description: "Skip research, plan directly" }
    ]
  },
  {
    question: "Spawn Plan Checker? (verifies plans before execution)",
    header: "Plan Check",
    multiSelect: false,
    options: [
      { label: "Yes", description: "Verify plans meet phase goals" },
      { label: "No", description: "Skip plan verification" }
    ]
  },
  {
    question: "Spawn Execution Verifier? (verifies phase completion)",
    header: "Verifier",
    multiSelect: false,
    options: [
      { label: "Yes", description: "Verify must-haves after execution" },
      { label: "No", description: "Skip post-execution verification" }
    ]
  },
  {
    question: "Enable Kata statusline?",
    header: "Statusline",
    multiSelect: false,
    options: [
      { label: "Yes (Recommended)", description: "Show model, context usage, update status in statusline" },
      { label: "No", description: "Use default Claude Code statusline" }
    ]
  }
])
Pre-select based on current config values (use defaults for missing keys).
若检测到缺失的键:
显示通知:
⚠️  有新的配置选项可用:{缺失键列表}
   正在将这些选项添加到你的设置中...
使用AskUserQuestion并显示当前值:
AskUserQuestion([
  {
    question: "Which model profile for agents?",
    header: "Model",
    multiSelect: false,
    options: [
      { label: "Quality", description: "Opus everywhere except verification (highest cost)" },
      { label: "Balanced (Recommended)", description: "Opus for planning, Sonnet for execution/verification" },
      { label: "Budget", description: "Sonnet for writing, Haiku for research/verification (lowest cost)" }
    ]
  },
  {
    question: "Commit planning docs to git?",
    header: "Commit Docs",
    multiSelect: false,
    options: [
      { label: "Yes (Recommended)", description: "Track planning artifacts in git history" },
      { label: "No", description: "Keep planning private (add .planning/ to .gitignore)" }
    ]
  },
  {
    question: "Use PR-based release workflow?",
    header: "PR Workflow",
    multiSelect: false,
    options: [
      { label: "Yes (Recommended)", description: "Protect main, create PRs, tag via GitHub Release" },
      { label: "No", description: "Commit directly to main, create tags locally" }
    ]
  },
  {
    question: "Spawn Plan Researcher? (researches domain before planning)",
    header: "Research",
    multiSelect: false,
    options: [
      { label: "Yes", description: "Research phase goals before planning" },
      { label: "No", description: "Skip research, plan directly" }
    ]
  },
  {
    question: "Spawn Plan Checker? (verifies plans before execution)",
    header: "Plan Check",
    multiSelect: false,
    options: [
      { label: "Yes", description: "Verify plans meet phase goals" },
      { label: "No", description: "Skip plan verification" }
    ]
  },
  {
    question: "Spawn Execution Verifier? (verifies phase completion)",
    header: "Verifier",
    multiSelect: false,
    options: [
      { label: "Yes", description: "Verify must-haves after execution" },
      { label: "No", description: "Skip post-execution verification" }
    ]
  },
  {
    question: "Enable Kata statusline?",
    header: "Statusline",
    multiSelect: false,
    options: [
      { label: "Yes (Recommended)", description: "Show model, context usage, update status in statusline" },
      { label: "No", description: "Use default Claude Code statusline" }
    ]
  }
])
根据当前配置值预选择(缺失的键使用默认值)。

4. Update Config

4. 更新配置

Merge new settings into existing config.json (preserving existing keys like
mode
,
depth
,
parallelization
):
json
{
  "mode": "yolo|interactive",
  "depth": "quick|standard|comprehensive",
  "parallelization": true|false,
  "model_profile": "quality|balanced|budget",
  "commit_docs": true|false,
  "pr_workflow": true|false,
  "display": {
    "statusline": true|false
  },
  "workflow": {
    "research": true|false,
    "plan_check": true|false,
    "verifier": true|false
  }
}
Write updated config to
.planning/config.json
.
If
display.statusline
changed to
true
:
Update
.claude/settings.json
with statusline configuration:
bash
undefined
将新设置合并到现有config.json中(保留
mode
depth
parallelization
等现有键):
json
{
  "mode": "yolo|interactive",
  "depth": "quick|standard|comprehensive",
  "parallelization": true|false,
  "model_profile": "quality|balanced|budget",
  "commit_docs": true|false,
  "pr_workflow": true|false,
  "display": {
    "statusline": true|false
  },
  "workflow": {
    "research": true|false,
    "plan_check": true|false,
    "verifier": true|false
  }
}
将更新后的配置写入
.planning/config.json
display.statusline
更改为
true
更新
.claude/settings.json
中的状态行配置:
bash
undefined

Ensure .claude directory exists

Ensure .claude directory exists

mkdir -p .claude
mkdir -p .claude

Check if settings.json exists and has statusLine

Check if settings.json exists and has statusLine

if [ -f .claude/settings.json ]; then

Check if statusLine already configured

if grep -q '"statusLine"' .claude/settings.json; then echo "Statusline already configured in .claude/settings.json" else # Add statusLine to existing settings using node node -e " const fs = require('fs'); const settings = JSON.parse(fs.readFileSync('.claude/settings.json', 'utf8')); settings.statusLine = { type: 'command', command: 'node "$CLAUDE_PROJECT_DIR/.claude/hooks/kata-statusline.js"' }; fs.writeFileSync('.claude/settings.json', JSON.stringify(settings, null, 2)); " echo "✓ Statusline enabled in .claude/settings.json" fi else

Create new settings.json with statusLine

cat > .claude/settings.json << 'SETTINGS_EOF' { "statusLine": { "type": "command", "command": "node "$CLAUDE_PROJECT_DIR/.claude/hooks/kata-statusline.js"" } } SETTINGS_EOF echo "✓ Created .claude/settings.json with statusline" fi

The statusline hook will be automatically installed on next session start by Kata's SessionStart hook.

**If `display.statusline` changed to `false`:**

Remove statusline from `.claude/settings.json`:

```bash
if [ -f .claude/settings.json ]; then
  node -e "
    const fs = require('fs');
    const settings = JSON.parse(fs.readFileSync('.claude/settings.json', 'utf8'));
    delete settings.statusLine;
    fs.writeFileSync('.claude/settings.json', JSON.stringify(settings, null, 2));
  "
  echo "✓ Statusline disabled in .claude/settings.json"
fi
If
commit_docs
changed to
false
:
  • Add
    .planning/
    to
    .gitignore
    (create if needed)
  • Note: User should run
    git rm -r --cached .planning/
    if already tracked
if [ -f .claude/settings.json ]; then

Check if statusLine already configured

if grep -q '"statusLine"' .claude/settings.json; then echo "Statusline already configured in .claude/settings.json" else # Add statusLine to existing settings using node node -e " const fs = require('fs'); const settings = JSON.parse(fs.readFileSync('.claude/settings.json', 'utf8')); settings.statusLine = { type: 'command', command: 'node "$CLAUDE_PROJECT_DIR/.claude/hooks/kata-statusline.js"' }; fs.writeFileSync('.claude/settings.json', JSON.stringify(settings, null, 2)); " echo "✓ Statusline enabled in .claude/settings.json" fi else

Create new settings.json with statusLine

cat > .claude/settings.json << 'SETTINGS_EOF' { "statusLine": { "type": "command", "command": "node "$CLAUDE_PROJECT_DIR/.claude/hooks/kata-statusline.js"" } } SETTINGS_EOF echo "✓ Created .claude/settings.json with statusline" fi

状态行钩子将在下次会话启动时由Kata的SessionStart钩子自动安装。

**若`display.statusline`更改为`false`:**

从`.claude/settings.json`中移除状态行配置:

```bash
if [ -f .claude/settings.json ]; then
  node -e "
    const fs = require('fs');
    const settings = JSON.parse(fs.readFileSync('.claude/settings.json', 'utf8'));
    delete settings.statusLine;
    fs.writeFileSync('.claude/settings.json', JSON.stringify(settings, null, 2));
  "
  echo "✓ Statusline disabled in .claude/settings.json"
fi
commit_docs
更改为
false
  • .planning/
    添加到
    .gitignore
    (若不存在则创建)
  • 注意:如果
    .planning/
    已被Git追踪,用户需运行
    git rm -r --cached .planning/

5. Confirm Changes

5. 确认更改

Display:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Kata ► SETTINGS UPDATED ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SettingValue
Model Profile{quality/balanced/budget}
Commit Docs{On/Off}
PR Workflow{On/Off}
Statusline{On/Off}
Plan Researcher{On/Off}
Plan Checker{On/Off}
Execution Verifier{On/Off}
These settings apply to future /kata-plan-phase and /kata-execute-phase runs.
Quick commands:
  • /kata-set-profile <profile> — switch model profile
  • /kata-plan-phase --research — force research
  • /kata-plan-phase --skip-research — skip research
  • /kata-plan-phase --skip-verify — skip plan check
If PR Workflow was just enabled (changed from Off to On), append:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ⚠ RECOMMENDED: Enable Branch Protection
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

PR workflow is enabled. Protect your main branch:

  https://github.com/{owner}/{repo}/settings/branches

Settings for `main`:
  ✓ Require a pull request before merging
  ✓ Do not allow bypassing the above settings
  ✗ Allow force pushes (uncheck)

This ensures ALL changes go through PRs.
</process>
<success_criteria>
  • Current config read
  • Missing keys detected and user notified
  • User presented with 7 settings (profile + commit_docs + pr_workflow + statusline + 3 toggles)
  • Config updated with complete schema
  • .claude/settings.json updated if statusline toggled
  • Changes confirmed to user </success_criteria>
显示:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Kata ► 设置已更新 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
配置项
模型配置文件{quality/balanced/budget}
提交文档{开启/关闭}
PR工作流{开启/关闭}
状态行{开启/关闭}
规划研究员Agent{开启/关闭}
规划检查器Agent{开启/关闭}
执行验证器Agent{开启/关闭}
这些设置将应用于后续的/kata-plan-phase和/kata-execute-phase运行。
快捷命令:
  • /kata-set-profile <profile> — 切换模型配置文件
  • /kata-plan-phase --research — 强制启用研究员
  • /kata-plan-phase --skip-research — 跳过研究员
  • /kata-plan-phase --skip-verify — 跳过规划检查
若PR工作流刚刚从关闭改为开启,补充显示:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ⚠ 推荐:启用分支保护
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

PR工作流已启用。请保护你的main分支:

  https://github.com/{owner}/{repo}/settings/branches

main分支的设置:
  ✓ 合并前需要拉取请求
  ✓ 不允许绕过上述设置
  ✗ 允许强制推送(取消勾选)

这将确保所有更改都通过PR进行。
</process>
<success_criteria>
  • 已读取当前配置
  • 已检测到缺失的键并通知用户
  • 已向用户展示7项设置(配置文件 + commit_docs + pr_workflow + statusline + 3个开关)
  • 已使用完整的配置架构更新配置
  • 若状态行开关更改,已更新.claude/settings.json
  • 已向用户确认更改 </success_criteria>