sillyspec 3.20.6 → 3.21.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.
Files changed (80) hide show
  1. package/.claude/CLAUDE.md +23 -0
  2. package/.claude/skills/sillyspec-archive/SKILL.md +86 -21
  3. package/.claude/skills/sillyspec-auto/SKILL.md +98 -83
  4. package/.claude/skills/sillyspec-brainstorm/SKILL.md +78 -44
  5. package/.claude/skills/sillyspec-doctor/SKILL.md +61 -31
  6. package/.claude/skills/sillyspec-execute/SKILL.md +90 -30
  7. package/.claude/skills/sillyspec-explore/SKILL.md +96 -109
  8. package/.claude/skills/sillyspec-export/SKILL.md +4 -0
  9. package/.claude/skills/sillyspec-init/SKILL.md +7 -0
  10. package/.claude/skills/sillyspec-plan/SKILL.md +74 -21
  11. package/.claude/skills/sillyspec-propose/SKILL.md +61 -21
  12. package/.claude/skills/sillyspec-quick/SKILL.md +84 -21
  13. package/.claude/skills/sillyspec-scan/SKILL.md +74 -21
  14. package/.claude/skills/sillyspec-state/SKILL.md +11 -1
  15. package/.claude/skills/sillyspec-status/SKILL.md +55 -21
  16. package/.claude/skills/sillyspec-verify/SKILL.md +82 -21
  17. package/.claude/skills/sillyspec-workspace/SKILL.md +12 -0
  18. package/CLAUDE.md +4 -0
  19. package/package.json +2 -2
  20. package/src/change-list.js +51 -16
  21. package/src/contract-matrix.js +67 -0
  22. package/src/doctor-diagnostics.js +575 -0
  23. package/src/hooks/worktree-guard.js +111 -111
  24. package/src/index.js +154 -82
  25. package/src/progress.js +59 -9
  26. package/src/run.js +139 -38
  27. package/src/stage-contract.js +14 -2
  28. package/src/stages/execute.js +37 -18
  29. package/src/stages/plan-postcheck.js +234 -0
  30. package/src/stages/plan.js +13 -0
  31. package/src/sync.js +13 -3
  32. package/src/worktree.js +69 -28
  33. package/docs/brainstorm-plan-contract.md +0 -64
  34. package/docs/plan-execute-contract.md +0 -123
  35. package/docs/platform-scan-protocol.md +0 -298
  36. package/docs/revision-mode.md +0 -115
  37. package/docs/sillyspec/file-lifecycle/known-implementation-gaps.md +0 -99
  38. package/docs/sillyspec/file-lifecycle/platform-workflows-sync.md +0 -223
  39. package/docs/sillyspec/file-lifecycle/stage-artifacts.md +0 -167
  40. package/docs/sillyspec/file-lifecycle/storage-and-state.md +0 -148
  41. package/docs/sillyspec/file-lifecycle/worktree-and-guard.md +0 -211
  42. package/docs/sillyspec/file-lifecycle.md +0 -132
  43. package/docs/workflow-contract-regression.md +0 -106
  44. package/docs/worktree-isolation.md +0 -252
  45. package/test/brainstorm-plan-contract.test.mjs +0 -273
  46. package/test/check-syntax.mjs +0 -26
  47. package/test/cli-top-level-aliases.test.mjs +0 -174
  48. package/test/contract-artifacts.test.mjs +0 -323
  49. package/test/decision-ref-version.mjs +0 -85
  50. package/test/decision-supersede.test.mjs +0 -277
  51. package/test/knowledge-match.test.mjs +0 -231
  52. package/test/plan-execute-contract.test.mjs +0 -357
  53. package/test/plan-optimization.test.mjs +0 -572
  54. package/test/platform-artifacts.test.mjs +0 -190
  55. package/test/platform-failure-samples.test.mjs +0 -199
  56. package/test/platform-recovery-chain.test.mjs +0 -179
  57. package/test/platform-recovery.test.mjs +0 -167
  58. package/test/platform-scan-p0.test.mjs +0 -186
  59. package/test/quick-recommend.test.mjs +0 -146
  60. package/test/revision-v1.test.mjs +0 -1145
  61. package/test/run-sanitize-project-name.test.mjs +0 -51
  62. package/test/run-scan-postcheck-fail.test.mjs +0 -64
  63. package/test/run-scan-project-parse.test.mjs +0 -200
  64. package/test/run-tests.mjs +0 -48
  65. package/test/runtime-cleanup-keeps-worktree.test.mjs +0 -107
  66. package/test/scan-docs-yaml-placeholders.test.mjs +0 -84
  67. package/test/scan-knowledge.test.mjs +0 -175
  68. package/test/scan-paths.test.mjs +0 -68
  69. package/test/scan-postcheck-project-priority.test.mjs +0 -85
  70. package/test/scan-postcheck.test.mjs +0 -197
  71. package/test/scan-workflow-anyfailed-block.test.mjs +0 -52
  72. package/test/spec-dir.test.mjs +0 -206
  73. package/test/stage-contract-failed-post-check.test.mjs +0 -102
  74. package/test/stage-contract.test.mjs +0 -301
  75. package/test/stage-definitions.test.mjs +0 -39
  76. package/test/wait-gates.test.mjs +0 -501
  77. package/test/workflow-spec-base.test.mjs +0 -142
  78. package/test/worktree-deps-provision.test.mjs +0 -148
  79. package/test/worktree-guard.test.mjs +0 -136
  80. package/test/worktree-native-overlay.test.mjs +0 -188
@@ -1,123 +0,0 @@
1
- ---
2
- author: qinyi
3
- created_at: 2026-06-19 00:25:00
4
- ---
5
-
6
- # Plan → Execute Contract
7
-
8
- ## 核心契约
9
-
10
- `plan.md` 是 execute 阶段的**唯一任务蓝图输入**。execute 不从其他来源(brainstorm、tasks.md、agent 记忆)获取任务列表。
11
-
12
- ## plan.md 格式要求
13
-
14
- ### Checkbox Task(必须)
15
-
16
- execute 通过 checkbox 解析任务,格式:
17
-
18
- ```markdown
19
- - [ ] task-01: 实现用户认证模块
20
- - [ ] task-02: 添加权限校验中间件
21
- - [ ] task-03: 编写集成测试
22
- ```
23
-
24
- ### Task ID 规则
25
-
26
- - 格式:`task-XX`(XX 为数字,建议两位补零)
27
- - 必须唯一:同一 plan.md 内不能有两个相同 task id
28
- - 建议连续:从 task-01 开始递增
29
- - 不能为空:每个 checkbox task 必须有 id
30
-
31
- ### Task Name 规则
32
-
33
- - 必须非空
34
- - 清晰描述任务内容
35
-
36
- ### Wave 分组
37
-
38
- ```markdown
39
- ## Wave 1
40
- - [ ] task-01: 搭建项目骨架
41
- - [ ] task-02: 配置 CI/CD
42
-
43
- ## Wave 2
44
- - [ ] task-03: 实现业务逻辑
45
- ```
46
-
47
- - Wave 内任务无依赖(可并行)
48
- - Wave 间有依赖(按序执行)
49
- - Wave 只能引用已存在的 task
50
-
51
- ## 校验规则
52
-
53
- execute 进入前调用 `validatePlanForExecute(planContent)`:
54
-
55
- | # | 规则 | 级别 |
56
- |---|------|------|
57
- | 1 | plan.md 非空 | error |
58
- | 2 | 至少有一个 checkbox task | error |
59
- | 3 | task id 唯一 | error |
60
- | 4 | task id 连续(task-01 起) | error |
61
- | 5 | task name 非空 | error |
62
- | 6 | task 有 id(无 id 只 warning) | warning |
63
-
64
- 校验失败 → fail-fast,不进入 execute。
65
- 校验通过但有 warning → 继续执行,提示警告。
66
-
67
- ## 复杂度场景
68
-
69
- ### none(最小变更)
70
- ```markdown
71
- ## Wave 1
72
- - [ ] task-01: 修复 bug
73
- ```
74
- 至少 1 个 checkbox task。
75
-
76
- ### light(轻量变更)
77
- ```markdown
78
- ## Wave 1
79
- - [ ] task-01: 添加 API 端点
80
- - [ ] task-02: 添加前端调用
81
- ```
82
- 1 个 Wave,2-3 个 task。
83
-
84
- ### full(完整变更)
85
- ```markdown
86
- ## Wave 1: 基础设施
87
- - [ ] task-01: 数据库 schema
88
- - [ ] task-02: 模型定义
89
-
90
- ## Wave 2: 业务逻辑
91
- - [ ] task-03: API 实现
92
- - [ ] task-04: 业务规则
93
-
94
- ## Wave 3: 测试
95
- - [ ] task-05: 集成测试
96
- ```
97
- 多个 Wave,每个 Wave 1-N 个 task。
98
-
99
- ## execute reopen 契约
100
-
101
- 当 execute 被 `--reopen` 时:
102
- 1. **必须从最新 plan.md 重新解析 steps**(不复用旧 task/wave)
103
- 2. 如果 plan.md 已变更(wave 数量变了),execute steps 会反映最新状态
104
- 3. 旧 completed steps 不保留(全部回到 pending/stale)
105
-
106
- ## 错误处理
107
-
108
- | 场景 | 行为 |
109
- |------|------|
110
- | plan.md 不存在 | 生成默认 3 Wave(向后兼容) |
111
- | plan.md 存在但无 checkbox | fail-fast |
112
- | task id 重复 | fail-fast |
113
- | task id 不连续 | fail-fast |
114
- | plan.md 被修改后 execute reopen | 重新解析,使用最新 wave/task |
115
-
116
- ## 双重校验
117
-
118
- 契约在两个时点执行:
119
-
120
- 1. **plan 完成时**(plan postcheck):plan.md 不合法 → 阻断 completed,plan 阶段无法完成
121
- 2. **execute 启动时**(execute entry):plan.md 不合法 → fail-fast,不进入 execute
122
-
123
- 这确保 plan.md 在进入 execute 之前就是合法的,execute 启动时的校验是二次保险。
@@ -1,298 +0,0 @@
1
- # 平台 Scan 产物协议
2
-
3
- SillySpec 平台执行模式的核心设计:**SillySpec 写产物,SillyHub 读产物**。平台不看 stdout,只靠文件系统判断 scan 成功、失败原因和证据文件位置。
4
-
5
- ## 状态枚举(src/constants.js)
6
-
7
- 所有平台产物共享同一套枚举值,SillyHub 直接使用常量,不猜字符串。
8
-
9
- ### SCAN_STATUS
10
-
11
- | 值 | 说明 |
12
- ---|---|
13
- | `pending` | scan 未开始 |
14
- | `in_progress` | scan 进行中 |
15
- | `success` | scan 成功,所有检查通过 |
16
- | `completed_with_warnings` | scan 成功但有警告 |
17
- | `failed_post_check` | scan 失败,post-check 不通过 |
18
-
19
- ### POINTER_STATUS
20
-
21
- | 值 | 说明 |
22
- ---|---|
23
- | `active` | 指针活跃,任务进行中 |
24
- | `scan_completed` | scan 已完成 |
25
- | `stale` | 指针过时(完成超过 24h,建议清理) |
26
- | `corrupted` | 指针损坏(缺少必要字段) |
27
-
28
- ### CHECK_SEVERITY
29
-
30
- | 值 | 说明 |
31
- ---|---|
32
- | `failed` | 严重:阻止成功 |
33
- | `warning` | 警告:不阻止成功 |
34
- | `passed` | 通过 |
35
-
36
- ## 目录结构
37
-
38
- ```
39
- <spec_root>/
40
- ├── manifest.json # 扫描元数据 + 产物索引
41
- ├── docs/<project>/scan/ # 项目文档
42
- │ ├── ARCHITECTURE.md
43
- │ ├── CONVENTIONS.md
44
- │ ├── PROJECT.md
45
- │ ├── STACK.md
46
- │ ├── STRUCTURE.md
47
- │ └── ... (7 份必需文档)
48
- ├── projects/*.yaml # 子项目注册
49
- ├── changes/<change-name>/ # 变更目录
50
- └── .runtime/
51
- ├── postcheck-result.json # post-check 结构化结果
52
- └── platform-scan.json # 平台参数持久化(主文件)
53
-
54
- <runtime_root>/
55
- └── scan-runs/<scan_run_id>/
56
- └── workflow-runs/
57
- └── <timestamp>-<workflow>-<project>-<status>.json # workflow 检查结果
58
-
59
- <source_root>/
60
- ├── .sillyspec-platform.json # 平台参数恢复指针(轻量,不在 .sillyspec 内)
61
- └── (源码,禁止 .sillyspec/ 污染)
62
- ```
63
-
64
- ## manifest.json
65
-
66
- scan 完成后写入 `<spec_root>/manifest.json`,是 SillyHub 判断 scan 结果的入口文件。
67
-
68
- ### 结构
69
-
70
- ```json
71
- {
72
- "workspace_id": "ws-xxx",
73
- "scan_run_id": "scan-2026-06-14-test-001",
74
- "source_root": "/path/to/source",
75
- "spec_root": "/path/to/spec",
76
- "runtime_root": "/path/to/runtime",
77
- "source_commit": "abc123...",
78
- "source_commit_error": null,
79
- "generated_at": "2026-06-14T01:50:00.000Z",
80
- "schema_version": 1,
81
- "postcheck_result_path": "<spec_root>/.runtime/postcheck-result.json",
82
- "workflow_runs_dir": "<runtime_root>/scan-runs/<scan_run_id>/workflow-runs",
83
- "platform_pointer_path": "<source_root>/.sillyspec-platform.json",
84
- "platform_pointer_status": "active",
85
- "scan_post_check": {
86
- "status": "success | completed_with_warnings | failed_post_check",
87
- "checks": [...]
88
- }
89
- }
90
- ```
91
-
92
- ### 字段说明
93
-
94
- | 字段 | 类型 | 说明 |
95
- |---|---|---|
96
- | `workspace_id` | string \| null | SillyHub workspace 标识 |
97
- | `scan_run_id` | string \| null | 本次 scan 唯一标识 |
98
- | `source_root` | string | 源码目录绝对路径 |
99
- | `spec_root` | string \| null | 规范目录(specDir) |
100
- | `runtime_root` | string \| null | 运行时产物目录 |
101
- | `source_commit` | string \| null | 源码 HEAD commit hash |
102
- | `source_commit_error` | string \| undefined | commit 获取失败原因 |
103
- | `generated_at` | string (ISO 8601) | manifest 生成时间 |
104
- | `schema_version` | number | 产物协议版本,当前为 1 |
105
- | `postcheck_result_path` | string \| null | post-check 结构化结果路径 |
106
- | `workflow_runs_dir` | string \| null | workflow 检查结果目录 |
107
- | `platform_pointer_path` | string | 平台指针文件路径 |
108
- | `platform_pointer_status` | string | 初始 `active`,由指针文件独立更新 |
109
- | `scan_post_check` | object \| undefined | post-check 结果(写入后追加) |
110
-
111
- ### 判断 scan 结果
112
-
113
- SillyHub 消费 manifest 的方式:
114
-
115
- 1. 读取 `<spec_root>/manifest.json`
116
- 2. 检查 `scan_post_check.status`:
117
- - `success` → scan 成功
118
- - `completed_with_warnings` → scan 成功但有警告
119
- - `failed_post_check` → scan 失败
120
- 3. 如果失败,读 `scan_post_check.checks` 获取具体失败项
121
- 4. 读 `postcheck_result_path` 获取完整结构化结果
122
- 5. 读 `workflow_runs_dir` 获取 workflow 检查证据
123
-
124
- ## .sillyspec-platform.json
125
-
126
- 跨 `--done` 生命周期的轻量指针文件,存储在 `<source_root>/.sillyspec-platform.json`(不在 `.sillyspec/` 内,不污染源码结构)。
127
-
128
- ### 生命周期
129
-
130
- | 阶段 | 行为 |
131
- |---|---|
132
- | **创建** | `run scan --spec-root` 时,写入 cwd 根目录 |
133
- | **读取** | 每次 `run`/`--done`/`--skip` 时,优先从 pointer 恢复平台参数 |
134
- | **更新** | 每次 `run` 时刷新 `savedAt` |
135
- | **完成标记** | scan post-check 后追加 `status=scan_completed` + `completedAt` + `scanStatus` |
136
- | **异常检测** | pointer 存在但缺 `specRoot` 时报错退出 |
137
- | **清理** | 无自动清理。`sillyspec platform pointer` 查看状态,`sillyspec platform pointer --cleanup` 手动清理 |
138
-
139
- ### CLI 检查命令
140
-
141
- ```bash
142
- # 查看指针状态
143
- sillyspec platform pointer
144
-
145
- # 清理过时/损坏指针
146
- sillyspec platform pointer --cleanup
147
- ```
148
-
149
- 输出示例:
150
- ```
151
- 📄 指针文件: /path/to/source/.sillyspec-platform.json
152
- specRoot: /path/to/spec
153
- runtimeRoot: /path/to/runtime
154
- workspaceId: ws-xxx
155
- scanRunId: scan-2026-06-14-test-001
156
- savedAt: 2026-06-14T01:50:00.000Z
157
- 状态: stale ⚠️
158
- completedAt: 2026-06-12T01:00:00.000Z
159
- scanStatus: success
160
- ⚠️ 指针已过时(完成超过 24h),可以安全删除。
161
- ```
162
-
163
- 状态判定逻辑:
164
- - 缺少 `specRoot` → `corrupted`
165
- - `status=scan_completed` 且 `completedAt` 超过 24h → `stale`
166
- - `status=scan_completed` 且未超时 → `scan_completed` ✅
167
- - 无 `status` 字段 → `active` 🔄
168
-
169
- ### 结构
170
-
171
- ```json
172
- {
173
- "specRoot": "/path/to/spec",
174
- "runtimeRoot": "/path/to/runtime",
175
- "workspaceId": "ws-xxx",
176
- "scanRunId": "scan-2026-06-14-test-001",
177
- "savedAt": "2026-06-14T01:50:00.000Z"
178
- }
179
- ```
180
-
181
- scan 完成后追加:
182
-
183
- ```json
184
- {
185
- "status": "scan_completed",
186
- "completedAt": "2026-06-14T01:52:00.000Z",
187
- "scanStatus": "success"
188
- }
189
- ```
190
-
191
- ## postcheck-result.json
192
-
193
- 写入 `<spec_root>/.runtime/postcheck-result.json`(平台模式)或 `<cwd>/.sillyspec/.runtime/postcheck-result.json`(本地模式)。
194
-
195
- ### 结构
196
-
197
- ```json
198
- {
199
- "workspace_id": "ws-xxx",
200
- "scan_run_id": "scan-2026-06-14-test-001",
201
- "status": "success | completed_with_warnings | failed_post_check",
202
- "source_root": "/path/to/source",
203
- "spec_root": "/path/to/spec",
204
- "runtime_root": "/path/to/runtime",
205
- "checks": [
206
- {
207
- "name": "source_root_docs_leak",
208
- "severity": "failed | warning",
209
- "detail": "..."
210
- }
211
- ],
212
- "source_root_leak": true,
213
- "docs_missing": ["ARCHITECTURE.md"],
214
- "profile": {
215
- "mode": "quick | standard | deep",
216
- "file_count": 10,
217
- "source_bytes": 102400,
218
- "project_count": 1,
219
- "reason": "..."
220
- }
221
- }
222
- ```
223
-
224
- ### check 类型
225
-
226
- | check name | severity | 说明 |
227
- |---|---|---|
228
- | `source_root_docs_leak` | failed | docs 文档泄漏到 source_root |
229
- | `source_root_leak` | failed | projects/workflows/knowledge/manifest/local 泄漏到 source_root |
230
- | `all_docs_missing` | failed | 7 份必需文档全部缺失 |
231
- | `partial_docs_missing` | failed | 部分文档缺失 |
232
- | `docs_missing_header` | warning | 文档缺少 frontmatter |
233
- | `local_config_invalid` | warning | local.yaml 中命令不存在 |
234
- | `tool_use_error` | warning | AI 执行工具调用错误 |
235
- | `api_error` | warning | API 错误(529/429/超时) |
236
-
237
- ## workflow-runs
238
-
239
- 写入 `<runtime_root>/scan-runs/<scan_run_id>/workflow-runs/`(平台模式)或 `<cwd>/.sillyspec/.runtime/workflow-runs/`(本地模式)。
240
-
241
- 每个文件命名:`<timestamp>-<workflow>-<project>-<status>.json`
242
-
243
- ### 结构
244
-
245
- ```json
246
- {
247
- "run_id": "20260614015000-scan-docs-test-project-pass",
248
- "created_at": "2026-06-14T01:50:00.000Z",
249
- "source": "run.js",
250
- "stage": "scan",
251
- "step": "深度扫描",
252
- "workflow": "scan-docs",
253
- "project": "test-project",
254
- "status": "pass | fail",
255
- "spec_version": 1,
256
- "roles": [...],
257
- "workflow_checks": [...],
258
- "failures": [...],
259
- "retry_prompts": [...]
260
- }
261
- ```
262
-
263
- ## source_root 零污染
264
-
265
- 平台模式的核心约束:source_root 下不产生 `.sillyspec/` 目录。
266
-
267
- post-check 会检查以下路径是否存在泄漏:
268
- - `<source_root>/.sillyspec/docs/` — 文档泄漏
269
- - `<source_root>/.sillyspec/projects/` — 项目注册泄漏
270
- - `<source_root>/.sillyspec/workflows/` — 工作流泄漏
271
- - `<source_root>/.sillyspec/knowledge/` — 术语泄漏
272
- - `<source_root>/.sillyspec/manifest.json` — manifest 泄漏
273
- - `<source_root>/.sillyspec/local.yaml` — 配置泄漏
274
-
275
- ## 产物消费优先级
276
-
277
- SillyHub 判断 scan 结果的推荐顺序:
278
-
279
- 1. `manifest.json` → `scan_post_check.overall_status` → 快速判断成功/失败
280
- 2. `postcheck-result.json` → 完整检查明细 + failure_categories
281
- 3. `workflow-runs/*.json` → workflow 检查证据
282
- 4. `docs/<project>/scan/*.md` → 实际文档内容
283
-
284
- ### failure_categories
285
-
286
- `postcheck-result.json` 中的 `failure_categories` 提供分类视图:
287
-
288
- | 类别 | 包含的 check |
289
- ---|---|
290
- | `path_pollution` | source_root_leak, source_root_docs_leak |
291
- | `missing_outputs` | all_docs_missing, partial_docs_missing, missing_docs |
292
- | `bad_references` | local_config_invalid |
293
- | `quality_warnings` | tool_use_error, api_error_529, rate_limit_exhausted, fallback_or_skip |
294
- | `violations` | manifest_write_failed, project_list_parse_failed + 所有 path_pollution |
295
-
296
- SillyHub 可以按类别快速定位问题域,而不需要遍历所有 checks。
297
-
298
- 不需要解析 stdout。
@@ -1,115 +0,0 @@
1
- ---
2
- author: qinyi
3
- created_at: 2026-06-18 22:48:00
4
- ---
5
-
6
- # Revision Mode — 阶段修订
7
-
8
- ## 核心语义
9
-
10
- 已完成(completed)的阶段不能直接重跑。必须通过 `--reopen` 进入受控修订模式。
11
-
12
- 修订模式确保:
13
- - 阶段状态机闭环:completed → revising → completed
14
- - 因果链不断:上游修订时,下游阶段自动标记 stale
15
- - 产物安全:reopen 不删除、不备份、不回滚文件,只改 progress 状态
16
-
17
- ## 命令
18
-
19
- ### `--reopen` — 重新打开已完成阶段
20
-
21
- ```bash
22
- sillyspec run brainstorm --reopen
23
- ```
24
-
25
- 把阶段从 completed 变为 revising。不删除步骤历史,不清空产物文件。
26
-
27
- **不带 `--from-step` 时:** 只在阶段存在 pending/stale/waiting/failed 步骤时允许继续。如果所有步骤都是 completed,会拒绝并要求指定 `--from-step`。
28
-
29
- ### `--reopen --from-step <index|name>` — 从指定步骤开始修订
30
-
31
- ```bash
32
- # 按序号(1-based)
33
- sillyspec run brainstorm --reopen --from-step 3
34
-
35
- # 按名称
36
- sillyspec run brainstorm --reopen --from-step "方案选择"
37
- ```
38
-
39
- 效果:
40
- - from-step 之前的步骤:保持 completed
41
- - from-step 本身:变为 pending
42
- - from-step 之后的步骤:标记为 stale(曾经完成,但因上游修订失效)
43
- - 当前阶段状态:变为 revising
44
- - 所有下游阶段:自动 cascade stale
45
-
46
- ### `--reset` — 彻底重置(核弹)
47
-
48
- ```bash
49
- sillyspec run brainstorm --reset
50
- ```
51
-
52
- 清空所有步骤状态,从头开始。不保留任何历史。只在确实需要完全重来时使用。
53
-
54
- ## 下游 cascade 规则
55
-
56
- 阶段顺序:`scan → brainstorm → plan → execute → verify → archive`
57
-
58
- reopen 任意阶段,其下游所有已 completed 的阶段自动变为 stale,并记录 staleReason。
59
-
60
- 示例:
61
- ```
62
- reopen brainstorm --from-step 2
63
- → brainstorm: revising
64
- → plan: stale (上游 brainstorm 已修订)
65
- → execute: stale
66
- → verify: stale
67
- → archive: stale (已有归档文件保留但不再可信)
68
- ```
69
-
70
- stale 阶段不能直接 `run`,必须 `--reopen --from-step` 或 `--reset`。
71
-
72
- ## --reopen / --from-step / --reset 对比
73
-
74
- | 维度 | --reopen --from-step | --reopen | --reset |
75
- |------|---------------------|----------|---------|
76
- | 步骤历史 | 保留之前的,后面失效 | 保留 | 全部清空 |
77
- | 产物文件 | 不动 | 不动 | 不动 |
78
- | 阶段状态 | revising | revising | pending |
79
- | revision 计数 | +1 | +1 | 不变 |
80
- | 下游 cascade | stale | stale | 不 cascade |
81
- | 适用场景 | 局部返工 | 继续中断 | 彻底重来 |
82
-
83
- ## 文件策略
84
-
85
- - reopen **不触碰**任何产物文件(design.md、plan.md、task docs 等)
86
- - agent 在 revision context 下审视并更新已有产物
87
- - 如需备份/快照功能,后续版本再加
88
-
89
- ## Revision Context 注入
90
-
91
- 修订模式下执行步骤时,prompt 前会注入:
92
-
93
- ```
94
- 🔄 Revision Context
95
- 本阶段处于修订模式(revision N),不是首次执行。
96
- - 修订起始步骤:index: name
97
- - 当前步骤之前已完成的步骤仍然有效,不需要重做。
98
- - 当前步骤及之后的步骤需要重新生成或调整已有产物。
99
- - 已有产物文件被保留,审视并更新它们,而不是从零创建。
100
- - 不要绕过 CLI 进度追踪。
101
- ```
102
-
103
- ## progress 展示示例
104
-
105
- ```
106
- 🔧 🧠 需求探索
107
- 📋 revision: 2, from step: 2: 加载项目上下文
108
- ✅ 状态检查 (保持 completed)
109
- ⬜ 加载项目上下文 (pending — 从这里重做)
110
- ⚠️ 协作与复用检查 (stale)
111
- ⚠️ 原型/设计图分析 (stale)
112
- ...
113
- ⚠️ 📐 实现计划
114
- ⚠️ stale: 上游阶段 brainstorm 已修订 (revision 2)
115
- ```
@@ -1,99 +0,0 @@
1
- ---
2
- author: qinyi
3
- created_at: 2026-06-04 16:25:42
4
- updated_at: 2026-06-04 16:55:00
5
- ---
6
-
7
- # 剩余实现差异清单
8
-
9
- 本页只记录当前代码仍存在的实现差异。已修复的条目不再保留为缺口,包括:
10
-
11
- - `brainstorm` / `propose` 重复 object key 导致步骤丢失。
12
- - scan prompt 写 `.sillyspec/.runtime/local.yaml`。
13
- - hook 只读根目录 `local.yaml`。
14
- - archive 第 4 步正常流程不触发自动归档。
15
- - 自动 sync / approval 参数顺序不匹配。
16
- - `ProgressManager._updatePlatformLastSync()` / `_updateApprovalStatus()` 缺失。
17
-
18
- ## workflow-runs 平台路径支持未从 run.js 接通
19
-
20
- 代码位置:`src/workflow.js`、`src/run.js`
21
-
22
- 现象:
23
-
24
- - `saveWorkflowRun()` 支持传 `runtimeRoot`。
25
- - `run.js` scan/archive post-check 调用时没有传 `runtimeRoot` / `scanRunId`。
26
-
27
- 影响:
28
-
29
- - 自动 post-check 的 workflow run 当前写本地 `.sillyspec/.runtime/workflow-runs/`。
30
- - 平台模式下不能按旧文档断言它会写入 `<runtime-root>/scan-runs/<scan-run-id>/workflow-runs/`。
31
-
32
- ## `--no-worktree` 未作为 run flag 接通
33
-
34
- 代码位置:`src/run.js`、`src/stages/execute.js`、`src/worktree.js`、`src/hooks/worktree-guard.js`
35
-
36
- 现象:
37
-
38
- - execute prompt 和 worktree 错误信息提到 `--no-worktree`。
39
- - `buildExecuteSteps()` 也有 `noWorktree` option。
40
- - `runCommand()` 的 known flags 不包含 `--no-worktree`。
41
- - CLI usage 也没有列出 `--no-worktree`。
42
-
43
- 影响:
44
-
45
- - 文档不能把 `--no-worktree` 描述成已可用的公开 run 参数。
46
- - `changes.no_worktree` / gate `noWorktree` 字段存在,但当前没有清晰 CLI 生命周期入口。
47
-
48
- ## DB schema version 口径不统一
49
-
50
- 代码位置:`src/db.js`、`src/progress.js`
51
-
52
- 现象:
53
-
54
- - `db.js` 的 `project.schema_version` 默认值是 4。
55
- - `progress.js` 的 `CURRENT_VERSION` 是 3。
56
- - `ProgressManager.init()` 写 project 行时使用 `CURRENT_VERSION`。
57
-
58
- 影响:
59
-
60
- - 文档只描述表结构,不把当前状态存储称为明确 v4 schema。
61
-
62
- ## `global.json` 是遗留口径
63
-
64
- 代码位置:`src/progress.js`
65
-
66
- 现象:
67
-
68
- - 注释和常量还提到 `.sillyspec/.runtime/global.json`。
69
- - 实际 `readGlobal()` / `writeGlobal()` 已经走 SQL。
70
-
71
- 影响:
72
-
73
- - 文档应写成“当前没有实际 global.json 生命周期”。
74
-
75
- ## workflow archive 固定 project 为 `sillyspec`
76
-
77
- 代码位置:`src/run.js`
78
-
79
- 现象:
80
-
81
- - archive `extract-module-impact` post-check 调用 `runPostCheck(resolved, cwd, 'sillyspec')`。
82
- - 不按当前项目注册表动态选择 project。
83
-
84
- 影响:
85
-
86
- - 文档不能写成 archive impact workflow 对所有项目自动按 project 维度检查。
87
-
88
- ## platform approve / reject 尚未实现
89
-
90
- 代码位置:`src/sync.js`
91
-
92
- 现象:
93
-
94
- - `sillyspec platform approve <change-name>` 和 `reject <change-name>` 有 CLI 分支。
95
- - 当前实现只打印 “尚未实现” warning。
96
-
97
- 影响:
98
-
99
- - 本地 `checkApproval()` 能读取并记录平台审批状态,但 CLI 端还不能主动向平台发起 approve/reject。