specops 0.2.4 → 0.3.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/.opencode/agent/specops-codebase-mapper.md +764 -0
- package/.opencode/agent/specops-debugger.md +1246 -0
- package/.opencode/agent/specops-executor.md +469 -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 +575 -0
- package/.opencode/agent/specops-project-researcher.md +354 -0
- package/.opencode/agent/specops-research-synthesizer.md +239 -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/skills/demand-analysis/SKILL.md +142 -10
- 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/__e2e__/01-state-engine.e2e.test.js +1 -1
- package/dist/acceptance/lazyDetector.js +1 -1
- package/dist/acceptance/lazyDetector.test.js +1 -1
- package/dist/acceptance/reporter.js +1 -1
- package/dist/acceptance/reporter.test.js +1 -1
- package/dist/acceptance/runner.js +1 -1
- package/dist/acceptance/runner.test.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/promptTemplate.test.js +1 -1
- package/dist/context/techContextLoader.js +1 -1
- package/dist/context/techContextLoader.test.js +1 -1
- 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/agentMachine.test.js +1 -1
- package/dist/machines/supervisorMachine.js +1 -1
- package/dist/machines/supervisorMachine.test.js +1 -1
- package/dist/persistence/schema.js +1 -1
- package/dist/persistence/stateFile.js +1 -1
- package/dist/persistence/stateFile.test.js +1 -1
- package/dist/plugin-engine.js +1 -1
- package/dist/plugin.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/id.js +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
在规划之前,展示 Claude 对某个阶段的假设,让用户能够尽早纠正误解。
|
|
3
|
+
|
|
4
|
+
与 discuss-phase 的关键区别:这是对 Claude 想法的分析,而不是收集用户信息。不产生文件输出——纯粹是对话式的,用于引发讨论。
|
|
5
|
+
</purpose>
|
|
6
|
+
|
|
7
|
+
<process>
|
|
8
|
+
|
|
9
|
+
<step name="validate_phase" priority="first">
|
|
10
|
+
阶段编号:$ARGUMENTS(必填)
|
|
11
|
+
|
|
12
|
+
**如果未提供参数:**
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
错误:需要提供阶段编号。
|
|
16
|
+
|
|
17
|
+
用法:/specops:list-phase-assumptions [阶段编号]
|
|
18
|
+
示例:/specops:list-phase-assumptions 3
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
退出工作流。
|
|
22
|
+
|
|
23
|
+
**如果提供了参数:**
|
|
24
|
+
验证阶段是否存在于路线图中:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cat .planning/ROADMAP.md | grep -i "Phase ${PHASE}"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**如果未找到阶段:**
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
错误:在路线图中未找到阶段 ${PHASE}。
|
|
34
|
+
|
|
35
|
+
可用阶段:
|
|
36
|
+
[列出路线图中的阶段]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
退出工作流。
|
|
40
|
+
|
|
41
|
+
**如果找到阶段:**
|
|
42
|
+
从路线图中解析阶段详情:
|
|
43
|
+
|
|
44
|
+
- 阶段编号
|
|
45
|
+
- 阶段名称
|
|
46
|
+
- 阶段描述/目标
|
|
47
|
+
- 提到的任何范围细节
|
|
48
|
+
|
|
49
|
+
继续到 analyze_phase。
|
|
50
|
+
</step>
|
|
51
|
+
|
|
52
|
+
<step name="analyze_phase">
|
|
53
|
+
根据路线图描述和项目上下文,从五个方面识别假设:
|
|
54
|
+
|
|
55
|
+
**1. 技术方案:**
|
|
56
|
+
Claude 会使用哪些库、框架、模式或工具?
|
|
57
|
+
- "我会使用 X 库,因为……"
|
|
58
|
+
- "我会遵循 Y 模式,因为……"
|
|
59
|
+
- "我会将其构建为 Z,因为……"
|
|
60
|
+
|
|
61
|
+
**2. 实现顺序:**
|
|
62
|
+
Claude 会先构建什么、其次构建什么、最后构建什么?
|
|
63
|
+
- "我会先从 X 开始,因为它是基础"
|
|
64
|
+
- "然后是 Y,因为它依赖于 X"
|
|
65
|
+
- "最后是 Z,因为……"
|
|
66
|
+
|
|
67
|
+
**3. 范围边界:**
|
|
68
|
+
在 Claude 的理解中,哪些包含在内、哪些排除在外?
|
|
69
|
+
- "此阶段包含:A、B、C"
|
|
70
|
+
- "此阶段不包含:D、E、F"
|
|
71
|
+
- "边界模糊之处:G 可能属于任一方"
|
|
72
|
+
|
|
73
|
+
**4. 风险领域:**
|
|
74
|
+
Claude 预期在哪些地方会遇到复杂性或挑战?
|
|
75
|
+
- "棘手的部分是 X,因为……"
|
|
76
|
+
- "潜在问题:Y、Z"
|
|
77
|
+
- "我会注意……"
|
|
78
|
+
|
|
79
|
+
**5. 依赖关系:**
|
|
80
|
+
Claude 假设哪些东西已经存在或需要就位?
|
|
81
|
+
- "这假设前面阶段已完成 X"
|
|
82
|
+
- "外部依赖:Y、Z"
|
|
83
|
+
- "这将被……消费"
|
|
84
|
+
|
|
85
|
+
对不确定的地方要坦诚。用置信度标记假设:
|
|
86
|
+
- "比较确定:……"(从路线图中明确可知)
|
|
87
|
+
- "假设:……"(合理推断)
|
|
88
|
+
- "不确定:……"(可能有多种情况)
|
|
89
|
+
</step>
|
|
90
|
+
|
|
91
|
+
<step name="present_assumptions">
|
|
92
|
+
以清晰、易扫描的格式展示假设:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
## 我对阶段 ${PHASE}:${PHASE_NAME} 的假设
|
|
96
|
+
|
|
97
|
+
### 技术方案
|
|
98
|
+
[列出关于如何实现的假设]
|
|
99
|
+
|
|
100
|
+
### 实现顺序
|
|
101
|
+
[列出关于排序的假设]
|
|
102
|
+
|
|
103
|
+
### 范围边界
|
|
104
|
+
**包含在内:** [包含的内容]
|
|
105
|
+
**排除在外:** [排除的内容]
|
|
106
|
+
**模糊地带:** [可能属于任一方的内容]
|
|
107
|
+
|
|
108
|
+
### 风险领域
|
|
109
|
+
[列出预期的挑战]
|
|
110
|
+
|
|
111
|
+
### 依赖关系
|
|
112
|
+
**来自前序阶段:** [需要的内容]
|
|
113
|
+
**外部依赖:** [第三方需求]
|
|
114
|
+
**输出给后续阶段:** [后续阶段需要从此阶段获取的内容]
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
**你怎么看?**
|
|
119
|
+
|
|
120
|
+
这些假设准确吗?请告诉我:
|
|
121
|
+
- 哪些我说对了
|
|
122
|
+
- 哪些我说错了
|
|
123
|
+
- 哪些我遗漏了
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
等待用户回复。
|
|
127
|
+
</step>
|
|
128
|
+
|
|
129
|
+
<step name="gather_feedback">
|
|
130
|
+
**如果用户提供了纠正:**
|
|
131
|
+
|
|
132
|
+
确认纠正内容:
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
关键纠正:
|
|
136
|
+
- [纠正 1]
|
|
137
|
+
- [纠正 2]
|
|
138
|
+
|
|
139
|
+
这显著改变了我的理解。[总结新的理解]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**如果用户确认假设:**
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
假设已验证。
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
继续到 offer_next。
|
|
149
|
+
</step>
|
|
150
|
+
|
|
151
|
+
<step name="offer_next">
|
|
152
|
+
展示后续步骤:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
接下来做什么?
|
|
156
|
+
1. 讨论上下文(/specops:discuss-phase ${PHASE})- 让我向你提问以构建全面的上下文
|
|
157
|
+
2. 规划此阶段(/specops:plan-phase ${PHASE})- 创建详细的执行计划
|
|
158
|
+
3. 重新审视假设 - 我将根据你的纠正重新分析
|
|
159
|
+
4. 暂时到此为止
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
等待用户选择。
|
|
163
|
+
|
|
164
|
+
如果选择"讨论上下文":注意 CONTEXT.md 将纳入此处讨论的任何纠正
|
|
165
|
+
如果选择"规划此阶段":在已理解假设的基础上继续
|
|
166
|
+
如果选择"重新审视":返回 analyze_phase 并更新理解
|
|
167
|
+
</step>
|
|
168
|
+
|
|
169
|
+
</process>
|
|
170
|
+
|
|
171
|
+
<success_criteria>
|
|
172
|
+
- 阶段编号已根据路线图验证
|
|
173
|
+
- 从五个方面展示了假设:技术方案、实现顺序、范围、风险、依赖
|
|
174
|
+
- 在适当的地方标记了置信度
|
|
175
|
+
- 展示了"你怎么看?"提示
|
|
176
|
+
- 确认了用户反馈
|
|
177
|
+
- 提供了清晰的后续步骤
|
|
178
|
+
</success_criteria>
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
编排并行代码库映射 Agent 来分析代码库,并在 .planning/codebase/ 中生成结构化文档。
|
|
3
|
+
|
|
4
|
+
每个 Agent 拥有全新的上下文,探索特定的焦点领域,并**直接写入文档**。编排器只接收确认信息和行数,然后写入摘要。
|
|
5
|
+
|
|
6
|
+
输出:.planning/codebase/ 文件夹,包含 7 个关于代码库状态的结构化文档。
|
|
7
|
+
</purpose>
|
|
8
|
+
|
|
9
|
+
<philosophy>
|
|
10
|
+
**为什么使用专用映射 Agent:**
|
|
11
|
+
- 每个领域拥有全新上下文(无 token 污染)
|
|
12
|
+
- Agent 直接写入文档(无需将上下文传回编排器)
|
|
13
|
+
- 编排器只汇总创建了什么(最小上下文使用)
|
|
14
|
+
- 更快的执行(Agent 同时运行)
|
|
15
|
+
|
|
16
|
+
**文档质量优先于长度:**
|
|
17
|
+
包含足够的细节以作为参考使用。优先提供实际示例(特别是代码模式)而非任意的简洁。
|
|
18
|
+
|
|
19
|
+
**始终包含文件路径:**
|
|
20
|
+
文档是 Claude 在规划/执行时的参考材料。始终包含用反引号格式化的实际文件路径:`src/services/user.ts`。
|
|
21
|
+
</philosophy>
|
|
22
|
+
|
|
23
|
+
<process>
|
|
24
|
+
|
|
25
|
+
<step name="init_context" priority="first">
|
|
26
|
+
加载代码库映射上下文:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
INIT=$(node .opencode/bin/specops-tools.cjs init map-codebase)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
从初始化 JSON 中提取:`mapper_model`、`commit_docs`、`codebase_dir`、`existing_maps`、`has_maps`、`codebase_dir_exists`。
|
|
33
|
+
</step>
|
|
34
|
+
|
|
35
|
+
<step name="check_existing">
|
|
36
|
+
使用初始化上下文中的 `has_maps` 检查 .planning/codebase/ 是否已存在。
|
|
37
|
+
|
|
38
|
+
如果 `codebase_dir_exists` 为 true:
|
|
39
|
+
```bash
|
|
40
|
+
ls -la .planning/codebase/
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**如果已存在:**
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
.planning/codebase/ 已存在,包含以下文档:
|
|
47
|
+
[列出找到的文件]
|
|
48
|
+
|
|
49
|
+
接下来做什么?
|
|
50
|
+
1. 刷新 - 删除现有并重新映射代码库
|
|
51
|
+
2. 更新 - 保留现有,仅更新特定文档
|
|
52
|
+
3. 跳过 - 使用现有代码库映射
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
等待用户回复。
|
|
56
|
+
|
|
57
|
+
如果选择"刷新":删除 .planning/codebase/,继续到 create_structure
|
|
58
|
+
如果选择"更新":询问要更新哪些文档,继续到 spawn_agents(已过滤)
|
|
59
|
+
如果选择"跳过":退出工作流
|
|
60
|
+
|
|
61
|
+
**如果不存在:**
|
|
62
|
+
继续到 create_structure。
|
|
63
|
+
</step>
|
|
64
|
+
|
|
65
|
+
<step name="create_structure">
|
|
66
|
+
创建 .planning/codebase/ 目录:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
mkdir -p .planning/codebase
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**预期输出文件:**
|
|
73
|
+
- STACK.md(来自技术映射器)
|
|
74
|
+
- INTEGRATIONS.md(来自技术映射器)
|
|
75
|
+
- ARCHITECTURE.md(来自架构映射器)
|
|
76
|
+
- STRUCTURE.md(来自架构映射器)
|
|
77
|
+
- CONVENTIONS.md(来自质量映射器)
|
|
78
|
+
- TESTING.md(来自质量映射器)
|
|
79
|
+
- CONCERNS.md(来自关注点映射器)
|
|
80
|
+
|
|
81
|
+
继续到 spawn_agents。
|
|
82
|
+
</step>
|
|
83
|
+
|
|
84
|
+
<step name="spawn_agents">
|
|
85
|
+
生成 4 个并行的 specops-codebase-mapper Agent。
|
|
86
|
+
|
|
87
|
+
使用 Task 工具,设置 `subagent_type="specops-codebase-mapper"`、`model="{mapper_model}"`,并设置 `run_in_background=true` 以并行执行。
|
|
88
|
+
|
|
89
|
+
**关键:** 使用专用的 `specops-codebase-mapper` Agent,而不是 `Explore`。映射 Agent 直接写入文档。
|
|
90
|
+
|
|
91
|
+
**Agent 1:技术焦点**
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
Task(
|
|
95
|
+
subagent_type="specops-codebase-mapper",
|
|
96
|
+
model="{mapper_model}",
|
|
97
|
+
run_in_background=true,
|
|
98
|
+
description="Map codebase tech stack",
|
|
99
|
+
prompt="Focus: tech
|
|
100
|
+
|
|
101
|
+
Analyze this codebase for technology stack and external integrations.
|
|
102
|
+
|
|
103
|
+
Write these documents to .planning/codebase/:
|
|
104
|
+
- STACK.md - Languages, runtime, frameworks, dependencies, configuration
|
|
105
|
+
- INTEGRATIONS.md - External APIs, databases, auth providers, webhooks
|
|
106
|
+
|
|
107
|
+
Explore thoroughly. Write documents directly using templates. Return confirmation only."
|
|
108
|
+
)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Agent 2:架构焦点**
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Task(
|
|
115
|
+
subagent_type="specops-codebase-mapper",
|
|
116
|
+
model="{mapper_model}",
|
|
117
|
+
run_in_background=true,
|
|
118
|
+
description="Map codebase architecture",
|
|
119
|
+
prompt="Focus: arch
|
|
120
|
+
|
|
121
|
+
Analyze this codebase architecture and directory structure.
|
|
122
|
+
|
|
123
|
+
Write these documents to .planning/codebase/:
|
|
124
|
+
- ARCHITECTURE.md - Pattern, layers, data flow, abstractions, entry points
|
|
125
|
+
- STRUCTURE.md - Directory layout, key locations, naming conventions
|
|
126
|
+
|
|
127
|
+
Explore thoroughly. Write documents directly using templates. Return confirmation only."
|
|
128
|
+
)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Agent 3:质量焦点**
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
Task(
|
|
135
|
+
subagent_type="specops-codebase-mapper",
|
|
136
|
+
model="{mapper_model}",
|
|
137
|
+
run_in_background=true,
|
|
138
|
+
description="Map codebase conventions",
|
|
139
|
+
prompt="Focus: quality
|
|
140
|
+
|
|
141
|
+
Analyze this codebase for coding conventions and testing patterns.
|
|
142
|
+
|
|
143
|
+
Write these documents to .planning/codebase/:
|
|
144
|
+
- CONVENTIONS.md - Code style, naming, patterns, error handling
|
|
145
|
+
- TESTING.md - Framework, structure, mocking, coverage
|
|
146
|
+
|
|
147
|
+
Explore thoroughly. Write documents directly using templates. Return confirmation only."
|
|
148
|
+
)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Agent 4:关注点焦点**
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
Task(
|
|
155
|
+
subagent_type="specops-codebase-mapper",
|
|
156
|
+
model="{mapper_model}",
|
|
157
|
+
run_in_background=true,
|
|
158
|
+
description="Map codebase concerns",
|
|
159
|
+
prompt="Focus: concerns
|
|
160
|
+
|
|
161
|
+
Analyze this codebase for technical debt, known issues, and areas of concern.
|
|
162
|
+
|
|
163
|
+
Write this document to .planning/codebase/:
|
|
164
|
+
- CONCERNS.md - Tech debt, bugs, security, performance, fragile areas
|
|
165
|
+
|
|
166
|
+
Explore thoroughly. Write document directly using template. Return confirmation only."
|
|
167
|
+
)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
继续到 collect_confirmations。
|
|
171
|
+
</step>
|
|
172
|
+
|
|
173
|
+
<step name="collect_confirmations">
|
|
174
|
+
等待所有 4 个 Agent 完成。
|
|
175
|
+
|
|
176
|
+
读取每个 Agent 的输出文件以收集确认信息。
|
|
177
|
+
|
|
178
|
+
**每个 Agent 的预期确认格式:**
|
|
179
|
+
```
|
|
180
|
+
## 映射完成
|
|
181
|
+
|
|
182
|
+
**焦点:** {focus}
|
|
183
|
+
**已写入文档:**
|
|
184
|
+
- `.planning/codebase/{DOC1}.md`({N} 行)
|
|
185
|
+
- `.planning/codebase/{DOC2}.md`({N} 行)
|
|
186
|
+
|
|
187
|
+
已准备好供编排器汇总。
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**你收到的内容:** 仅文件路径和行数。不是文档内容。
|
|
191
|
+
|
|
192
|
+
如果任何 Agent 失败,记录失败并继续处理成功的文档。
|
|
193
|
+
|
|
194
|
+
继续到 verify_output。
|
|
195
|
+
</step>
|
|
196
|
+
|
|
197
|
+
<step name="verify_output">
|
|
198
|
+
验证所有文档是否成功创建:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
ls -la .planning/codebase/
|
|
202
|
+
wc -l .planning/codebase/*.md
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**验证清单:**
|
|
206
|
+
- 所有 7 个文档都存在
|
|
207
|
+
- 没有空文档(每个应超过 20 行)
|
|
208
|
+
|
|
209
|
+
如果有文档缺失或为空,记录哪些 Agent 可能失败了。
|
|
210
|
+
|
|
211
|
+
继续到 scan_for_secrets。
|
|
212
|
+
</step>
|
|
213
|
+
|
|
214
|
+
<step name="scan_for_secrets">
|
|
215
|
+
**关键安全检查:** 在提交前扫描输出文件中意外泄露的密钥。
|
|
216
|
+
|
|
217
|
+
运行密钥模式检测:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# 检查生成文档中的常见 API 密钥模式
|
|
221
|
+
grep -E '(sk-[a-zA-Z0-9]{20,}|sk_live_[a-zA-Z0-9]+|sk_test_[a-zA-Z0-9]+|ghp_[a-zA-Z0-9]{36}|gho_[a-zA-Z0-9]{36}|glpat-[a-zA-Z0-9_-]+|AKIA[A-Z0-9]{16}|xox[baprs]-[a-zA-Z0-9-]+|-----BEGIN.*PRIVATE KEY|eyJ[a-zA-Z0-9_-]+\.eyJ[a-zA-Z0-9_-]+\.)' .planning/codebase/*.md 2>/dev/null && SECRETS_FOUND=true || SECRETS_FOUND=false
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**如果 SECRETS_FOUND=true:**
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
⚠️ 安全警告:在代码库文档中检测到潜在密钥!
|
|
228
|
+
|
|
229
|
+
在以下位置发现类似 API 密钥或令牌的模式:
|
|
230
|
+
[显示 grep 输出]
|
|
231
|
+
|
|
232
|
+
如果提交,这将暴露凭据。
|
|
233
|
+
|
|
234
|
+
**需要操作:**
|
|
235
|
+
1. 审查上面标记的内容
|
|
236
|
+
2. 如果这些是真实密钥,必须在提交前移除
|
|
237
|
+
3. 考虑将敏感文件添加到 Claude Code "Deny" 权限
|
|
238
|
+
|
|
239
|
+
在提交前暂停。如果标记的内容实际上不敏感,请回复"可以继续",否则请先编辑文件。
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
等待用户确认后再继续到 commit_codebase_map。
|
|
243
|
+
|
|
244
|
+
**如果 SECRETS_FOUND=false:**
|
|
245
|
+
|
|
246
|
+
继续到 commit_codebase_map。
|
|
247
|
+
</step>
|
|
248
|
+
|
|
249
|
+
<step name="commit_codebase_map">
|
|
250
|
+
提交代码库映射:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
node .opencode/bin/specops-tools.cjs commit "docs: map existing codebase" --files .planning/codebase/*.md
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
继续到 offer_next。
|
|
257
|
+
</step>
|
|
258
|
+
|
|
259
|
+
<step name="offer_next">
|
|
260
|
+
展示完成摘要和后续步骤。
|
|
261
|
+
|
|
262
|
+
**获取行数:**
|
|
263
|
+
```bash
|
|
264
|
+
wc -l .planning/codebase/*.md
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**输出格式:**
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
代码库映射完成。
|
|
271
|
+
|
|
272
|
+
已创建 .planning/codebase/:
|
|
273
|
+
- STACK.md([N] 行)- 技术和依赖
|
|
274
|
+
- ARCHITECTURE.md([N] 行)- 系统设计和模式
|
|
275
|
+
- STRUCTURE.md([N] 行)- 目录布局和组织
|
|
276
|
+
- CONVENTIONS.md([N] 行)- 代码风格和模式
|
|
277
|
+
- TESTING.md([N] 行)- 测试结构和实践
|
|
278
|
+
- INTEGRATIONS.md([N] 行)- 外部服务和 API
|
|
279
|
+
- CONCERNS.md([N] 行)- 技术债务和问题
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## ▶ 下一步
|
|
285
|
+
|
|
286
|
+
**初始化项目** — 使用代码库上下文进行规划
|
|
287
|
+
|
|
288
|
+
`/specops:new-project`
|
|
289
|
+
|
|
290
|
+
<sub>先 `/clear` → 全新上下文窗口</sub>
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
**其他可用操作:**
|
|
295
|
+
- 重新运行映射:`/specops:map-codebase`
|
|
296
|
+
- 查看特定文件:`cat .planning/codebase/STACK.md`
|
|
297
|
+
- 在继续之前编辑任何文档
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
结束工作流。
|
|
303
|
+
</step>
|
|
304
|
+
|
|
305
|
+
</process>
|
|
306
|
+
|
|
307
|
+
<success_criteria>
|
|
308
|
+
- .planning/codebase/ 目录已创建
|
|
309
|
+
- 4 个并行 specops-codebase-mapper Agent 已使用 run_in_background=true 生成
|
|
310
|
+
- Agent 直接写入文档(编排器不接收文档内容)
|
|
311
|
+
- 读取 Agent 输出文件以收集确认信息
|
|
312
|
+
- 所有 7 个代码库文档都存在
|
|
313
|
+
- 清晰的完成摘要包含行数
|
|
314
|
+
- 以 SpecOps 风格向用户提供清晰的后续步骤
|
|
315
|
+
</success_criteria>
|