setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<!--
ADR: 2025-12-05-itp-setup-todowrite-workflow
-->
<!--
ADR: 2025-12-05-itp-setup-todowrite-workflow
-->
ITP Setup
ITP 设置
Verify and install dependencies required by the workflow using TodoWrite-driven interactive workflow.
/itp:go使用TodoWrite驱动的交互式工作流,验证并安装工作流所需的依赖。
/itp:goMANDATORY FIRST ACTION
强制首步操作
YOUR FIRST ACTION MUST BE TodoWrite with the template below.
DO NOT:
- Run any checks before TodoWrite
- Skip the interactive gate
- Install without user confirmation
Execute this TodoWrite template EXACTLY:
TodoWrite with todos:
- "Setup: Detect platform (macOS/Linux)" | pending | "Detecting platform"
- "Setup: Check Core Tools (uv, gh, prettier)" | pending | "Checking Core Tools"
- "Setup: Check ADR Diagram Tools (cpanm, graph-easy)" | pending | "Checking ADR Tools"
- "Setup: Check Code Audit Tools (ruff, semgrep, jscpd, gitleaks)" | pending | "Checking Audit Tools"
- "Setup: Check Release Tools (node, semantic-release)" | pending | "Checking Release Tools"
- "Setup: Present findings and disclaimer" | pending | "Presenting findings"
- "Setup: GATE - Await user decision" | pending | "Awaiting user decision"
- "Setup: Install missing tools (if confirmed)" | pending | "Installing missing tools"
- "Setup: Verify installation" | pending | "Verifying installation"After TodoWrite completes, proceed to Phase 1 below.
你的第一个操作必须是使用下方模板执行TodoWrite。
禁止操作:
- 不要在执行TodoWrite前运行任何检查
- 不要跳过交互式确认关口
- 不要在未获得用户确认的情况下执行安装
请严格执行以下TodoWrite模板:
TodoWrite with todos:
- "Setup: Detect platform (macOS/Linux)" | pending | "Detecting platform"
- "Setup: Check Core Tools (uv, gh, prettier)" | pending | "Checking Core Tools"
- "Setup: Check ADR Diagram Tools (cpanm, graph-easy)" | pending | "Checking ADR Tools"
- "Setup: Check Code Audit Tools (ruff, semgrep, jscpd, gitleaks)" | pending | "Checking Audit Tools"
- "Setup: Check Release Tools (node, semantic-release)" | pending | "Checking Release Tools"
- "Setup: Present findings and disclaimer" | pending | "Presenting findings"
- "Setup: GATE - Await user decision" | pending | "Awaiting user decision"
- "Setup: Install missing tools (if confirmed)" | pending | "Installing missing tools"
- "Setup: Verify installation" | pending | "Verifying installation"TodoWrite执行完成后,继续执行下方的第1阶段。
Phase 1: Preflight Check
第1阶段:预检
Mark each todo as before starting, when done.
in_progresscompleted在开始每个待办项前将其标记为,完成后标记为。
in_progresscompletedTodo 1: Detect Platform
待办1:检测平台
bash
/usr/bin/env bash << 'SETUP_EOF'
PLUGIN_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/itp}"
source "$PLUGIN_DIR/scripts/install-dependencies.sh" --detect-only
SETUP_EOFPlatform detection sets: , (package manager),
OSPMHAS_MISEbash
/usr/bin/env bash << 'SETUP_EOF'
PLUGIN_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/itp}"
source "$PLUGIN_DIR/scripts/install-dependencies.sh" --detect-only
SETUP_EOF平台检测会设置以下变量:、(包管理器)、
OSPMHAS_MISETodo 2: Check Core Tools
待办2:检查核心工具
Check each tool using :
command -v| Tool | Check | Required |
|---|---|---|
| uv | | Yes |
| gh | | Yes |
| prettier | | Yes |
Record findings:
- Found: -> mark completed
[OK] uv (installed) - Missing: -> note for Phase 3
[x] prettier (missing)
使用检查每个工具:
command -v| 工具 | 检查命令 | 是否必填 |
|---|---|---|
| uv | | 是 |
| gh | | 是 |
| prettier | | 是 |
记录检查结果:
- 已安装:-> 标记为完成
[OK] uv (installed) - 缺失:-> 记录到第3阶段
[x] prettier (missing)
Todo 3: Check ADR Diagram Tools
待办3:检查ADR绘图工具
| Tool | Check | Required |
|---|---|---|
| cpanm | | For diagrams |
| graph-easy | | For diagrams |
| 工具 | 检查命令 | 必填场景 |
|---|---|---|
| cpanm | | 绘图功能 |
| graph-easy | | 绘图功能 |
Todo 4: Check Code Audit Tools
待办4:检查代码审计工具
| Tool | Check | Required |
|---|---|---|
| ruff | | For code-audit |
| semgrep | | For code-audit |
| jscpd | | For code-audit |
| gitleaks | | For secret-scan |
| 工具 | 检查命令 | 必填场景 |
|---|---|---|
| ruff | | 代码审计 |
| semgrep | | 代码审计 |
| jscpd | | 代码审计 |
| gitleaks | | 密钥扫描 |
Todo 5: Check Release Tools
待办5:检查发布工具
| Tool | Check | Required |
|---|---|---|
| node | | For release |
| semantic-release | | For release |
| doppler | | For PyPI only |
| 工具 | 检查命令 | 必填场景 |
|---|---|---|
| node | | 发布功能 |
| semantic-release | | 发布功能 |
| doppler | | 仅PyPI发布 |
Phase 2: Present Findings (Interactive Gate)
第2阶段:展示检查结果(交互式确认关口)
Todo 6: Present Findings
待办6:展示检查结果
IMPORTANT: Use mise-first commands when available
When presenting missing tool installation commands:
- If (detected in Todo 1): Show mise commands
HAS_MISE=true - If : Show platform package manager commands (brew/apt)
HAS_MISE=false
Mise command reference (use when HAS_MISE=true):
| Tool | mise command | Notes |
|---|---|---|
| gitleaks | | |
| ruff | | |
| uv | | |
| gh | | NEVER mise (iTerm2 issues) |
| semgrep | | |
| node | | |
| doppler | | |
| prettier | | |
| jscpd | |
Warning: gh CLI must be installed via Homebrew, not mise. mise-installed gh causes iTerm2 tab spawning issues with Claude Code. ADR
Display summary format (versions derived from actual tool output):
=== SETUP PREFLIGHT COMPLETE ===
Found: X tools | Missing: Y tools
Your existing installations:
[OK] uv (<derived from: uv --version>)
[OK] gh (<derived from: gh --version>)
[x] gitleaks (missing)
...
Note: This plugin is developed against latest tool versions.
Your existing installations are respected.
Missing tools will be installed via mise (detected):
gitleaks -> mise use --global gitleaksIf HAS_MISE=false, show platform commands instead:
Missing tools will be installed via brew:
gitleaks -> brew install gitleaksIMPORTANT: Version numbers must be derived dynamically from running the actual tool's version command. Never hardcode version numbers.
重要提示:优先使用可用的mise命令
展示缺失工具的安装命令时:
- 如果(在待办1中检测到):展示mise命令
HAS_MISE=true - 如果:展示对应平台的包管理器命令(brew/apt)
HAS_MISE=false
Mise命令参考(当HAS_MISE=true时使用):
| 工具 | mise命令 | 备注 |
|---|---|---|
| gitleaks | | |
| ruff | | |
| uv | | |
| gh | | 禁止使用mise(存在iTerm2兼容问题) |
| semgrep | | |
| node | | |
| doppler | | |
| prettier | | |
| jscpd | |
警告: gh CLI必须通过Homebrew安装,不能使用mise。通过mise安装的gh会导致Claude Code触发iTerm2标签页无限生成的问题。ADR
展示摘要格式(版本号从实际工具输出生成):
=== 安装预检完成 ===
已找到:X个工具 | 缺失:Y个工具
你已安装的工具:
[OK] uv (<从uv --version命令输出获取>)
[OK] gh (<从gh --version命令输出获取>)
[x] gitleaks (缺失)
...
注意:本插件基于最新版本的工具开发,会保留你现有的安装版本。
缺失的工具将通过检测到的mise安装:
gitleaks -> mise use --global gitleaks如果HAS_MISE=false,请改为展示平台对应命令:
缺失的工具将通过brew安装:
gitleaks -> brew install gitleaks重要提示:版本号必须通过实际运行工具的版本命令动态获取,禁止硬编码版本号。
Todo 7: GATE - Await User Decision
待办7:确认关口 - 等待用户决策
If missing tools exist, STOP and ask user:
Use AskUserQuestion with these options:
question: "Would you like to install the missing tools?"
header: "Install"
options:
- label: "Install missing"
description: "Automatically install all missing tools"
- label: "Skip"
description: "Show manual install commands and exit"IMPORTANT: Do NOT proceed to Phase 3 until user responds.
If ALL tools present: Mark todo completed, skip to "All set!" message, mark todos 8-9 as N/A.
如果存在缺失的工具,请停止流程并询问用户:
使用AskUserQuestion,附带以下选项:
question: "你是否想要安装缺失的工具?"
header: "安装"
options:
- label: "安装缺失项"
description: "自动安装所有缺失的工具"
- label: "跳过"
description: "展示手动安装命令并退出"重要提示:在用户回复前,不要进入第3阶段。
如果所有工具都已安装:标记当前待办为完成,直接跳转到“全部就绪!”提示,将待办8-9标记为不适用(N/A)。
Phase 3: Installation (Conditional)
第3阶段:安装(条件执行)
Todo 8: Install Missing Tools
待办8:安装缺失工具
Only execute if:
- User selected "Install missing"
- OR flag was passed (skip interactive gate)
--install
Run installation commands for missing tools only:
bash
/usr/bin/env bash << 'SETUP_EOF_2'
PLUGIN_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/itp}"
bash "$PLUGIN_DIR/scripts/install-dependencies.sh" --install
SETUP_EOF_2If user selected "Skip":
- Display manual install commands
- Mark todo as skipped
- Exit cleanly
仅在满足以下条件时执行:
- 用户选择了“安装缺失项”
- 或者传入了参数(跳过交互式确认关口)
--install
仅运行缺失工具的安装命令:
bash
/usr/bin/env bash << 'SETUP_EOF_2'
PLUGIN_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/itp}"
bash "$PLUGIN_DIR/scripts/install-dependencies.sh" --install
SETUP_EOF_2如果用户选择了“跳过”:
- 展示手动安装命令
- 将当前待办标记为跳过
- 正常退出流程
Todo 9: Verify Installation
待办9:验证安装
Re-run checks to confirm tools are now available:
bash
/usr/bin/env bash << 'PREFLIGHT_EOF'
PLUGIN_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/itp}"
bash "$PLUGIN_DIR/scripts/install-dependencies.sh" --check
PREFLIGHT_EOFMark todo completed only if verification passes.
重新运行检查确认工具现在可用:
bash
/usr/bin/env bash << 'PREFLIGHT_EOF'
PLUGIN_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/itp}"
bash "$PLUGIN_DIR/scripts/install-dependencies.sh" --check
PREFLIGHT_EOF仅当验证通过时标记当前待办为完成。
Flag Handling
参数处理
| Flag | Behavior |
|---|---|
| (none) | Default: Check -> Gate -> Ask permission |
| Same as default (hidden alias) |
| Check -> Skip gate -> Install automatically |
| Alias for |
Parse for flags:
$ARGUMENTSbash
case "$ARGUMENTS" in
*--install*|*--yes*)
SKIP_GATE=true
;;
*)
SKIP_GATE=false
;;
esac| 参数 | 行为 |
|---|---|
| (无) | 默认:检查 -> 确认关口 -> 征求用户许可 |
| 和默认行为一致(隐藏别名) |
| 检查 -> 跳过确认关口 -> 自动安装 |
| |
解析获取参数:
$ARGUMENTSbash
case "$ARGUMENTS" in
*--install*|*--yes*)
SKIP_GATE=true
;;
*)
SKIP_GATE=false
;;
esacEdge Cases
边界场景处理
| Case | Handling |
|---|---|
| All tools present | Todos 1-6 complete, Todo 7 shows "All set!", Todos 8-9 marked N/A |
| Some missing, user says "install" | Todos 8-9 execute normally |
| Some missing, user says "skip" | Show manual commands, mark todos 8-9 as skipped |
| Skip Todo 7 gate, proceed directly to install |
| macOS vs Linux | Todo 1 detects platform, install commands adapt |
| 场景 | 处理方式 |
|---|---|
| 所有工具已安装 | 待办1-6完成,待办7展示“全部就绪!”,待办8-9标记为不适用 |
| 存在缺失工具,用户选择“安装” | 待办8-9正常执行 |
| 存在缺失工具,用户选择“跳过” | 展示手动安装命令,待办8-9标记为跳过 |
传入 | 跳过后待7的确认关口,直接进入安装流程 |
| macOS vs Linux | 待办1检测平台,安装命令自动适配对应系统 |
Troubleshooting
问题排查
graph-easy fails to install
graph-easy安装失败
bash
undefinedbash
undefinedEnsure cpanminus is installed first
Ensure cpanminus is installed first
brew install cpanminus
brew install cpanminus
Then install Graph::Easy
Then install Graph::Easy
cpanm Graph::Easy
undefinedcpanm Graph::Easy
undefinedsemantic-release not found
semantic-release找不到
bash
undefinedbash
undefinedInstall globally with npm
Install globally with npm
npm i -g semantic-release@25
npm i -g semantic-release@25
Or use npx (no global install needed)
Or use npx (no global install needed)
npx semantic-release --version
undefinednpx semantic-release --version
undefinedPermission errors with npm
npm权限错误
bash
/usr/bin/env bash << 'CONFIG_EOF'bash
/usr/bin/env bash << 'CONFIG_EOF'Fix npm permissions
Fix npm permissions
mkdir -p /.npm-global
npm config set prefix '/.npm-global'
mkdir -p /.npm-global
npm config set prefix '/.npm-global'
Add to your shell config
Add to your shell config
SHELL_RC="$([[ "$SHELL" == */zsh ]] && echo ~/.zshrc || echo /.bashrc)"
echo 'export PATH=/.npm-global/bin:$PATH' >> "$SHELL_RC"
source "$SHELL_RC"
CONFIG_EOF
---SHELL_RC="$([[ "$SHELL" == */zsh ]] && echo ~/.zshrc || echo /.bashrc)"
echo 'export PATH=/.npm-global/bin:$PATH' >> "$SHELL_RC"
source "$SHELL_RC"
CONFIG_EOF
---Next Steps
后续步骤
After setup completes, configure itp-hooks for enhanced workflow guidance:
-
Check hook status:bash
/itp:hooks status -
Install hooks (if not already installed):bash
/itp:hooks install
设置完成后,配置itp-hooks以获得更完善的工作流指引:
-
检查钩子状态:bash
/itp:hooks status -
安装钩子(如果尚未安装):bash
/itp:hooks install
What hooks provide
钩子提供的能力
- PreToolUse guard: Blocks Unicode box-drawing diagrams without source blocks
<details> - PostToolUse reminder: Prompts ADR sync and graph-easy skill usage
IMPORTANT: Hooks require a Claude Code session restart after installation.
- PreToolUse防护:拦截没有源块的Unicode框线图
<details> - PostToolUse提醒:提示ADR同步和graph-easy skill使用
重要提示: 钩子安装后需要重启Claude Code会话才能生效。