@kunlv/atdc 1.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/AGENTS.md +58 -0
- package/GO.md +245 -0
- package/bin/add-command.py +144 -0
- package/bin/atdc.js +460 -0
- package/bin/cls.js +98 -0
- package/central/link.sh +60 -0
- package/central/ticket_center_server/.handoffs/TASK-238389_QYinVipLimit.md +128 -0
- package/central/ticket_center_server/.test_plans/TASK-227254-SupportMembership-self-test-plan.md +566 -0
- package/central/ticket_center_server/.test_plans/task-238389-qyin-vip-limit-self-test-plan.md +210 -0
- package/commands/claude/atd.md +3 -0
- package/commands/claude/atdc/1-spec.md +5 -0
- package/commands/claude/atdc/1-update.md +5 -0
- package/commands/claude/atdc/2-qa.md +3 -0
- package/commands/claude/atdc/3-impl-skip-spec.md +5 -0
- package/commands/claude/atdc/3-impl.md +3 -0
- package/commands/claude/atdc/4-verify.md +3 -0
- package/commands/claude/atdc/5-done.md +3 -0
- package/commands/claude/atdc/add-command.md +4 -0
- package/commands/claude/atdc/add-to-hc.md +3 -0
- package/commands/claude/atdc/analysis-cls-log.md +4 -0
- package/commands/claude/atdc/article.md +6 -0
- package/commands/claude/atdc/bugfix.md +4 -0
- package/commands/claude/atdc/code-simplifier.md +8 -0
- package/commands/claude/atdc/commit.md +4 -0
- package/commands/claude/atdc/compound.md +5 -0
- package/commands/claude/atdc/context.md +3 -0
- package/commands/claude/atdc/diagnose.md +8 -0
- package/commands/claude/atdc/git-guardrails.md +18 -0
- package/commands/claude/atdc/grill-with-docs.md +8 -0
- package/commands/claude/atdc/handoff.md +8 -0
- package/commands/claude/atdc/health.md +3 -0
- package/commands/claude/atdc/learn.md +4 -0
- package/commands/claude/atdc/review.md +10 -0
- package/commands/claude/atdc/search.md +4 -0
- package/commands/claude/atdc/strategy.md +3 -0
- package/commands/claude/atdc/table2xlsx.md +4 -0
- package/commands/claude/atdc/test-plan.md +5 -0
- package/commands/claude/atdc/travel-planner.md +4 -0
- package/commands/claude/atdc/xlsx2sql-insert.md +4 -0
- package/commands/claude/atdc/xlsx2sql-update.md +4 -0
- package/commands/claude/atdc/zoom-out.md +8 -0
- package/commands/codex/atdc/SKILL.md +8 -0
- package/commands/codex/atdc-1-spec/SKILL.md +8 -0
- package/commands/codex/atdc-1-update/SKILL.md +8 -0
- package/commands/codex/atdc-2-qa/SKILL.md +8 -0
- package/commands/codex/atdc-3-impl/SKILL.md +8 -0
- package/commands/codex/atdc-3-impl-skip-spec/SKILL.md +8 -0
- package/commands/codex/atdc-4-verify/SKILL.md +8 -0
- package/commands/codex/atdc-5-done/SKILL.md +8 -0
- package/commands/codex/atdc-add-command/SKILL.md +7 -0
- package/commands/codex/atdc-add-to-hc/SKILL.md +8 -0
- package/commands/codex/atdc-analysis-cls-log/SKILL.md +5 -0
- package/commands/codex/atdc-article/SKILL.md +8 -0
- package/commands/codex/atdc-bugfix/SKILL.md +5 -0
- package/commands/codex/atdc-code-simplifier/SKILL.md +7 -0
- package/commands/codex/atdc-commit/SKILL.md +7 -0
- package/commands/codex/atdc-compound/SKILL.md +8 -0
- package/commands/codex/atdc-context/SKILL.md +8 -0
- package/commands/codex/atdc-diagnose/SKILL.md +9 -0
- package/commands/codex/atdc-git-guardrails/SKILL.md +19 -0
- package/commands/codex/atdc-grill-with-docs/SKILL.md +9 -0
- package/commands/codex/atdc-handoff/SKILL.md +9 -0
- package/commands/codex/atdc-health/SKILL.md +8 -0
- package/commands/codex/atdc-learn/SKILL.md +7 -0
- package/commands/codex/atdc-review/SKILL.md +49 -0
- package/commands/codex/atdc-search/SKILL.md +5 -0
- package/commands/codex/atdc-strategy/SKILL.md +8 -0
- package/commands/codex/atdc-table2xlsx/SKILL.md +8 -0
- package/commands/codex/atdc-test-plan/SKILL.md +13 -0
- package/commands/codex/atdc-travel-planner/SKILL.md +7 -0
- package/commands/codex/atdc-xlsx2sql-insert/SKILL.md +8 -0
- package/commands/codex/atdc-xlsx2sql-update/SKILL.md +8 -0
- package/commands/codex/atdc-zoom-out/SKILL.md +9 -0
- package/commands/cursor/atdc/SKILL.md +8 -0
- package/commands/cursor/atdc-1-spec/SKILL.md +8 -0
- package/commands/cursor/atdc-1-update/SKILL.md +8 -0
- package/commands/cursor/atdc-2-qa/SKILL.md +8 -0
- package/commands/cursor/atdc-3-impl/SKILL.md +8 -0
- package/commands/cursor/atdc-3-impl-skip-spec/SKILL.md +8 -0
- package/commands/cursor/atdc-4-verify/SKILL.md +8 -0
- package/commands/cursor/atdc-5-done/SKILL.md +8 -0
- package/commands/cursor/atdc-add-command/SKILL.md +7 -0
- package/commands/cursor/atdc-add-to-hc/SKILL.md +8 -0
- package/commands/cursor/atdc-analysis-cls-log/SKILL.md +5 -0
- package/commands/cursor/atdc-article/SKILL.md +8 -0
- package/commands/cursor/atdc-bugfix/SKILL.md +5 -0
- package/commands/cursor/atdc-code-simplifier/SKILL.md +7 -0
- package/commands/cursor/atdc-commit/SKILL.md +7 -0
- package/commands/cursor/atdc-compound/SKILL.md +8 -0
- package/commands/cursor/atdc-context/SKILL.md +8 -0
- package/commands/cursor/atdc-diagnose/SKILL.md +8 -0
- package/commands/cursor/atdc-git-guardrails/SKILL.md +18 -0
- package/commands/cursor/atdc-grill-with-docs/SKILL.md +8 -0
- package/commands/cursor/atdc-handoff/SKILL.md +8 -0
- package/commands/cursor/atdc-health/SKILL.md +8 -0
- package/commands/cursor/atdc-learn/SKILL.md +7 -0
- package/commands/cursor/atdc-review/SKILL.md +49 -0
- package/commands/cursor/atdc-search/SKILL.md +5 -0
- package/commands/cursor/atdc-strategy/SKILL.md +8 -0
- package/commands/cursor/atdc-table2xlsx/SKILL.md +8 -0
- package/commands/cursor/atdc-test-plan/SKILL.md +7 -0
- package/commands/cursor/atdc-travel-planner/SKILL.md +7 -0
- package/commands/cursor/atdc-xlsx2sql-insert/SKILL.md +8 -0
- package/commands/cursor/atdc-xlsx2sql-update/SKILL.md +8 -0
- package/commands/cursor/atdc-zoom-out/SKILL.md +8 -0
- package/commands/opencode/atd.md +6 -0
- package/commands/opencode/atdc/1-spec.md +8 -0
- package/commands/opencode/atdc/1-update.md +8 -0
- package/commands/opencode/atdc/2-qa.md +6 -0
- package/commands/opencode/atdc/3-impl-skip-spec.md +8 -0
- package/commands/opencode/atdc/3-impl.md +6 -0
- package/commands/opencode/atdc/4-verify.md +6 -0
- package/commands/opencode/atdc/5-done.md +6 -0
- package/commands/opencode/atdc/add-command.md +6 -0
- package/commands/opencode/atdc/add-to-hc.md +6 -0
- package/commands/opencode/atdc/analysis-cls-log.md +6 -0
- package/commands/opencode/atdc/article.md +6 -0
- package/commands/opencode/atdc/bugfix.md +6 -0
- package/commands/opencode/atdc/code-simplifier.md +8 -0
- package/commands/opencode/atdc/commit.md +6 -0
- package/commands/opencode/atdc/compound.md +8 -0
- package/commands/opencode/atdc/context.md +6 -0
- package/commands/opencode/atdc/diagnose.md +8 -0
- package/commands/opencode/atdc/git-guardrails.md +18 -0
- package/commands/opencode/atdc/grill-with-docs.md +8 -0
- package/commands/opencode/atdc/handoff.md +8 -0
- package/commands/opencode/atdc/health.md +6 -0
- package/commands/opencode/atdc/learn.md +6 -0
- package/commands/opencode/atdc/review.md +7 -0
- package/commands/opencode/atdc/search.md +6 -0
- package/commands/opencode/atdc/strategy.md +6 -0
- package/commands/opencode/atdc/table2xlsx.md +6 -0
- package/commands/opencode/atdc/test-plan.md +6 -0
- package/commands/opencode/atdc/travel-planner.md +6 -0
- package/commands/opencode/atdc/xlsx2sql-insert.md +6 -0
- package/commands/opencode/atdc/xlsx2sql-update.md +6 -0
- package/commands/opencode/atdc/zoom-out.md +8 -0
- package/config/cls-defaults.json +19 -0
- package/hooks/atd-archive.sh +86 -0
- package/hooks/atd-state.sh +165 -0
- package/hooks/evidence-hook.sh +88 -0
- package/hooks/evidence-log.sh +54 -0
- package/hooks/guardrails.sh +65 -0
- package/hooks/handoff-compress.sh +104 -0
- package/hooks/phase-guard.sh +134 -0
- package/hooks/phase-write-guard.sh +96 -0
- package/hooks/ponytail-fix.sh +179 -0
- package/hooks/ponytail-guard.sh +66 -0
- package/hooks/ponytail-scan.sh +62 -0
- package/install.sh +276 -0
- package/package.json +20 -0
- package/packages/cls/bin/cls.js +146 -0
- package/packages/cls/config/defaults.json +17 -0
- package/packages/cls/mcp/server.js +142 -0
- package/packages/cls/package.json +29 -0
- package/packages/cls/scripts/postinstall.js +19 -0
- package/packages/cls/src/client.js +262 -0
- package/prompts/1-spec.md +271 -0
- package/prompts/1-update.md +198 -0
- package/prompts/2-qa.md +164 -0
- package/prompts/3-impl-bugfix.md +271 -0
- package/prompts/3-impl.md +419 -0
- package/prompts/4-verify.md +160 -0
- package/prompts/5-done.md +227 -0
- package/prompts/6-article.md +571 -0
- package/prompts/X-add-command.md +60 -0
- package/prompts/X-add-to-hc.md +178 -0
- package/prompts/X-analysis-cls-log.md +68 -0
- package/prompts/X-bugfix.md +10 -0
- package/prompts/X-code-simplifier.md +38 -0
- package/prompts/X-commit.md +116 -0
- package/prompts/X-compound.md +188 -0
- package/prompts/X-context-scan.md +101 -0
- package/prompts/X-diagnose.md +116 -0
- package/prompts/X-grill-with-docs.md +120 -0
- package/prompts/X-handoff.md +80 -0
- package/prompts/X-health.md +78 -0
- package/prompts/X-learn.md +151 -0
- package/prompts/X-review.md +417 -0
- package/prompts/X-search.md +74 -0
- package/prompts/X-strategy.md +95 -0
- package/prompts/X-table2xlsx.md +46 -0
- package/prompts/X-test-plan.md +436 -0
- package/prompts/X-travel-planner.md +22 -0
- package/prompts/X-xlsx2sql-insert.md +34 -0
- package/prompts/X-xlsx2sql-update.md +40 -0
- package/prompts/X-zoom-out.md +119 -0
- package/reference/diagnose-loop.md +66 -0
- package/reference/gates.md +90 -0
- package/reference/git-guardrails.md +71 -0
- package/reference/guards.md +275 -0
- package/reference/learn.md +100 -0
- package/reference/memory.md +190 -0
- package/reference/risk.md +74 -0
- package/reference/tdd.md +40 -0
- package/scripts/svg2png.js +46 -0
- package/src/cls/client.js +244 -0
- package/src/constants.js +49 -0
- package/src/evidence/ai-draft-metrics.js +157 -0
- package/src/evidence/canvas.js +184 -0
- package/src/evidence/index.js +98 -0
- package/src/evidence/sink-events.js +165 -0
- package/src/evidence/stage-timing.js +112 -0
- package/src/installers/claude.js +79 -0
- package/src/installers/codex.js +62 -0
- package/src/installers/opencode.js +72 -0
- package/src/manifest/ponytail-patterns.json +185 -0
- package/src/mcp/cls-mcp-server.js +142 -0
- package/src/utils.js +79 -0
- package/src/validators/state-validate.js +123 -0
- package/templates/.phase-state.json +13 -0
- package/templates/adr.md +62 -0
- package/templates/changelog.md +21 -0
- package/templates/concepts.md +35 -0
- package/templates/design.md +47 -0
- package/templates/handoff.md +64 -0
- package/templates/learn-skill.md +43 -0
- package/templates/progress.json +17 -0
- package/templates/proposal.md +29 -0
- package/templates/solution.md +36 -0
- package/templates/strategy.md +39 -0
- package/templates/tasks.md +41 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# prompts/1-update · 需求变更
|
|
2
|
+
|
|
3
|
+
从此文件读取后,直接开始执行,无需用户再次确认启动。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Step 0:检测目标 change
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ls openspec/changes/ | grep -v archive
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- 无活跃 change → 提示"当前无活跃 change,请先使用 `/atdc:1-spec` 创建需求",停止。
|
|
14
|
+
- 有多个活跃 change → 让用户指定目标 change 名。
|
|
15
|
+
- 有且只有一个 → 自动选中。
|
|
16
|
+
|
|
17
|
+
确认目标 change 路径:`openspec/changes/<name>/`
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Step 1:读取现有文档
|
|
22
|
+
|
|
23
|
+
读取目标 change 的全部文档,理解当前状态:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
CHANGE_NAME="<目标change名>"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
读取以下文件:
|
|
30
|
+
- `openspec/changes/$CHANGE_NAME/proposal.md`
|
|
31
|
+
- `openspec/changes/$CHANGE_NAME/design.md`
|
|
32
|
+
- `openspec/changes/$CHANGE_NAME/tasks.md`
|
|
33
|
+
- `openspec/changes/$CHANGE_NAME/specs/` 下所有 spec.md
|
|
34
|
+
- `openspec/changes/$CHANGE_NAME/.progress.json`(如存在)
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Step 2:检查执行状态
|
|
39
|
+
|
|
40
|
+
根据 `.progress.json` 判断 change 当前阶段:
|
|
41
|
+
|
|
42
|
+
| 状态 | 允许变更 | 处理方式 |
|
|
43
|
+
|------|---------|---------|
|
|
44
|
+
| 未开始执行(无 .progress.json) | 允许 | 直接变更 |
|
|
45
|
+
| 执行中(有 .progress.json) | 需用户确认 | 警告"变更可能影响已完成任务",等用户确认后继续 |
|
|
46
|
+
| 已归档(在 archive/ 下) | 不允许 | 提示"该 change 已归档,请使用 `/atdc:1-spec` 创建新 change" |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Step 3:澄清变更内容
|
|
51
|
+
|
|
52
|
+
用户说明需求变更,AI 逐一确认:
|
|
53
|
+
|
|
54
|
+
1. 变更的具体内容是什么?(新增需求/修改需求/删除需求)
|
|
55
|
+
2. 变更原因?(外部反馈/技术发现/需求偏差/其他)
|
|
56
|
+
3. 变更影响的模块/文件有哪些?
|
|
57
|
+
|
|
58
|
+
AI 对比现有文档,输出变更摘要:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
📋 需求变更摘要:
|
|
62
|
+
|
|
63
|
+
变更内容:<一句话>
|
|
64
|
+
影响文件:
|
|
65
|
+
- proposal.md:<变更说明>
|
|
66
|
+
- design.md:<变更说明>
|
|
67
|
+
- specs/<模块>/spec.md:<变更说明>
|
|
68
|
+
- tasks.md:<变更说明(新增/删除/修改哪些任务)>
|
|
69
|
+
|
|
70
|
+
涉及 Verification Checklist 变更:<是/否>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
等用户确认后执行更新。
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Step 4:判断影响范围 + 精准更新
|
|
78
|
+
|
|
79
|
+
> **💡 省钱提示**:接下来将批量更新 specs/ + tasks.md + changelog.md 等文档,预计输出 3-10K token。
|
|
80
|
+
> 如果当前使用昂贵模型,建议切到便宜模型后再继续。
|
|
81
|
+
>
|
|
82
|
+
> **模式 C(可选)**:如果你决定切模型,现在暂停,用 `/model <便宜模型>` 切换后回复"继续"。
|
|
83
|
+
> 不切模型则直接开始更新。
|
|
84
|
+
|
|
85
|
+
根据变更内容,先判断影响哪些文件,只打开受影响的文件:
|
|
86
|
+
|
|
87
|
+
| 变更类型 | 必更新 | 按需更新 | 跳过 |
|
|
88
|
+
|---------|--------|---------|------|
|
|
89
|
+
| 新增需求 | specs, tasks, checklist | proposal(背景/范围), design(模块/接口) | - |
|
|
90
|
+
| 修改需求 | specs | proposal, design, tasks, checklist | - |
|
|
91
|
+
| 删除需求 | specs, tasks, checklist | proposal(范围), design(模块/接口) | - |
|
|
92
|
+
| 接口变更 | design, specs | tasks, checklist | proposal |
|
|
93
|
+
| 技术方案调整 | design | specs, tasks | proposal |
|
|
94
|
+
| 任务拆分/合并 | tasks, checklist | specs | proposal, design |
|
|
95
|
+
|
|
96
|
+
输出影响判断:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
📋 影响范围:
|
|
100
|
+
|
|
101
|
+
本次变更将更新:
|
|
102
|
+
- [x] proposal.md ← 原因:<说明>
|
|
103
|
+
- [ ] design.md (本次无需更新)
|
|
104
|
+
- [x] specs/ ← 原因:<说明>
|
|
105
|
+
- [x] tasks.md ← 原因:<说明>
|
|
106
|
+
- [x] checklist ← 原因:<说明>
|
|
107
|
+
|
|
108
|
+
确认后开始更新。
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
等用户确认后,只打开勾选的文件,逐一更新。
|
|
112
|
+
|
|
113
|
+
### 各文件更新规则
|
|
114
|
+
|
|
115
|
+
**proposal.md**:
|
|
116
|
+
- **新增需求**:补充背景与目标、追加实施范围
|
|
117
|
+
- **修改需求**:更新技术方案、实施范围
|
|
118
|
+
- **删除需求**:从实施范围中移除
|
|
119
|
+
|
|
120
|
+
**design.md**:
|
|
121
|
+
- **新增需求**:追加模块/接口/数据流
|
|
122
|
+
- **修改需求**:更新接口签名、数据流、ADR
|
|
123
|
+
- **删除需求**:移除对应模块/接口
|
|
124
|
+
|
|
125
|
+
**specs/<模块>/spec.md**:
|
|
126
|
+
- **新增需求**:追加 SHALL/MUST 条目
|
|
127
|
+
- **修改需求**:更新对应条目
|
|
128
|
+
- **删除需求**:移除对应条目,同步删除 tasks.md 中的关联任务
|
|
129
|
+
|
|
130
|
+
**tasks.md**:
|
|
131
|
+
- 新增任务:插入到合适位置,更新 Dependencies
|
|
132
|
+
- 删除任务:移除任务,清理其他任务的 Dependencies 引用
|
|
133
|
+
- 修改任务:更新目标/文件/步骤/验证方式
|
|
134
|
+
- 重新编号(如有删除)
|
|
135
|
+
|
|
136
|
+
**Verification Checklist**:
|
|
137
|
+
重新生成,确保覆盖所有 SHALL/MUST:
|
|
138
|
+
|
|
139
|
+
```markdown
|
|
140
|
+
## Verification Checklist
|
|
141
|
+
|
|
142
|
+
- [ ] 系统 SHALL <需求描述> → Task N
|
|
143
|
+
- [ ] 系统 MUST <需求描述> → Task N
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Step 5:记录 changelog
|
|
149
|
+
|
|
150
|
+
在 `openspec/changes/<name>/changelog.md` 追加一条变更记录:
|
|
151
|
+
|
|
152
|
+
```markdown
|
|
153
|
+
## [YYYY-MM-DD] <变更标题>
|
|
154
|
+
|
|
155
|
+
**类型**:新增 / 修改 / 删除
|
|
156
|
+
**原因**:<变更原因>
|
|
157
|
+
**内容**:<变更描述>
|
|
158
|
+
|
|
159
|
+
**影响文件**:
|
|
160
|
+
- `proposal.md`:<具体变更>
|
|
161
|
+
- `design.md`:<具体变更>
|
|
162
|
+
- `specs/<模块>/spec.md`:<具体变更>
|
|
163
|
+
- `tasks.md`:<具体变更(新增/删除/修改)>
|
|
164
|
+
|
|
165
|
+
**Verification Checklist 变更**:
|
|
166
|
+
- 新增:<条目>
|
|
167
|
+
- 删除:<条目>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Step 6:C1 重新审核暂停
|
|
173
|
+
|
|
174
|
+
更新完成后,重新评估复杂度(同 1-spec Phase 3a),暂停等待 C1 重新审核:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
📋 需求变更完成,等待 C1 重新审核:
|
|
178
|
+
|
|
179
|
+
变更目录:openspec/changes/<name>/
|
|
180
|
+
├── proposal.md 📝 已更新
|
|
181
|
+
├── design.md 📝 已更新
|
|
182
|
+
├── tasks.md 📝 已更新(N 个任务)
|
|
183
|
+
├── changelog.md 📝 已追加
|
|
184
|
+
└── specs/ 📝 已更新(N 个模块)
|
|
185
|
+
|
|
186
|
+
变更摘要:<一句话>
|
|
187
|
+
|
|
188
|
+
审核重点:
|
|
189
|
+
1. 变更后的需求完整、无歧义
|
|
190
|
+
2. 接口变更与现有实现兼容
|
|
191
|
+
3. 新增/删除任务的 Dependencies 正确
|
|
192
|
+
4. Verification Checklist 覆盖所有 SHALL/MUST
|
|
193
|
+
|
|
194
|
+
审核通过后说"执行"或"run",AI 必须读取 `atdc/prompts/3-impl.md` 进入执行阶段,禁止直接写代码。
|
|
195
|
+
如需质疑检验,说"grill"。
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**不得在用户确认前开始写任何代码。**
|
package/prompts/2-qa.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# prompts/2-qa · 规格质疑检验(Grill 模式)
|
|
2
|
+
|
|
3
|
+
从此文件读取后,直接开始执行,无需用户再次确认。
|
|
4
|
+
|
|
5
|
+
可在 C1 审核前后触发,也可通过 `/atdc:grill` 独立触发。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 1:确认当前 change 并读取规格
|
|
10
|
+
|
|
11
|
+
若 `<name>` 未知(独立触发 `/atdc:grill` 时),先执行:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
ls openspec/changes/ | grep -v archive
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
取唯一活跃 change,或有多个时询问用户选择哪一个,再**按需精确读取**(不 cat 全文):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 提取 proposal/design 的关键章节(背景、方案、排除选项)
|
|
21
|
+
grep -A5 "^## 背景\|^## 方案\|^## 排除\|^## 技术方案\|^## Background\|^## Rejected" \
|
|
22
|
+
openspec/changes/<name>/proposal.md openspec/changes/<name>/design.md
|
|
23
|
+
|
|
24
|
+
# 提取 tasks.md 的任务标题 + Files 声明 + Verification Checklist
|
|
25
|
+
grep -E "^### [0-9]+\.|^\*\*Files\*\*|^## Verification|^- \[" \
|
|
26
|
+
openspec/changes/<name>/tasks.md
|
|
27
|
+
|
|
28
|
+
# 提取所有 spec 的 SHALL/MUST 条目
|
|
29
|
+
grep -h "SHALL\|MUST\|Scenario\|Given\|When\|Then" \
|
|
30
|
+
openspec/changes/<name>/specs/*/spec.md
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
> 若上述摘要不足以回答某维度的问题,再用 `sed -n 'N,Mp'` 精确读取对应段落。
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Step 2:生成问题清单(内部,不输出给用户)
|
|
38
|
+
|
|
39
|
+
> **💡 省钱提示**:接下来将逐个追问,预计多轮交互 3-8K token。
|
|
40
|
+
> 如果当前使用昂贵模型,建议切到便宜模型后再继续。
|
|
41
|
+
>
|
|
42
|
+
> **模式 C(可选)**:如果你决定切模型,现在暂停,用 `/model <便宜模型>` 切换后回复"继续"。
|
|
43
|
+
> 不切模型则直接开始。
|
|
44
|
+
|
|
45
|
+
从以下四个维度**内部生成完整问题清单**(不输出),按严重程度排序:
|
|
46
|
+
|
|
47
|
+
**验证优先规则**:如果某个问题可以通过探索代码库验证(如"是否已有类似实现"、"接口是否已存在"、"该表是否有唯一索引"),优先用 CodeGraph 或 grep 查代码找答案。能从代码中确认的事实直接从清单中移除,不问用户。
|
|
48
|
+
|
|
49
|
+
### 2a. 隐性假设
|
|
50
|
+
proposal.md 和 design.md 中没有明说、但实现时必须成立的前提:
|
|
51
|
+
- 依赖的外部服务/接口行为假设
|
|
52
|
+
- 数据格式、字段存在性假设
|
|
53
|
+
- 并发/性能假设
|
|
54
|
+
- 业务规则假设("用户一定已登录"、"该字段一定非空"等)
|
|
55
|
+
|
|
56
|
+
### 2b. 边界与遗漏
|
|
57
|
+
spec.md 中覆盖不足的场景:
|
|
58
|
+
- 有 happy path 但缺对应 sad path
|
|
59
|
+
- 缺边界值(空值/零值/超限/最大值)
|
|
60
|
+
- 并发场景(同一资源同时被多个请求操作)
|
|
61
|
+
- 降级场景(依赖服务不可用时的行为)
|
|
62
|
+
- 权限/鉴权边界
|
|
63
|
+
|
|
64
|
+
### 2c. 技术风险
|
|
65
|
+
design.md 中存在的潜在问题:
|
|
66
|
+
- 引入的新依赖是否稳定
|
|
67
|
+
- 性能瓶颈(N+1 查询、无缓存的高频接口、大事务)
|
|
68
|
+
- 数据一致性风险(跨表操作、缓存与 DB 不同步)
|
|
69
|
+
- 可观测性缺失(无日志、无指标、无报警)
|
|
70
|
+
|
|
71
|
+
### 2d. Task 与 Spec 对齐缺口
|
|
72
|
+
tasks.md 中每个 task 是否都有 spec 需求对应:
|
|
73
|
+
- 有 task 但 spec 没有对应 SHALL/MUST → "野 task"
|
|
74
|
+
- 有 SHALL/MUST 但没有 task 承接 → "漏实现"
|
|
75
|
+
- task 的 Files 声明是否覆盖了所有需要改动的文件
|
|
76
|
+
|
|
77
|
+
### 2e. 受影响流程(Blast Radius 质疑)
|
|
78
|
+
design.md 中声明的"涉及文件"是否覆盖了所有受影响的用户流程:
|
|
79
|
+
|
|
80
|
+
1. 用 `codegraph_impact` 对 design.md 中的关键符号做 1-hop 分析
|
|
81
|
+
2. 识别 blast radius 内是否有 spec 未覆盖的用户流程
|
|
82
|
+
3. 检查:
|
|
83
|
+
- 是否有被间接影响的入口函数(handler / CLI command / 消费者)未在 proposal 中提及
|
|
84
|
+
- 是否有共享依赖被修改但下游调用方未考虑
|
|
85
|
+
- 变更是否影响消息队列消费者、定时任务、Webhook 等异步链路
|
|
86
|
+
|
|
87
|
+
验证优先规则同样适用:能从 CodeGraph 确认的流程直接标记为已验证,不问用户。只把"确实存在但不确定是否需要处理"的流程纳入追问。
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Step 3:逐个追问(grill-me 模式)
|
|
92
|
+
|
|
93
|
+
按严重程度从高到低,**每次只问一个问题**:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
🔍 [维度] <问题>
|
|
97
|
+
|
|
98
|
+
我的判断:<AI 自己的分析和推荐方案>
|
|
99
|
+
|
|
100
|
+
你怎么看?
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
规则:
|
|
104
|
+
- **每个问题附带 AI 推荐方案**:不要只抛问题,给出"如果是我,我会这样处理"的建议
|
|
105
|
+
- **能从代码验证的已经过滤掉了**(Step 2 规则),剩下的是真正需要用户判断的
|
|
106
|
+
- 等用户回答后再问下一个,不得连续追问
|
|
107
|
+
- 用户回答"跳过" → 跳过当前问题,继续下一个
|
|
108
|
+
- 用户回答"够了" → 停止追问,进入 Step 4
|
|
109
|
+
|
|
110
|
+
每得到一个用户回答,记录到内部清单(问题 + 用户决策 + AI 建议)。
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Step 4:输出最终报告
|
|
115
|
+
|
|
116
|
+
所有问题问完或用户说"够了"后,输出总结:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
🔍 Grill 质疑报告 — <change-name>
|
|
120
|
+
|
|
121
|
+
已验证(代码库确认):N 条 → 无需处理
|
|
122
|
+
已追问并决策:N 条
|
|
123
|
+
|
|
124
|
+
### 决策记录
|
|
125
|
+
| # | 维度 | 问题 | 用户决策 | 建议方案 |
|
|
126
|
+
|---|------|------|---------|---------|
|
|
127
|
+
| 1 | 隐性假设 | <问题> | <用户回答摘要> | <AI 推荐> |
|
|
128
|
+
| 2 | 边界遗漏 | <问题> | <用户回答摘要> | <AI 推荐> |
|
|
129
|
+
| ... | | | | |
|
|
130
|
+
|
|
131
|
+
### 需回改规格的项
|
|
132
|
+
- <需要修改 proposal/specs/tasks 的具体项>
|
|
133
|
+
|
|
134
|
+
### 已确认可继续
|
|
135
|
+
- <用户确认无需修改的项>
|
|
136
|
+
|
|
137
|
+
严重问题(需修改规格后才能执行):N 条
|
|
138
|
+
建议优化(可执行但建议跟进):N 条
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Step 5:等待用户决策
|
|
144
|
+
|
|
145
|
+
根据报告内容给出明确建议:
|
|
146
|
+
|
|
147
|
+
- **有严重问题** → 输出:`建议回到规格修改后再执行,说"修改"返回 propose,说"忽略"强制继续。`
|
|
148
|
+
- **仅建议优化** → 输出:`无阻塞问题,可以继续执行。说"执行"或"run"开始实施,说"修改"返回调整规格。`
|
|
149
|
+
- **无问题** → 输出:`规格质量良好,未发现问题。说"执行"或"run"开始实施。`
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Step 6(可选):决策沉淀到项目文档
|
|
154
|
+
|
|
155
|
+
Grill 过程中产生的决策和术语澄清可持久化,供后续 change 复用:
|
|
156
|
+
|
|
157
|
+
> 以上 <N> 条决策 + <N> 条术语澄清是否需要沉淀?
|
|
158
|
+
> - 说 `docs` → 执行沉淀:
|
|
159
|
+
> 1. 术语澄清 → 更新 CONTEXT.md 的「领域词汇表」段
|
|
160
|
+
> 2. 重大决策(涉及技术选型/架构方向/排除方案)→ 生成 ADR
|
|
161
|
+
> 3. 边界场景发现 → 更新 CONTEXT.md 的「已知约束」段
|
|
162
|
+
> - 说 `继续` → 跳过沉淀,直接输出完成提示
|
|
163
|
+
|
|
164
|
+
> **触发条件**:Step 4 报告中「已追问并决策」≥ 1 条时显示;0 条则隐藏。
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# prompts/3-impl-bugfix · Bugfix 快速流程
|
|
2
|
+
|
|
3
|
+
从此文件读取后直接开始执行,无需用户再次确认。
|
|
4
|
+
|
|
5
|
+
> **设计参考**:
|
|
6
|
+
> - [Compound Engineering `/ce-debug`](https://github.com/EveryInc/compound-engineering-plugin):causal chain gate、assumption audit、trivial fast-path、smart escalation
|
|
7
|
+
> - [Matt Pocock `/diagnosing-bugs`](https://github.com/mattpocock/skills):feedback loop first、3-5 ranked hypotheses、post-mortem
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 🔴 Step -1:规则加载
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Read @atdc/reference/guards.md → R2 TDD 约束
|
|
15
|
+
Read @atdc/reference/tdd.md → RED→GREEN→REFACTOR 完整循环
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
> Bugfix 只加载 TDD 相关规则。R5/R6/R8 按需引用。
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Step 0:恢复断点
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cat openspec/changes/<name>/.progress.json 2>/dev/null
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- 存在 → 报告进度,询问"从断点继续 / 从头开始"
|
|
29
|
+
- 不存在 → 创建初始 `.progress.json`
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Step 0.5:区分 hotfix vs bugfix
|
|
34
|
+
|
|
35
|
+
> ⚠️ 如果 `.phase-state.json` 中 `mode=hotfix`,不要用这个 prompt。hotfix 是"紧急热修",可用最简流程。
|
|
36
|
+
> `mode=bugfix` 才是本 prompt 的适用场景:已知 Bug,需要根因分析 + 回归测试。
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Phase 0:Build a Feedback Loop
|
|
41
|
+
|
|
42
|
+
> 目标:构造一个能复现 Bug 的 tight loop。**一条命令,agent-runnable,红色 = Bug 存在,绿色 = 已修复。**
|
|
43
|
+
|
|
44
|
+
### 0a. 判断是否需要完整 loop
|
|
45
|
+
|
|
46
|
+
**Trivial fast-path**:明显 Bug(typo/missing import/null deref/off-by-one/单行修复)→ 跳过 Phase 0-1,直接写 `bug-report.md`(一行描述 + 修复),进 Phase 2。
|
|
47
|
+
|
|
48
|
+
其他情况 → 构造 feedback loop。
|
|
49
|
+
|
|
50
|
+
### 0b. 构造反馈循环
|
|
51
|
+
|
|
52
|
+
按优先级尝试:
|
|
53
|
+
|
|
54
|
+
1. Failing test — 能找到的最小粒度的 test
|
|
55
|
+
2. Curl / HTTP script — 对 dev server 发请求
|
|
56
|
+
3. CLI invocation — 命令行复现
|
|
57
|
+
4. 手动复现步骤 — 前 3 种都构造不出来时才用
|
|
58
|
+
|
|
59
|
+
**完成标准**:
|
|
60
|
+
- 一条命令可以运行(test 命令 / curl / script)
|
|
61
|
+
- 红色 = Bug 存在(能观察到用户描述的症状)
|
|
62
|
+
- 已实际运行过至少一次(输出证据)
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 示例:将 feedback loop 命令写在这里,运行并确认红色
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 0c. 无法构造 loop
|
|
69
|
+
|
|
70
|
+
停止,输出:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
⚠️ 无法构造 feedback loop。请提供:
|
|
74
|
+
(a) 可以复现 Bug 的环境
|
|
75
|
+
(b) 错误日志/堆栈/HAR file
|
|
76
|
+
(c) 手动复现步骤(越详细越好)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Phase 1:Reproduce + Root Cause
|
|
82
|
+
|
|
83
|
+
### 1a. 复现 Bug
|
|
84
|
+
|
|
85
|
+
运行 Phase 0 的 feedback loop,确认红色。
|
|
86
|
+
|
|
87
|
+
### 1b. 最小化
|
|
88
|
+
|
|
89
|
+
缩小复现场景到最小范围——每次去掉一个元素,重跑 loop,确认仍然红色。保留所有 load-bearing 元素。
|
|
90
|
+
|
|
91
|
+
### 1c. Assumption Audit
|
|
92
|
+
|
|
93
|
+
列出你的理解依赖的所有"这必须为真"的信念。每条标记 **verified**(你读过代码/跑过测试/检查过状态)或 **assumed**。
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
| 假设 | 状态 |
|
|
97
|
+
|------|------|
|
|
98
|
+
| <假设1> | verified |
|
|
99
|
+
| <假设2> | assumed |
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 1d. Hypothesise
|
|
103
|
+
|
|
104
|
+
生成 3-5 个可证伪假设,按可能性排序。每个假设格式:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
#N: <可能性> <假设描述>
|
|
108
|
+
Evidence: <支撑证据(具体值/行为/输出)>
|
|
109
|
+
Causal chain: <trigger> → <step1> → ... → <symptom>
|
|
110
|
+
Prediction: 如果这个假设正确,<在X条件/场景下>应该观察到<Y>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 1e. Test Hypotheses
|
|
114
|
+
|
|
115
|
+
从可能性最高的假设开始,一次只验证一个。使用 predication 做区分。
|
|
116
|
+
|
|
117
|
+
### 1f. Causal Chain Gate
|
|
118
|
+
|
|
119
|
+
> 🔴 **因果链闸门**:必须能完整解释从 trigger 到 symptom 的全链路,无缺口。否则禁止进入 Phase 2。
|
|
120
|
+
|
|
121
|
+
### 1g. 写入 bug-report.md
|
|
122
|
+
|
|
123
|
+
将以上分析写入 `bug-report.md`:
|
|
124
|
+
|
|
125
|
+
```markdown
|
|
126
|
+
# bug-report: <简短描述>
|
|
127
|
+
|
|
128
|
+
## 描述
|
|
129
|
+
<Bug 现象、影响>
|
|
130
|
+
|
|
131
|
+
## 复现步骤
|
|
132
|
+
1. <步骤1>
|
|
133
|
+
2. <步骤2>
|
|
134
|
+
|
|
135
|
+
## Feedback Loop
|
|
136
|
+
`<命令>`
|
|
137
|
+
|
|
138
|
+
## 根因分析
|
|
139
|
+
### 因果链
|
|
140
|
+
<trigger> → <step1> → ... → <symptom>
|
|
141
|
+
|
|
142
|
+
### 假设审计
|
|
143
|
+
<assumption audit 表>
|
|
144
|
+
|
|
145
|
+
### 验证过的假设
|
|
146
|
+
<#N 假设 + 结论>
|
|
147
|
+
|
|
148
|
+
## 影响范围
|
|
149
|
+
<涉及模块/用户>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Phase 2:TDD Fix
|
|
155
|
+
|
|
156
|
+
### 2a. 回归测试(RED)
|
|
157
|
+
|
|
158
|
+
先写回归测试,确认 Bug 可复现(基于 Phase 0 的 feedback loop):
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# 运行回归测试,确认 RED
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 2b. 最小修复(GREEN)
|
|
165
|
+
|
|
166
|
+
只改根因,不夹带重构/格式化/无关清理。一处改动 = 一个 fix。
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# 运行回归测试,确认 GREEN
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 2c. REFACTOR
|
|
173
|
+
|
|
174
|
+
清理冗余代码、改进可读性。不改行为。
|
|
175
|
+
|
|
176
|
+
### 2d. Smart Escalation
|
|
177
|
+
|
|
178
|
+
> 修复失败 ≥ 3 次 → 停止盲目重试。诊断为什么失败:
|
|
179
|
+
|
|
180
|
+
| Pattern | Diagnosis | Next |
|
|
181
|
+
|---------|-----------|------|
|
|
182
|
+
| 修复仍红色 | 根因判断错误 | 回到 Phase 1 |
|
|
183
|
+
| 修复通过但新测试失败 | 修复引入新 Bug | 回退,重新分析影响范围 |
|
|
184
|
+
| 修复间歇性通过 | 非确定性 Bug | 提高 feedback loop 复现率 |
|
|
185
|
+
|
|
186
|
+
### 2e. 更新 bug-report.md
|
|
187
|
+
|
|
188
|
+
追加修复信息:
|
|
189
|
+
|
|
190
|
+
```markdown
|
|
191
|
+
## 修复
|
|
192
|
+
<改动内容和理由>
|
|
193
|
+
|
|
194
|
+
## 回归测试
|
|
195
|
+
`<测试命令>` — <结果>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Phase 3:Cleanup + Post-mortem
|
|
201
|
+
|
|
202
|
+
### 3a. 确认修复
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# 重跑 feedback loop — 确认绿色
|
|
206
|
+
# 运行相关测试套件 — 确认无回归
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### 3b. 清理
|
|
210
|
+
|
|
211
|
+
- 删除所有 debug 日志/throwaway 代码
|
|
212
|
+
- 确认只改了修复需要的文件
|
|
213
|
+
|
|
214
|
+
### 3c. Post-mortem
|
|
215
|
+
|
|
216
|
+
写入 `bug-report.md`:
|
|
217
|
+
|
|
218
|
+
```markdown
|
|
219
|
+
## Post-mortem
|
|
220
|
+
|
|
221
|
+
### 什么可以预防这个 Bug?
|
|
222
|
+
<本次修复总结>
|
|
223
|
+
|
|
224
|
+
### 架构改进建议(如有)
|
|
225
|
+
- **问题**:<seam 不足 / 耦合过紧 / 缺少 guard / 缺少测试覆盖>
|
|
226
|
+
- **建议**:<具体的架构改进方向>
|
|
227
|
+
- **优先级**:<建议 / 低 / 中 / 高>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
> 架构建议是参考性的,不作为 MUST 要求。
|
|
231
|
+
|
|
232
|
+
### 3d. 记录 Evidence
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
atdc evidence record <name> task_complete --phase=build --task=bugfix --files="<changed-files>"
|
|
236
|
+
atdc evidence metrics <name> --snapshot
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Phase 4:Handoff
|
|
242
|
+
|
|
243
|
+
### 4a. C3 验证
|
|
244
|
+
|
|
245
|
+
引用 `@atdc/prompts/4-verify.md`,按 Verification Checklist 逐条验证:
|
|
246
|
+
|
|
247
|
+
- Feedback loop 绿色(Bug 不再复现)
|
|
248
|
+
- 回归测试通过
|
|
249
|
+
- 无越界文件变更
|
|
250
|
+
|
|
251
|
+
### 4b. C2 Review + 归档
|
|
252
|
+
|
|
253
|
+
引用 `@atdc/prompts/5-done.md`,执行归档流程。
|
|
254
|
+
|
|
255
|
+
归档前记录最终 evidence:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
atdc evidence record <name> done --phase=archive
|
|
259
|
+
atdc evidence metrics <name> --commit
|
|
260
|
+
atdc evidence canvas <name>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Verification Checklist(由 Agent 从 bug-report.md 提取)
|
|
266
|
+
|
|
267
|
+
- [ ] Feedback loop 绿色(Bug 不再复现)
|
|
268
|
+
- [ ] 回归测试通过
|
|
269
|
+
- [ ] Causal chain 完整无缺口
|
|
270
|
+
- [ ] Post-mortem 已记录
|
|
271
|
+
- [ ] Evidence 事件已记录
|