specops 0.2.5 → 0.3.2
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/.opencode/agent/specops-codebase-mapper.md +764 -0
- package/.opencode/agent/specops-debugger.md +1246 -0
- package/.opencode/agent/specops-executor.md +475 -0
- package/.opencode/agent/specops-integration-checker.md +443 -0
- package/.opencode/agent/specops-phase-researcher.md +547 -0
- package/.opencode/agent/specops-plan-checker.md +690 -0
- package/.opencode/agent/specops-planner.md +581 -0
- package/.opencode/agent/specops-project-researcher.md +354 -0
- package/.opencode/agent/specops-research-synthesizer.md +242 -0
- package/.opencode/agent/specops-roadmapper.md +642 -0
- package/.opencode/agent/specops-work-verifier.md +573 -0
- package/.opencode/references/checkpoints.md +776 -0
- package/.opencode/references/continuation-format.md +249 -0
- package/.opencode/references/decimal-phase-calculation.md +65 -0
- package/.opencode/references/git-integration.md +248 -0
- package/.opencode/references/git-planning-commit.md +38 -0
- package/.opencode/references/model-profile-resolution.md +34 -0
- package/.opencode/references/model-profiles.md +92 -0
- package/.opencode/references/phase-argument-parsing.md +61 -0
- package/.opencode/references/planning-config.md +196 -0
- package/.opencode/references/questioning.md +145 -0
- package/.opencode/references/tdd.md +263 -0
- package/.opencode/references/ui-brand.md +160 -0
- package/.opencode/references/verification-patterns.md +612 -0
- package/.opencode/templates/DEBUG.md +164 -0
- package/.opencode/templates/UAT.md +180 -0
- package/.opencode/templates/VALIDATION.md +76 -0
- package/.opencode/templates/codebase/architecture.md +255 -0
- package/.opencode/templates/codebase/concerns.md +310 -0
- package/.opencode/templates/codebase/conventions.md +307 -0
- package/.opencode/templates/codebase/integrations.md +280 -0
- package/.opencode/templates/codebase/stack.md +186 -0
- package/.opencode/templates/codebase/structure.md +285 -0
- package/.opencode/templates/codebase/testing.md +480 -0
- package/.opencode/templates/context.md +221 -0
- package/.opencode/templates/continue-here.md +78 -0
- package/.opencode/templates/debug-subagent-prompt.md +91 -0
- package/.opencode/templates/discovery.md +147 -0
- package/.opencode/templates/milestone-archive.md +123 -0
- package/.opencode/templates/milestone.md +115 -0
- package/.opencode/templates/phase-prompt.md +333 -0
- package/.opencode/templates/planner-subagent-prompt.md +117 -0
- package/.opencode/templates/project.md +184 -0
- package/.opencode/templates/requirements.md +130 -0
- package/.opencode/templates/research-project/ARCHITECTURE.md +204 -0
- package/.opencode/templates/research-project/FEATURES.md +147 -0
- package/.opencode/templates/research-project/PITFALLS.md +200 -0
- package/.opencode/templates/research-project/STACK.md +120 -0
- package/.opencode/templates/research-project/SUMMARY.md +170 -0
- package/.opencode/templates/research.md +278 -0
- package/.opencode/templates/retrospective.md +54 -0
- package/.opencode/templates/roadmap.md +202 -0
- package/.opencode/templates/state.md +176 -0
- package/.opencode/templates/summary-complex.md +59 -0
- package/.opencode/templates/summary-minimal.md +41 -0
- package/.opencode/templates/summary-standard.md +48 -0
- package/.opencode/templates/summary.md +248 -0
- package/.opencode/templates/user-setup.md +311 -0
- package/.opencode/templates/verification-report.md +322 -0
- package/.opencode/workflows/add-phase.md +111 -0
- package/.opencode/workflows/add-tests.md +350 -0
- package/.opencode/workflows/add-todo.md +157 -0
- package/.opencode/workflows/audit-milestone.md +297 -0
- package/.opencode/workflows/check-todos.md +176 -0
- package/.opencode/workflows/cleanup.md +152 -0
- package/.opencode/workflows/complete-milestone.md +763 -0
- package/.opencode/workflows/diagnose-issues.md +219 -0
- package/.opencode/workflows/discovery-phase.md +288 -0
- package/.opencode/workflows/discuss-phase.md +542 -0
- package/.opencode/workflows/execute-phase.md +449 -0
- package/.opencode/workflows/execute-plan.md +447 -0
- package/.opencode/workflows/health.md +156 -0
- package/.opencode/workflows/help.md +489 -0
- package/.opencode/workflows/insert-phase.md +129 -0
- package/.opencode/workflows/list-phase-assumptions.md +178 -0
- package/.opencode/workflows/map-codebase.md +315 -0
- package/.opencode/workflows/new-milestone.md +382 -0
- package/.opencode/workflows/new-project.md +1116 -0
- package/.opencode/workflows/pause-work.md +122 -0
- package/.opencode/workflows/plan-milestone-gaps.md +274 -0
- package/.opencode/workflows/plan-phase.md +569 -0
- package/.opencode/workflows/progress.md +381 -0
- package/.opencode/workflows/quick.md +453 -0
- package/.opencode/workflows/remove-phase.md +154 -0
- package/.opencode/workflows/research-phase.md +73 -0
- package/.opencode/workflows/resume-project.md +304 -0
- package/.opencode/workflows/set-profile.md +80 -0
- package/.opencode/workflows/settings.md +213 -0
- package/.opencode/workflows/transition.md +544 -0
- package/.opencode/workflows/update.md +219 -0
- package/.opencode/workflows/verify-phase.md +242 -0
- package/.opencode/workflows/verify-work.md +569 -0
- package/commands/specops/add-phase.md +43 -0
- package/commands/specops/add-tests.md +41 -0
- package/commands/specops/add-todo.md +47 -0
- package/commands/specops/audit-milestone.md +36 -0
- package/commands/specops/check-todos.md +45 -0
- package/commands/specops/cleanup.md +18 -0
- package/commands/specops/complete-milestone.md +136 -0
- package/commands/specops/debug.md +167 -0
- package/commands/specops/discuss-phase.md +83 -0
- package/commands/specops/execute-phase.md +41 -0
- package/commands/specops/health.md +22 -0
- package/commands/specops/help.md +22 -0
- package/commands/specops/insert-phase.md +32 -0
- package/commands/specops/join-discord.md +18 -0
- package/commands/specops/list-phase-assumptions.md +46 -0
- package/commands/specops/map-codebase.md +71 -0
- package/commands/specops/new-milestone.md +44 -0
- package/commands/specops/new-project.md +42 -0
- package/commands/specops/pause-work.md +38 -0
- package/commands/specops/plan-milestone-gaps.md +34 -0
- package/commands/specops/plan-phase.md +45 -0
- package/commands/specops/progress.md +24 -0
- package/commands/specops/quick.md +41 -0
- package/commands/specops/reapply-patches.md +111 -0
- package/commands/specops/remove-phase.md +31 -0
- package/commands/specops/research-phase.md +189 -0
- package/commands/specops/resume-work.md +40 -0
- package/commands/specops/set-profile.md +34 -0
- package/commands/specops/settings.md +36 -0
- package/commands/specops/update.md +37 -0
- package/commands/specops/verify-work.md +38 -0
- package/dist/__integration__/fixtures/generator.d.ts +4 -0
- package/dist/__integration__/fixtures/generator.js +1 -0
- package/dist/__integration__/mocks/server.d.ts +7 -0
- package/dist/__integration__/mocks/server.js +1 -0
- package/dist/__integration__/setup.d.ts +6 -0
- package/dist/__integration__/setup.js +1 -0
- package/dist/acceptance/lazyDetector.js +1 -1
- package/dist/acceptance/reporter.js +1 -1
- package/dist/acceptance/runner.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/promptTemplate.js +1 -1
- package/dist/context/techContextLoader.js +1 -1
- package/dist/engine.d.ts +1 -0
- package/dist/engine.js +1 -1
- package/dist/evolution/distiller.js +1 -1
- package/dist/evolution/index.js +1 -1
- package/dist/evolution/memoryGraph.js +1 -1
- package/dist/evolution/selector.js +1 -1
- package/dist/evolution/signals.js +1 -1
- package/dist/evolution/solidify.js +1 -1
- package/dist/evolution/store.js +1 -1
- package/dist/evolution/types.js +1 -1
- package/dist/init.d.ts +4 -3
- package/dist/init.js +1 -1
- package/dist/machines/agentMachine.js +1 -1
- package/dist/machines/supervisorMachine.js +1 -1
- package/dist/persistence/schema.js +1 -1
- package/dist/persistence/stateFile.js +1 -1
- package/dist/plugin-engine.js +1 -1
- package/dist/plugin.js +1 -1
- package/dist/requirement-analysis/analyzers/repository-parser.d.ts +121 -0
- package/dist/requirement-analysis/analyzers/repository-parser.js +1 -0
- package/dist/requirement-analysis/generators/prd-generator.d.ts +90 -0
- package/dist/requirement-analysis/generators/prd-generator.js +1 -0
- package/dist/requirement-analysis/integrations/v1-integration.d.ts +73 -0
- package/dist/requirement-analysis/integrations/v1-integration.js +1 -0
- package/dist/requirement-analysis/tools/analyze-requirements.js +1 -0
- package/dist/requirement-analysis/types/analysis-result.d.ts +326 -0
- package/dist/requirement-analysis/types/analysis-result.js +1 -0
- package/dist/requirement-analysis/types/feature-mapping.d.ts +294 -0
- package/dist/requirement-analysis/types/feature-mapping.js +1 -0
- package/dist/requirement-analysis/types/index.d.ts +171 -0
- package/dist/requirement-analysis/types/index.js +1 -0
- package/dist/requirement-analysis/types/tech-stack.d.ts +213 -0
- package/dist/requirement-analysis/types/tech-stack.js +1 -0
- package/dist/requirement-analysis/utils/error-handler.d.ts +112 -0
- package/dist/requirement-analysis/utils/error-handler.js +1 -0
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.js +1 -1
- package/dist/utils/id.js +1 -1
- package/package.json +4 -2
- package/skills/competitor-search/SKILL.md +169 -0
- package/skills/demand-analysis/SKILL.md +307 -0
- package/skills/feature-search/SKILL.md +182 -0
- package/skills/requirement-analysis/README.md +464 -0
- package/skills/requirement-analysis/SKILL.md +224 -0
- package/skills/requirement-analysis/templates/feature-mapping-template.json +210 -0
- package/skills/requirement-analysis/templates/prd-template.md +104 -0
- package/skills/tech-selection/SKILL.md +198 -0
- package/dist/__e2e__/01-state-engine.e2e.test.d.ts +0 -10
- package/dist/__e2e__/01-state-engine.e2e.test.js +0 -1
- package/dist/acceptance/lazyDetector.test.d.ts +0 -1
- package/dist/acceptance/lazyDetector.test.js +0 -1
- package/dist/acceptance/reporter.test.d.ts +0 -1
- package/dist/acceptance/reporter.test.js +0 -1
- package/dist/acceptance/runner.test.d.ts +0 -1
- package/dist/acceptance/runner.test.js +0 -1
- package/dist/context/promptTemplate.test.d.ts +0 -1
- package/dist/context/promptTemplate.test.js +0 -1
- package/dist/context/techContextLoader.test.d.ts +0 -1
- package/dist/context/techContextLoader.test.js +0 -1
- package/dist/machines/agentMachine.test.d.ts +0 -1
- package/dist/machines/agentMachine.test.js +0 -1
- package/dist/machines/supervisorMachine.test.d.ts +0 -1
- package/dist/machines/supervisorMachine.test.js +0 -1
- package/dist/persistence/stateFile.test.d.ts +0 -1
- package/dist/persistence/stateFile.test.js +0 -1
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
编排并行调试 Agent 来调查 UAT 缺口并找到根因。
|
|
3
|
+
|
|
4
|
+
UAT 发现缺口后,为每个缺口生成一个调试 Agent。每个 Agent 使用 UAT 预填的症状进行自主调查。收集根因,更新 UAT.md 缺口的诊断信息,然后交接给 plan-phase --gaps 处理实际诊断结果。
|
|
5
|
+
|
|
6
|
+
编排器保持精简:解析缺口、生成 Agent、收集结果、更新 UAT。
|
|
7
|
+
</purpose>
|
|
8
|
+
|
|
9
|
+
<paths>
|
|
10
|
+
DEBUG_DIR=.planning/debug
|
|
11
|
+
|
|
12
|
+
调试文件使用 `.planning/debug/` 路径(带前导点的隐藏目录)。
|
|
13
|
+
</paths>
|
|
14
|
+
|
|
15
|
+
<core_principle>
|
|
16
|
+
**先诊断再规划修复。**
|
|
17
|
+
|
|
18
|
+
UAT 告诉我们什么坏了(症状)。调试 Agent 找出为什么坏了(根因)。plan-phase --gaps 然后基于实际原因创建针对性修复,而不是猜测。
|
|
19
|
+
|
|
20
|
+
没有诊断:"评论不刷新" → 猜测修复 → 可能猜错
|
|
21
|
+
有诊断:"评论不刷新" → "useEffect 缺少依赖" → 精确修复
|
|
22
|
+
</core_principle>
|
|
23
|
+
|
|
24
|
+
<process>
|
|
25
|
+
|
|
26
|
+
<step name="parse_gaps">
|
|
27
|
+
**从 UAT.md 提取缺口:**
|
|
28
|
+
|
|
29
|
+
读取"Gaps"部分(YAML 格式):
|
|
30
|
+
```yaml
|
|
31
|
+
- truth: "Comment appears immediately after submission"
|
|
32
|
+
status: failed
|
|
33
|
+
reason: "User reported: works but doesn't show until I refresh the page"
|
|
34
|
+
severity: major
|
|
35
|
+
test: 2
|
|
36
|
+
artifacts: []
|
|
37
|
+
missing: []
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
对于每个缺口,同时读取"Tests"部分中对应的测试以获取完整上下文。
|
|
41
|
+
|
|
42
|
+
构建缺口列表:
|
|
43
|
+
```
|
|
44
|
+
gaps = [
|
|
45
|
+
{truth: "Comment appears immediately...", severity: "major", test_num: 2, reason: "..."},
|
|
46
|
+
{truth: "Reply button positioned correctly...", severity: "minor", test_num: 5, reason: "..."},
|
|
47
|
+
...
|
|
48
|
+
]
|
|
49
|
+
```
|
|
50
|
+
</step>
|
|
51
|
+
|
|
52
|
+
<step name="report_plan">
|
|
53
|
+
**向用户报告诊断计划:**
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
## 正在诊断 {N} 个缺口
|
|
57
|
+
|
|
58
|
+
生成并行调试 Agent 来调查根因:
|
|
59
|
+
|
|
60
|
+
| 缺口(预期行为) | 严重程度 |
|
|
61
|
+
|-------------------|----------|
|
|
62
|
+
| 提交后评论立即显示 | 重大 |
|
|
63
|
+
| 回复按钮位置正确 | 轻微 |
|
|
64
|
+
| 删除操作移除评论 | 阻塞 |
|
|
65
|
+
|
|
66
|
+
每个 Agent 将:
|
|
67
|
+
1. 创建 DEBUG-{slug}.md 并预填症状
|
|
68
|
+
2. 自主调查(阅读代码、形成假设、测试)
|
|
69
|
+
3. 返回根因
|
|
70
|
+
|
|
71
|
+
这将并行运行——所有缺口同时调查。
|
|
72
|
+
```
|
|
73
|
+
</step>
|
|
74
|
+
|
|
75
|
+
<step name="spawn_agents">
|
|
76
|
+
**并行生成调试 Agent:**
|
|
77
|
+
|
|
78
|
+
对于每个缺口,填充 debug-subagent-prompt 模板并生成:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Task(
|
|
82
|
+
prompt=filled_debug_subagent_prompt + "\n\n<files_to_read>\n- {phase_dir}/{phase_num}-UAT.md\n- .planning/STATE.md\n</files_to_read>",
|
|
83
|
+
subagent_type="general-purpose",
|
|
84
|
+
description="Debug: {truth_short}"
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**所有 Agent 在单条消息中生成**(并行执行)。
|
|
89
|
+
|
|
90
|
+
模板占位符:
|
|
91
|
+
- `{truth}`:失败的预期行为
|
|
92
|
+
- `{expected}`:来自 UAT 测试
|
|
93
|
+
- `{actual}`:来自 reason 字段的用户原始描述
|
|
94
|
+
- `{errors}`:UAT 中的任何错误消息(或"无报告")
|
|
95
|
+
- `{reproduction}`:UAT 中的"测试 {test_num}"
|
|
96
|
+
- `{timeline}`:"在 UAT 期间发现"
|
|
97
|
+
- `{goal}`:`find_root_cause_only`(UAT 流程——plan-phase --gaps 处理修复)
|
|
98
|
+
- `{slug}`:从 truth 生成
|
|
99
|
+
</step>
|
|
100
|
+
|
|
101
|
+
<step name="collect_results">
|
|
102
|
+
**从 Agent 收集根因:**
|
|
103
|
+
|
|
104
|
+
每个 Agent 返回:
|
|
105
|
+
```
|
|
106
|
+
## 已找到根因
|
|
107
|
+
|
|
108
|
+
**调试会话:** ${DEBUG_DIR}/{slug}.md
|
|
109
|
+
|
|
110
|
+
**根因:** {具体原因及证据}
|
|
111
|
+
|
|
112
|
+
**证据摘要:**
|
|
113
|
+
- {关键发现 1}
|
|
114
|
+
- {关键发现 2}
|
|
115
|
+
- {关键发现 3}
|
|
116
|
+
|
|
117
|
+
**涉及文件:**
|
|
118
|
+
- {file1}:{问题所在}
|
|
119
|
+
- {file2}:{相关问题}
|
|
120
|
+
|
|
121
|
+
**建议修复方向:** {给 plan-phase --gaps 的简要提示}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
解析每个返回以提取:
|
|
125
|
+
- root_cause:诊断出的原因
|
|
126
|
+
- files:涉及的文件
|
|
127
|
+
- debug_path:调试会话文件路径
|
|
128
|
+
- suggested_fix:缺口修复计划的提示
|
|
129
|
+
|
|
130
|
+
如果 Agent 返回 `## 调查无定论`:
|
|
131
|
+
- root_cause:"调查无定论——需要人工审查"
|
|
132
|
+
- 记录哪个问题需要人工关注
|
|
133
|
+
- 包含 Agent 返回的剩余可能性
|
|
134
|
+
</step>
|
|
135
|
+
|
|
136
|
+
<step name="update_uat">
|
|
137
|
+
**用诊断信息更新 UAT.md 缺口:**
|
|
138
|
+
|
|
139
|
+
对于 Gaps 部分中的每个缺口,添加 artifacts 和 missing 字段:
|
|
140
|
+
|
|
141
|
+
```yaml
|
|
142
|
+
- truth: "Comment appears immediately after submission"
|
|
143
|
+
status: failed
|
|
144
|
+
reason: "User reported: works but doesn't show until I refresh the page"
|
|
145
|
+
severity: major
|
|
146
|
+
test: 2
|
|
147
|
+
root_cause: "useEffect in CommentList.tsx missing commentCount dependency"
|
|
148
|
+
artifacts:
|
|
149
|
+
- path: "src/components/CommentList.tsx"
|
|
150
|
+
issue: "useEffect missing dependency"
|
|
151
|
+
missing:
|
|
152
|
+
- "Add commentCount to useEffect dependency array"
|
|
153
|
+
- "Trigger re-render when new comment added"
|
|
154
|
+
debug_session: .planning/debug/comment-not-refreshing.md
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
将 frontmatter 中的状态更新为"diagnosed"。
|
|
158
|
+
|
|
159
|
+
提交更新后的 UAT.md:
|
|
160
|
+
```bash
|
|
161
|
+
node .opencode/bin/specops-tools.cjs commit "docs({phase_num}): add root causes from diagnosis" --files ".planning/phases/XX-name/{phase_num}-UAT.md"
|
|
162
|
+
```
|
|
163
|
+
</step>
|
|
164
|
+
|
|
165
|
+
<step name="report_results">
|
|
166
|
+
**报告诊断结果并交接:**
|
|
167
|
+
|
|
168
|
+
显示:
|
|
169
|
+
```
|
|
170
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
171
|
+
SpecOps ► 诊断完成
|
|
172
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
173
|
+
|
|
174
|
+
| 缺口(预期行为) | 根因 | 文件 |
|
|
175
|
+
|-------------------|------|------|
|
|
176
|
+
| 提交后评论立即显示 | useEffect 缺少依赖 | CommentList.tsx |
|
|
177
|
+
| 回复按钮位置正确 | CSS flex 顺序错误 | ReplyButton.tsx |
|
|
178
|
+
| 删除操作移除评论 | API 缺少 auth header | api/comments.ts |
|
|
179
|
+
|
|
180
|
+
调试会话:${DEBUG_DIR}/
|
|
181
|
+
|
|
182
|
+
正在继续规划修复……
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
返回 verify-work 编排器进行自动规划。
|
|
186
|
+
不要提供手动后续步骤——verify-work 处理后续流程。
|
|
187
|
+
</step>
|
|
188
|
+
|
|
189
|
+
</process>
|
|
190
|
+
|
|
191
|
+
<context_efficiency>
|
|
192
|
+
Agent 启动时已从 UAT 预填症状(无需症状收集)。
|
|
193
|
+
Agent 只负责诊断——plan-phase --gaps 处理修复(不应用修复)。
|
|
194
|
+
</context_efficiency>
|
|
195
|
+
|
|
196
|
+
<failure_handling>
|
|
197
|
+
**Agent 未能找到根因:**
|
|
198
|
+
- 将缺口标记为"需要人工审查"
|
|
199
|
+
- 继续处理其他缺口
|
|
200
|
+
- 报告不完整的诊断
|
|
201
|
+
|
|
202
|
+
**Agent 超时:**
|
|
203
|
+
- 检查 DEBUG-{slug}.md 中的部分进展
|
|
204
|
+
- 可以使用 /specops:debug 恢复
|
|
205
|
+
|
|
206
|
+
**所有 Agent 都失败:**
|
|
207
|
+
- 可能是系统性问题(权限、git 等)
|
|
208
|
+
- 报告以供人工调查
|
|
209
|
+
- 回退到不带根因的 plan-phase --gaps(精确度较低)
|
|
210
|
+
</failure_handling>
|
|
211
|
+
|
|
212
|
+
<success_criteria>
|
|
213
|
+
- [ ] 已从 UAT.md 解析缺口
|
|
214
|
+
- [ ] 已并行生成调试 Agent
|
|
215
|
+
- [ ] 已从所有 Agent 收集根因
|
|
216
|
+
- [ ] 已用 artifacts 和 missing 更新 UAT.md 缺口
|
|
217
|
+
- [ ] 调试会话已保存到 ${DEBUG_DIR}/
|
|
218
|
+
- [ ] 已交接给 verify-work 进行自动规划
|
|
219
|
+
</success_criteria>
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
在适当的深度级别执行发现。
|
|
3
|
+
生成 DISCOVERY.md(用于第 2-3 级),为 PLAN.md 的创建提供信息。
|
|
4
|
+
|
|
5
|
+
由 plan-phase.md 的 mandatory_discovery 步骤调用,带有深度参数。
|
|
6
|
+
|
|
7
|
+
注意:如需全面的生态系统研究("专家如何构建这个"),请改用 /specops:research-phase,它会生成 RESEARCH.md。
|
|
8
|
+
</purpose>
|
|
9
|
+
|
|
10
|
+
<depth_levels>
|
|
11
|
+
**此工作流支持三个深度级别:**
|
|
12
|
+
|
|
13
|
+
| 级别 | 名称 | 时间 | 输出 | 适用场景 |
|
|
14
|
+
| ---- | ------------ | --------- | ------------------------------------------ | ----------------------------------------- |
|
|
15
|
+
| 1 | 快速验证 | 2-5 分钟 | 无文件,以验证后的知识继续 | 单个库,确认当前语法 |
|
|
16
|
+
| 2 | 标准 | 15-30 分钟| DISCOVERY.md | 在选项间选择,新的外部集成 |
|
|
17
|
+
| 3 | 深度探索 | 1+ 小时 | 带验证门控的详细 DISCOVERY.md | 架构决策,新颖问题 |
|
|
18
|
+
|
|
19
|
+
**深度由 plan-phase.md 在路由到此处之前确定。**
|
|
20
|
+
</depth_levels>
|
|
21
|
+
|
|
22
|
+
<source_hierarchy>
|
|
23
|
+
**强制要求:Context7 优先于 WebSearch**
|
|
24
|
+
|
|
25
|
+
Claude 的训练数据有 6-18 个月的滞后。始终进行验证。
|
|
26
|
+
|
|
27
|
+
1. **Context7 MCP 优先** - 当前文档,无幻觉
|
|
28
|
+
2. **官方文档** - 当 Context7 覆盖不足时
|
|
29
|
+
3. **WebSearch 最后** - 仅用于比较和趋势
|
|
30
|
+
|
|
31
|
+
参见 .opencode/templates/discovery.md `<discovery_protocol>` 获取完整协议。
|
|
32
|
+
</source_hierarchy>
|
|
33
|
+
|
|
34
|
+
<process>
|
|
35
|
+
|
|
36
|
+
<step name="determine_depth">
|
|
37
|
+
检查从 plan-phase.md 传入的深度参数:
|
|
38
|
+
- `depth=verify` → 第 1 级(快速验证)
|
|
39
|
+
- `depth=standard` → 第 2 级(标准发现)
|
|
40
|
+
- `depth=deep` → 第 3 级(深度探索)
|
|
41
|
+
|
|
42
|
+
路由到下方对应的级别工作流。
|
|
43
|
+
</step>
|
|
44
|
+
|
|
45
|
+
<step name="level_1_quick_verify">
|
|
46
|
+
**第 1 级:快速验证(2-5 分钟)**
|
|
47
|
+
|
|
48
|
+
适用于:单个已知库,确认语法/版本仍然正确。
|
|
49
|
+
|
|
50
|
+
**流程:**
|
|
51
|
+
|
|
52
|
+
1. 在 Context7 中解析库:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
mcp__context7__resolve-library-id with libraryName: "[library]"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
2. 获取相关文档:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
mcp__context7__get-library-docs with:
|
|
62
|
+
- context7CompatibleLibraryID: [from step 1]
|
|
63
|
+
- topic: [specific concern]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
3. 验证:
|
|
67
|
+
|
|
68
|
+
- 当前版本符合预期
|
|
69
|
+
- API 语法未变
|
|
70
|
+
- 近期版本无破坏性变更
|
|
71
|
+
|
|
72
|
+
4. **如果验证通过:** 返回 plan-phase.md 并附带确认。无需 DISCOVERY.md。
|
|
73
|
+
|
|
74
|
+
5. **如果发现问题:** 升级到第 2 级。
|
|
75
|
+
|
|
76
|
+
**输出:** 口头确认继续,或升级到第 2 级。
|
|
77
|
+
</step>
|
|
78
|
+
|
|
79
|
+
<step name="level_2_standard">
|
|
80
|
+
**第 2 级:标准发现(15-30 分钟)**
|
|
81
|
+
|
|
82
|
+
适用于:在选项间选择,新的外部集成。
|
|
83
|
+
|
|
84
|
+
**流程:**
|
|
85
|
+
|
|
86
|
+
1. **确定需要发现什么:**
|
|
87
|
+
|
|
88
|
+
- 有哪些选项?
|
|
89
|
+
- 关键比较标准是什么?
|
|
90
|
+
- 我们的具体用例是什么?
|
|
91
|
+
|
|
92
|
+
2. **对每个选项使用 Context7:**
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
For each library/framework:
|
|
96
|
+
- mcp__context7__resolve-library-id
|
|
97
|
+
- mcp__context7__get-library-docs (mode: "code" for API, "info" for concepts)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
3. **官方文档** 补充 Context7 缺失的内容。
|
|
101
|
+
|
|
102
|
+
4. **WebSearch** 用于比较:
|
|
103
|
+
|
|
104
|
+
- "[option A] vs [option B] {current_year}"
|
|
105
|
+
- "[option] known issues"
|
|
106
|
+
- "[option] with [our stack]"
|
|
107
|
+
|
|
108
|
+
5. **交叉验证:** 任何 WebSearch 发现 → 用 Context7/官方文档确认。
|
|
109
|
+
|
|
110
|
+
6. **创建 DISCOVERY.md** 使用 .opencode/templates/discovery.md 结构:
|
|
111
|
+
|
|
112
|
+
- 带推荐的摘要
|
|
113
|
+
- 每个选项的关键发现
|
|
114
|
+
- 来自 Context7 的代码示例
|
|
115
|
+
- 置信度(第 2 级应为中高)
|
|
116
|
+
|
|
117
|
+
7. 返回 plan-phase.md。
|
|
118
|
+
|
|
119
|
+
**输出:** `.planning/phases/XX-name/DISCOVERY.md`
|
|
120
|
+
</step>
|
|
121
|
+
|
|
122
|
+
<step name="level_3_deep_dive">
|
|
123
|
+
**第 3 级:深度探索(1+ 小时)**
|
|
124
|
+
|
|
125
|
+
适用于:架构决策,新颖问题,高风险选择。
|
|
126
|
+
|
|
127
|
+
**流程:**
|
|
128
|
+
|
|
129
|
+
1. **界定发现范围** 使用 .opencode/templates/discovery.md:
|
|
130
|
+
|
|
131
|
+
- 定义清晰的范围
|
|
132
|
+
- 定义包含/排除边界
|
|
133
|
+
- 列出需要回答的具体问题
|
|
134
|
+
|
|
135
|
+
2. **穷尽式 Context7 研究:**
|
|
136
|
+
|
|
137
|
+
- 所有相关库
|
|
138
|
+
- 相关模式和概念
|
|
139
|
+
- 如需要,每个库多个主题
|
|
140
|
+
|
|
141
|
+
3. **深入阅读官方文档:**
|
|
142
|
+
|
|
143
|
+
- 架构指南
|
|
144
|
+
- 最佳实践章节
|
|
145
|
+
- 迁移/升级指南
|
|
146
|
+
- 已知限制
|
|
147
|
+
|
|
148
|
+
4. **WebSearch 获取生态系统上下文:**
|
|
149
|
+
|
|
150
|
+
- 其他人如何解决类似问题
|
|
151
|
+
- 生产环境经验
|
|
152
|
+
- 陷阱和反模式
|
|
153
|
+
- 近期变更/公告
|
|
154
|
+
|
|
155
|
+
5. **交叉验证所有发现:**
|
|
156
|
+
|
|
157
|
+
- 每个 WebSearch 声明 → 用权威来源验证
|
|
158
|
+
- 标记已验证 vs 假设
|
|
159
|
+
- 标记矛盾之处
|
|
160
|
+
|
|
161
|
+
6. **创建全面的 DISCOVERY.md:**
|
|
162
|
+
|
|
163
|
+
- 来自 .opencode/templates/discovery.md 的完整结构
|
|
164
|
+
- 带来源归属的质量报告
|
|
165
|
+
- 按发现标注置信度
|
|
166
|
+
- 如果任何关键发现置信度为低 → 添加验证检查点
|
|
167
|
+
|
|
168
|
+
7. **置信度门控:** 如果总体置信度为低,在继续之前展示选项。
|
|
169
|
+
|
|
170
|
+
8. 返回 plan-phase.md。
|
|
171
|
+
|
|
172
|
+
**输出:** `.planning/phases/XX-name/DISCOVERY.md`(全面版)
|
|
173
|
+
</step>
|
|
174
|
+
|
|
175
|
+
<step name="identify_unknowns">
|
|
176
|
+
**用于第 2-3 级:** 定义我们需要学习什么。
|
|
177
|
+
|
|
178
|
+
问:在规划此阶段之前,我们需要了解什么?
|
|
179
|
+
|
|
180
|
+
- 技术选择?
|
|
181
|
+
- 最佳实践?
|
|
182
|
+
- API 模式?
|
|
183
|
+
- 架构方案?
|
|
184
|
+
</step>
|
|
185
|
+
|
|
186
|
+
<step name="create_discovery_scope">
|
|
187
|
+
使用 .opencode/templates/discovery.md。
|
|
188
|
+
|
|
189
|
+
包含:
|
|
190
|
+
|
|
191
|
+
- 清晰的发现目标
|
|
192
|
+
- 有范围的包含/排除列表
|
|
193
|
+
- 来源偏好(官方文档、Context7、当年)
|
|
194
|
+
- DISCOVERY.md 的输出结构
|
|
195
|
+
</step>
|
|
196
|
+
|
|
197
|
+
<step name="execute_discovery">
|
|
198
|
+
执行发现:
|
|
199
|
+
- 使用 web search 获取当前信息
|
|
200
|
+
- 使用 Context7 MCP 获取库文档
|
|
201
|
+
- 优先使用当年来源
|
|
202
|
+
- 按模板结构组织发现
|
|
203
|
+
</step>
|
|
204
|
+
|
|
205
|
+
<step name="create_discovery_output">
|
|
206
|
+
写入 `.planning/phases/XX-name/DISCOVERY.md`:
|
|
207
|
+
- 带推荐的摘要
|
|
208
|
+
- 带来源的关键发现
|
|
209
|
+
- 代码示例(如适用)
|
|
210
|
+
- 元数据(置信度、依赖、开放问题、假设)
|
|
211
|
+
</step>
|
|
212
|
+
|
|
213
|
+
<step name="confidence_gate">
|
|
214
|
+
创建 DISCOVERY.md 后,检查置信度。
|
|
215
|
+
|
|
216
|
+
如果置信度为低:
|
|
217
|
+
使用 AskUserQuestion:
|
|
218
|
+
|
|
219
|
+
- header:"低置信度"
|
|
220
|
+
- question:"发现置信度为低:[原因]。你希望如何继续?"
|
|
221
|
+
- options:
|
|
222
|
+
- "深入研究" - 在规划前做更多研究
|
|
223
|
+
- "继续进行" - 接受不确定性,带注意事项规划
|
|
224
|
+
- "暂停" - 我需要考虑一下
|
|
225
|
+
|
|
226
|
+
如果置信度为中:
|
|
227
|
+
内联提示:"发现完成(中等置信度)。[简要原因]。继续规划?"
|
|
228
|
+
|
|
229
|
+
如果置信度为高:
|
|
230
|
+
直接继续,仅注明:"发现完成(高置信度)。"
|
|
231
|
+
</step>
|
|
232
|
+
|
|
233
|
+
<step name="open_questions_gate">
|
|
234
|
+
如果 DISCOVERY.md 有 open_questions:
|
|
235
|
+
|
|
236
|
+
内联展示:
|
|
237
|
+
"发现中的开放问题:
|
|
238
|
+
|
|
239
|
+
- [问题 1]
|
|
240
|
+
- [问题 2]
|
|
241
|
+
|
|
242
|
+
这些可能影响实现。确认并继续?(是 / 先处理)"
|
|
243
|
+
|
|
244
|
+
如果选择"先处理":收集用户对问题的输入,更新发现。
|
|
245
|
+
</step>
|
|
246
|
+
|
|
247
|
+
<step name="offer_next">
|
|
248
|
+
```
|
|
249
|
+
发现完成:.planning/phases/XX-name/DISCOVERY.md
|
|
250
|
+
推荐:[一句话]
|
|
251
|
+
置信度:[级别]
|
|
252
|
+
|
|
253
|
+
接下来做什么?
|
|
254
|
+
|
|
255
|
+
1. 讨论阶段上下文(/specops:discuss-phase [当前阶段])
|
|
256
|
+
2. 创建阶段计划(/specops:plan-phase [当前阶段])
|
|
257
|
+
3. 细化发现(深入研究)
|
|
258
|
+
4. 审查发现
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
注意:DISCOVERY.md 不会单独提交。它将随阶段完成一起提交。
|
|
262
|
+
</step>
|
|
263
|
+
|
|
264
|
+
</process>
|
|
265
|
+
|
|
266
|
+
<success_criteria>
|
|
267
|
+
**第 1 级(快速验证):**
|
|
268
|
+
- 已咨询 Context7 获取库/主题信息
|
|
269
|
+
- 当前状态已验证或问题已升级
|
|
270
|
+
- 口头确认继续(无文件)
|
|
271
|
+
|
|
272
|
+
**第 2 级(标准):**
|
|
273
|
+
- 已咨询 Context7 获取所有选项信息
|
|
274
|
+
- WebSearch 发现已交叉验证
|
|
275
|
+
- 已创建带推荐的 DISCOVERY.md
|
|
276
|
+
- 置信度为中或更高
|
|
277
|
+
- 已准备好为 PLAN.md 创建提供信息
|
|
278
|
+
|
|
279
|
+
**第 3 级(深度探索):**
|
|
280
|
+
- 已定义发现范围
|
|
281
|
+
- 已穷尽式咨询 Context7
|
|
282
|
+
- 所有 WebSearch 发现已对照权威来源验证
|
|
283
|
+
- 已创建全面分析的 DISCOVERY.md
|
|
284
|
+
- 带来源归属的质量报告
|
|
285
|
+
- 如果有低置信度发现 → 已定义验证检查点
|
|
286
|
+
- 已通过置信度门控
|
|
287
|
+
- 已准备好为 PLAN.md 创建提供信息
|
|
288
|
+
</success_criteria>
|