wizard

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

RU: Wizard

RU: 向导

Interactive configuration wizard using AskUserQuestion. Presents work categories neutrally, lets user classify each as Encourage/Forbid, then resolves conflicts.
使用AskUserQuestion实现的交互式配置向导。中立地展示工作类别,让用户将每个类别归类为鼓励/禁止,然后解决冲突。

Arguments

参数

  • --clear
    : Clear existing guidance before starting (fresh config)
  • --clear
    : 启动前清除现有引导配置(全新配置)

Step 1: Work Area Selection

步骤1:工作区域选择

Present ALL work categories neutrally. Let user select which ones they want to configure:
yaml
questions:
  - question: "Which work areas do you want to configure? (Select all relevant)"
    header: "Work Areas"
    multiSelect: true
    options:
      - label: "Bug fixes"
        description: "Fix errors, exceptions, crashes"
      - label: "Feature completion"
        description: "Finish incomplete features"
      - label: "Performance"
        description: "Speed, memory, efficiency"
      - label: "Error handling"
        description: "Edge cases, validation"
      - label: "Security"
        description: "Vulnerability fixes, auth improvements"
      - label: "Documentation"
        description: "README, docstrings, comments"
      - label: "Dependency upgrades"
        description: "Version bumps, lock files"
      - label: "Code formatting"
        description: "Linting, style changes"
      - label: "Test expansion"
        description: "Adding tests for existing code"
      - label: "Refactoring"
        description: "Code restructuring, DRY improvements"
      - label: "API changes"
        description: "Endpoints, contracts, interfaces"
      - label: "Database changes"
        description: "Schema, migrations, queries"
中立地展示所有工作类别,让用户选择想要配置的项:
yaml
questions:
  - question: "Which work areas do you want to configure? (Select all relevant)"
    header: "Work Areas"
    multiSelect: true
    options:
      - label: "Bug fixes"
        description: "Fix errors, exceptions, crashes"
      - label: "Feature completion"
        description: "Finish incomplete features"
      - label: "Performance"
        description: "Speed, memory, efficiency"
      - label: "Error handling"
        description: "Edge cases, validation"
      - label: "Security"
        description: "Vulnerability fixes, auth improvements"
      - label: "Documentation"
        description: "README, docstrings, comments"
      - label: "Dependency upgrades"
        description: "Version bumps, lock files"
      - label: "Code formatting"
        description: "Linting, style changes"
      - label: "Test expansion"
        description: "Adding tests for existing code"
      - label: "Refactoring"
        description: "Code restructuring, DRY improvements"
      - label: "API changes"
        description: "Endpoints, contracts, interfaces"
      - label: "Database changes"
        description: "Schema, migrations, queries"

Step 2: Classify Each Selection

步骤2:为每个选中项分类

For EACH item selected in Step 1, ask whether to Encourage or Forbid:
yaml
questions:
  - question: "For '[ITEM]': Should RU prioritize or avoid this?"
    header: "Classify"
    multiSelect: false
    options:
      - label: "Encourage (Prioritize)"
        description: "RU should actively seek this type of work"
      - label: "Forbid (Avoid)"
        description: "RU should not work on this unless necessary"
      - label: "Skip (No preference)"
        description: "Leave neutral, neither prioritize nor avoid"
Repeat for each selected item. Track which items are classified as:
  • Encouraged: Add to
    guidance.encouraged[]
  • Forbidden: Add to
    guidance.forbidden[]
  • Skipped: Do not add to either list
对步骤1中选中的每一项,询问是鼓励还是禁止:
yaml
questions:
  - question: "For '[ITEM]': Should RU prioritize or avoid this?"
    header: "Classify"
    multiSelect: false
    options:
      - label: "Encourage (Prioritize)"
        description: "RU should actively seek this type of work"
      - label: "Forbid (Avoid)"
        description: "RU should not work on this unless necessary"
      - label: "Skip (No preference)"
        description: "Leave neutral, neither prioritize nor avoid"
为每个选中项重复上述流程。将项按分类记录:
  • 鼓励项: 添加到
    guidance.encouraged[]
  • 禁止项: 添加到
    guidance.forbidden[]
  • 跳过项: 不添加到任何列表

Step 3: Custom Items

步骤3:自定义项

Ask if user wants to add custom items not in the predefined list:
yaml
questions:
  - question: "Do you want to add custom work areas?"
    header: "Custom"
    multiSelect: false
    options:
      - label: "No, use selected items only"
        description: "Proceed with the items already configured"
      - label: "Yes, add custom items"
        description: "I'll type specific topics to configure"
If user selects "Yes", prompt for text input, then ask for each custom item:
  • "Encourage or Forbid '[custom item]'?"
询问用户是否要添加预定义列表外的自定义项:
yaml
questions:
  - question: "Do you want to add custom work areas?"
    header: "Custom"
    multiSelect: false
    options:
      - label: "No, use selected items only"
        description: "Proceed with the items already configured"
      - label: "Yes, add custom items"
        description: "I'll type specific topics to configure"
如果用户选择“是”,提示用户输入文本,然后为每个自定义项询问:
  • "Encourage or Forbid '[custom item]'?"

Step 4: Conflict Detection

步骤4:冲突检测

After all classification, check for conflicts (same item in both encouraged AND forbidden lists).
Conflicts can occur if:
  • User accidentally selected same item in both categories
  • Custom item duplicates a predefined category
If conflicts detected:
yaml
questions:
  - question: "'[ITEM]' is marked both Encouraged AND Forbidden. Which takes priority?"
    header: "Conflict"
    multiSelect: false
    options:
      - label: "Encourage wins"
        description: "Prioritize this work, remove from forbidden"
      - label: "Forbid wins"
        description: "Avoid this work, remove from encouraged"
      - label: "Remove both"
        description: "Leave neutral, no guidance for this item"
Repeat for each conflict until all are resolved.
所有分类完成后,检查冲突(同一项同时出现在鼓励和禁止列表中)。
可能出现冲突的场景:
  • 用户意外将同一项分到两个分类
  • 自定义项与预定义类别重复
如果检测到冲突:
yaml
questions:
  - question: "'[ITEM]' is marked both Encouraged AND Forbidden. Which takes priority?"
    header: "Conflict"
    multiSelect: false
    options:
      - label: "Encourage wins"
        description: "Prioritize this work, remove from forbidden"
      - label: "Forbid wins"
        description: "Avoid this work, remove from encouraged"
      - label: "Remove both"
        description: "Leave neutral, no guidance for this item"
为每个冲突重复上述流程直到全部解决。

Step 5: Save Configuration

步骤5:保存配置

After collecting and validating all selections, run this script to save:
bash
/usr/bin/env bash << 'RU_CONFIGURE_SAVE'
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}"
CONFIG_FILE="$PROJECT_DIR/.claude/ru-config.json"
收集并验证所有选择后,运行以下脚本保存:
bash
/usr/bin/env bash << 'RU_CONFIGURE_SAVE'
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}"
CONFIG_FILE="$PROJECT_DIR/.claude/ru-config.json"

Ensure config file exists with guidance structure

Ensure config file exists with guidance structure

mkdir -p "$PROJECT_DIR/.claude" if [[ ! -f "$CONFIG_FILE" ]]; then echo '{"guidance": {"forbidden": [], "encouraged": []}}' > "$CONFIG_FILE" fi
mkdir -p "$PROJECT_DIR/.claude" if [[ ! -f "$CONFIG_FILE" ]]; then echo '{"guidance": {"forbidden": [], "encouraged": []}}' > "$CONFIG_FILE" fi

Ensure guidance structure exists

Ensure guidance structure exists

if ! jq -e '.guidance' "$CONFIG_FILE" >/dev/null 2>&1; then jq '. + {guidance: {forbidden: [], encouraged: []}}' "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE" fi
echo "Configuration saved to: $CONFIG_FILE" echo "" echo "Current guidance:" echo " Forbidden: $(jq -r '.guidance.forbidden | length' "$CONFIG_FILE") items" echo " Encouraged: $(jq -r '.guidance.encouraged | length' "$CONFIG_FILE") items" echo "" jq -r '.guidance.forbidden[]' "$CONFIG_FILE" 2>/dev/null | while read item; do echo " ✗ FORBID: $item" done jq -r '.guidance.encouraged[]' "$CONFIG_FILE" 2>/dev/null | while read item; do echo " ✓ ENCOURAGE: $item" done echo "" echo "To view: /ru:config show" echo "To modify: /ru:forbid or /ru:encourage" RU_CONFIGURE_SAVE
undefined
if ! jq -e '.guidance' "$CONFIG_FILE" >/dev/null 2>&1; then jq '. + {guidance: {forbidden: [], encouraged: []}}' "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE" fi
echo "Configuration saved to: $CONFIG_FILE" echo "" echo "Current guidance:" echo " Forbidden: $(jq -r '.guidance.forbidden | length' "$CONFIG_FILE") items" echo " Encouraged: $(jq -r '.guidance.encouraged | length' "$CONFIG_FILE") items" echo "" jq -r '.guidance.forbidden[]' "$CONFIG_FILE" 2>/dev/null | while read item; do echo " ✗ FORBID: $item" done jq -r '.guidance.encouraged[]' "$CONFIG_FILE" 2>/dev/null | while read item; do echo " ✓ ENCOURAGE: $item" done echo "" echo "To view: /ru:config show" echo "To modify: /ru:forbid or /ru:encourage" RU_CONFIGURE_SAVE
undefined

Flow Summary

流程摘要

┌─────────────────────────────────────────────────────────────┐
│  Step 1: Work Area Selection (neutral, multiSelect)         │
│  [ ] Bug fixes    [ ] Features     [ ] Performance          │
│  [ ] Docs         [ ] Deps         [ ] Formatting           │
│  [ ] Tests        [ ] Security     [ ] Refactoring          │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│  Step 2: Classify Each (for each selected item)             │
│  "For 'Bug fixes': Encourage / Forbid / Skip?"              │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│  Step 3: Custom Items (optional)                            │
│  "Add custom work areas?" → If yes, classify each           │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│  Step 4: Conflict Resolution (if any)                       │
│  "'X' is both Encouraged AND Forbidden. Which wins?"        │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│  Step 5: Save config + Display summary                      │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│  步骤1:工作区域选择(中立,可多选)                          │
│  [ ] Bug修复    [ ] 功能开发     [ ] 性能优化                  │
│  [ ] 文档        [ ] 依赖升级     [ ] 代码格式化               │
│  [ ] 测试        [ ] 安全         [ ] 代码重构                  │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│  步骤2:为每个选中项分类                                     │
│  "对于 'Bug修复':鼓励 / 禁止 / 跳过?"                        │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│  步骤3:自定义项(可选)                                      │
│  "是否添加自定义工作区域?" → 是则为每个自定义项分类           │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│  步骤4:冲突解决(如有)                                      │
│  "'X' 同时被标记为鼓励和禁止,以哪个为准?"                    │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│  步骤5:保存配置 + 展示摘要                                  │
└─────────────────────────────────────────────────────────────┘

Adding Items Helper

添加项助手

Use this bash snippet to add items from AskUserQuestion selections:
bash
/usr/bin/env bash << 'ADD_GUIDANCE_ITEM'
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}"
CONFIG_FILE="$PROJECT_DIR/.claude/ru-config.json"
TYPE="${1:-forbidden}"  # "forbidden" or "encouraged"
ITEM="${2:-}"           # Item to add

if [[ -z "$ITEM" ]]; then
    exit 0
fi
使用以下bash片段从AskUserQuestion选择中添加项:
bash
/usr/bin/env bash << 'ADD_GUIDANCE_ITEM'
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}"
CONFIG_FILE="$PROJECT_DIR/.claude/ru-config.json"
TYPE="${1:-forbidden}"  # "forbidden" or "encouraged"
ITEM="${2:-}"           # Item to add

if [[ -z "$ITEM" ]]; then
    exit 0
fi

Ensure file exists

Ensure file exists

mkdir -p "$PROJECT_DIR/.claude" if [[ ! -f "$CONFIG_FILE" ]]; then echo '{"guidance": {"forbidden": [], "encouraged": []}}' > "$CONFIG_FILE" fi
mkdir -p "$PROJECT_DIR/.claude" if [[ ! -f "$CONFIG_FILE" ]]; then echo '{"guidance": {"forbidden": [], "encouraged": []}}' > "$CONFIG_FILE" fi

Add item with timestamp

Add item with timestamp

TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ) jq --arg item "$ITEM" --arg ts "$TIMESTAMP"
".guidance.${TYPE} = ((.guidance.${TYPE} // []) + [$item] | unique) | .guidance.timestamp = $ts"
"$CONFIG_FILE" > "$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE" ADD_GUIDANCE_ITEM
undefined
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ) jq --arg item "$ITEM" --arg ts "$TIMESTAMP"
".guidance.${TYPE} = ((.guidance.${TYPE} // []) + [$item] | unique) | .guidance.timestamp = $ts"
"$CONFIG_FILE" > "$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE" ADD_GUIDANCE_ITEM
undefined

Clear Guidance Helper

清除引导助手

Use with
--clear
argument to reset before wizard:
bash
/usr/bin/env bash << 'CLEAR_GUIDANCE'
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}"
CONFIG_FILE="$PROJECT_DIR/.claude/ru-config.json"

if [[ -f "$CONFIG_FILE" ]]; then
    TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
    jq --arg ts "$TIMESTAMP" \
        '.guidance = {forbidden: [], encouraged: [], timestamp: $ts}' \
        "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
    echo "Guidance cleared."
fi
CLEAR_GUIDANCE
--clear
参数配合使用,在向导启动前重置配置:
bash
/usr/bin/env bash << 'CLEAR_GUIDANCE'
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(pwd)}"
CONFIG_FILE="$PROJECT_DIR/.claude/ru-config.json"

if [[ -f "$CONFIG_FILE" ]]; then
    TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
    jq --arg ts "$TIMESTAMP" \
        '.guidance = {forbidden: [], encouraged: [], timestamp: $ts}' \
        "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
    echo "Guidance cleared."
fi
CLEAR_GUIDANCE

Troubleshooting

故障排查

IssueCauseSolution
jq errorConfig file malformedRun
/ru:config reset
to recreate
No options appearingAskUserQuestion issueCheck that multiSelect is set
Config not saved.claude dir missingCreate with
mkdir -p .claude
Conflicts not shownSame item different caseUse exact same text for items
Custom input emptySkipped text promptRe-run wizard and enter items
问题原因解决方案
jq错误配置文件格式错误运行
/ru:config reset
重建
无选项展示AskUserQuestion异常检查是否设置了multiSelect参数
配置未保存.claude目录不存在执行
mkdir -p .claude
创建目录
冲突未展示同一项目大小写不同对所有项使用完全一致的文本
自定义输入为空跳过了文本输入提示重新运行向导并输入内容