sillyspec 3.20.2 → 3.20.4

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 (133) hide show
  1. package/.claude/skills/sillyspec-archive/SKILL.md +21 -21
  2. package/.claude/skills/sillyspec-auto/SKILL.md +83 -83
  3. package/.claude/skills/sillyspec-brainstorm/SKILL.md +44 -44
  4. package/.claude/skills/sillyspec-commit/SKILL.md +106 -106
  5. package/.claude/skills/sillyspec-continue/SKILL.md +45 -45
  6. package/.claude/skills/sillyspec-doctor/SKILL.md +31 -31
  7. package/.claude/skills/sillyspec-execute/SKILL.md +30 -30
  8. package/.claude/skills/sillyspec-explore/SKILL.md +109 -109
  9. package/.claude/skills/sillyspec-knowledge/SKILL.md +269 -269
  10. package/.claude/skills/sillyspec-plan/SKILL.md +21 -21
  11. package/.claude/skills/sillyspec-propose/SKILL.md +21 -21
  12. package/.claude/skills/sillyspec-quick/SKILL.md +21 -21
  13. package/.claude/skills/sillyspec-resume/SKILL.md +68 -68
  14. package/.claude/skills/sillyspec-scan/SKILL.md +21 -21
  15. package/.claude/skills/sillyspec-state/SKILL.md +54 -54
  16. package/.claude/skills/sillyspec-status/SKILL.md +21 -21
  17. package/.claude/skills/sillyspec-verify/SKILL.md +21 -21
  18. package/.claude/skills/sillyspec-workspace/SKILL.md +157 -157
  19. package/.husky/pre-push +13 -13
  20. package/CLAUDE.md +18 -18
  21. package/README.md +198 -188
  22. package/SKILL.md +90 -91
  23. package/bin/sillyspec.js +2 -2
  24. package/docs/brainstorm-plan-contract.md +64 -64
  25. package/docs/plan-execute-contract.md +123 -123
  26. package/docs/platform-scan-protocol.md +298 -298
  27. package/docs/revision-mode.md +115 -115
  28. package/docs/sillyspec/file-lifecycle/known-implementation-gaps.md +99 -99
  29. package/docs/sillyspec/file-lifecycle/platform-workflows-sync.md +218 -218
  30. package/docs/sillyspec/file-lifecycle/stage-artifacts.md +167 -167
  31. package/docs/sillyspec/file-lifecycle/storage-and-state.md +148 -148
  32. package/docs/sillyspec/file-lifecycle/worktree-and-guard.md +211 -193
  33. package/docs/sillyspec/file-lifecycle.md +125 -125
  34. package/docs/workflow-contract-regression.md +106 -106
  35. package/docs/worktree-isolation.md +252 -252
  36. package/package.json +40 -40
  37. package/packages/dashboard/dist/assets/index-Bq_Z2hne.js +7446 -7446
  38. package/packages/dashboard/dist/assets/index-O2W5RV4z.css +1 -1
  39. package/packages/dashboard/dist/index.html +16 -16
  40. package/packages/dashboard/index.html +15 -15
  41. package/packages/dashboard/package-lock.json +2384 -2384
  42. package/packages/dashboard/package.json +25 -25
  43. package/packages/dashboard/server/executor.js +86 -86
  44. package/packages/dashboard/server/index.js +588 -588
  45. package/packages/dashboard/server/parser.js +526 -526
  46. package/packages/dashboard/server/watcher.js +344 -344
  47. package/packages/dashboard/src/App.vue +558 -558
  48. package/packages/dashboard/src/components/ActionBar.vue +93 -93
  49. package/packages/dashboard/src/components/CommandPalette.vue +96 -96
  50. package/packages/dashboard/src/components/DetailPanel.vue +137 -137
  51. package/packages/dashboard/src/components/LogStream.vue +65 -65
  52. package/packages/dashboard/src/components/PipelineStage.vue +95 -95
  53. package/packages/dashboard/src/components/PipelineView.vue +156 -156
  54. package/packages/dashboard/src/components/ProjectList.vue +210 -210
  55. package/packages/dashboard/src/components/StageBadge.vue +67 -67
  56. package/packages/dashboard/src/components/StepCard.vue +94 -94
  57. package/packages/dashboard/src/components/detail/DocsDetail.vue +48 -48
  58. package/packages/dashboard/src/components/detail/GitDetail.vue +61 -61
  59. package/packages/dashboard/src/components/detail/TechDetail.vue +43 -43
  60. package/packages/dashboard/src/composables/useDashboard.js +170 -170
  61. package/packages/dashboard/src/composables/useKeyboard.js +119 -119
  62. package/packages/dashboard/src/composables/useWebSocket.js +129 -129
  63. package/packages/dashboard/src/main.js +8 -8
  64. package/packages/dashboard/src/style.css +132 -132
  65. package/packages/dashboard/vite.config.js +18 -18
  66. package/src/brainstorm-postcheck.js +158 -158
  67. package/src/change-list.js +52 -52
  68. package/src/change-risk-profile.js +352 -352
  69. package/src/classify-change.js +73 -73
  70. package/src/constants.js +70 -70
  71. package/src/contract-matrix.js +278 -278
  72. package/src/db.js +201 -201
  73. package/src/endpoint-extractor.js +315 -315
  74. package/src/hooks/claude-pre-tool-use.cjs +125 -125
  75. package/src/hooks/worktree-guard.js +653 -653
  76. package/src/index.js +922 -900
  77. package/src/init.js +431 -431
  78. package/src/knowledge-match.js +130 -130
  79. package/src/migrate.js +117 -117
  80. package/src/modules.js +482 -482
  81. package/src/progress.js +1734 -1734
  82. package/src/run.js +3465 -3358
  83. package/src/scan-postcheck.js +387 -383
  84. package/src/setup.js +398 -398
  85. package/src/stage-contract.js +700 -700
  86. package/src/stages/archive.js +160 -160
  87. package/src/stages/brainstorm-auto.js +229 -229
  88. package/src/stages/brainstorm.js +645 -645
  89. package/src/stages/doctor.js +365 -365
  90. package/src/stages/execute.js +625 -625
  91. package/src/stages/explore.js +34 -34
  92. package/src/stages/index.js +29 -29
  93. package/src/stages/knowledge.js +498 -498
  94. package/src/stages/plan-postcheck.js +511 -513
  95. package/src/stages/plan.js +582 -582
  96. package/src/stages/propose.js +174 -174
  97. package/src/stages/quick.js +82 -82
  98. package/src/stages/scan.js +558 -558
  99. package/src/stages/status.js +65 -65
  100. package/src/stages/verify.js +322 -322
  101. package/src/sync.js +497 -497
  102. package/src/task-review.js +346 -346
  103. package/src/workflow.js +785 -785
  104. package/src/worktree-apply.js +549 -549
  105. package/src/worktree-deps.js +185 -0
  106. package/src/worktree.js +982 -932
  107. package/templates/workflows/archive-impact.yaml +79 -79
  108. package/templates/workflows/scan-docs.yaml +132 -132
  109. package/test/brainstorm-plan-contract.test.mjs +273 -273
  110. package/test/check-syntax.mjs +26 -26
  111. package/test/contract-artifacts.test.mjs +323 -323
  112. package/test/decision-supersede.test.mjs +277 -277
  113. package/test/knowledge-match.test.mjs +231 -231
  114. package/test/plan-execute-contract.test.mjs +330 -330
  115. package/test/plan-optimization.test.mjs +572 -572
  116. package/test/platform-artifacts.test.mjs +166 -166
  117. package/test/platform-failure-samples.test.mjs +199 -199
  118. package/test/platform-recovery-chain.test.mjs +167 -167
  119. package/test/platform-recovery.test.mjs +136 -136
  120. package/test/platform-scan-p0.test.mjs +168 -168
  121. package/test/revision-v1.test.mjs +1145 -1145
  122. package/test/run-scan-project-parse.test.mjs +200 -200
  123. package/test/run-tests.mjs +48 -48
  124. package/test/scan-knowledge.test.mjs +175 -175
  125. package/test/scan-paths.test.mjs +68 -68
  126. package/test/scan-postcheck.test.mjs +197 -197
  127. package/test/spec-dir.test.mjs +206 -206
  128. package/test/stage-contract.test.mjs +299 -299
  129. package/test/stage-definitions.test.mjs +39 -39
  130. package/test/wait-gates.test.mjs +496 -496
  131. package/test/worktree-deps-provision.test.mjs +148 -0
  132. package/test/worktree-guard.test.mjs +71 -71
  133. package/test/worktree-native-overlay.test.mjs +188 -188
@@ -1,167 +1,167 @@
1
- ---
2
- author: qinyi
3
- created_at: 2026-06-04 16:25:42
4
- ---
5
-
6
- # 阶段与变更产物
7
-
8
- ## 变更注册
9
-
10
- 变更状态由 `ProgressManager.initChange()` 写入 SQLite:
11
-
12
- - 确保 `.sillyspec/changes/<change>/` 存在
13
- - `changes` 表插入或激活 change
14
- - 为所有有效阶段写入 `stages` 行
15
- - 默认 `current_stage = 'brainstorm'`
16
-
17
- `run.js` 在执行阶段时会调用 `pm.registerChange()`,确保 effective change 是 active。
18
-
19
- ## 阶段步骤来源
20
-
21
- 阶段定义来自 `src/stages/*.js`,由 `src/stages/index.js` 注册。`scan`、`quick`、`explore`、`archive`、`status`、`doctor` 被标记为辅助阶段;辅助阶段完成后,`run.js` 会把该阶段步骤重置为 pending,并清空当前辅助阶段的 gate 状态。
22
-
23
- 当前运行时步骤数:
24
-
25
- | 阶段 | 步骤数 | 产物口径 |
26
- |---|---:|---|
27
- | scan | 10 | 生成 `.sillyspec/docs/<project>/...`,step 2 后动态展开项目级步骤 |
28
- | brainstorm | 11 | 第 10 步写 `design.md` 并自审,第 11 步确认后生成四件套,可选生成 `MASTER.md`、prototype、后续包骨架 |
29
- | propose | 7 | 第 5 步生成四件套,第 6 步自检门控 |
30
- | plan | 8+ | 生成 `plan.md`;如解析到任务,会动态插入任务蓝图协调器 |
31
- | execute | 12+ | 生成/使用 worktree,按 Wave 执行;最终 apply/cleanup |
32
- | verify | 7 | 写 `verify-result.md` |
33
- | archive | 5 | 写 `module-impact.md`,同步模块文档,归档目录 |
34
- | quick | 3 | 写 quicklog 或追加 change tasks;直接改主工作区 |
35
-
36
- ## 变更四件套
37
-
38
- 目标路径:`.sillyspec/changes/<change>/`
39
-
40
- | 文件 | 当前创建方式 | 后续消费者 |
41
- |---|---|---|
42
- | `proposal.md` | brainstorm 第 11 步;propose 第 5 步 | propose/plan/verify/archive prompt |
43
- | `design.md` | brainstorm 第 10/11 步;propose 第 5 步 | plan、execute、verify、worktree apply 的文件清单 |
44
- | `requirements.md` | brainstorm 第 11 步;propose 第 5 步 | plan、verify |
45
- | `tasks.md` | brainstorm 第 11 步;propose 第 5 步;quick `--change` 可追加 task | plan、execute、verify、archive |
46
-
47
- `run.js validateFileLocations()` 在阶段完成时会检查:
48
-
49
- | 阶段 | 预期文件 |
50
- |---|---|
51
- | propose | `proposal.md`、`design.md`、`requirements.md`、`tasks.md` |
52
- | plan | `plan.md` |
53
- | verify | `verify-result.md` |
54
- | archive | `module-impact.md` |
55
-
56
- 这个检查只打印警告,不会阻止流程。
57
-
58
- ## `design.md` 文件变更清单
59
-
60
- 解析方:`src/change-list.js`
61
-
62
- 规则:
63
-
64
- - 查找 `## 文件变更清单` 或 `### 文件变更清单`
65
- - 截取到下一个 `##` 标题
66
- - 解析 Markdown 表格
67
- - 取第二列作为文件路径
68
- - 忽略空路径、`—`、`-`、`.sillyspec/` 开头路径
69
-
70
- 消费者:
71
-
72
- - `worktree-apply.js` 用它作为 allow list
73
- - verify/archive prompt 要求人工对照
74
-
75
- 如果清单为空,`applyWorktree()` 不做 allow list 限制。
76
-
77
- ## `plan.md` 和 `tasks/task-NN.md`
78
-
79
- `plan.md` 创建方式:plan 阶段“展开任务并分组”prompt 写入。
80
-
81
- `run.js completeStep()` 在该步骤完成后读取 `plan.md`。如果能解析到 `- [ ] task-XX:` 格式的任务,会通过 `buildPlanSteps(changeDir, planContent)` 动态插入“生成任务蓝图(子代理并行)”步骤。
82
-
83
- `tasks/task-NN.md` 创建方式:动态任务蓝图协调器 prompt 要求子代理写入。
84
-
85
- 当前 `tasks/task-NN.md` frontmatter 模板包含:
86
-
87
- - `id`
88
- - `title`
89
- - `priority`
90
- - `estimated_hours`
91
- - `depends_on`
92
- - `blocks`
93
- - `allowed_paths`
94
-
95
- ## `verify-result.md`
96
-
97
- 路径:`.sillyspec/changes/<change>/verify-result.md`
98
-
99
- 创建方式:verify 阶段最后一步 prompt。
100
-
101
- `run.js` 不生成报告正文,只在 verify 阶段完成后检查文件是否存在,并提示下一步 `sillyspec run archive`。
102
-
103
- ## `module-impact.md`
104
-
105
- 路径:`.sillyspec/changes/<change>/module-impact.md`
106
-
107
- 创建方式:archive 阶段 `extract-module-impact` prompt。
108
-
109
- `run.js` 在该步骤完成后会尝试加载 `.sillyspec/workflows/archive-impact.yaml` 并执行 workflow post-check,然后把检查结果保存到 `.sillyspec/.runtime/workflow-runs/`。
110
-
111
- ## scan 文档
112
-
113
- 目标目录:`.sillyspec/docs/<project>/scan/`
114
-
115
- 当前 scan 定义要求 7 份核心扫描文档:
116
-
117
- - `ARCHITECTURE.md`
118
- - `CONVENTIONS.md`
119
- - `STRUCTURE.md`
120
- - `INTEGRATIONS.md`
121
- - `TESTING.md`
122
- - `CONCERNS.md`
123
- - `PROJECT.md`
124
-
125
- `scan` step 2 之后,`run.js` 会把所有带 `perProject: true` 的步骤按项目展开,并在 `.sillyspec/.runtime/scan-projects.json` 记录已展开状态。
126
-
127
- ## 模块文档
128
-
129
- 目标目录:`.sillyspec/docs/<project>/modules/`
130
-
131
- | 文件 | 当前创建/维护方 |
132
- |---|---|
133
- | `_module-map.yaml` | scan 可选步骤;`sillyspec modules rebuild` 会按模块卡片重建骨架 |
134
- | `<module>.md` | scan 可选步骤;archive `sync-module-docs` prompt;quick prompt |
135
- | `dependencies.md` | `generateDependenciesMd()` 可生成,但当前 CLI 没有直接暴露该函数 |
136
-
137
- `sillyspec modules rebuild` 不是全量源码重扫。它会保留/合并模块卡片并生成骨架,输出也明确提示 tags、entrypoints、main_symbols、depends_on、used_by 需要重新 scan 或手动补充。
138
-
139
- ## quicklog
140
-
141
- 路径:`.sillyspec/quicklog/QUICKLOG-<git-user>.md`
142
-
143
- 创建方式:quick 阶段“理解任务”prompt,且没有 `--change` 时创建/追加。
144
-
145
- 格式规则来自 prompt:
146
-
147
- - ID 为 `ql-YYYYMMDD-NNN-XXXX`
148
- - `NNN` 每天从 001 递增
149
- - `XXXX` 是 4 位随机十六进制字符
150
- - 第一步写“进行中”
151
- - 第三步改为“已完成”
152
- - 超过 500 行时 prompt 要求轮转为 `QUICKLOG-<USER>-YYYY-MM-DD.md`
153
-
154
- 这些写入和轮转由 AI 按 prompt 执行,当前没有独立 JS 函数自动完成。
155
-
156
- ## 归档目录
157
-
158
- 目标目录:`.sillyspec/changes/archive/<date>-<change>/`
159
-
160
- 当前移动目录由 `run.js` 执行:
161
-
162
- - archive 第 4 步是“确认归档”。
163
- - 执行 `sillyspec run archive --done --confirm --output "确认归档"` 时,`run.js` 会把 `.sillyspec/changes/<change>/` 移动到 `.sillyspec/changes/archive/<date>-<change>/`。
164
- - 移动后会调用 `ProgressManager.unregisterChange()`,注销 active change。
165
- - 如果没有带 `--confirm`,`run.js` 会把第 4 步回退为 pending,清除该步输出,并提示补上 `--confirm`。
166
-
167
- 第 5 步“更新路线图和提交”只负责后续人工收尾,不再移动目录。
1
+ ---
2
+ author: qinyi
3
+ created_at: 2026-06-04 16:25:42
4
+ ---
5
+
6
+ # 阶段与变更产物
7
+
8
+ ## 变更注册
9
+
10
+ 变更状态由 `ProgressManager.initChange()` 写入 SQLite:
11
+
12
+ - 确保 `.sillyspec/changes/<change>/` 存在
13
+ - `changes` 表插入或激活 change
14
+ - 为所有有效阶段写入 `stages` 行
15
+ - 默认 `current_stage = 'brainstorm'`
16
+
17
+ `run.js` 在执行阶段时会调用 `pm.registerChange()`,确保 effective change 是 active。
18
+
19
+ ## 阶段步骤来源
20
+
21
+ 阶段定义来自 `src/stages/*.js`,由 `src/stages/index.js` 注册。`scan`、`quick`、`explore`、`archive`、`status`、`doctor` 被标记为辅助阶段;辅助阶段完成后,`run.js` 会把该阶段步骤重置为 pending,并清空当前辅助阶段的 gate 状态。
22
+
23
+ 当前运行时步骤数:
24
+
25
+ | 阶段 | 步骤数 | 产物口径 |
26
+ |---|---:|---|
27
+ | scan | 10 | 生成 `.sillyspec/docs/<project>/...`,step 2 后动态展开项目级步骤 |
28
+ | brainstorm | 11 | 第 10 步写 `design.md` 并自审,第 11 步确认后生成四件套,可选生成 `MASTER.md`、prototype、后续包骨架 |
29
+ | propose | 7 | 第 5 步生成四件套,第 6 步自检门控 |
30
+ | plan | 8+ | 生成 `plan.md`;如解析到任务,会动态插入任务蓝图协调器 |
31
+ | execute | 12+ | 生成/使用 worktree,按 Wave 执行;最终 apply/cleanup |
32
+ | verify | 7 | 写 `verify-result.md` |
33
+ | archive | 5 | 写 `module-impact.md`,同步模块文档,归档目录 |
34
+ | quick | 3 | 写 quicklog 或追加 change tasks;直接改主工作区 |
35
+
36
+ ## 变更四件套
37
+
38
+ 目标路径:`.sillyspec/changes/<change>/`
39
+
40
+ | 文件 | 当前创建方式 | 后续消费者 |
41
+ |---|---|---|
42
+ | `proposal.md` | brainstorm 第 11 步;propose 第 5 步 | propose/plan/verify/archive prompt |
43
+ | `design.md` | brainstorm 第 10/11 步;propose 第 5 步 | plan、execute、verify、worktree apply 的文件清单 |
44
+ | `requirements.md` | brainstorm 第 11 步;propose 第 5 步 | plan、verify |
45
+ | `tasks.md` | brainstorm 第 11 步;propose 第 5 步;quick `--change` 可追加 task | plan、execute、verify、archive |
46
+
47
+ `run.js validateFileLocations()` 在阶段完成时会检查:
48
+
49
+ | 阶段 | 预期文件 |
50
+ |---|---|
51
+ | propose | `proposal.md`、`design.md`、`requirements.md`、`tasks.md` |
52
+ | plan | `plan.md` |
53
+ | verify | `verify-result.md` |
54
+ | archive | `module-impact.md` |
55
+
56
+ 这个检查只打印警告,不会阻止流程。
57
+
58
+ ## `design.md` 文件变更清单
59
+
60
+ 解析方:`src/change-list.js`
61
+
62
+ 规则:
63
+
64
+ - 查找 `## 文件变更清单` 或 `### 文件变更清单`
65
+ - 截取到下一个 `##` 标题
66
+ - 解析 Markdown 表格
67
+ - 取第二列作为文件路径
68
+ - 忽略空路径、`—`、`-`、`.sillyspec/` 开头路径
69
+
70
+ 消费者:
71
+
72
+ - `worktree-apply.js` 用它作为 allow list
73
+ - verify/archive prompt 要求人工对照
74
+
75
+ 如果清单为空,`applyWorktree()` 不做 allow list 限制。
76
+
77
+ ## `plan.md` 和 `tasks/task-NN.md`
78
+
79
+ `plan.md` 创建方式:plan 阶段“展开任务并分组”prompt 写入。
80
+
81
+ `run.js completeStep()` 在该步骤完成后读取 `plan.md`。如果能解析到 `- [ ] task-XX:` 格式的任务,会通过 `buildPlanSteps(changeDir, planContent)` 动态插入“生成任务蓝图(子代理并行)”步骤。
82
+
83
+ `tasks/task-NN.md` 创建方式:动态任务蓝图协调器 prompt 要求子代理写入。
84
+
85
+ 当前 `tasks/task-NN.md` frontmatter 模板包含:
86
+
87
+ - `id`
88
+ - `title`
89
+ - `priority`
90
+ - `estimated_hours`
91
+ - `depends_on`
92
+ - `blocks`
93
+ - `allowed_paths`
94
+
95
+ ## `verify-result.md`
96
+
97
+ 路径:`.sillyspec/changes/<change>/verify-result.md`
98
+
99
+ 创建方式:verify 阶段最后一步 prompt。
100
+
101
+ `run.js` 不生成报告正文,只在 verify 阶段完成后检查文件是否存在,并提示下一步 `sillyspec run archive`。
102
+
103
+ ## `module-impact.md`
104
+
105
+ 路径:`.sillyspec/changes/<change>/module-impact.md`
106
+
107
+ 创建方式:archive 阶段 `extract-module-impact` prompt。
108
+
109
+ `run.js` 在该步骤完成后会尝试加载 `.sillyspec/workflows/archive-impact.yaml` 并执行 workflow post-check,然后把检查结果保存到 `.sillyspec/.runtime/workflow-runs/`。
110
+
111
+ ## scan 文档
112
+
113
+ 目标目录:`.sillyspec/docs/<project>/scan/`
114
+
115
+ 当前 scan 定义要求 7 份核心扫描文档:
116
+
117
+ - `ARCHITECTURE.md`
118
+ - `CONVENTIONS.md`
119
+ - `STRUCTURE.md`
120
+ - `INTEGRATIONS.md`
121
+ - `TESTING.md`
122
+ - `CONCERNS.md`
123
+ - `PROJECT.md`
124
+
125
+ `scan` step 2 之后,`run.js` 会把所有带 `perProject: true` 的步骤按项目展开,并在 `.sillyspec/.runtime/scan-projects.json` 记录已展开状态。
126
+
127
+ ## 模块文档
128
+
129
+ 目标目录:`.sillyspec/docs/<project>/modules/`
130
+
131
+ | 文件 | 当前创建/维护方 |
132
+ |---|---|
133
+ | `_module-map.yaml` | scan 可选步骤;`sillyspec modules rebuild` 会按模块卡片重建骨架 |
134
+ | `<module>.md` | scan 可选步骤;archive `sync-module-docs` prompt;quick prompt |
135
+ | `dependencies.md` | `generateDependenciesMd()` 可生成,但当前 CLI 没有直接暴露该函数 |
136
+
137
+ `sillyspec modules rebuild` 不是全量源码重扫。它会保留/合并模块卡片并生成骨架,输出也明确提示 tags、entrypoints、main_symbols、depends_on、used_by 需要重新 scan 或手动补充。
138
+
139
+ ## quicklog
140
+
141
+ 路径:`.sillyspec/quicklog/QUICKLOG-<git-user>.md`
142
+
143
+ 创建方式:quick 阶段“理解任务”prompt,且没有 `--change` 时创建/追加。
144
+
145
+ 格式规则来自 prompt:
146
+
147
+ - ID 为 `ql-YYYYMMDD-NNN-XXXX`
148
+ - `NNN` 每天从 001 递增
149
+ - `XXXX` 是 4 位随机十六进制字符
150
+ - 第一步写“进行中”
151
+ - 第三步改为“已完成”
152
+ - 超过 500 行时 prompt 要求轮转为 `QUICKLOG-<USER>-YYYY-MM-DD.md`
153
+
154
+ 这些写入和轮转由 AI 按 prompt 执行,当前没有独立 JS 函数自动完成。
155
+
156
+ ## 归档目录
157
+
158
+ 目标目录:`.sillyspec/changes/archive/<date>-<change>/`
159
+
160
+ 当前移动目录由 `run.js` 执行:
161
+
162
+ - archive 第 4 步是“确认归档”。
163
+ - 执行 `sillyspec run archive --done --confirm --output "确认归档"` 时,`run.js` 会把 `.sillyspec/changes/<change>/` 移动到 `.sillyspec/changes/archive/<date>-<change>/`。
164
+ - 移动后会调用 `ProgressManager.unregisterChange()`,注销 active change。
165
+ - 如果没有带 `--confirm`,`run.js` 会把第 4 步回退为 pending,清除该步输出,并提示补上 `--confirm`。
166
+
167
+ 第 5 步“更新路线图和提交”只负责后续人工收尾,不再移动目录。
@@ -1,148 +1,148 @@
1
- ---
2
- author: qinyi
3
- created_at: 2026-06-04 16:25:42
4
- ---
5
-
6
- # 存储与状态
7
-
8
- ## Runtime 目录
9
-
10
- `.sillyspec/.runtime/` 是当前实现的运行时目录,`init.js` 和 `ProgressManager._ensureRuntimeDir()` 会创建:
11
-
12
- ```text
13
- .sillyspec/.runtime/
14
- ├── sillyspec.db
15
- ├── user-inputs.md
16
- ├── gate-status.json (按阶段动态生成/删除)
17
- ├── platform-scan.json (平台 scan 参数暂存)
18
- ├── scan-projects.json (scan step 2 后的项目展开状态)
19
- ├── artifacts/
20
- ├── history/
21
- ├── logs/
22
- ├── templates/
23
- ├── workflow-runs/
24
- └── worktrees/
25
- ```
26
-
27
- `.runtime/` 在 `.gitignore` 中,默认不进入版本控制。
28
-
29
- ## `sillyspec.db`
30
-
31
- 位置:`.sillyspec/.runtime/sillyspec.db`
32
-
33
- 创建方:`ProgressManager._ensureDB()` 使用 `src/db.js` 的 `DB.init()`。底层是 `sql.js`,每次事务后通过 `db.export()` 写回磁盘。
34
-
35
- 当前 DDL 包含:
36
-
37
- | 表 | 用途 |
38
- |---|---|
39
- | `project` | 项目名、schema version、创建/更新时间 |
40
- | `changes` | 变更名、当前阶段、活跃/归档状态、`no_worktree`、平台同步字段、隔离状态字段 |
41
- | `stages` | 每个 change 的阶段状态 |
42
- | `steps` | 每个 stage 的步骤状态和输出摘要 |
43
- | `batch_progress` | 批量任务统计 |
44
- | `approvals` | 平台审批状态 |
45
-
46
- `progress.js` 通过 SQL 读写这些表,并组装成兼容旧 progress 格式的 JS 对象。进度数据仅存储在 SQLite 数据库中,不再使用 progress.json 文件。
47
-
48
- 注意:`db.js` 的 `project.schema_version` DDL 默认值是 `4`,但 `progress.js` 的 `CURRENT_VERSION` 是 `3`,并在初始化/写入时使用 `3`。文档不要把这里写成稳定的 v4 schema 事实。
49
-
50
- ## `global.json`
51
-
52
- `progress.js` 仍保留 `GLOBAL_FILE = 'global.json'` 常量和注释,但 `readGlobal()` / `writeGlobal()` 已经改为 SQL 查询/写入 `project` 与 `changes` 表。
53
-
54
- 当前代码没有创建或维护 `.sillyspec/.runtime/global.json` 的实际生命周期。
55
-
56
- ## `gate-status.json`
57
-
58
- 位置:`.sillyspec/.runtime/gate-status.json`
59
-
60
- 写入/删除方:`ProgressManager._updateGateStatus()`。每次 `ProgressManager._write()` 后调用。
61
-
62
- 生成条件:
63
-
64
- - 查询 `changes` 表中 `status = 'active'`
65
- - 且 `current_stage IN ('execute', 'quick')`
66
- - 有匹配行时写入,没有匹配行时删除
67
-
68
- 结构:
69
-
70
- ```json
71
- {
72
- "stage": "execute",
73
- "changes": ["change-name"],
74
- "updatedAt": "2026-06-04T08:00:00.000Z",
75
- "noWorktree": true
76
- }
77
- ```
78
-
79
- `stage` 优先取 `execute`;同时存在 execute/quick 时,execute 会覆盖 quick。`noWorktree` 只要任一匹配 change 的 `no_worktree = 1` 就出现。
80
-
81
- 消费者:`src/hooks/worktree-guard.js`。hook 会先读 gate 文件,再 fallback 到 sqlite3 CLI 查询 `sillyspec.db`。
82
-
83
- ## `user-inputs.md`
84
-
85
- 位置:`.sillyspec/.runtime/user-inputs.md`
86
-
87
- 创建方:`ProgressManager.init()`。
88
-
89
- 追加方:`run.js` 的 `completeStep()`。当 `sillyspec run <stage> --done --output ...` 携带 output 时,按当前 change/stage/step 追加记录。
90
-
91
- 每条记录形态:
92
-
93
- ```markdown
94
- ## <时间> | <change> | <stage>: <step-name>
95
- - 输入:<inputText>
96
- - 输出:<outputText>
97
- ```
98
-
99
- 如果 output 超过 200 字,step 表中只保存截断摘要,但 `user-inputs.md` 保存完整 output。
100
-
101
- ## `artifacts/`
102
-
103
- 位置:
104
-
105
- - 本地模式:`.sillyspec/.runtime/artifacts/`
106
- - 平台 scan 且传入 `--runtime-root`:`<runtime-root>/scan-runs/<scan-run-id>/`
107
-
108
- 写入方:`run.js completeStep()`。
109
-
110
- 触发条件:`--output` 长度超过 200 字。
111
-
112
- 文件名:
113
-
114
- ```text
115
- <change>-<stage>-step<N>-<YYYYMMDDHHMMSS>.txt
116
- ```
117
-
118
- 注意:artifact 路径由 `completeStep()` 处理;这不等同于 workflow run 归档路径。
119
-
120
- ## `history/`
121
-
122
- 位置:`.sillyspec/.runtime/history/`
123
-
124
- 写入方:`ProgressManager.completeStage()`。
125
-
126
- 文件名:
127
-
128
- ```text
129
- <change>-<stage>-<timestamp>.json
130
- ```
131
-
132
- `sillyspec run <stage> --done` 的普通流程不直接调用 `completeStage()`;它通过 `_write()` 更新 DB。只有使用 `sillyspec progress complete-stage <stage>` 这类 progress 子命令时会写 history 文件。
133
-
134
- ## `local.yaml` 路径口径
135
-
136
- 当前主配置口径已经统一到:
137
-
138
- ```text
139
- .sillyspec/local.yaml
140
- ```
141
-
142
- | 位置 | 代码/提示 | 当前行为 |
143
- |---|---|---|
144
- | `.sillyspec/local.yaml` | `init.js` gitignore、`scan.js` prompt、`sync.js`、多个阶段 prompt | 平台配置、本地命令配置、hook 扩展白名单的主入口 |
145
- | `.sillyspec/local.yml` | `worktree-guard.js loadLocalConfig()` | hook 兼容读取 |
146
- | `local.yaml` / `local.yml`(项目根) | `worktree-guard.js loadLocalConfig()` | hook fallback 兼容旧配置 |
147
-
148
- 因此,文档可以把 `.sillyspec/local.yaml` 写成当前稳定主入口,但不能删除根目录 `local.yaml` / `local.yml` 的兼容说明。
1
+ ---
2
+ author: qinyi
3
+ created_at: 2026-06-04 16:25:42
4
+ ---
5
+
6
+ # 存储与状态
7
+
8
+ ## Runtime 目录
9
+
10
+ `.sillyspec/.runtime/` 是当前实现的运行时目录,`init.js` 和 `ProgressManager._ensureRuntimeDir()` 会创建:
11
+
12
+ ```text
13
+ .sillyspec/.runtime/
14
+ ├── sillyspec.db
15
+ ├── user-inputs.md
16
+ ├── gate-status.json (按阶段动态生成/删除)
17
+ ├── platform-scan.json (平台 scan 参数暂存)
18
+ ├── scan-projects.json (scan step 2 后的项目展开状态)
19
+ ├── artifacts/
20
+ ├── history/
21
+ ├── logs/
22
+ ├── templates/
23
+ ├── workflow-runs/
24
+ └── worktrees/
25
+ ```
26
+
27
+ `.runtime/` 在 `.gitignore` 中,默认不进入版本控制。
28
+
29
+ ## `sillyspec.db`
30
+
31
+ 位置:`.sillyspec/.runtime/sillyspec.db`
32
+
33
+ 创建方:`ProgressManager._ensureDB()` 使用 `src/db.js` 的 `DB.init()`。底层是 `sql.js`,每次事务后通过 `db.export()` 写回磁盘。
34
+
35
+ 当前 DDL 包含:
36
+
37
+ | 表 | 用途 |
38
+ |---|---|
39
+ | `project` | 项目名、schema version、创建/更新时间 |
40
+ | `changes` | 变更名、当前阶段、活跃/归档状态、`no_worktree`、平台同步字段、隔离状态字段 |
41
+ | `stages` | 每个 change 的阶段状态 |
42
+ | `steps` | 每个 stage 的步骤状态和输出摘要 |
43
+ | `batch_progress` | 批量任务统计 |
44
+ | `approvals` | 平台审批状态 |
45
+
46
+ `progress.js` 通过 SQL 读写这些表,并组装成兼容旧 progress 格式的 JS 对象。进度数据仅存储在 SQLite 数据库中,不再使用 progress.json 文件。
47
+
48
+ 注意:`db.js` 的 `project.schema_version` DDL 默认值是 `4`,但 `progress.js` 的 `CURRENT_VERSION` 是 `3`,并在初始化/写入时使用 `3`。文档不要把这里写成稳定的 v4 schema 事实。
49
+
50
+ ## `global.json`
51
+
52
+ `progress.js` 仍保留 `GLOBAL_FILE = 'global.json'` 常量和注释,但 `readGlobal()` / `writeGlobal()` 已经改为 SQL 查询/写入 `project` 与 `changes` 表。
53
+
54
+ 当前代码没有创建或维护 `.sillyspec/.runtime/global.json` 的实际生命周期。
55
+
56
+ ## `gate-status.json`
57
+
58
+ 位置:`.sillyspec/.runtime/gate-status.json`
59
+
60
+ 写入/删除方:`ProgressManager._updateGateStatus()`。每次 `ProgressManager._write()` 后调用。
61
+
62
+ 生成条件:
63
+
64
+ - 查询 `changes` 表中 `status = 'active'`
65
+ - 且 `current_stage IN ('execute', 'quick')`
66
+ - 有匹配行时写入,没有匹配行时删除
67
+
68
+ 结构:
69
+
70
+ ```json
71
+ {
72
+ "stage": "execute",
73
+ "changes": ["change-name"],
74
+ "updatedAt": "2026-06-04T08:00:00.000Z",
75
+ "noWorktree": true
76
+ }
77
+ ```
78
+
79
+ `stage` 优先取 `execute`;同时存在 execute/quick 时,execute 会覆盖 quick。`noWorktree` 只要任一匹配 change 的 `no_worktree = 1` 就出现。
80
+
81
+ 消费者:`src/hooks/worktree-guard.js`。hook 会先读 gate 文件,再 fallback 到 sqlite3 CLI 查询 `sillyspec.db`。
82
+
83
+ ## `user-inputs.md`
84
+
85
+ 位置:`.sillyspec/.runtime/user-inputs.md`
86
+
87
+ 创建方:`ProgressManager.init()`。
88
+
89
+ 追加方:`run.js` 的 `completeStep()`。当 `sillyspec run <stage> --done --output ...` 携带 output 时,按当前 change/stage/step 追加记录。
90
+
91
+ 每条记录形态:
92
+
93
+ ```markdown
94
+ ## <时间> | <change> | <stage>: <step-name>
95
+ - 输入:<inputText>
96
+ - 输出:<outputText>
97
+ ```
98
+
99
+ 如果 output 超过 200 字,step 表中只保存截断摘要,但 `user-inputs.md` 保存完整 output。
100
+
101
+ ## `artifacts/`
102
+
103
+ 位置:
104
+
105
+ - 本地模式:`.sillyspec/.runtime/artifacts/`
106
+ - 平台 scan 且传入 `--runtime-root`:`<runtime-root>/scan-runs/<scan-run-id>/`
107
+
108
+ 写入方:`run.js completeStep()`。
109
+
110
+ 触发条件:`--output` 长度超过 200 字。
111
+
112
+ 文件名:
113
+
114
+ ```text
115
+ <change>-<stage>-step<N>-<YYYYMMDDHHMMSS>.txt
116
+ ```
117
+
118
+ 注意:artifact 路径由 `completeStep()` 处理;这不等同于 workflow run 归档路径。
119
+
120
+ ## `history/`
121
+
122
+ 位置:`.sillyspec/.runtime/history/`
123
+
124
+ 写入方:`ProgressManager.completeStage()`。
125
+
126
+ 文件名:
127
+
128
+ ```text
129
+ <change>-<stage>-<timestamp>.json
130
+ ```
131
+
132
+ `sillyspec run <stage> --done` 的普通流程不直接调用 `completeStage()`;它通过 `_write()` 更新 DB。只有使用 `sillyspec progress complete-stage <stage>` 这类 progress 子命令时会写 history 文件。
133
+
134
+ ## `local.yaml` 路径口径
135
+
136
+ 当前主配置口径已经统一到:
137
+
138
+ ```text
139
+ .sillyspec/local.yaml
140
+ ```
141
+
142
+ | 位置 | 代码/提示 | 当前行为 |
143
+ |---|---|---|
144
+ | `.sillyspec/local.yaml` | `init.js` gitignore、`scan.js` prompt、`sync.js`、多个阶段 prompt | 平台配置、本地命令配置、hook 扩展白名单的主入口 |
145
+ | `.sillyspec/local.yml` | `worktree-guard.js loadLocalConfig()` | hook 兼容读取 |
146
+ | `local.yaml` / `local.yml`(项目根) | `worktree-guard.js loadLocalConfig()` | hook fallback 兼容旧配置 |
147
+
148
+ 因此,文档可以把 `.sillyspec/local.yaml` 写成当前稳定主入口,但不能删除根目录 `local.yaml` / `local.yml` 的兼容说明。