ccg-ros2-workflow 2.2.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +211 -96
- package/README.zh-CN.md +256 -0
- package/dist/cli.mjs +15 -15
- package/dist/index.d.mts +61 -34
- package/dist/index.d.ts +61 -34
- package/dist/index.mjs +4 -4
- package/dist/shared/ccg-ros2-workflow.Bhm8c7P1.mjs +5154 -0
- package/package.json +31 -12
- package/templates/codex/AGENTS.md +348 -0
- package/templates/codex/agents/ccg-implement.toml +73 -0
- package/templates/codex/agents/ccg-research.toml +73 -0
- package/templates/codex/agents/ccg-review.toml +82 -0
- package/templates/codex/config.toml +21 -0
- package/templates/codex/hooks/ccg-workflow.py +253 -0
- package/templates/codex/hooks.json +15 -0
- package/templates/commands/agents/planner.md +97 -122
- package/templates/commands/agents/system-integrator.md +2 -2
- package/templates/commands/agents/team-architect.md +97 -0
- package/templates/commands/agents/team-qa.md +121 -0
- package/templates/commands/agents/team-reviewer.md +112 -0
- package/templates/commands/commit.md +30 -1
- package/templates/commands/context.md +332 -0
- package/templates/commands/go.md +206 -0
- package/templates/commands/init.md +1 -1
- package/templates/commands/spec-impl.md +41 -21
- package/templates/commands/spec-init.md +21 -27
- package/templates/commands/spec-plan.md +54 -21
- package/templates/commands/spec-research.md +78 -26
- package/templates/commands/spec-review.md +20 -16
- package/templates/{commands → commands-legacy}/analyze.md +1 -1
- package/templates/commands-legacy/backend.md +224 -0
- package/templates/commands-legacy/codex-exec.md +411 -0
- package/templates/{commands → commands-legacy}/debug.md +1 -1
- package/templates/commands-legacy/enhance.md +55 -0
- package/templates/{commands → commands-legacy}/feat.md +2 -2
- package/templates/commands-legacy/frontend.md +213 -0
- package/templates/{commands → commands-legacy}/optimize.md +1 -1
- package/templates/{commands → commands-legacy}/plan.md +1 -15
- package/templates/{commands → commands-legacy}/team-plan.md +1 -1
- package/templates/commands-legacy/team.md +475 -0
- package/templates/{commands → commands-legacy}/test.md +1 -1
- package/templates/commands-legacy/workflow.md +283 -0
- package/templates/engine/model-router.md +123 -0
- package/templates/engine/phase-guide.md +207 -0
- package/templates/engine/strategies/debug-investigate.md +169 -0
- package/templates/engine/strategies/deep-research.md +141 -0
- package/templates/engine/strategies/direct-fix.md +108 -0
- package/templates/engine/strategies/full-collaborate.md +389 -0
- package/templates/engine/strategies/git-action.md +43 -0
- package/templates/engine/strategies/guided-develop.md +282 -0
- package/templates/engine/strategies/optimize-measure.md +103 -0
- package/templates/engine/strategies/quick-implement.md +96 -0
- package/templates/engine/strategies/refactor-safely.md +180 -0
- package/templates/engine/strategies/review-audit.md +123 -0
- package/templates/hooks/session-start.js +100 -0
- package/templates/hooks/skill-router.js +144 -0
- package/templates/hooks/subagent-context.js +161 -0
- package/templates/hooks/task-utils.js +190 -0
- package/templates/hooks/workflow-state.js +55 -0
- package/templates/output-styles/abyss-command.md +56 -0
- package/templates/output-styles/abyss-concise.md +89 -0
- package/templates/output-styles/abyss-ritual.md +70 -0
- package/templates/output-styles/engineer-professional.md +20 -3
- package/templates/output-styles/laowang-engineer.md +2 -2
- package/templates/prompts/antigravity/analyzer.md +59 -0
- package/templates/prompts/antigravity/architect.md +55 -0
- package/templates/prompts/antigravity/builder.md +52 -0
- package/templates/prompts/antigravity/debugger.md +48 -0
- package/templates/prompts/antigravity/frontend.md +50 -0
- package/templates/prompts/antigravity/optimizer.md +40 -0
- package/templates/prompts/antigravity/reviewer.md +67 -0
- package/templates/prompts/antigravity/tester.md +39 -0
- package/templates/prompts/claude/debugger.md +1 -1
- package/templates/prompts/claude/reviewer.md +1 -1
- package/templates/prompts/codex/analyzer.md +8 -0
- package/templates/prompts/codex/architect.md +9 -1
- package/templates/prompts/codex/builder.md +61 -0
- package/templates/prompts/codex/debugger.md +9 -1
- package/templates/prompts/codex/optimizer.md +7 -0
- package/templates/prompts/codex/reviewer.md +7 -0
- package/templates/prompts/codex/tester.md +8 -1
- package/templates/prompts/gemini/analyzer.md +11 -3
- package/templates/prompts/gemini/architect.md +10 -2
- package/templates/prompts/gemini/debugger.md +8 -0
- package/templates/prompts/gemini/frontend.md +10 -2
- package/templates/prompts/gemini/optimizer.md +9 -2
- package/templates/prompts/gemini/reviewer.md +7 -0
- package/templates/prompts/gemini/tester.md +8 -1
- package/templates/rules/ccg-skill-routing.md +91 -0
- package/templates/rules/ccg-skills.md +65 -0
- package/templates/skills/SKILL.md +92 -0
- package/templates/skills/domains/ai/SKILL.md +34 -0
- package/templates/skills/domains/ai/agent-dev.md +242 -0
- package/templates/skills/domains/ai/llm-security.md +288 -0
- package/templates/skills/domains/ai/prompt-and-eval.md +279 -0
- package/templates/skills/domains/ai/rag-system.md +542 -0
- package/templates/skills/domains/architecture/SKILL.md +42 -0
- package/templates/skills/domains/architecture/api-design.md +225 -0
- package/templates/skills/domains/architecture/caching.md +299 -0
- package/templates/skills/domains/architecture/cloud-native.md +285 -0
- package/templates/skills/domains/architecture/message-queue.md +329 -0
- package/templates/skills/domains/architecture/security-arch.md +297 -0
- package/templates/skills/domains/data-engineering/SKILL.md +207 -0
- package/templates/skills/domains/development/SKILL.md +46 -0
- package/templates/skills/domains/development/cpp.md +369 -0
- package/templates/skills/domains/development/go.md +323 -0
- package/templates/skills/domains/development/java.md +277 -0
- package/templates/skills/domains/development/python.md +487 -0
- package/templates/skills/domains/development/rust.md +313 -0
- package/templates/skills/domains/development/shell.md +313 -0
- package/templates/skills/domains/development/typescript.md +277 -0
- package/templates/skills/domains/devops/SKILL.md +39 -0
- package/templates/skills/domains/devops/cost-optimization.md +272 -0
- package/templates/skills/domains/devops/database.md +217 -0
- package/templates/skills/domains/devops/devsecops.md +198 -0
- package/templates/skills/domains/devops/git-workflow.md +181 -0
- package/templates/skills/domains/devops/observability.md +280 -0
- package/templates/skills/domains/devops/performance.md +336 -0
- package/templates/skills/domains/devops/testing.md +283 -0
- package/templates/skills/domains/infrastructure/SKILL.md +200 -0
- package/templates/skills/domains/mobile/SKILL.md +224 -0
- package/templates/skills/domains/orchestration/SKILL.md +29 -0
- package/templates/skills/domains/orchestration/multi-agent.md +263 -0
- package/templates/skills/domains/ros2-control/SKILL.md +206 -0
- package/templates/skills/domains/ros2-hardware/SKILL.md +277 -0
- package/templates/skills/domains/ros2-manipulation/SKILL.md +237 -0
- package/templates/skills/domains/ros2-navigation/SKILL.md +196 -0
- package/templates/skills/domains/ros2-perception/SKILL.md +166 -0
- package/templates/skills/domains/ros2-upper-app/SKILL.md +50 -0
- package/templates/skills/domains/ros2-upper-app/launch-files.md +224 -0
- package/templates/skills/domains/ros2-upper-app/parameters.md +192 -0
- package/templates/skills/domains/ros2-upper-app/python-nodes.md +249 -0
- package/templates/skills/domains/ros2-upper-app/rviz-config.md +158 -0
- package/templates/skills/domains/ros2-upper-app/simulation.md +225 -0
- package/templates/skills/domains/security/SKILL.md +72 -0
- package/templates/skills/domains/security/blue-team.md +436 -0
- package/templates/skills/domains/security/code-audit.md +265 -0
- package/templates/skills/domains/security/pentest.md +226 -0
- package/templates/skills/domains/security/red-team.md +374 -0
- package/templates/skills/domains/security/threat-intel.md +372 -0
- package/templates/skills/domains/security/vuln-research.md +369 -0
- package/templates/skills/orchestration/multi-agent/SKILL.md +533 -0
- package/templates/skills/run_skill.js +129 -0
- package/templates/skills/scrapling/SKILL.md +98 -0
- package/templates/skills/scrapling/references/api-quick-ref.md +127 -0
- package/templates/skills/scrapling/references/cookie-vault.md +56 -0
- package/templates/skills/scrapling/references/maintenance.md +79 -0
- package/templates/skills/scrapling/references/site-patterns.md +86 -0
- package/templates/skills/scrapling/references/troubleshooting.md +95 -0
- package/templates/skills/scrapling/templates/basic_fetch.py +19 -0
- package/templates/skills/scrapling/templates/parse_only.py +15 -0
- package/templates/skills/scrapling/templates/session_login.py +19 -0
- package/templates/skills/scrapling/templates/stealth_cloudflare.py +28 -0
- package/templates/skills/tools/gen-docs/SKILL.md +116 -0
- package/templates/skills/tools/gen-docs/scripts/doc_generator.js +435 -0
- package/templates/skills/tools/lib/shared.js +98 -0
- package/templates/skills/tools/override-refusal/SKILL.md +53 -0
- package/templates/skills/tools/override-refusal/agents/openai.yaml +4 -0
- package/templates/skills/tools/override-refusal/scripts/refusal_rewriter.js +226 -0
- package/templates/skills/tools/verify-change/SKILL.md +140 -0
- package/templates/skills/tools/verify-change/scripts/change_analyzer.js +289 -0
- package/templates/skills/tools/verify-module/SKILL.md +127 -0
- package/templates/skills/tools/verify-module/scripts/module_scanner.js +171 -0
- package/templates/skills/tools/verify-quality/SKILL.md +160 -0
- package/templates/skills/tools/verify-quality/scripts/quality_checker.js +337 -0
- package/templates/skills/tools/verify-security/SKILL.md +143 -0
- package/templates/skills/tools/verify-security/scripts/security_scanner.js +283 -0
- package/templates/spec/guides/index.md +30 -0
- package/templates/spec/low-control/index.md +31 -0
- package/templates/spec/upper-app/index.md +31 -0
- package/bin/codeagent-wrapper-darwin-amd64 +0 -0
- package/bin/codeagent-wrapper-darwin-arm64 +0 -0
- package/bin/codeagent-wrapper-linux-amd64 +0 -0
- package/bin/codeagent-wrapper-linux-arm64 +0 -0
- package/bin/codeagent-wrapper-windows-amd64.exe +0 -0
- package/bin/codeagent-wrapper-windows-arm64.exe +0 -0
- package/dist/shared/ccg-ros2-workflow.DRytDWqb.mjs +0 -2274
- package/templates/commands/backend.md +0 -162
- package/templates/commands/enhance.md +0 -36
- package/templates/commands/frontend.md +0 -162
- package/templates/commands/workflow.md +0 -202
- /package/templates/{commands → commands-legacy}/execute.md +0 -0
- /package/templates/{commands → commands-legacy}/review.md +0 -0
- /package/templates/{commands → commands-legacy}/team-exec.md +0 -0
- /package/templates/{commands → commands-legacy}/team-research.md +0 -0
- /package/templates/{commands → commands-legacy}/team-review.md +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Strategy: Debug Investigate — 深度调试
|
|
2
|
+
|
|
3
|
+
> 适用于原因不明的复杂 bug,需要多模型并行诊断和交叉验证。
|
|
4
|
+
|
|
5
|
+
## 适用条件
|
|
6
|
+
- 复杂度 M 或以上
|
|
7
|
+
- 错误原因不明确
|
|
8
|
+
- 需要多角度诊断
|
|
9
|
+
|
|
10
|
+
## 前置加载
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
Read("~/.claude/.ccg/engine/model-router.md")
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 工作流状态机
|
|
19
|
+
|
|
20
|
+
[phase-state:1-collect]
|
|
21
|
+
当前阶段:信息收集
|
|
22
|
+
📍 Next: 收集完错误信息后启动双模型诊断
|
|
23
|
+
[/phase-state:1-collect]
|
|
24
|
+
|
|
25
|
+
[phase-state:2-diagnose]
|
|
26
|
+
当前阶段:双模型并行诊断
|
|
27
|
+
Gate: 错误信息已收集 ✓
|
|
28
|
+
📍 Next: 双模型诊断返回后进入交叉验证
|
|
29
|
+
[/phase-state:2-diagnose]
|
|
30
|
+
|
|
31
|
+
[phase-state:3-validate]
|
|
32
|
+
当前阶段:交叉验证
|
|
33
|
+
Gate: 双模型诊断已返回 ✓
|
|
34
|
+
📍 Next: 假设排序后请用户确认修复方向
|
|
35
|
+
[/phase-state:3-validate]
|
|
36
|
+
|
|
37
|
+
[phase-state:4-confirm]
|
|
38
|
+
当前阶段:用户确认(HARD STOP)
|
|
39
|
+
Gate: 假设已排序 ✓
|
|
40
|
+
📍 Next: 用户确认后进入修复
|
|
41
|
+
[/phase-state:4-confirm]
|
|
42
|
+
|
|
43
|
+
[phase-state:5-fix]
|
|
44
|
+
当前阶段:修复与验证
|
|
45
|
+
Gate: 用户已确认修复方向 ✓
|
|
46
|
+
📍 Next: 修复完成后报告结果
|
|
47
|
+
[/phase-state:5-fix]
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 阶段详情
|
|
52
|
+
|
|
53
|
+
### Phase 1: 信息收集 [required]
|
|
54
|
+
|
|
55
|
+
**Task 更新**:`currentPhase → "1-collect"`, `nextAction → "收集错误信息"`
|
|
56
|
+
|
|
57
|
+
1. 收集错误上下文:
|
|
58
|
+
- 错误消息 / 堆栈跟踪
|
|
59
|
+
- 复现步骤(如果有)
|
|
60
|
+
- 最近的相关变更(`git log --oneline -10`)
|
|
61
|
+
- 环境信息(如相关)
|
|
62
|
+
|
|
63
|
+
2. 搜索相关代码(Grep/MCP)
|
|
64
|
+
3. 读取可能相关的文件
|
|
65
|
+
|
|
66
|
+
### Phase 2: 双模型并行诊断 [required]
|
|
67
|
+
|
|
68
|
+
**Gate check**: 错误信息已收集
|
|
69
|
+
|
|
70
|
+
**并行调用**(`run_in_background: true`):
|
|
71
|
+
- **backend 模型**:debugger 角色
|
|
72
|
+
```
|
|
73
|
+
<TASK>
|
|
74
|
+
需求:诊断以下问题
|
|
75
|
+
上下文:[错误信息、堆栈、相关代码]
|
|
76
|
+
</TASK>
|
|
77
|
+
OUTPUT: 诊断假设(按可能性排序,每个假设含:根因分析、证据、修复建议)
|
|
78
|
+
```
|
|
79
|
+
- **frontend 模型**:debugger 角色(相同格式)
|
|
80
|
+
|
|
81
|
+
等待双模型返回。
|
|
82
|
+
|
|
83
|
+
**Task 更新**:`currentPhase → "2-diagnose"`, `nextAction → "等待双模型诊断返回"`
|
|
84
|
+
|
|
85
|
+
### Phase 3: 交叉验证
|
|
86
|
+
|
|
87
|
+
**Gate check**: 双模型诊断已返回
|
|
88
|
+
|
|
89
|
+
1. 对比两个模型的诊断结果
|
|
90
|
+
2. 找出共识点(两个模型都指出的问题 → 高可信度)
|
|
91
|
+
3. 找出分歧点(只有一个模型指出 → 需要验证)
|
|
92
|
+
4. 综合排序所有假设:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
🔍 诊断结果
|
|
96
|
+
|
|
97
|
+
### 高可信度假设(双模型共识)
|
|
98
|
+
1. [假设] — [证据]
|
|
99
|
+
修复方案: [具体方案]
|
|
100
|
+
|
|
101
|
+
### 待验证假设(单模型提出)
|
|
102
|
+
2. [假设] — [来源模型] — [证据]
|
|
103
|
+
修复方案: [具体方案]
|
|
104
|
+
|
|
105
|
+
### 已排除
|
|
106
|
+
- [假设] — [排除理由]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Phase 4: 用户确认 [required · HARD STOP]
|
|
110
|
+
|
|
111
|
+
**Gate check**: 假设已排序
|
|
112
|
+
|
|
113
|
+
展示诊断结果,请用户选择修复方向:
|
|
114
|
+
- 按假设 1 修复
|
|
115
|
+
- 按假设 2 修复
|
|
116
|
+
- 需要更多调查
|
|
117
|
+
- 其他方向
|
|
118
|
+
|
|
119
|
+
**Task 更新**:
|
|
120
|
+
```
|
|
121
|
+
更新 task.json:
|
|
122
|
+
currentPhase → "4-confirm"
|
|
123
|
+
gate → "user_approval_required"
|
|
124
|
+
nextAction → "等待用户确认修复方向"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**必须等待用户明确确认**,不可自动选择。
|
|
128
|
+
|
|
129
|
+
用户确认后:`task.json: gate → null, currentPhase → "5-fix"`
|
|
130
|
+
|
|
131
|
+
### Phase 5: 修复与验证
|
|
132
|
+
|
|
133
|
+
**Gate check**: 用户已确认
|
|
134
|
+
|
|
135
|
+
1. 按确认的方向应用修复
|
|
136
|
+
2. 运行测试验证
|
|
137
|
+
3. 如果修复无效 → 回退,尝试下一个假设,或返回 Phase 4 重新确认
|
|
138
|
+
4. 输出结果:
|
|
139
|
+
```
|
|
140
|
+
✅ 调试完成
|
|
141
|
+
根因: [确认的根因]
|
|
142
|
+
修复: [应用的修复]
|
|
143
|
+
验证: [测试结果]
|
|
144
|
+
📍 Next: /ccg commit 提交修复
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### Spec Evolution(归档前必须执行)
|
|
148
|
+
|
|
149
|
+
参考 `phase-guide.md § 8 Spec Evolution Protocol` 执行:
|
|
150
|
+
1. 分析本次调试的根因和修复方案,提炼可复用的调试经验和防御性编码约定
|
|
151
|
+
2. 如有值得记录的经验(特别是非显而易见的坑)→ 草拟 Spec 条目,展示给用户确认后追加到 `.ccg/spec/{domain}/index.md`
|
|
152
|
+
3. 无值得提炼的经验 → 跳过
|
|
153
|
+
|
|
154
|
+
**Task 更新**:`status → "archived"`
|
|
155
|
+
|
|
156
|
+
**归档任务**:
|
|
157
|
+
```bash
|
|
158
|
+
mkdir -p .ccg/tasks/archive/$(date +%Y-%m) && mv .ccg/tasks/{task-name} .ccg/tasks/archive/$(date +%Y-%m)/
|
|
159
|
+
git add .ccg/tasks/ && git commit -m "chore: archive ccg task"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 铁律
|
|
165
|
+
|
|
166
|
+
- **Phase 4 是 HARD STOP** — 不可自动决定修复方向
|
|
167
|
+
- **双模型诊断必须并行** — 独立诊断才有交叉验证价值
|
|
168
|
+
- **修复前必须有诊断** — 不可跳过 Phase 2-3 直接改代码
|
|
169
|
+
- **修复无效时必须回退** — 不可在错误方向上继续深入
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Strategy: Deep Research — 深度研究
|
|
2
|
+
|
|
3
|
+
> 适用于技术方案研究、对比分析。多模型并行探索,结构化输出。
|
|
4
|
+
|
|
5
|
+
## 适用条件
|
|
6
|
+
- 用户提出研究/分析/对比类问题
|
|
7
|
+
- 不涉及代码修改(纯研究)
|
|
8
|
+
- 任何复杂度级别
|
|
9
|
+
|
|
10
|
+
## 前置加载
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
Read("~/.claude/.ccg/engine/model-router.md")
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 工作流状态机
|
|
19
|
+
|
|
20
|
+
[phase-state:1-clarify]
|
|
21
|
+
当前阶段:明确研究问题
|
|
22
|
+
📍 Next: 问题明确后启动多模型探索
|
|
23
|
+
[/phase-state:1-clarify]
|
|
24
|
+
|
|
25
|
+
[phase-state:2-explore]
|
|
26
|
+
当前阶段:多模型并行探索
|
|
27
|
+
Gate: 研究问题已明确 ✓
|
|
28
|
+
📍 Next: 双模型结果返回后进入综合
|
|
29
|
+
[/phase-state:2-explore]
|
|
30
|
+
|
|
31
|
+
[phase-state:3-synthesize]
|
|
32
|
+
当前阶段:综合分析
|
|
33
|
+
Gate: 双模型探索已返回 ✓
|
|
34
|
+
📍 Next: 输出结构化报告后进入讨论
|
|
35
|
+
[/phase-state:3-synthesize]
|
|
36
|
+
|
|
37
|
+
[phase-state:4-discuss]
|
|
38
|
+
当前阶段:交互式讨论
|
|
39
|
+
📍 Next: 用户满意后结束
|
|
40
|
+
[/phase-state:4-discuss]
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 阶段详情
|
|
45
|
+
|
|
46
|
+
### Phase 1: 明确问题 [required]
|
|
47
|
+
|
|
48
|
+
1. 解析用户的研究意图:
|
|
49
|
+
- 要研究什么?
|
|
50
|
+
- 研究目的是什么?(做决策?了解现状?评估可行性?)
|
|
51
|
+
- 有什么约束或偏好?
|
|
52
|
+
|
|
53
|
+
2. 如果问题太宽泛,先收窄:
|
|
54
|
+
```
|
|
55
|
+
📋 研究范围
|
|
56
|
+
问题: [明确的研究问题]
|
|
57
|
+
目的: [决策/了解/评估]
|
|
58
|
+
约束: [时间/技术/资源约束]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Phase 2: 多模型并行探索 [required]
|
|
62
|
+
|
|
63
|
+
**Task 更新**:`currentPhase → "2-explore"`, `nextAction → "双模型并行探索"`
|
|
64
|
+
|
|
65
|
+
**并行调用**(`run_in_background: true`):
|
|
66
|
+
- **backend 模型**:analyzer 角色
|
|
67
|
+
```
|
|
68
|
+
<TASK>
|
|
69
|
+
需求:研究分析 [问题]
|
|
70
|
+
上下文:[项目上下文、技术栈、约束]
|
|
71
|
+
</TASK>
|
|
72
|
+
OUTPUT: 技术分析报告(可行性、架构选项、风险、成本估算)
|
|
73
|
+
```
|
|
74
|
+
- **frontend 模型**:analyzer 角色
|
|
75
|
+
```
|
|
76
|
+
<TASK>
|
|
77
|
+
需求:研究分析 [问题]
|
|
78
|
+
上下文:[项目上下文、用户场景、约束]
|
|
79
|
+
</TASK>
|
|
80
|
+
OUTPUT: 用户/体验视角分析(UX 影响、用户流程、设计选项)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
等待双模型返回。
|
|
84
|
+
|
|
85
|
+
### Phase 3: 综合分析
|
|
86
|
+
|
|
87
|
+
**Gate check**: 双模型探索已返回
|
|
88
|
+
|
|
89
|
+
交叉对比双方视角。
|
|
90
|
+
|
|
91
|
+
**持久化研究成果**(如有任务目录):
|
|
92
|
+
- 将双模型原始分析写入 `.ccg/tasks/{task-name}/research/backend-analysis.md`
|
|
93
|
+
- 将双模型原始分析写入 `.ccg/tasks/{task-name}/research/frontend-analysis.md`
|
|
94
|
+
|
|
95
|
+
输出结构化报告:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
📋 研究报告: [主题]
|
|
99
|
+
|
|
100
|
+
## 选项对比
|
|
101
|
+
|
|
102
|
+
| 维度 | 方案 A | 方案 B | 方案 C |
|
|
103
|
+
|------|--------|--------|--------|
|
|
104
|
+
| 概述 | ... | ... | ... |
|
|
105
|
+
| 优势 | ... | ... | ... |
|
|
106
|
+
| 劣势 | ... | ... | ... |
|
|
107
|
+
| 复杂度 | S/M/L | S/M/L | S/M/L |
|
|
108
|
+
| 风险 | low/mid/high | ... | ... |
|
|
109
|
+
| 预估工期 | ... | ... | ... |
|
|
110
|
+
|
|
111
|
+
## 推荐
|
|
112
|
+
|
|
113
|
+
**推荐方案 [X]**
|
|
114
|
+
理由:[简明理由]
|
|
115
|
+
|
|
116
|
+
## 注意事项
|
|
117
|
+
- [关键风险或注意点]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Phase 4: 交互式讨论
|
|
121
|
+
|
|
122
|
+
用户可以:
|
|
123
|
+
- 追问某个方案的细节
|
|
124
|
+
- 要求更深入分析某个方面
|
|
125
|
+
- 要求 POC / 原型验证
|
|
126
|
+
- 确认结论并结束
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
📍 研究已完成。如需实施推荐方案,可以用 /ccg:go implement [方案描述]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Task 更新**(如有):`status → "completed"`, `nextAction → "研究完成,可实施推荐方案"`
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 铁律
|
|
137
|
+
|
|
138
|
+
- **纯研究模式,不做代码修改** — 除非用户明确要求 POC
|
|
139
|
+
- **结果必须结构化输出** — 表格对比,不是自由聊天
|
|
140
|
+
- **必须给出推荐** — 不可只列选项不做判断
|
|
141
|
+
- **双模型探索必须并行** — 独立视角更有价值
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Strategy: Direct Fix — 直接修复
|
|
2
|
+
|
|
3
|
+
> 适用于范围清晰、单文件的简单 bug 修复。Claude 独立完成,不调用外部模型。
|
|
4
|
+
|
|
5
|
+
## 适用条件
|
|
6
|
+
- 复杂度 S(单文件,<30 行变更)
|
|
7
|
+
- 错误信息或复现路径明确
|
|
8
|
+
- 风险 low 或 medium
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 工作流状态机
|
|
13
|
+
|
|
14
|
+
[phase-state:1-locate]
|
|
15
|
+
当前阶段:定位问题代码
|
|
16
|
+
Gate: 项目上下文已获取 ✓(由 /ccg Phase 1 完成)
|
|
17
|
+
📍 Next: 找到问题代码后进入诊断阶段
|
|
18
|
+
[/phase-state:1-locate]
|
|
19
|
+
|
|
20
|
+
[phase-state:2-diagnose]
|
|
21
|
+
当前阶段:诊断根因
|
|
22
|
+
Gate: 已找到相关代码 ✓
|
|
23
|
+
📍 Next: 确定根因后进入修复阶段
|
|
24
|
+
[/phase-state:2-diagnose]
|
|
25
|
+
|
|
26
|
+
[phase-state:3-fix]
|
|
27
|
+
当前阶段:应用修复
|
|
28
|
+
Gate: 根因已确定 ✓
|
|
29
|
+
📍 Next: 修复完成后进入验证阶段
|
|
30
|
+
[/phase-state:3-fix]
|
|
31
|
+
|
|
32
|
+
[phase-state:4-verify]
|
|
33
|
+
当前阶段:验证修复
|
|
34
|
+
Gate: 修复已应用 ✓
|
|
35
|
+
📍 Next: 验证通过后报告结果,建议提交
|
|
36
|
+
[/phase-state:4-verify]
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 阶段详情
|
|
41
|
+
|
|
42
|
+
### Phase 1: 定位 [required]
|
|
43
|
+
|
|
44
|
+
1. 从用户描述中提取关键信息:
|
|
45
|
+
- 错误消息(如果有)
|
|
46
|
+
- 发生位置(文件、功能、页面)
|
|
47
|
+
- 复现步骤
|
|
48
|
+
|
|
49
|
+
2. 搜索相关代码:
|
|
50
|
+
- 有错误消息 → `Grep` 搜索错误文本
|
|
51
|
+
- 有文件/函数名 → 直接 `Read` 目标文件
|
|
52
|
+
- 信息不足 → 用 MCP 搜索工具或 `Grep` 按关键词搜索
|
|
53
|
+
|
|
54
|
+
3. 读取找到的代码文件,理解上下文
|
|
55
|
+
|
|
56
|
+
### Phase 2: 诊断 [required]
|
|
57
|
+
|
|
58
|
+
1. 分析代码逻辑,找到 bug 的根因
|
|
59
|
+
2. 如果有多个可能原因,按可能性排序
|
|
60
|
+
3. 简要说明诊断结果:
|
|
61
|
+
```
|
|
62
|
+
🔍 诊断
|
|
63
|
+
文件: [path:line]
|
|
64
|
+
根因: [一句话说明]
|
|
65
|
+
修复方案: [一句话说明]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Phase 3: 修复
|
|
69
|
+
|
|
70
|
+
1. 应用最小修复(只改必要的部分)
|
|
71
|
+
2. 如果项目有测试 → 运行相关测试
|
|
72
|
+
3. 如果没有测试 → 建议但不强制添加
|
|
73
|
+
|
|
74
|
+
### Phase 4: 验证
|
|
75
|
+
|
|
76
|
+
1. `git diff` 展示变更
|
|
77
|
+
2. 确认修复合理性:
|
|
78
|
+
- 变更范围是否最小?
|
|
79
|
+
- 是否引入新问题?
|
|
80
|
+
- 边界条件是否考虑?
|
|
81
|
+
3. 如果修复涉及认证/输入处理/安全相关代码 → `/verify-security` 安全扫描
|
|
82
|
+
4. 输出结果:
|
|
83
|
+
```
|
|
84
|
+
✅ 修复完成
|
|
85
|
+
变更: [N] 文件,[M] 行
|
|
86
|
+
根因: [简述]
|
|
87
|
+
修复: [简述]
|
|
88
|
+
📍 Next: 可以用 /ccg:commit 提交
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 升级规则
|
|
94
|
+
|
|
95
|
+
如果在 Phase 1-2 中发现以下情况,建议升级:
|
|
96
|
+
- 涉及 3+ 文件 → 升级到 `guided-develop`
|
|
97
|
+
- 原因不明,需要深度调试 → 升级到 `debug-investigate`
|
|
98
|
+
- 涉及架构问题 → 升级到 `refactor-safely`
|
|
99
|
+
|
|
100
|
+
告知用户并等待确认后切换策略。
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 铁律
|
|
105
|
+
|
|
106
|
+
- **不可在未读代码的情况下猜测修复方案** — Phase 1 必须实际读取代码
|
|
107
|
+
- **最小修复原则** — 只改导致 bug 的部分,不做"顺手重构"
|
|
108
|
+
- **不可跳过诊断直接改代码** — 即使"一眼看出问题",也要经过 Phase 2 确认根因
|