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,447 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
执行阶段提示(PLAN.md)并创建结果摘要(SUMMARY.md)。
|
|
3
|
+
</purpose>
|
|
4
|
+
|
|
5
|
+
<required_reading>
|
|
6
|
+
在任何操作之前先读取 STATE.md 以加载项目上下文。
|
|
7
|
+
读取 config.json 了解规划行为设置。
|
|
8
|
+
|
|
9
|
+
@.opencode/references/git-integration.md
|
|
10
|
+
</required_reading>
|
|
11
|
+
|
|
12
|
+
<process>
|
|
13
|
+
|
|
14
|
+
<step name="init_context" priority="first">
|
|
15
|
+
加载执行上下文(仅传路径以最小化编排器上下文):
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
INIT=$(node .opencode/bin/specops-tools.cjs init execute-phase "${PHASE}")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
从 init JSON 中提取:`executor_model`、`commit_docs`、`phase_dir`、`phase_number`、`plans`、`summaries`、`incomplete_plans`、`state_path`、`config_path`。
|
|
22
|
+
|
|
23
|
+
如果 `.planning/` 缺失:报错。
|
|
24
|
+
</step>
|
|
25
|
+
|
|
26
|
+
<step name="identify_plan">
|
|
27
|
+
```bash
|
|
28
|
+
# Use plans/summaries from INIT JSON, or list files
|
|
29
|
+
ls .planning/phases/XX-name/*-PLAN.md 2>/dev/null | sort
|
|
30
|
+
ls .planning/phases/XX-name/*-SUMMARY.md 2>/dev/null | sort
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
找到第一个没有对应 SUMMARY 的 PLAN。支持小数阶段(`01.1-hotfix/`):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
PHASE=$(echo "$PLAN_PATH" | grep -oE '[0-9]+(\.[0-9]+)?-[0-9]+')
|
|
37
|
+
# config settings can be fetched via specops-tools config-get if needed
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
<if mode="yolo">
|
|
41
|
+
自动批准:`⚡ Execute {phase}-{plan}-PLAN.md [Plan X of Y for Phase Z]` → parse_segments。
|
|
42
|
+
</if>
|
|
43
|
+
|
|
44
|
+
<if mode="interactive" OR="custom with gates.execute_next_plan true">
|
|
45
|
+
展示计划识别结果,等待确认。
|
|
46
|
+
</if>
|
|
47
|
+
</step>
|
|
48
|
+
|
|
49
|
+
<step name="record_start_time">
|
|
50
|
+
```bash
|
|
51
|
+
PLAN_START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
52
|
+
PLAN_START_EPOCH=$(date +%s)
|
|
53
|
+
```
|
|
54
|
+
</step>
|
|
55
|
+
|
|
56
|
+
<step name="parse_segments">
|
|
57
|
+
```bash
|
|
58
|
+
grep -n "type=\"checkpoint" .planning/phases/XX-name/{phase}-{plan}-PLAN.md
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**按检查点类型路由:**
|
|
62
|
+
|
|
63
|
+
| 检查点 | 模式 | 执行方式 |
|
|
64
|
+
|--------|------|----------|
|
|
65
|
+
| 无 | A(自主) | 单个子代理:完整计划 + SUMMARY + 提交 |
|
|
66
|
+
| 仅验证类 | B(分段) | 检查点之间的分段。无/human-verify 后 → 子代理。decision/human-action 后 → 主进程 |
|
|
67
|
+
| 决策类 | C(主进程) | 完全在主进程上下文中执行 |
|
|
68
|
+
|
|
69
|
+
**模式 A:** init_agent_tracking → 生成 Task(subagent_type="specops-executor", model=executor_model),提示包含:在 [path] 执行计划,自主模式,所有任务 + SUMMARY + 提交,遵循偏差/认证规则,报告:计划名称、任务、SUMMARY 路径、提交哈希 → 跟踪 agent_id → 等待 → 更新跟踪 → 报告。
|
|
70
|
+
|
|
71
|
+
**模式 B:** 逐段执行。自主段:为指定任务生成子代理(不含 SUMMARY/提交)。检查点:主进程上下文。所有段完成后:聚合、创建 SUMMARY、提交。参见 segment_execution。
|
|
72
|
+
|
|
73
|
+
**模式 C:** 使用标准流程在主进程中执行(step name="execute")。
|
|
74
|
+
|
|
75
|
+
每个子代理的新鲜上下文保持最高质量。主进程上下文保持精简。
|
|
76
|
+
</step>
|
|
77
|
+
|
|
78
|
+
<step name="init_agent_tracking">
|
|
79
|
+
```bash
|
|
80
|
+
if [ ! -f .planning/agent-history.json ]; then
|
|
81
|
+
echo '{"version":"1.0","max_entries":50,"entries":[]}' > .planning/agent-history.json
|
|
82
|
+
fi
|
|
83
|
+
rm -f .planning/current-agent-id.txt
|
|
84
|
+
if [ -f .planning/current-agent-id.txt ]; then
|
|
85
|
+
INTERRUPTED_ID=$(cat .planning/current-agent-id.txt)
|
|
86
|
+
echo "Found interrupted agent: $INTERRUPTED_ID"
|
|
87
|
+
fi
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
如果中断:询问用户是恢复(Task `resume` 参数)还是重新开始。
|
|
91
|
+
|
|
92
|
+
**跟踪协议:** 生成时:将 agent_id 写入 `current-agent-id.txt`,追加到 agent-history.json:`{"agent_id":"[id]","task_description":"[desc]","phase":"[phase]","plan":"[plan]","segment":[num|null],"timestamp":"[ISO]","status":"spawned","completion_timestamp":null}`。完成时:status → "completed",设置 completion_timestamp,删除 current-agent-id.txt。清理:如果 entries > max_entries,移除最旧的 "completed"(绝不移除 "spawned")。
|
|
93
|
+
|
|
94
|
+
模式 A/B 在生成前运行。模式 C:跳过。
|
|
95
|
+
</step>
|
|
96
|
+
|
|
97
|
+
<step name="segment_execution">
|
|
98
|
+
仅模式 B(仅验证类检查点)。模式 A/C 跳过。
|
|
99
|
+
|
|
100
|
+
1. 解析分段映射:检查点位置和类型
|
|
101
|
+
2. 每个分段:
|
|
102
|
+
- 子代理路由:为指定任务生成 specops-executor。提示:任务范围、计划路径、读取完整计划获取上下文、执行指定任务、跟踪偏差、不含 SUMMARY/提交。通过代理协议跟踪。
|
|
103
|
+
- 主进程路由:使用标准流程执行任务(step name="execute")
|
|
104
|
+
3. 所有分段完成后:聚合文件/偏差/决策 → 创建 SUMMARY.md → 提交 → 自检:
|
|
105
|
+
- 用 `[ -f ]` 验证 key-files.created 在磁盘上存在
|
|
106
|
+
- 检查 `git log --oneline --all --grep="{phase}-{plan}"` 返回 ≥1 个提交
|
|
107
|
+
- 在 SUMMARY 末尾追加 `## Self-Check: PASSED` 或 `## Self-Check: FAILED`
|
|
108
|
+
|
|
109
|
+
**已知 Claude Code bug(classifyHandoffIfNeeded):** 如果任何段代理报告「失败」且包含 `classifyHandoffIfNeeded is not defined`,这是 Claude Code 运行时 bug——不是真正的失败。运行抽查;如果通过,视为成功。
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
</step>
|
|
114
|
+
|
|
115
|
+
<step name="load_prompt">
|
|
116
|
+
```bash
|
|
117
|
+
cat .planning/phases/XX-name/{phase}-{plan}-PLAN.md
|
|
118
|
+
```
|
|
119
|
+
这就是执行指令。严格按照执行。如果计划引用了 CONTEXT.md:在整个过程中尊重用户的愿景。
|
|
120
|
+
|
|
121
|
+
**如果计划包含 `<interfaces>` 块:** 这些是预提取的类型定义和合约。直接使用它们——不要重新读取源文件来发现类型。规划器已经提取了你需要的内容。
|
|
122
|
+
</step>
|
|
123
|
+
|
|
124
|
+
<step name="previous_phase_check">
|
|
125
|
+
```bash
|
|
126
|
+
node .opencode/bin/specops-tools.cjs phases list --type summaries --raw
|
|
127
|
+
# Extract the second-to-last summary from the JSON result
|
|
128
|
+
```
|
|
129
|
+
如果前一个 SUMMARY 有未解决的「遇到的问题」或「下一阶段就绪性」阻塞项:AskUserQuestion(header="Previous Issues", options: "Proceed anyway" | "Address first" | "Review previous")。
|
|
130
|
+
</step>
|
|
131
|
+
|
|
132
|
+
<step name="execute">
|
|
133
|
+
偏差是正常的——按下面的规则处理。
|
|
134
|
+
|
|
135
|
+
1. 从提示读取 @context 文件
|
|
136
|
+
2. 每个任务:
|
|
137
|
+
- `type="auto"`:如果 `tdd="true"` → TDD 执行。使用偏差规则 + 认证门控实现。验证完成标准。提交(参见 task_commit)。记录哈希到 Summary。
|
|
138
|
+
- `type="checkpoint:*"`:停止 → checkpoint_protocol → 等待用户 → 确认后才继续。
|
|
139
|
+
3. 运行 `<verification>` 检查
|
|
140
|
+
4. 确认 `<success_criteria>` 已满足
|
|
141
|
+
5. 在 Summary 中记录偏差
|
|
142
|
+
</step>
|
|
143
|
+
|
|
144
|
+
<authentication_gates>
|
|
145
|
+
|
|
146
|
+
## 认证门控
|
|
147
|
+
|
|
148
|
+
执行过程中的认证错误不是失败——它们是预期的交互点。
|
|
149
|
+
|
|
150
|
+
**标识符:** "Not authenticated"、"Unauthorized"、401/403、"Please run {tool} login"、"Set {ENV_VAR}"
|
|
151
|
+
|
|
152
|
+
**协议:**
|
|
153
|
+
1. 识别认证门控(不是 bug)
|
|
154
|
+
2. 停止任务执行
|
|
155
|
+
3. 创建动态 checkpoint:human-action,包含确切的认证步骤
|
|
156
|
+
4. 等待用户完成认证
|
|
157
|
+
5. 验证凭据有效
|
|
158
|
+
6. 重试原始任务
|
|
159
|
+
7. 正常继续
|
|
160
|
+
|
|
161
|
+
**示例:** `vercel --yes` → "Not authenticated" → 检查点要求用户 `vercel login` → 用 `vercel whoami` 验证 → 重试部署 → 继续
|
|
162
|
+
|
|
163
|
+
**在 Summary 中:** 记录为正常流程,放在「## Authentication Gates」下,不记为偏差。
|
|
164
|
+
|
|
165
|
+
</authentication_gates>
|
|
166
|
+
|
|
167
|
+
<deviation_rules>
|
|
168
|
+
|
|
169
|
+
## 偏差规则
|
|
170
|
+
|
|
171
|
+
你会发现计划外的工作。自动应用,全部记录到 Summary。
|
|
172
|
+
|
|
173
|
+
| 规则 | 触发条件 | 操作 | 权限 |
|
|
174
|
+
|------|----------|------|------|
|
|
175
|
+
| **1:Bug** | 行为异常、错误、查询错误、类型错误、安全漏洞、竞态条件、泄漏 | 修复 → 测试 → 验证 → 记录 `[Rule 1 - Bug]` | 自动 |
|
|
176
|
+
| **2:缺失关键项** | 缺少必要项:错误处理、验证、认证、CSRF/CORS、限流、索引、日志 | 添加 → 测试 → 验证 → 记录 `[Rule 2 - Missing Critical]` | 自动 |
|
|
177
|
+
| **3:阻塞项** | 阻止完成:缺少依赖、类型错误、导入失败、缺少环境变量/配置/文件、循环依赖 | 修复阻塞 → 验证可继续 → 记录 `[Rule 3 - Blocking]` | 自动 |
|
|
178
|
+
| **4:架构变更** | 结构性变更:新数据库表、schema 变更、新服务、切换库、破坏性 API、新基础设施 | 停止 → 展示决策(如下)→ 记录 `[Rule 4 - Architectural]` | 询问用户 |
|
|
179
|
+
|
|
180
|
+
**规则 4 格式:**
|
|
181
|
+
```
|
|
182
|
+
⚠️ Architectural Decision Needed
|
|
183
|
+
|
|
184
|
+
Current task: [task name]
|
|
185
|
+
Discovery: [what prompted this]
|
|
186
|
+
Proposed change: [modification]
|
|
187
|
+
Why needed: [rationale]
|
|
188
|
+
Impact: [what this affects]
|
|
189
|
+
Alternatives: [other approaches]
|
|
190
|
+
|
|
191
|
+
Proceed with proposed change? (yes / different approach / defer)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**优先级:** 规则 4(停止)> 规则 1-3(自动)> 不确定 → 规则 4
|
|
195
|
+
**边界情况:** 缺少验证 → R2 | 空引用崩溃 → R1 | 新表 → R4 | 新列 → R1/2
|
|
196
|
+
**启发式:** 影响正确性/安全性/完成度?→ R1-3。可能?→ R4。
|
|
197
|
+
|
|
198
|
+
</deviation_rules>
|
|
199
|
+
|
|
200
|
+
<deviation_documentation>
|
|
201
|
+
|
|
202
|
+
## 记录偏差
|
|
203
|
+
|
|
204
|
+
Summary 必须包含偏差部分。没有偏差?→ `## Deviations from Plan\n\nNone - plan executed exactly as written.`
|
|
205
|
+
|
|
206
|
+
每个偏差:**[Rule N - Category] Title** — 发现于:任务 X | 问题 | 修复 | 修改的文件 | 验证 | 提交哈希
|
|
207
|
+
|
|
208
|
+
结尾:**偏差总计:** N 个自动修复(细分)。**影响:** 评估。
|
|
209
|
+
|
|
210
|
+
</deviation_documentation>
|
|
211
|
+
|
|
212
|
+
<tdd_plan_execution>
|
|
213
|
+
## TDD 执行
|
|
214
|
+
|
|
215
|
+
对于 `type: tdd` 计划——红-绿-重构:
|
|
216
|
+
|
|
217
|
+
1. **基础设施**(仅第一个 TDD 计划):检测项目、安装框架、配置、验证空测试套件
|
|
218
|
+
2. **红:** 读取 `<behavior>` → 失败测试 → 运行(必须失败)→ 提交:`test({phase}-{plan}): add failing test for [feature]`
|
|
219
|
+
3. **绿:** 读取 `<implementation>` → 最少代码 → 运行(必须通过)→ 提交:`feat({phase}-{plan}): implement [feature]`
|
|
220
|
+
4. **重构:** 清理 → 测试必须通过 → 提交:`refactor({phase}-{plan}): clean up [feature]`
|
|
221
|
+
|
|
222
|
+
错误处理:红阶段不失败 → 调查测试/已有功能。绿阶段不通过 → 调试、迭代。重构导致失败 → 撤销。
|
|
223
|
+
|
|
224
|
+
详见 `.opencode/references/tdd.md`。
|
|
225
|
+
</tdd_plan_execution>
|
|
226
|
+
|
|
227
|
+
<task_commit>
|
|
228
|
+
## 任务提交协议
|
|
229
|
+
|
|
230
|
+
每个任务完成后(验证通过、完成标准满足),立即提交。
|
|
231
|
+
|
|
232
|
+
**1. 检查:** `git status --short`
|
|
233
|
+
|
|
234
|
+
**2. 逐个暂存**(绝不使用 `git add .` 或 `git add -A`):
|
|
235
|
+
```bash
|
|
236
|
+
git add src/api/auth.ts
|
|
237
|
+
git add src/types/user.ts
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**3. 提交类型:**
|
|
241
|
+
|
|
242
|
+
| 类型 | 使用场景 | 示例 |
|
|
243
|
+
|------|----------|------|
|
|
244
|
+
| `feat` | 新功能 | feat(08-02): create user registration endpoint |
|
|
245
|
+
| `fix` | Bug 修复 | fix(08-02): correct email validation regex |
|
|
246
|
+
| `test` | 仅测试(TDD 红阶段) | test(08-02): add failing test for password hashing |
|
|
247
|
+
| `refactor` | 无行为变更(TDD 重构阶段) | refactor(08-02): extract validation to helper |
|
|
248
|
+
| `perf` | 性能优化 | perf(08-02): add database index |
|
|
249
|
+
| `docs` | 文档 | docs(08-02): add API docs |
|
|
250
|
+
| `style` | 格式化 | style(08-02): format auth module |
|
|
251
|
+
| `chore` | 配置/依赖 | chore(08-02): add bcrypt dependency |
|
|
252
|
+
|
|
253
|
+
**4. 格式:** `{type}({phase}-{plan}): {description}`,用要点列出关键变更。
|
|
254
|
+
|
|
255
|
+
**5. 记录哈希:**
|
|
256
|
+
```bash
|
|
257
|
+
TASK_COMMIT=$(git rev-parse --short HEAD)
|
|
258
|
+
TASK_COMMITS+=("Task ${TASK_NUM}: ${TASK_COMMIT}")
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
</task_commit>
|
|
262
|
+
|
|
263
|
+
<step name="checkpoint_protocol">
|
|
264
|
+
遇到 `type="checkpoint:*"` 时:先自动化一切可自动化的。检查点仅用于验证/决策。
|
|
265
|
+
|
|
266
|
+
显示:`CHECKPOINT: [Type]` 框 → 进度 {X}/{Y} → 任务名称 → 类型相关内容 → `YOUR ACTION: [signal]`
|
|
267
|
+
|
|
268
|
+
| 类型 | 内容 | 恢复信号 |
|
|
269
|
+
|------|------|----------|
|
|
270
|
+
| human-verify(90%) | 构建了什么 + 验证步骤(命令/URL) | "approved" 或描述问题 |
|
|
271
|
+
| decision(9%) | 需要的决策 + 上下文 + 含优劣的选项 | "Select: option-id" |
|
|
272
|
+
| human-action(1%) | 已自动化的内容 + 一个手动步骤 + 验证计划 | "done" |
|
|
273
|
+
|
|
274
|
+
响应后:如指定则验证。通过 → 继续。失败 → 告知,等待。等待用户——不要虚构完成。
|
|
275
|
+
|
|
276
|
+
详见 .opencode/references/checkpoints.md。
|
|
277
|
+
</step>
|
|
278
|
+
|
|
279
|
+
<step name="checkpoint_return_for_orchestrator">
|
|
280
|
+
通过 Task 生成且遇到检查点时:返回结构化状态(无法直接与用户交互)。
|
|
281
|
+
|
|
282
|
+
**必需返回:** 1)已完成任务表(哈希 + 文件) 2)当前任务(什么在阻塞) 3)检查点详情(面向用户的内容) 4)等待内容(需要用户提供什么)
|
|
283
|
+
|
|
284
|
+
编排器解析 → 向用户展示 → 用你的已完成任务状态生成新的延续代理。你不会被恢复。在主进程上下文中:使用上面的 checkpoint_protocol。
|
|
285
|
+
</step>
|
|
286
|
+
|
|
287
|
+
<step name="verification_failure_gate">
|
|
288
|
+
如果验证失败:停止。展示:"任务 [X] 验证失败:[name]。预期:[criteria]。实际:[result]。" 选项:重试 | 跳过(标记为未完成)| 停止(调查)。如果跳过 → SUMMARY「遇到的问题」。
|
|
289
|
+
</step>
|
|
290
|
+
|
|
291
|
+
<step name="record_completion_time">
|
|
292
|
+
```bash
|
|
293
|
+
PLAN_END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
294
|
+
PLAN_END_EPOCH=$(date +%s)
|
|
295
|
+
|
|
296
|
+
DURATION_SEC=$(( PLAN_END_EPOCH - PLAN_START_EPOCH ))
|
|
297
|
+
DURATION_MIN=$(( DURATION_SEC / 60 ))
|
|
298
|
+
|
|
299
|
+
if [[ $DURATION_MIN -ge 60 ]]; then
|
|
300
|
+
HRS=$(( DURATION_MIN / 60 ))
|
|
301
|
+
MIN=$(( DURATION_MIN % 60 ))
|
|
302
|
+
DURATION="${HRS}h ${MIN}m"
|
|
303
|
+
else
|
|
304
|
+
DURATION="${DURATION_MIN} min"
|
|
305
|
+
fi
|
|
306
|
+
```
|
|
307
|
+
</step>
|
|
308
|
+
|
|
309
|
+
<step name="generate_user_setup">
|
|
310
|
+
```bash
|
|
311
|
+
grep -A 50 "^user_setup:" .planning/phases/XX-name/{phase}-{plan}-PLAN.md | head -50
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
如果 user_setup 存在:使用模板 `.opencode/templates/user-setup.md` 创建 `{phase}-USER-SETUP.md`。每个服务包含:环境变量表、账户设置清单、仪表盘配置、本地开发说明、验证命令。状态为「Incomplete」。设置 `USER_SETUP_CREATED=true`。如果为空/缺失:跳过。
|
|
315
|
+
</step>
|
|
316
|
+
|
|
317
|
+
<step name="create_summary">
|
|
318
|
+
在 `.planning/phases/XX-name/` 创建 `{phase}-{plan}-SUMMARY.md`。使用 `.opencode/templates/summary.md`。
|
|
319
|
+
|
|
320
|
+
**Frontmatter:** phase、plan、subsystem、tags | requires/provides/affects | tech-stack.added/patterns | key-files.created/modified | key-decisions | requirements-completed(**必须**原样复制 PLAN.md frontmatter 中的 `requirements` 数组)| duration ($DURATION)、completed ($PLAN_END_TIME date)。
|
|
321
|
+
|
|
322
|
+
标题:`# Phase [X] Plan [Y]: [Name] Summary`
|
|
323
|
+
|
|
324
|
+
一句话摘要要实质性:「使用 jose 库的 JWT 认证,含刷新令牌轮换」而不是「认证已实现」
|
|
325
|
+
|
|
326
|
+
包含:时长、开始/结束时间、任务数、文件数。
|
|
327
|
+
|
|
328
|
+
下一步:还有更多计划 → 「准备好执行 {next-plan}」| 最后一个 → 「阶段完成,准备转换」。
|
|
329
|
+
</step>
|
|
330
|
+
|
|
331
|
+
<step name="update_current_position">
|
|
332
|
+
使用 specops-tools 更新 STATE.md:
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
# Advance plan counter (handles last-plan edge case)
|
|
336
|
+
node .opencode/bin/specops-tools.cjs state advance-plan
|
|
337
|
+
|
|
338
|
+
# Recalculate progress bar from disk state
|
|
339
|
+
node .opencode/bin/specops-tools.cjs state update-progress
|
|
340
|
+
|
|
341
|
+
# Record execution metrics
|
|
342
|
+
node .opencode/bin/specops-tools.cjs state record-metric \
|
|
343
|
+
--phase "${PHASE}" --plan "${PLAN}" --duration "${DURATION}" \
|
|
344
|
+
--tasks "${TASK_COUNT}" --files "${FILE_COUNT}"
|
|
345
|
+
```
|
|
346
|
+
</step>
|
|
347
|
+
|
|
348
|
+
<step name="extract_decisions_and_issues">
|
|
349
|
+
从 SUMMARY 提取决策并添加到 STATE.md:
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
# Add each decision from SUMMARY key-decisions
|
|
353
|
+
# Prefer file inputs for shell-safe text (preserves `$`, `*`, etc. exactly)
|
|
354
|
+
node .opencode/bin/specops-tools.cjs state add-decision \
|
|
355
|
+
--phase "${PHASE}" --summary-file "${DECISION_TEXT_FILE}" --rationale-file "${RATIONALE_FILE}"
|
|
356
|
+
|
|
357
|
+
# Add blockers if any found
|
|
358
|
+
node .opencode/bin/specops-tools.cjs state add-blocker --text-file "${BLOCKER_TEXT_FILE}"
|
|
359
|
+
```
|
|
360
|
+
</step>
|
|
361
|
+
|
|
362
|
+
<step name="update_session_continuity">
|
|
363
|
+
使用 specops-tools 更新会话信息:
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
node .opencode/bin/specops-tools.cjs state record-session \
|
|
367
|
+
--stopped-at "Completed ${PHASE}-${PLAN}-PLAN.md" \
|
|
368
|
+
--resume-file "None"
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
保持 STATE.md 在 150 行以内。
|
|
372
|
+
</step>
|
|
373
|
+
|
|
374
|
+
<step name="issues_review_gate">
|
|
375
|
+
如果 SUMMARY「遇到的问题」≠ "None":yolo → 记录并继续。Interactive → 展示问题,等待确认。
|
|
376
|
+
</step>
|
|
377
|
+
|
|
378
|
+
<step name="update_roadmap">
|
|
379
|
+
```bash
|
|
380
|
+
node .opencode/bin/specops-tools.cjs roadmap update-plan-progress "${PHASE}"
|
|
381
|
+
```
|
|
382
|
+
统计磁盘上的 PLAN 和 SUMMARY 文件数。更新进度表行,含正确的计数和状态(`In Progress` 或 `Complete` 加日期)。
|
|
383
|
+
</step>
|
|
384
|
+
|
|
385
|
+
<step name="update_requirements">
|
|
386
|
+
从 PLAN.md frontmatter 的 `requirements:` 字段标记已完成的需求:
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
node .opencode/bin/specops-tools.cjs requirements mark-complete ${REQ_IDS}
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
从计划的 frontmatter 提取需求 ID(如 `requirements: [AUTH-01, AUTH-02]`)。如果没有 requirements 字段,跳过。
|
|
393
|
+
</step>
|
|
394
|
+
|
|
395
|
+
<step name="git_commit_metadata">
|
|
396
|
+
任务代码已按任务提交。提交计划元数据:
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
node .opencode/bin/specops-tools.cjs commit "docs({phase}-{plan}): complete [plan-name] plan" --files .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/STATE.md .planning/ROADMAP.md .planning/REQUIREMENTS.md
|
|
400
|
+
```
|
|
401
|
+
</step>
|
|
402
|
+
|
|
403
|
+
<step name="update_codebase_map">
|
|
404
|
+
如果 .planning/codebase/ 不存在:跳过。
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
FIRST_TASK=$(git log --oneline --grep="feat({phase}-{plan}):" --grep="fix({phase}-{plan}):" --grep="test({phase}-{plan}):" --reverse | head -1 | cut -d' ' -f1)
|
|
408
|
+
git diff --name-only ${FIRST_TASK}^..HEAD 2>/dev/null
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
仅更新结构性变更:新 src/ 目录 → STRUCTURE.md | 依赖 → STACK.md | 文件模式 → CONVENTIONS.md | API 客户端 → INTEGRATIONS.md | 配置 → STACK.md | 重命名 → 更新路径。跳过纯代码/bugfix/内容变更。
|
|
412
|
+
|
|
413
|
+
```bash
|
|
414
|
+
node .opencode/bin/specops-tools.cjs commit "" --files .planning/codebase/*.md --amend
|
|
415
|
+
```
|
|
416
|
+
</step>
|
|
417
|
+
|
|
418
|
+
<step name="offer_next">
|
|
419
|
+
如果 `USER_SETUP_CREATED=true`:在顶部显示 `⚠️ USER SETUP REQUIRED`,含路径 + 环境变量/配置任务。
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
ls -1 .planning/phases/[current-phase-dir]/*-PLAN.md 2>/dev/null | wc -l
|
|
423
|
+
ls -1 .planning/phases/[current-phase-dir]/*-SUMMARY.md 2>/dev/null | wc -l
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
| 条件 | 路由 | 操作 |
|
|
427
|
+
|------|------|------|
|
|
428
|
+
| summaries < plans | **A:更多计划** | 找到下一个没有 SUMMARY 的 PLAN。Yolo:自动继续。Interactive:显示下一个计划,建议 `/specops:execute-phase {phase}` + `/specops:verify-work`。到此停止。 |
|
|
429
|
+
| summaries = plans,当前 < 最高阶段 | **B:阶段完成** | 显示完成信息,建议 `/specops:plan-phase {Z+1}` + `/specops:verify-work {Z}` + `/specops:discuss-phase {Z+1}` |
|
|
430
|
+
| summaries = plans,当前 = 最高阶段 | **C:里程碑完成** | 显示横幅,建议 `/specops:complete-milestone` + `/specops:verify-work` + `/specops:add-phase` |
|
|
431
|
+
|
|
432
|
+
所有路由:先 `/clear` 获取全新上下文。
|
|
433
|
+
</step>
|
|
434
|
+
|
|
435
|
+
</process>
|
|
436
|
+
|
|
437
|
+
<success_criteria>
|
|
438
|
+
|
|
439
|
+
- 所有 PLAN.md 中的任务已完成
|
|
440
|
+
- 所有验证通过
|
|
441
|
+
- 如果 frontmatter 中有 user_setup 则已生成 USER-SETUP.md
|
|
442
|
+
- 已创建含实质性内容的 SUMMARY.md
|
|
443
|
+
- STATE.md 已更新(位置、决策、问题、会话)
|
|
444
|
+
- ROADMAP.md 已更新
|
|
445
|
+
- 如果代码库映射存在:映射已随执行变更更新(或无重大变更时跳过)
|
|
446
|
+
- 如果创建了 USER-SETUP.md:在完成输出中醒目展示
|
|
447
|
+
</success_criteria>
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
验证 `.planning/` 目录的完整性并报告可操作的问题。检查缺失文件、无效配置、不一致状态和孤立计划。可选择自动修复可修复的问题。
|
|
3
|
+
</purpose>
|
|
4
|
+
|
|
5
|
+
<required_reading>
|
|
6
|
+
在开始之前,阅读调用提示的 execution_context 中引用的所有文件。
|
|
7
|
+
</required_reading>
|
|
8
|
+
|
|
9
|
+
<process>
|
|
10
|
+
|
|
11
|
+
<step name="parse_args">
|
|
12
|
+
**解析参数:**
|
|
13
|
+
|
|
14
|
+
检查命令参数中是否包含 `--repair` 标志。
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
REPAIR_FLAG=""
|
|
18
|
+
if arguments contain "--repair"; then
|
|
19
|
+
REPAIR_FLAG="--repair"
|
|
20
|
+
fi
|
|
21
|
+
```
|
|
22
|
+
</step>
|
|
23
|
+
|
|
24
|
+
<step name="run_health_check">
|
|
25
|
+
**运行健康检查:**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
node .opencode/bin/specops-tools.cjs validate health $REPAIR_FLAG
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
解析 JSON 输出:
|
|
32
|
+
- `status`:"healthy" | "degraded" | "broken"
|
|
33
|
+
- `errors[]`:严重问题(code、message、fix、repairable)
|
|
34
|
+
- `warnings[]`:非严重问题
|
|
35
|
+
- `info[]`:信息性备注
|
|
36
|
+
- `repairable_count`:可自动修复的问题数量
|
|
37
|
+
- `repairs_performed[]`:使用 --repair 时执行的操作
|
|
38
|
+
</step>
|
|
39
|
+
|
|
40
|
+
<step name="format_output">
|
|
41
|
+
**格式化并显示结果:**
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
45
|
+
SpecOps Health Check
|
|
46
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
47
|
+
|
|
48
|
+
Status: HEALTHY | DEGRADED | BROKEN
|
|
49
|
+
Errors: N | Warnings: N | Info: N
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**如果执行了修复:**
|
|
53
|
+
```
|
|
54
|
+
## Repairs Performed
|
|
55
|
+
|
|
56
|
+
- ✓ config.json: Created with defaults
|
|
57
|
+
- ✓ STATE.md: Regenerated from roadmap
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**如果存在错误:**
|
|
61
|
+
```
|
|
62
|
+
## Errors
|
|
63
|
+
|
|
64
|
+
- [E001] config.json: JSON parse error at line 5
|
|
65
|
+
Fix: Run /specops:health --repair to reset to defaults
|
|
66
|
+
|
|
67
|
+
- [E002] PROJECT.md not found
|
|
68
|
+
Fix: Run /specops:new-project to create
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**如果存在警告:**
|
|
72
|
+
```
|
|
73
|
+
## Warnings
|
|
74
|
+
|
|
75
|
+
- [W001] STATE.md references phase 5, but only phases 1-3 exist
|
|
76
|
+
Fix: Run /specops:health --repair to regenerate
|
|
77
|
+
|
|
78
|
+
- [W005] Phase directory "1-setup" doesn't follow NN-name format
|
|
79
|
+
Fix: Rename to match pattern (e.g., 01-setup)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**如果存在信息:**
|
|
83
|
+
```
|
|
84
|
+
## Info
|
|
85
|
+
|
|
86
|
+
- [I001] 02-implementation/02-01-PLAN.md has no SUMMARY.md
|
|
87
|
+
Note: May be in progress
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**页脚(如果存在可修复问题且未使用 --repair):**
|
|
91
|
+
```
|
|
92
|
+
---
|
|
93
|
+
N issues can be auto-repaired. Run: /specops:health --repair
|
|
94
|
+
```
|
|
95
|
+
</step>
|
|
96
|
+
|
|
97
|
+
<step name="offer_repair">
|
|
98
|
+
**如果存在可修复问题且未使用 --repair:**
|
|
99
|
+
|
|
100
|
+
询问用户是否要运行修复:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
Would you like to run /specops:health --repair to fix N issues automatically?
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
如果是,使用 --repair 标志重新运行并显示结果。
|
|
107
|
+
</step>
|
|
108
|
+
|
|
109
|
+
<step name="verify_repairs">
|
|
110
|
+
**如果执行了修复:**
|
|
111
|
+
|
|
112
|
+
不带 --repair 重新运行健康检查以确认问题已解决:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
node .opencode/bin/specops-tools.cjs validate health
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
报告最终状态。
|
|
119
|
+
</step>
|
|
120
|
+
|
|
121
|
+
</process>
|
|
122
|
+
|
|
123
|
+
<error_codes>
|
|
124
|
+
|
|
125
|
+
| Code | Severity | Description | Repairable |
|
|
126
|
+
|------|----------|-------------|------------|
|
|
127
|
+
| E001 | error | 未找到 .planning/ 目录 | No |
|
|
128
|
+
| E002 | error | 未找到 PROJECT.md | No |
|
|
129
|
+
| E003 | error | 未找到 ROADMAP.md | No |
|
|
130
|
+
| E004 | error | 未找到 STATE.md | Yes |
|
|
131
|
+
| E005 | error | config.json 解析错误 | Yes |
|
|
132
|
+
| W001 | warning | PROJECT.md 缺少必需部分 | No |
|
|
133
|
+
| W002 | warning | STATE.md 引用了无效阶段 | Yes |
|
|
134
|
+
| W003 | warning | 未找到 config.json | Yes |
|
|
135
|
+
| W004 | warning | config.json 字段值无效 | No |
|
|
136
|
+
| W005 | warning | 阶段目录命名不匹配 | No |
|
|
137
|
+
| W006 | warning | ROADMAP 中有阶段但无目录 | No |
|
|
138
|
+
| W007 | warning | 磁盘上有阶段但不在 ROADMAP 中 | No |
|
|
139
|
+
| I001 | info | 计划无 SUMMARY(可能正在进行中) | No |
|
|
140
|
+
|
|
141
|
+
</error_codes>
|
|
142
|
+
|
|
143
|
+
<repair_actions>
|
|
144
|
+
|
|
145
|
+
| Action | Effect | Risk |
|
|
146
|
+
|--------|--------|------|
|
|
147
|
+
| createConfig | 使用默认值创建 config.json | 无 |
|
|
148
|
+
| resetConfig | 删除并重新创建 config.json | 丢失自定义设置 |
|
|
149
|
+
| regenerateState | 从 ROADMAP 结构创建 STATE.md | 丢失会话历史 |
|
|
150
|
+
|
|
151
|
+
**不可修复(风险太高):**
|
|
152
|
+
- PROJECT.md、ROADMAP.md 内容
|
|
153
|
+
- 阶段目录重命名
|
|
154
|
+
- 孤立计划清理
|
|
155
|
+
|
|
156
|
+
</repair_actions>
|