sillyspec 3.27.2 → 3.27.6

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 (398) hide show
  1. package/.claude/skills/sillyspec-execute/SKILL.md +8 -0
  2. package/.claude/skills/sillyspec-quick/SKILL.md +2 -1
  3. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-archive/SKILL.md +87 -0
  4. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-auto/SKILL.md +93 -0
  5. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-brainstorm/SKILL.md +114 -0
  6. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-commit/SKILL.md +67 -0
  7. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-continue/SKILL.md +47 -0
  8. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-doctor/SKILL.md +76 -0
  9. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-execute/SKILL.md +214 -0
  10. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-explore/SKILL.md +102 -0
  11. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-export/SKILL.md +57 -0
  12. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-init/SKILL.md +177 -0
  13. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-knowledge/SKILL.md +270 -0
  14. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-plan/SKILL.md +156 -0
  15. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-quick/SKILL.md +116 -0
  16. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-resume/SKILL.md +70 -0
  17. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-scan/SKILL.md +79 -0
  18. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-state/SKILL.md +64 -0
  19. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-status/SKILL.md +54 -0
  20. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-verify/SKILL.md +87 -0
  21. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-workspace/SKILL.md +175 -0
  22. package/.claude/worktrees/sillyspec-data-model-research/.gitattributes +2 -0
  23. package/.claude/worktrees/sillyspec-data-model-research/.husky/pre-push +20 -0
  24. package/.claude/worktrees/sillyspec-data-model-research/README.md +203 -0
  25. package/.claude/worktrees/sillyspec-data-model-research/SKILL.md +91 -0
  26. package/.claude/worktrees/sillyspec-data-model-research/bin/sillyspec.js +2 -0
  27. package/.claude/worktrees/sillyspec-data-model-research/logo.jpg +0 -0
  28. package/.claude/worktrees/sillyspec-data-model-research/package-lock.json +977 -0
  29. package/.claude/worktrees/sillyspec-data-model-research/package.json +39 -0
  30. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/assets/index-Bq_Z2hne.js +7446 -0
  31. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/assets/index-O2W5RV4z.css +1 -0
  32. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/favicon.jpg +0 -0
  33. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/index.html +16 -0
  34. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/logo.jpg +0 -0
  35. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/prototype-dashboard.html +836 -0
  36. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/prototype-overview.html +256 -0
  37. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/package.json +25 -0
  38. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/server/executor.js +95 -0
  39. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/server/index.js +679 -0
  40. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/server/parser.js +526 -0
  41. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/server/watcher.js +357 -0
  42. package/.claude/worktrees/sillyspec-data-model-research/src/agent-session-log.js +803 -0
  43. package/.claude/worktrees/sillyspec-data-model-research/src/change-list.js +290 -0
  44. package/.claude/worktrees/sillyspec-data-model-research/src/change-risk-profile.js +270 -0
  45. package/.claude/worktrees/sillyspec-data-model-research/src/check-primitives.js +65 -0
  46. package/.claude/worktrees/sillyspec-data-model-research/src/classify-change.js +109 -0
  47. package/.claude/worktrees/sillyspec-data-model-research/src/commit-suggest.js +202 -0
  48. package/.claude/worktrees/sillyspec-data-model-research/src/config-cat.js +88 -0
  49. package/.claude/worktrees/sillyspec-data-model-research/src/config-schema.js +328 -0
  50. package/.claude/worktrees/sillyspec-data-model-research/src/constants.js +97 -0
  51. package/.claude/worktrees/sillyspec-data-model-research/src/contract-matrix.js +480 -0
  52. package/.claude/worktrees/sillyspec-data-model-research/src/datetime.js +20 -0
  53. package/.claude/worktrees/sillyspec-data-model-research/src/db-engine.js +55 -0
  54. package/.claude/worktrees/sillyspec-data-model-research/src/db.js +381 -0
  55. package/.claude/worktrees/sillyspec-data-model-research/src/decision-distill.js +517 -0
  56. package/.claude/worktrees/sillyspec-data-model-research/src/dispatch/backends/local-agent.js +155 -0
  57. package/.claude/worktrees/sillyspec-data-model-research/src/dispatch/backends/sillyhub-mcp.js +245 -0
  58. package/.claude/worktrees/sillyspec-data-model-research/src/dispatch/probe.js +246 -0
  59. package/.claude/worktrees/sillyspec-data-model-research/src/dispatch/strategy.js +121 -0
  60. package/.claude/worktrees/sillyspec-data-model-research/src/docs-check.js +825 -0
  61. package/.claude/worktrees/sillyspec-data-model-research/src/docs-debt.js +393 -0
  62. package/.claude/worktrees/sillyspec-data-model-research/src/docs-gate.js +107 -0
  63. package/.claude/worktrees/sillyspec-data-model-research/src/doctor-diagnostics.js +1099 -0
  64. package/.claude/worktrees/sillyspec-data-model-research/src/endpoint-extractor.js +420 -0
  65. package/.claude/worktrees/sillyspec-data-model-research/src/foreign-declared.js +78 -0
  66. package/.claude/worktrees/sillyspec-data-model-research/src/fs-atomic.js +73 -0
  67. package/.claude/worktrees/sillyspec-data-model-research/src/git-helper.js +150 -0
  68. package/.claude/worktrees/sillyspec-data-model-research/src/hooks/claude-pre-tool-use.cjs +130 -0
  69. package/.claude/worktrees/sillyspec-data-model-research/src/hooks/worktree-guard.js +892 -0
  70. package/.claude/worktrees/sillyspec-data-model-research/src/index.js +2798 -0
  71. package/.claude/worktrees/sillyspec-data-model-research/src/init.js +626 -0
  72. package/.claude/worktrees/sillyspec-data-model-research/src/knowledge-match.js +231 -0
  73. package/.claude/worktrees/sillyspec-data-model-research/src/local-detect.js +128 -0
  74. package/.claude/worktrees/sillyspec-data-model-research/src/local-register.js +104 -0
  75. package/.claude/worktrees/sillyspec-data-model-research/src/machine-interface.js +543 -0
  76. package/.claude/worktrees/sillyspec-data-model-research/src/migrate.js +127 -0
  77. package/.claude/worktrees/sillyspec-data-model-research/src/module-impact.js +166 -0
  78. package/.claude/worktrees/sillyspec-data-model-research/src/module-resolve.js +222 -0
  79. package/.claude/worktrees/sillyspec-data-model-research/src/modules.js +580 -0
  80. package/.claude/worktrees/sillyspec-data-model-research/src/progress/change-registry.js +336 -0
  81. package/.claude/worktrees/sillyspec-data-model-research/src/progress/consistency-doctor.js +355 -0
  82. package/.claude/worktrees/sillyspec-data-model-research/src/progress/shared.js +36 -0
  83. package/.claude/worktrees/sillyspec-data-model-research/src/progress/stage-machine.js +594 -0
  84. package/.claude/worktrees/sillyspec-data-model-research/src/progress/step-store.js +265 -0
  85. package/.claude/worktrees/sillyspec-data-model-research/src/progress.js +1304 -0
  86. package/.claude/worktrees/sillyspec-data-model-research/src/quick-recommend.js +115 -0
  87. package/.claude/worktrees/sillyspec-data-model-research/src/quicklog.js +852 -0
  88. package/.claude/worktrees/sillyspec-data-model-research/src/review-tier.js +77 -0
  89. package/.claude/worktrees/sillyspec-data-model-research/src/run/command.js +1595 -0
  90. package/.claude/worktrees/sillyspec-data-model-research/src/run/complete-handlers.js +1552 -0
  91. package/.claude/worktrees/sillyspec-data-model-research/src/run/complete.js +1259 -0
  92. package/.claude/worktrees/sillyspec-data-model-research/src/run/concurrent-detect.js +156 -0
  93. package/.claude/worktrees/sillyspec-data-model-research/src/run/gates.js +1084 -0
  94. package/.claude/worktrees/sillyspec-data-model-research/src/run/multi-repo-context.js +208 -0
  95. package/.claude/worktrees/sillyspec-data-model-research/src/run/next.js +128 -0
  96. package/.claude/worktrees/sillyspec-data-model-research/src/run/prompt.js +843 -0
  97. package/.claude/worktrees/sillyspec-data-model-research/src/run/quick-audit.js +186 -0
  98. package/.claude/worktrees/sillyspec-data-model-research/src/run/scan-profile.js +269 -0
  99. package/.claude/worktrees/sillyspec-data-model-research/src/run/shared.js +1562 -0
  100. package/.claude/worktrees/sillyspec-data-model-research/src/run/stage.js +584 -0
  101. package/.claude/worktrees/sillyspec-data-model-research/src/run.js +23 -0
  102. package/.claude/worktrees/sillyspec-data-model-research/src/scan-diff.js +388 -0
  103. package/.claude/worktrees/sillyspec-data-model-research/src/scan-postcheck.js +512 -0
  104. package/.claude/worktrees/sillyspec-data-model-research/src/scan-staleness.js +95 -0
  105. package/.claude/worktrees/sillyspec-data-model-research/src/setup.js +414 -0
  106. package/.claude/worktrees/sillyspec-data-model-research/src/sillyhub-mcp/client.js +597 -0
  107. package/.claude/worktrees/sillyspec-data-model-research/src/sillyhub-mcp/config.js +62 -0
  108. package/.claude/worktrees/sillyspec-data-model-research/src/spec-dir-typo.js +50 -0
  109. package/.claude/worktrees/sillyspec-data-model-research/src/spec-sync.js +358 -0
  110. package/.claude/worktrees/sillyspec-data-model-research/src/stage-contract-engine.js +171 -0
  111. package/.claude/worktrees/sillyspec-data-model-research/src/stage-contract-spec.js +550 -0
  112. package/.claude/worktrees/sillyspec-data-model-research/src/stage-contract.js +889 -0
  113. package/.claude/worktrees/sillyspec-data-model-research/src/stage-review.js +597 -0
  114. package/.claude/worktrees/sillyspec-data-model-research/src/stages/archive.js +199 -0
  115. package/.claude/worktrees/sillyspec-data-model-research/src/stages/brainstorm-auto.js +236 -0
  116. package/.claude/worktrees/sillyspec-data-model-research/src/stages/brainstorm.js +617 -0
  117. package/.claude/worktrees/sillyspec-data-model-research/src/stages/cmd-existence.js +145 -0
  118. package/.claude/worktrees/sillyspec-data-model-research/src/stages/doctor.js +540 -0
  119. package/.claude/worktrees/sillyspec-data-model-research/src/stages/execute.js +1275 -0
  120. package/.claude/worktrees/sillyspec-data-model-research/src/stages/explore.js +43 -0
  121. package/.claude/worktrees/sillyspec-data-model-research/src/stages/index.js +29 -0
  122. package/.claude/worktrees/sillyspec-data-model-research/src/stages/knowledge.js +514 -0
  123. package/.claude/worktrees/sillyspec-data-model-research/src/stages/plan-postcheck.js +1344 -0
  124. package/.claude/worktrees/sillyspec-data-model-research/src/stages/plan.js +650 -0
  125. package/.claude/worktrees/sillyspec-data-model-research/src/stages/quick.js +167 -0
  126. package/.claude/worktrees/sillyspec-data-model-research/src/stages/scan.js +608 -0
  127. package/.claude/worktrees/sillyspec-data-model-research/src/stages/status.js +64 -0
  128. package/.claude/worktrees/sillyspec-data-model-research/src/stages/verify.js +246 -0
  129. package/.claude/worktrees/sillyspec-data-model-research/src/sync.js +1470 -0
  130. package/.claude/worktrees/sillyspec-data-model-research/src/task-review.js +1498 -0
  131. package/.claude/worktrees/sillyspec-data-model-research/src/taskcard.js +210 -0
  132. package/.claude/worktrees/sillyspec-data-model-research/src/verify-postcheck.js +1718 -0
  133. package/.claude/worktrees/sillyspec-data-model-research/src/verify-probes.js +277 -0
  134. package/.claude/worktrees/sillyspec-data-model-research/src/version.js +19 -0
  135. package/.claude/worktrees/sillyspec-data-model-research/src/workflow.js +600 -0
  136. package/.claude/worktrees/sillyspec-data-model-research/src/workspace.js +125 -0
  137. package/.claude/worktrees/sillyspec-data-model-research/src/worktree-apply.js +1446 -0
  138. package/.claude/worktrees/sillyspec-data-model-research/src/worktree-deps.js +576 -0
  139. package/.claude/worktrees/sillyspec-data-model-research/src/worktree.js +1715 -0
  140. package/.claude/worktrees/sillyspec-data-model-research/templates/claude-instruction.md +23 -0
  141. package/.claude/worktrees/sillyspec-data-model-research/templates/prompts/taskcard-rules.md +28 -0
  142. package/.claude/worktrees/sillyspec-data-model-research/templates/prompts/testcase-design.md +12 -0
  143. package/.claude/worktrees/sillyspec-data-model-research/templates/prompts/verify-probes.md +32 -0
  144. package/.claude/worktrees/sillyspec-data-model-research/templates/workflows/archive-impact.yaml +79 -0
  145. package/.claude/worktrees/sillyspec-data-model-research/templates/workflows/scan-docs.yaml +132 -0
  146. package/.worktrees/8d2d0392/.claude/skills/sillyspec-archive/SKILL.md +87 -0
  147. package/.worktrees/8d2d0392/.claude/skills/sillyspec-auto/SKILL.md +93 -0
  148. package/.worktrees/8d2d0392/.claude/skills/sillyspec-brainstorm/SKILL.md +114 -0
  149. package/.worktrees/8d2d0392/.claude/skills/sillyspec-commit/SKILL.md +67 -0
  150. package/.worktrees/8d2d0392/.claude/skills/sillyspec-continue/SKILL.md +47 -0
  151. package/.worktrees/8d2d0392/.claude/skills/sillyspec-doctor/SKILL.md +76 -0
  152. package/.worktrees/8d2d0392/.claude/skills/sillyspec-execute/SKILL.md +214 -0
  153. package/.worktrees/8d2d0392/.claude/skills/sillyspec-explore/SKILL.md +102 -0
  154. package/.worktrees/8d2d0392/.claude/skills/sillyspec-export/SKILL.md +57 -0
  155. package/.worktrees/8d2d0392/.claude/skills/sillyspec-init/SKILL.md +177 -0
  156. package/.worktrees/8d2d0392/.claude/skills/sillyspec-knowledge/SKILL.md +270 -0
  157. package/.worktrees/8d2d0392/.claude/skills/sillyspec-plan/SKILL.md +156 -0
  158. package/.worktrees/8d2d0392/.claude/skills/sillyspec-propose/SKILL.md +87 -0
  159. package/.worktrees/8d2d0392/.claude/skills/sillyspec-quick/SKILL.md +116 -0
  160. package/.worktrees/8d2d0392/.claude/skills/sillyspec-resume/SKILL.md +70 -0
  161. package/.worktrees/8d2d0392/.claude/skills/sillyspec-scan/SKILL.md +79 -0
  162. package/.worktrees/8d2d0392/.claude/skills/sillyspec-state/SKILL.md +64 -0
  163. package/.worktrees/8d2d0392/.claude/skills/sillyspec-status/SKILL.md +54 -0
  164. package/.worktrees/8d2d0392/.claude/skills/sillyspec-verify/SKILL.md +87 -0
  165. package/.worktrees/8d2d0392/.claude/skills/sillyspec-workspace/SKILL.md +175 -0
  166. package/.worktrees/8d2d0392/.claude/skills/verify-per-user/SKILL.md +6 -0
  167. package/.worktrees/8d2d0392/.gitattributes +2 -0
  168. package/.worktrees/8d2d0392/.husky/pre-push +20 -0
  169. package/.worktrees/8d2d0392/README.md +203 -0
  170. package/.worktrees/8d2d0392/SKILL.md +91 -0
  171. package/.worktrees/8d2d0392/architecture-analysis.md +448 -0
  172. package/.worktrees/8d2d0392/bin/sillyspec.js +2 -0
  173. package/.worktrees/8d2d0392/eval/README.md +86 -0
  174. package/.worktrees/8d2d0392/eval/eval.config.json +28 -0
  175. package/.worktrees/8d2d0392/eval/lib/adapters/cli.mjs +63 -0
  176. package/.worktrees/8d2d0392/eval/lib/adapters/dryrun.mjs +27 -0
  177. package/.worktrees/8d2d0392/eval/lib/config.mjs +82 -0
  178. package/.worktrees/8d2d0392/eval/lib/db.mjs +76 -0
  179. package/.worktrees/8d2d0392/eval/lib/report.mjs +120 -0
  180. package/.worktrees/8d2d0392/eval/lib/runner.mjs +157 -0
  181. package/.worktrees/8d2d0392/eval/lib/tasks.mjs +73 -0
  182. package/.worktrees/8d2d0392/eval/lib/util.mjs +107 -0
  183. package/.worktrees/8d2d0392/eval/lib/workdir.mjs +30 -0
  184. package/.worktrees/8d2d0392/eval/run.mjs +83 -0
  185. package/.worktrees/8d2d0392/eval/tasks/001-slugify/files/package.json +6 -0
  186. package/.worktrees/8d2d0392/eval/tasks/001-slugify/solution/src/slugify.mjs +26 -0
  187. package/.worktrees/8d2d0392/eval/tasks/001-slugify/task.json +6 -0
  188. package/.worktrees/8d2d0392/eval/tasks/001-slugify/verify.mjs +28 -0
  189. package/.worktrees/8d2d0392/eval/tasks/002-each-day/files/package.json +6 -0
  190. package/.worktrees/8d2d0392/eval/tasks/002-each-day/files/src/dates.mjs +4 -0
  191. package/.worktrees/8d2d0392/eval/tasks/002-each-day/solution/src/dates.mjs +30 -0
  192. package/.worktrees/8d2d0392/eval/tasks/002-each-day/task.json +6 -0
  193. package/.worktrees/8d2d0392/eval/tasks/002-each-day/verify.mjs +31 -0
  194. package/.worktrees/8d2d0392/eval/tasks/003-word-report/files/data/notes.txt +5 -0
  195. package/.worktrees/8d2d0392/eval/tasks/003-word-report/files/package.json +6 -0
  196. package/.worktrees/8d2d0392/eval/tasks/003-word-report/solution/bin/report.mjs +36 -0
  197. package/.worktrees/8d2d0392/eval/tasks/003-word-report/task.json +6 -0
  198. package/.worktrees/8d2d0392/eval/tasks/003-word-report/verify.mjs +38 -0
  199. package/.worktrees/8d2d0392/logo.jpg +0 -0
  200. package/.worktrees/8d2d0392/package-lock.json +977 -0
  201. package/.worktrees/8d2d0392/package.json +41 -0
  202. package/.worktrees/8d2d0392/packages/dashboard/dist/assets/index-Bq_Z2hne.js +7446 -0
  203. package/.worktrees/8d2d0392/packages/dashboard/dist/assets/index-O2W5RV4z.css +1 -0
  204. package/.worktrees/8d2d0392/packages/dashboard/dist/favicon.jpg +0 -0
  205. package/.worktrees/8d2d0392/packages/dashboard/dist/index.html +16 -0
  206. package/.worktrees/8d2d0392/packages/dashboard/dist/logo.jpg +0 -0
  207. package/.worktrees/8d2d0392/packages/dashboard/dist/prototype-dashboard.html +836 -0
  208. package/.worktrees/8d2d0392/packages/dashboard/dist/prototype-overview.html +256 -0
  209. package/.worktrees/8d2d0392/packages/dashboard/package.json +25 -0
  210. package/.worktrees/8d2d0392/packages/dashboard/server/executor.js +95 -0
  211. package/.worktrees/8d2d0392/packages/dashboard/server/index.js +679 -0
  212. package/.worktrees/8d2d0392/packages/dashboard/server/parser.js +526 -0
  213. package/.worktrees/8d2d0392/packages/dashboard/server/watcher.js +357 -0
  214. package/.worktrees/8d2d0392/src/agent-session-log.js +803 -0
  215. package/.worktrees/8d2d0392/src/change-list.js +290 -0
  216. package/.worktrees/8d2d0392/src/change-risk-profile.js +339 -0
  217. package/.worktrees/8d2d0392/src/check-primitives.js +65 -0
  218. package/.worktrees/8d2d0392/src/classify-change.js +109 -0
  219. package/.worktrees/8d2d0392/src/commit-suggest.js +202 -0
  220. package/.worktrees/8d2d0392/src/config-cat.js +88 -0
  221. package/.worktrees/8d2d0392/src/config-schema.js +328 -0
  222. package/.worktrees/8d2d0392/src/constants.js +97 -0
  223. package/.worktrees/8d2d0392/src/contract-matrix.js +533 -0
  224. package/.worktrees/8d2d0392/src/datetime.js +20 -0
  225. package/.worktrees/8d2d0392/src/db-engine.js +55 -0
  226. package/.worktrees/8d2d0392/src/db.js +381 -0
  227. package/.worktrees/8d2d0392/src/decision-distill.js +517 -0
  228. package/.worktrees/8d2d0392/src/dispatch/backends/local-agent.js +155 -0
  229. package/.worktrees/8d2d0392/src/dispatch/backends/sillyhub-mcp.js +245 -0
  230. package/.worktrees/8d2d0392/src/dispatch/probe.js +246 -0
  231. package/.worktrees/8d2d0392/src/dispatch/strategy.js +121 -0
  232. package/.worktrees/8d2d0392/src/docs-check.js +825 -0
  233. package/.worktrees/8d2d0392/src/docs-debt.js +393 -0
  234. package/.worktrees/8d2d0392/src/docs-gate.js +107 -0
  235. package/.worktrees/8d2d0392/src/doctor-diagnostics.js +1099 -0
  236. package/.worktrees/8d2d0392/src/endpoint-extractor.js +409 -0
  237. package/.worktrees/8d2d0392/src/foreign-declared.js +78 -0
  238. package/.worktrees/8d2d0392/src/fs-atomic.js +73 -0
  239. package/.worktrees/8d2d0392/src/git-helper.js +150 -0
  240. package/.worktrees/8d2d0392/src/hooks/claude-pre-tool-use.cjs +130 -0
  241. package/.worktrees/8d2d0392/src/hooks/worktree-guard.js +892 -0
  242. package/.worktrees/8d2d0392/src/index.js +2854 -0
  243. package/.worktrees/8d2d0392/src/init.js +626 -0
  244. package/.worktrees/8d2d0392/src/knowledge-match.js +231 -0
  245. package/.worktrees/8d2d0392/src/local-detect.js +128 -0
  246. package/.worktrees/8d2d0392/src/local-register.js +104 -0
  247. package/.worktrees/8d2d0392/src/machine-interface.js +543 -0
  248. package/.worktrees/8d2d0392/src/migrate.js +127 -0
  249. package/.worktrees/8d2d0392/src/module-impact.js +166 -0
  250. package/.worktrees/8d2d0392/src/module-resolve.js +222 -0
  251. package/.worktrees/8d2d0392/src/modules.js +580 -0
  252. package/.worktrees/8d2d0392/src/plan-adopt-waves.js +126 -0
  253. package/.worktrees/8d2d0392/src/progress/change-registry.js +336 -0
  254. package/.worktrees/8d2d0392/src/progress/consistency-doctor.js +355 -0
  255. package/.worktrees/8d2d0392/src/progress/shared.js +36 -0
  256. package/.worktrees/8d2d0392/src/progress/stage-machine.js +594 -0
  257. package/.worktrees/8d2d0392/src/progress/step-store.js +265 -0
  258. package/.worktrees/8d2d0392/src/progress.js +1304 -0
  259. package/.worktrees/8d2d0392/src/quick-recommend.js +115 -0
  260. package/.worktrees/8d2d0392/src/quicklog.js +883 -0
  261. package/.worktrees/8d2d0392/src/review-tier.js +77 -0
  262. package/.worktrees/8d2d0392/src/run/command.js +1641 -0
  263. package/.worktrees/8d2d0392/src/run/complete-handlers.js +1552 -0
  264. package/.worktrees/8d2d0392/src/run/complete.js +1259 -0
  265. package/.worktrees/8d2d0392/src/run/concurrent-detect.js +156 -0
  266. package/.worktrees/8d2d0392/src/run/gates.js +1094 -0
  267. package/.worktrees/8d2d0392/src/run/multi-repo-context.js +208 -0
  268. package/.worktrees/8d2d0392/src/run/next.js +128 -0
  269. package/.worktrees/8d2d0392/src/run/prompt.js +843 -0
  270. package/.worktrees/8d2d0392/src/run/quick-audit.js +186 -0
  271. package/.worktrees/8d2d0392/src/run/scan-profile.js +269 -0
  272. package/.worktrees/8d2d0392/src/run/shared.js +1562 -0
  273. package/.worktrees/8d2d0392/src/run/stage.js +587 -0
  274. package/.worktrees/8d2d0392/src/run.js +23 -0
  275. package/.worktrees/8d2d0392/src/scan-diff.js +388 -0
  276. package/.worktrees/8d2d0392/src/scan-postcheck.js +524 -0
  277. package/.worktrees/8d2d0392/src/scan-staleness.js +95 -0
  278. package/.worktrees/8d2d0392/src/setup.js +414 -0
  279. package/.worktrees/8d2d0392/src/sillyhub-mcp/client.js +597 -0
  280. package/.worktrees/8d2d0392/src/sillyhub-mcp/config.js +62 -0
  281. package/.worktrees/8d2d0392/src/spec-dir-typo.js +50 -0
  282. package/.worktrees/8d2d0392/src/spec-sync.js +358 -0
  283. package/.worktrees/8d2d0392/src/stage-contract-engine.js +171 -0
  284. package/.worktrees/8d2d0392/src/stage-contract-spec.js +551 -0
  285. package/.worktrees/8d2d0392/src/stage-contract.js +948 -0
  286. package/.worktrees/8d2d0392/src/stage-review.js +597 -0
  287. package/.worktrees/8d2d0392/src/stages/archive.js +199 -0
  288. package/.worktrees/8d2d0392/src/stages/brainstorm-auto.js +285 -0
  289. package/.worktrees/8d2d0392/src/stages/brainstorm.js +624 -0
  290. package/.worktrees/8d2d0392/src/stages/cmd-existence.js +145 -0
  291. package/.worktrees/8d2d0392/src/stages/doctor.js +540 -0
  292. package/.worktrees/8d2d0392/src/stages/execute.js +1277 -0
  293. package/.worktrees/8d2d0392/src/stages/explore.js +43 -0
  294. package/.worktrees/8d2d0392/src/stages/index.js +29 -0
  295. package/.worktrees/8d2d0392/src/stages/knowledge.js +514 -0
  296. package/.worktrees/8d2d0392/src/stages/plan-postcheck.js +1398 -0
  297. package/.worktrees/8d2d0392/src/stages/plan.js +651 -0
  298. package/.worktrees/8d2d0392/src/stages/quick.js +167 -0
  299. package/.worktrees/8d2d0392/src/stages/scan.js +608 -0
  300. package/.worktrees/8d2d0392/src/stages/status.js +64 -0
  301. package/.worktrees/8d2d0392/src/stages/verify.js +246 -0
  302. package/.worktrees/8d2d0392/src/sync.js +1470 -0
  303. package/.worktrees/8d2d0392/src/task-review.js +1498 -0
  304. package/.worktrees/8d2d0392/src/taskcard-placeholders.js +21 -0
  305. package/.worktrees/8d2d0392/src/taskcard.js +217 -0
  306. package/.worktrees/8d2d0392/src/verify-postcheck.js +1718 -0
  307. package/.worktrees/8d2d0392/src/verify-probes.js +327 -0
  308. package/.worktrees/8d2d0392/src/version.js +19 -0
  309. package/.worktrees/8d2d0392/src/workflow.js +600 -0
  310. package/.worktrees/8d2d0392/src/workspace.js +125 -0
  311. package/.worktrees/8d2d0392/src/worktree-apply.js +1611 -0
  312. package/.worktrees/8d2d0392/src/worktree-deps.js +576 -0
  313. package/.worktrees/8d2d0392/src/worktree.js +1838 -0
  314. package/.worktrees/8d2d0392/templates/claude-instruction.md +23 -0
  315. package/.worktrees/8d2d0392/templates/prompts/taskcard-rules.md +29 -0
  316. package/.worktrees/8d2d0392/templates/prompts/testcase-design.md +12 -0
  317. package/.worktrees/8d2d0392/templates/prompts/verify-probes.md +32 -0
  318. package/.worktrees/8d2d0392/templates/workflows/archive-impact.yaml +79 -0
  319. package/.worktrees/8d2d0392/templates/workflows/scan-docs.yaml +132 -0
  320. package/architecture-analysis.md +448 -0
  321. package/eval/README.md +86 -0
  322. package/eval/eval.config.json +28 -0
  323. package/eval/lib/adapters/cli.mjs +63 -0
  324. package/eval/lib/adapters/dryrun.mjs +27 -0
  325. package/eval/lib/config.mjs +82 -0
  326. package/eval/lib/db.mjs +76 -0
  327. package/eval/lib/report.mjs +120 -0
  328. package/eval/lib/runner.mjs +157 -0
  329. package/eval/lib/tasks.mjs +73 -0
  330. package/eval/lib/util.mjs +107 -0
  331. package/eval/lib/workdir.mjs +30 -0
  332. package/eval/run.mjs +83 -0
  333. package/eval/tasks/001-slugify/files/package.json +6 -0
  334. package/eval/tasks/001-slugify/solution/src/slugify.mjs +26 -0
  335. package/eval/tasks/001-slugify/task.json +6 -0
  336. package/eval/tasks/001-slugify/verify.mjs +28 -0
  337. package/eval/tasks/002-each-day/files/package.json +6 -0
  338. package/eval/tasks/002-each-day/files/src/dates.mjs +4 -0
  339. package/eval/tasks/002-each-day/solution/src/dates.mjs +30 -0
  340. package/eval/tasks/002-each-day/task.json +6 -0
  341. package/eval/tasks/002-each-day/verify.mjs +31 -0
  342. package/eval/tasks/003-word-report/files/data/notes.txt +5 -0
  343. package/eval/tasks/003-word-report/files/package.json +6 -0
  344. package/eval/tasks/003-word-report/solution/bin/report.mjs +36 -0
  345. package/eval/tasks/003-word-report/task.json +6 -0
  346. package/eval/tasks/003-word-report/verify.mjs +38 -0
  347. package/package.json +4 -2
  348. package/src/agent-session-log.js +45 -5
  349. package/src/change-risk-profile.js +83 -14
  350. package/src/config-schema.js +18 -3
  351. package/src/contract-matrix.js +90 -29
  352. package/src/datetime.js +20 -0
  353. package/src/decision-distill.js +517 -0
  354. package/src/dispatch/backends/local-agent.js +4 -4
  355. package/src/docs-check.js +227 -0
  356. package/src/docs-debt.js +187 -24
  357. package/src/doctor-diagnostics.js +102 -2
  358. package/src/endpoint-extractor.js +41 -52
  359. package/src/foreign-declared.js +155 -0
  360. package/src/index.js +95 -13
  361. package/src/init.js +9 -7
  362. package/src/knowledge-match.js +107 -6
  363. package/src/local-register.js +7 -1
  364. package/src/module-resolve.js +12 -1
  365. package/src/modules.js +2 -1
  366. package/src/plan-adopt-waves.js +126 -0
  367. package/src/quicklog.js +50 -4
  368. package/src/run/command.js +124 -44
  369. package/src/run/complete-handlers.js +48 -19
  370. package/src/run/complete.js +5 -2
  371. package/src/run/gates.js +104 -22
  372. package/src/run/prompt.js +84 -42
  373. package/src/run/quick-audit.js +11 -0
  374. package/src/run/shared.js +152 -10
  375. package/src/run/stage.js +8 -5
  376. package/src/run.js +2 -2
  377. package/src/scan-postcheck.js +30 -17
  378. package/src/stage-contract-spec.js +3 -2
  379. package/src/stage-contract.js +68 -4
  380. package/src/stages/archive.js +53 -12
  381. package/src/stages/brainstorm-auto.js +50 -1
  382. package/src/stages/brainstorm.js +13 -0
  383. package/src/stages/doctor.js +157 -1
  384. package/src/stages/execute.js +32 -6
  385. package/src/stages/plan-postcheck.js +76 -17
  386. package/src/stages/plan.js +9 -4
  387. package/src/stages/quick.js +6 -1
  388. package/src/stages/verify.js +32 -15
  389. package/src/sync.js +41 -3
  390. package/src/task-review.js +2 -2
  391. package/src/taskcard-placeholders.js +21 -0
  392. package/src/taskcard.js +43 -1
  393. package/src/verify-postcheck.js +315 -13
  394. package/src/verify-probes.js +73 -10
  395. package/src/worktree-apply.js +569 -227
  396. package/src/worktree-deps.js +150 -1
  397. package/src/worktree.js +285 -77
  398. package/templates/prompts/taskcard-rules.md +2 -1
@@ -0,0 +1,199 @@
1
+ export const definition = {
2
+ name: 'archive',
3
+ title: '归档变更',
4
+ description: '规范沉淀,可追溯',
5
+ steps: [
6
+ {
7
+ name: '任务完成度检查',
8
+ prompt: `检查任务完成度,决定是否可归档。
9
+
10
+ ### 客观完成度报告(CLI 已注入,勿自行数 checkbox)
11
+ {TASK_COMPLETION_REPORT}
12
+
13
+ ### 判定规则
14
+ - **真相源 = review.json verdict**:上方报告由 CLI 从 .runtime/execute-runs/<runId>/tasks/task-NN/review.json 的 specVerdict + qualityVerdict 算出。
15
+ - tasks.md 的 - [x] checkbox **仅作显示态参考**:它依赖自动回填,runId marker / review 缺失时会停在未勾态,与客观 verdict 不一致时**以本报告为准**,不要被未勾 checkbox 误导。
16
+ - 报告「未通过 / 缺失」= 0 且 source 为 review.json → 完成度合格,进入下一步。
17
+ - 报告含「cannot_verify 草稿(未真正复核)」计数 > 0 → 这些 task 只有 cannot_verify 草稿兜底、未被真正复核:先确认 verify 阶段已兑现其 requiredEvidence(verify-result.md 有对应证据),缺证据的派独立子代理对照 task brief + git diff 补真实复核(升级为 pass/fail),勿静默放行。
18
+ - 报告 source 为 plan-checkbox-fallback(客观源不可用)→ 完成度无法客观确认,**必须暂停**让用户交叉核对,不要直接放行。
19
+ - 存在未完成任务 → **必须暂停等待用户决定**,不要自行判断"可以归档"。
20
+ - 调用:sillyspec run archive --wait --reason "存在未完成任务,是否继续归档" --options "继续归档,回到execute完成剩余任务" --output "未完成任务列表"
21
+
22
+ ### 输出
23
+ 完成度报告(已通过/总数 + 数据源 + 未完成任务列表)`,
24
+ outputHint: '完成度报告',
25
+ optional: false
26
+ },
27
+ {
28
+ name: 'extract-module-impact',
29
+ prompt: `最终确认 changes/<change>/module-impact.md(本次变更的模块影响分析)。该文档由 plan review_plan 步生成首版、execute 各 Wave 更新、verify 核对——本步是归档前最后一次确认(module-impact 已非 archive 生成,改活文档终审)。
30
+
31
+ ### 操作
32
+ 1. 读取 changes/<change>/module-impact.md(应已存在;large 变更 plan 阶段产出首版)
33
+ 2. 运行 git diff --name-only HEAD~1(或 git diff --name-only --cached)获取真实修改文件列表
34
+ 3. 三重核对:module-impact.md 记录的受影响模块/文件 vs 真实 git diff 文件列表 vs .sillyspec/docs/<project>/modules/_module-map.yaml 模块映射(不存在则仅核 unmapped 部分)。以 git diff 为准(真实 > 记录)
35
+ 4. 发现不一致(漏标受影响模块 / 影响类型错误 / 实际未触碰的模块被误标)→ 直接修正 module-impact.md,使其与实际变更一致
36
+ 5. module-impact.md 第一行标题必须用中文:# 模块影响分析(Module Impact)— <变更简述>
37
+
38
+ ### 降级(module-impact.md 不存在)
39
+ 若缺失(如旧变更未经新 plan 流程,或 small 变更从未生成):先跑 \`sillyspec module-impact --change <change-name>\`——CLI 按 _module-map.yaml paths 前缀匹配预填「模块影响矩阵」骨架(文件×模块归属 + 未匹配文件清单,机械部分全代算),你只需逐行填「影响类型」(逻辑变更/数据结构变更/接口变更/调用关系变更/配置变更/新增)与 needs_review 标记,补首行中文标题 \`# 模块影响分析(Module Impact)— <变更简述>\`。骨架无从生成(无 module-map / 无 diff)时才按 archive-impact.yaml 的 impact-analyzer 角色规则全手写。
40
+
41
+ 确认完成后,下一步 sync-module-docs 会读 module-impact.md 更新模块卡片文档。`,
42
+ outputHint: 'module-impact.md 终审结果 + 修正摘要',
43
+ optional: false
44
+ },
45
+ {
46
+ name: 'sync-module-docs',
47
+ // conditionalWait(坑 archive-subconfirm-redundant,2026-08-23 实证:requiresWait 硬门强制
48
+ // 三段式 --wait → --continue --answer → --done,与 verify 文档同步阻断门、归档移动前死信
49
+ // 校验、下一步「确认归档 --confirm」四层确认重复,交互碎。改 conditionalWait(brainstorm-auto
50
+ // 同款先例):常规同步直接写入 + --done(agent 写入动作在 --done 前完成,坑 verify-archive-
51
+ // flow-pitfalls 坑4 的「无机会写入」不回归);仅异常(needs_review/未映射/标记缺失)才 --wait
52
+ // 请用户裁决。用户确认收敛到「确认归档 --confirm」一处。
53
+ conditionalWait: true,
54
+ repeatableWait: true,
55
+ maxWaitRounds: 3,
56
+ waitReason: '等待用户裁决模块文档同步异常',
57
+ waitOptions: ['确认写入', '跳过同步'],
58
+ prompt: `根据 module-impact.md 同步更新模块索引和卡片文档。
59
+
60
+ ### ⚠️ 核心原则:结构化事实改 _module-map.yaml,语义解释改模块卡片
61
+ - \`_module-map.yaml\` 是唯一的结构化索引源(paths/tags/entrypoints/depends_on/used_by/status/needs_review)
62
+ - 模块卡片只负责语义说明(定位/契约摘要/关键逻辑/注意事项/人工备注)
63
+ - 一个信息只维护一次,不要两边重复
64
+
65
+ ### 操作
66
+ 1. 读取 \`.sillyspec/changes/<change-name>/module-impact.md\`
67
+ 2. 如果没有受影响模块(只有 unmapped)→ 提示用户,跳过同步
68
+ 3. 对每个受影响模块,按影响类型分别更新:
69
+
70
+ #### 更新 _module-map.yaml 的规则
71
+ - **路径变化** → 更新对应模块的 paths
72
+ - **依赖变化** → 更新 depends_on / used_by(同时更新反向模块的 used_by / depends_on)
73
+ - **导出符号变化** → 更新 entrypoints / main_symbols
74
+ - **新增模块** → 添加完整条目
75
+ - **模块废弃** → status: deprecated
76
+ - **不确定的影响** → needs_review: true, review_reasons 追加原因
77
+ - 如果 _module-map.yaml 的 generated_at 已过时,更新为当前时间
78
+
79
+ #### 更新模块卡片(modules/<module-id>.md)的规则
80
+ - **契约语义变化**(新增/删除对外能力) → 更新"契约摘要"
81
+ - **关键逻辑变化** → 更新"关键逻辑"
82
+ - **边界变化**(模块职责扩大/缩小) → 更新"定位"
83
+ - **注意事项变化** → 更新"注意事项"
84
+ - **内部实现变化**(不影响对外接口) → 通常不更新卡片
85
+ - **人工备注** → 永远保护,不覆盖
86
+
87
+ #### 人工备注保护
88
+ 1. 用正则提取 \`<!-- MANUAL_NOTES_START -->\` 到 \`<!-- MANUAL_NOTES_END -->\` 之间的内容
89
+ 2. 生成新卡片后,原样回填到人工备注区域
90
+ 3. 如果标记缺失或重复 → 在 _module-map.yaml 中标记 needs_review: true
91
+
92
+ #### 新建模块卡片模板
93
+ 一级标题格式 \`# <中文名>(<module-id>)\`——中文名从模块职责提炼 2-8 字,括号内保留 module-id 原样(sillyhub 平台解析识别用,与 scan 生成约定一致)。frontmatter 已带 author/created_at 真值(<git-user>/<now-datetime> 占位符由 CLI 每步替换),照抄即过元数据校验、勿删。
94
+ \`\`\`markdown
95
+ ---
96
+ schema_version: 1
97
+ doc_type: module-card
98
+ module_id: <module-id>
99
+ author: <git-user>
100
+ created_at: <now-datetime>
101
+ ---
102
+
103
+ # <中文名>(<module-id>)
104
+
105
+ ## 定位
106
+
107
+ ## 契约摘要
108
+
109
+ ## 关键逻辑
110
+
111
+ ## 注意事项
112
+
113
+ ## 人工备注
114
+
115
+ <!-- MANUAL_NOTES_START -->
116
+
117
+ <!-- MANUAL_NOTES_END -->
118
+ \`\`\`
119
+
120
+ 4. 展示所有更新内容(diff 摘要),按同步状态分流:
121
+ - **常规**(无 needs_review 影响、无 unmapped 模块、人工备注标记齐全)→ **直接写入** _module-map.yaml 和受影响的模块卡片,diff 摘要写入 --output 后 --done(本步不单独弹确认——用户确认收敛到下一步「确认归档 --confirm」,该步展示同一 diff 摘要)
122
+ - **异常**(含 needs_review 影响项 / unmapped 模块 / 人工备注标记缺失或重复 / 覆盖会丢失手动维护字段)→ 暂停请用户裁决:
123
+ \`sillyspec run archive --wait --reason "等待用户裁决模块文档同步异常" --options "确认写入,跳过同步" --output "diff 摘要 + 异常说明"\`
124
+ 用户 --continue --answer "确认写入" 后写入;"跳过同步" 则不写入,提示 "module-impact.md 已保留,可稍后手动同步"
125
+ 5. 回填 module-impact.md 的"更新结果"表格,区分目标:
126
+ - 目标列写 "\`_module-map.yaml: <module-id>\`" 或 "\`modules/<module-id>.md\`"
127
+ 6. **同步完成后**,如需刷新 \`_module-map.yaml\` 索引:\`sillyspec modules rebuild --force\`(默认 dry-run 只预览不写;\`--force\` 才覆盖,但会清空 tags/entrypoints/main_symbols/depends_on/used_by 等手动维护字段——与 archive-impact 的「人工备注保护」约束冲突,仅当手动字段已并入骨架或可接受覆盖时用;优先手动更新 dependencies.md / 模块卡片)
128
+
129
+ ### 输出
130
+ 已更新的文件路径列表 + diff 摘要(异常时附裁决结果)`,
131
+ outputHint: '模块文档更新结果',
132
+ optional: false
133
+ },
134
+ {
135
+ name: 'decision-distill 决策提炼',
136
+ // conditionalWait(同 sync-module-docs 先例):常规提炼直接写入 + --done;仅异常(rejected
137
+ // 条目缺否决理由/复潮条件 → distillIntoKnowledge 返回 needsWait 非空)才 --wait 请用户裁决
138
+ // (补录后重跑幂等 / 跳过该条)。勿引入 requiresWait 硬门——与下一步「确认归档 --confirm」
139
+ // 重复确认(坑 archive-subconfirm-redundant)。
140
+ conditionalWait: true,
141
+ repeatableWait: true,
142
+ maxWaitRounds: 3,
143
+ waitReason: '等待用户裁决 rejected 决策缺字段',
144
+ waitOptions: ['补录后继续', '跳过该条'],
145
+ prompt: `读取变更 decisions.md,把有实现影响的决策提炼进决策知识库(提炼/幂等/INDEX 路由行本体在 CLI 纯函数 src/decision-distill.js,本步只接线,勿手工改写条目格式)。
146
+
147
+ ### 操作
148
+ 1. 定位参数:changeDir = \`.sillyspec/changes/<change-name>\`(decisions.md 所在——本步在「确认归档」移动目录之前,仍在原位);knowledgeRoot = \`.sillyspec/knowledge\`;headHash = \`git rev-parse --short HEAD\`(落条目「最近确认」)
149
+ 2. 调用纯函数 \`distillIntoKnowledge(changeDir, knowledgeRoot, headHash)\`,按返回的 \`{ written, skipped, needsWait }\` 分流(见第 3 点):
150
+ - 能解析到 sillyspec 源码/安装位置时(如 sillyspec 仓内 dogfood)直接 import 调用:\`node --input-type=module -e "import { distillIntoKnowledge } from './src/decision-distill.js'; console.log(JSON.stringify(distillIntoKnowledge(changeDir, knowledgeRoot, headHash), null, 2))"\`
151
+ - 解析不到(consumer 仓库无源码,node import 会 ERR_MODULE_NOT_FOUND)→ 按其语义执行:解析 D-xxx@vN 条目;入选规则 = 任意 type 的 status=rejected 留痕 + 五类 type(architecture/compatibility/boundary/definition/process)且 status∈{confirmed,accepted} 提炼 implemented,type=scope 不入选;条目幂等落 \`.sillyspec/knowledge/decisions/<模块域>.md\`(同 ID 同版本重写不重复追加、@vN+1 整段替换旧版并注 supersedes;「模块域」缺失按 impacts 路径与 _module-map.yaml paths 前缀匹配兜底,仍未中归 unmapped);implemented 条目写「状态:implemented + 锚点:<src 路径:行号,未记录则填"未记录"> + 最近确认:<headHash> + 理由:<一句话>」,rejected 条目写「状态:rejected + 否决理由: + 复潮条件:」;\`knowledge/INDEX.md\` 的 decisions 路由行(\`- <域>|decision|决策 → [decisions/<域>.md](decisions/<域>.md)\`)幂等增删
152
+ 3. 分流规则:
153
+ - **常规**(needsWait 为空且 written 非空)→ 写入已由函数完成,written 摘要(decisions/<域>.md × D-xxx@vN × append/update/supersede)写入 --output 后直接 --done(本步不单独弹确认——用户确认收敛到下一步「确认归档 --confirm」)
154
+ - **needsWait 非空**(rejected 条目缺否决理由/复潮条件,该条目未写盘、其余条目照常提炼)→ 暂停请用户裁决:
155
+ \`sillyspec run archive --wait --reason "等待用户裁决 rejected 决策缺字段" --options "补录后继续,跳过该条" --output "needsWait 描述 + 已提炼摘要"\`
156
+ - 「补录后继续」→ 按 needsWait 描述在 changes/<change-name>/decisions.md 补齐缺失的否决理由/复潮条件,重跑第 2 步(幂等,重跑安全)
157
+ - 「跳过该条」→ 该条目不入库,--output 注记跳过原因后 --done
158
+ - **零输出**(skipped 非空 = 无 decisions.md / 无入选条目)→ 不创建任何文件、不动 INDEX,--output 注一句 skipped 原因后直接 --done(同 docs-debt 无债零输出原则)
159
+ 4. 降级:调用或解析异常(模块加载失败 / decisions.md 结构异常抛错)→ warn 记录异常摘要后跳过本步 --done(best-effort,同 agent-session-log 先例),不阻断归档——决策提炼失败不挡归档移动
160
+
161
+ ### 输出
162
+ 已提炼条目清单(decisions/<域>.md × D-xxx@vN × action)或零输出/跳过/降级原因`,
163
+ outputHint: '决策提炼结果',
164
+ optional: false
165
+ },
166
+ {
167
+ name: '确认归档',
168
+ prompt: `确认归档内容,由 CLI 执行目录移动。
169
+
170
+ ### 操作
171
+ 1. 展示:变更目录名、包含的文件列表(含 module-impact.md)、生成总结
172
+ 2. 确保任务清单(tasks.md)所有 task checkbox 都已勾选
173
+ 3. 让用户确认后,用 \`--confirm\` 完成本步骤:
174
+ \`sillyspec run archive --done --confirm --output "确认归档"\`
175
+ 4. CLI 会创建 \`.sillyspec/changes/archive/\`,并将变更目录移动到 \`.sillyspec/changes/archive/<原变更名>/\`
176
+
177
+ ### 输出
178
+ 归档完成 + archive 目录路径`,
179
+ outputHint: '归档确认',
180
+ optional: false
181
+ },
182
+ {
183
+ name: '更新路线图和提交',
184
+ prompt: `更新路线图并暂存变更。
185
+
186
+ ### 操作
187
+ 1. 如果 \`.sillyspec/ROADMAP.md\` 存在,标记对应 Phase 为已完成
188
+ 2. \`git add .sillyspec/changes/archive/\` — 暂存归档结果(archive/ 下仅本次归档新增,不会裹挟 changes/ 下其他活跃变更;不要 commit,由用户通过统一提交工具处理)
189
+ 3. \`git add .sillyspec/docs/<project>/modules/\` — 暂存模块文档更新(如有;精确到本次同步的模块文档,勿 add 整个 .sillyspec/docs/)
190
+ 4. \`git add .sillyspec/knowledge/decisions/\` — 暂存决策知识库更新(如有;decision-distill 步骤的提炼产物,精确到 decisions 子目录,勿 add 整个 .sillyspec/knowledge/;不要 commit,由用户通过统一提交工具处理)
191
+ 5. 确认 sillyspec.db 中该变更已不再 active(确认归档步骤由 CLI 调用 unregisterChange)
192
+
193
+ ### 输出
194
+ 归档完成确认 + 累积规范统计`,
195
+ outputHint: '归档完成',
196
+ optional: false
197
+ }
198
+ ]
199
+ }
@@ -0,0 +1,236 @@
1
+ /**
2
+ * brainstorm-auto.js — auto/full 模式使用的 brainstorm 步骤定义
3
+ *
4
+ * 与 brainstorm.js 的区别:
5
+ * 1. artifact-first:直接写文件,对话只输出摘要
6
+ * 2. 自动决策:基于 AC-001~AC-011 checklist,不频繁请示
7
+ * 3. next-action.json:结构化产物,驱动下游推进
8
+ * 4. 只有 blocking questions 才 wait 用户
9
+ * 5. 步骤从 ~13 步精简为 4 步
10
+ */
11
+
12
+ export const definition = {
13
+ name: 'brainstorm',
14
+ title: '头脑风暴(自动模式)',
15
+ description: '探索需求、分析技术方案、识别风险 — artifact-first,自动决策优先',
16
+
17
+ steps: [
18
+ {
19
+ name: '进度确认与上下文加载',
20
+ migratedFrom: ['状态检查与上下文加载'],
21
+ prompt: `检查进度、加载项目上下文、匹配模块。用 \`sillyspec progress show\` 查流程进度,不要用 \`sillyspec status\`(项目级快照,不推进流程)。
22
+
23
+ ### 操作
24
+ 1. 运行 \`sillyspec progress show\`,确认 currentStage 为 "brainstorm"
25
+ 2. 如果未初始化,提示先运行 sillyspec init
26
+ 3. **检查变更名称**:如果当前变更名是自动生成的(如 \`2026-06-02-new-change-a3f2b7c1\`),直接重命名为有意义名称,然后运行 \`sillyspec change-rename <旧名> <新名>\`
27
+
28
+ ### 加载上下文
29
+ 4. 读取项目总览 \`.sillyspec/docs/<project>/scan/PROJECT.md\`(如存在)+ 共享规范 + 子项目上下文
30
+ 5. 加载项目信息:\`cat .sillyspec/projects/*.yaml 2>/dev/null\`
31
+ 6. 加载本地配置:\`cat .sillyspec/local.yaml 2>/dev/null\`
32
+ 7. 棕地项目:读取 scan 下的 STRUCTURE.md、CONVENTIONS.md、ARCHITECTURE.md
33
+ 8. 加载模块索引:读取 \`.sillyspec/docs/<project>/modules/_module-map.yaml\`(如存在)
34
+ 9. 查看进行中的变更:\`ls .sillyspec/changes/ | grep -v archive\`
35
+ 10. 检查同名变更或可复用模板
36
+
37
+ ### 模块匹配
38
+ 根据用户描述的需求关键词,匹配相关模块(用 _module-map.yaml 的 tags/aliases/paths)。
39
+
40
+ ### 子项目判定
41
+ - 单项目:直接确认
42
+ - 多项目且用户已指定:直接确认
43
+ - 多项目且用户未指定:列出项目列表,需要用户确认
44
+
45
+ ### 如果有用户提供的原型/截图
46
+ 分析提取:页面结构、表单字段、交互流程、业务规则。
47
+
48
+ ### 输出
49
+ 状态摘要 + 项目现状理解(3-5 句)+ 涉及模块列表 + 子项目 + 原型分析(如有)
50
+
51
+ ### 注意
52
+ - 以 CLI 返回为准,不要自行推断阶段
53
+ - 不要用 mv 命令重命名变更目录,必须用 \`sillyspec change-rename\``,
54
+ outputHint: '状态摘要 + 上下文 + 模块匹配',
55
+ optional: false
56
+ },
57
+ {
58
+ name: '需求分析与方案设计',
59
+ // conditionalWait(非 requiresWait):与主模式 Step3 对齐。prompt 明确「目标明确→跳过追问,
60
+ // 直接进入方案设计」「checklist 全 ✅ → AUTO_DECIDED」——这两种场景 AI 无需追问,必须能直接 --done。
61
+ // 若用 requiresWait,CLI 硬门强制要 --answer(complete.js:223),AI 只能伪造 --answer「无需追问」
62
+ // (正是 Grill 第三病)或 --wait 一个不存在的问题。conditionalWait 让「无需追问」路径直接 --done,
63
+ // 只在真正需要用户决策(方案选择/拆分确认)时才走 --wait(multi-agent-review B1)。
64
+ conditionalWait: true,
65
+ repeatableWait: true,
66
+ maxWaitRounds: 5,
67
+ waitReason: '等待用户回答需求问题',
68
+ waitOptions: ['回答见--answer', '信息够了,进入设计'],
69
+ prompt: `分析需求,必要时追问,然后设计方案。
70
+
71
+ ### 操作
72
+
73
+ #### A. 需求评估
74
+ 1. 汇总上一步加载的上下文和用户需求
75
+ 2. 判断需求是否清晰:
76
+ - 目标明确、范围清楚、无歧义 → 跳过追问,直接进入方案设计
77
+ - 有歧义或不清楚 → 挑**一个最关键的**问题追问
78
+
79
+ #### B. 追问规则(只在需要时)
80
+ - 一次只问一个问题,不要一次性列出多个问题
81
+ - 能从代码/文档确认的不要问用户
82
+ - 多选题优于开放式问题
83
+ - YAGNI — 砍掉不需要的功能
84
+ - 2-3 轮问答就应进入方案设计
85
+ - 优先追问影响架构/数据/接口的问题,实现细节不要问
86
+
87
+ **如果需要追问:**调用 \`sillyspec run brainstorm --wait --reason "等待用户回答需求问题" --options "回答见--answer,信息够了,进入设计" --output "你的单个问题"\`
88
+
89
+ #### C. 复杂度评估(追问结束后或不需要追问时)
90
+ 1. 判断是否需要拆分或走批量模式:
91
+ - 3+ 个可独立交付的功能模块 → 建议拆分
92
+ - 任务 > 10 且有重复模式 → 建议批量模式
93
+ - 简单 CRUD → 不拆
94
+ 2. 如果需要拆分/批量模式:暂停等用户确认
95
+ - 调用:\`sillyspec run brainstorm --wait --reason "等待用户确认拆分方案" --options "同意拆分,不需要拆分,走批量模式" --output "拆分方案摘要"\`
96
+ 3. 不需要拆分 → 继续
97
+
98
+ #### D. 方案设计(自动决策优先)
99
+ 1. 基于需求理解和上下文,提出 1-3 种实现方案
100
+ 2. **使用自动决策 checklist(AC-001~AC-011)判断是否需要用户选择:**
101
+
102
+ \`\`\`
103
+ AC-001: 未修改公共 API
104
+ AC-002: 未修改数据库 schema
105
+ AC-003: 未涉及鉴权/权限
106
+ AC-004: 未扩大 allowed_paths
107
+ AC-005: 未引入新外部依赖
108
+ AC-006: 未修改核心模块(workflow/daemon/session/lifecycle)
109
+ AC-007: 已有项目约定可复用
110
+ AC-008: 不影响向后兼容
111
+ AC-009: 不涉及数据迁移
112
+ AC-010: 单模块范围内可完成
113
+ AC-011: 不涉及业务规则/产品范围/默认行为/用户可见行为变更
114
+ \`\`\`
115
+
116
+ 3. **自动决策判定:**
117
+ - 只有一个明显合理方案 + checklist 全部 ✅ → **自动选择,标记 AUTO_DECIDED**
118
+ - 有多个方案但影响不大(checklist 全部 ✅)→ **自动选推荐方案,标记 AUTO_DECIDED**
119
+ - 有多个方案且 checklist 有 ❌(影响架构/数据/接口/权限/兼容性/业务)→ **只有这一种情况才暂停等用户选择**
120
+
121
+ 4. 如果需要用户选择方案:
122
+ - 调用:\`sillyspec run brainstorm --wait --reason "等待用户选择方案" --options "方案A,方案B,方案C" --output "方案对比摘要"\`
123
+
124
+ #### E. Design Grill(轻量交叉审查)
125
+ 对方案做快速交叉审查:
126
+ - 检查方案与 ARCHITECTURE.md / CONVENTIONS.md 的一致性
127
+ - 检查是否有术语歧义、边界遗漏
128
+ - 能自动解决的直接修正,只有需要业务判断的才问用户
129
+ - 跳过条件:单模块、无状态流转、< 3 个文件变更
130
+
131
+ ### 输出
132
+ 需求理解摘要 + 复杂度评估 + 方案决策(AUTO_DECIDED 或用户选择)
133
+
134
+ ### 注意
135
+ - **不要自问自答。** 不要在自己输出中模拟用户回答然后说"需求已明确"
136
+ - checklist 判定结果必须在 decisions.md 中记录依据`,
137
+ outputHint: '需求理解 + 方案决策',
138
+ optional: false
139
+ },
140
+ {
141
+ name: '生成设计产物',
142
+ prompt: `将设计方案写入文件(artifact-first),不回显正文。
143
+
144
+ ### 操作
145
+ 1. 确保变更目录存在:\`mkdir -p .sillyspec/changes/<change-name>\`
146
+ 2. **直接将设计方案写入文件,不要先在对话中输出完整内容再写文件。**
147
+ 3. 产物写入**变更根目录**(\`.sillyspec/changes/<change-name>/\`),不要建 \`brainstorm/\` 子目录——stage validator 只认根目录,写进子目录会在 \`--done\` 校验时被判产物缺失。
148
+
149
+ ### 产物文件
150
+
151
+ #### design.md(必填,写入变更根目录 \`design.md\`)
152
+ 包含:背景、设计目标、非目标、总体方案、文件变更清单、接口定义、数据模型(如涉及)、兼容策略(brownfield)、风险登记、决策追踪。
153
+
154
+ #### decisions.md(必填,写入变更根目录 \`decisions.md\`)
155
+ 记录所有决策:
156
+ \`\`\`markdown
157
+ ## D-001@v1: 决策短标题
158
+ - type: architecture | boundary | compatibility | ...
159
+ - priority: P0 | P1 | P2
160
+ - status: AUTO_DECIDED | NEEDS_REVIEW | USER_DECIDED
161
+ - source: user | code | docs
162
+ - question: 被解决的问题
163
+ - answer: 选择或结论
164
+ - checklist: AC-001 ✅, AC-007 ✅(AUTO_DECIDED 时必须列出)
165
+ - normalized_requirement: 可测试约束
166
+ - impacts: [FR-01, task-01]
167
+ - evidence: 代码/文档路径或用户回答轮次
168
+ \`\`\`
169
+
170
+ #### gaps.md(必填,写入变更根目录 \`gaps.md\`)
171
+ 记录已识别的缺口。status=BLOCKER 的缺口会在 plan-postcheck 中触发回退。
172
+
173
+ #### assumptions.md(必填,写入变更根目录 \`assumptions.md\`)
174
+ 记录隐含假设和验证方法。
175
+
176
+ #### next-action.json(必填,写入变更根目录 \`next-action.json\`)
177
+ \`\`\`json
178
+ {
179
+ "status": "ready_for_plan" | "waiting_for_user",
180
+ "decision_level": "high" | "medium" | "low",
181
+ "has_blocking_questions": true | false,
182
+ "blocking_reasons": [],
183
+ "questions": [],
184
+ "auto_decisions": [
185
+ { "id": "D-001", "decision": "方案描述", "reason": "AC-007 ✅" }
186
+ ]
187
+ }
188
+ \`\`\`
189
+
190
+ ### 自审
191
+ 对 design.md 执行自审(需求覆盖、文件变更清单具体性、验收标准可测试、非目标清晰、兼容策略)。发现问题直接修改文件。
192
+
193
+ ### 如果有 blocking questions
194
+ 将问题写入 next-action.json.questions,在对话中输出问题列表和推荐选项,然后 --wait。
195
+
196
+ ### 输出(artifact-first)
197
+ 只输出摘要:
198
+ \`\`\`
199
+ 已生成设计产物(5 个文件,均在变更根目录):
200
+ - design.md — 采用 xxx 方案,涉及 N 个文件变更
201
+ - decisions.md — M 个决策,K 个 AUTO_DECIDED
202
+ - gaps.md — J 个缺口,0 个 BLOCKER
203
+ - assumptions.md — L 个假设
204
+ - next-action.json — ready_for_plan / waiting_for_user
205
+ \`\`\``,
206
+ outputHint: '产物摘要',
207
+ optional: false
208
+ },
209
+ {
210
+ name: '生成规范文件',
211
+ requiresWait: true,
212
+ waitReason: '等待用户最终确认',
213
+ waitOptions: ['确认', '需要修改', '推翻重来'],
214
+ prompt: `生成 proposal.md / requirements.md / tasks.md,让用户确认。
215
+
216
+ ### 操作
217
+ 1. 基于变更根目录下的设计产物(design.md / decisions.md / gaps.md / assumptions.md / next-action.json),生成规范文件(直接写入变更根目录):
218
+ - **proposal.md**:动机、关键问题、变更范围、不在范围内、成功标准
219
+ - **requirements.md**:角色表 + FR 编号需求 + Given/When/Then + 非功能需求
220
+ - **tasks.md**:任务列表骨架(只列名称;任务清单唯一真相,plan 阶段展开细节并写回本文件——execute 勾选与 verify 对照都在本文件)
221
+ 2. 所有规范文件头部包含 YAML frontmatter
222
+ 3. \`git add {SPEC_ROOT}/changes/<change-name>/\` — 暂存本变更的规范文件(勿用 .sillyspec/ 整目录——会裹挟其他活跃变更;不要 commit)
223
+
224
+ ### 输出(摘要)
225
+ 规范文件路径列表(各一句话说明)
226
+
227
+ ### 铁律
228
+ - **直接写文件,不在对话中输出完整内容**
229
+ - 暂停等待用户确认:\`sillyspec run brainstorm --wait --reason "等待用户最终确认" --options "确认,需要修改,推翻重来" --output "规范文件摘要"\`
230
+ - 禁止自动 commit
231
+ - 禁止在确认前推进到后续阶段`,
232
+ outputHint: '规范文件摘要',
233
+ optional: false
234
+ }
235
+ ]
236
+ }