sillyspec 3.27.11 → 3.28.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 (1219) hide show
  1. package/.claude/skills/sillyspec-execute/SKILL.md +1 -1
  2. package/README.md +3 -2
  3. package/package.json +1 -1
  4. package/src/agent-session-log.js +77 -10
  5. package/src/change-delete.js +181 -0
  6. package/src/config-schema.js +2 -2
  7. package/src/contract-matrix.js +15 -2
  8. package/src/docs-check.js +126 -0
  9. package/src/doctor-diagnostics.js +64 -1
  10. package/src/endpoint-extractor.js +107 -28
  11. package/src/index.js +208 -13
  12. package/src/init.js +104 -27
  13. package/src/machine-interface.js +63 -0
  14. package/src/module-changelog.js +116 -0
  15. package/src/progress/change-registry.js +28 -0
  16. package/src/progress/shared.js +6 -0
  17. package/src/progress/stage-machine.js +191 -9
  18. package/src/progress.js +6 -0
  19. package/src/run/command.js +26 -1
  20. package/src/run/complete-handlers.js +42 -4
  21. package/src/run/complete.js +12 -4
  22. package/src/run/prompt.js +12 -1
  23. package/src/run/quick-audit.js +98 -0
  24. package/src/run/shared.js +86 -0
  25. package/src/run/stage.js +18 -11
  26. package/src/spec-sync.js +191 -14
  27. package/src/stages/archive.js +5 -0
  28. package/src/stages/execute.js +7 -2
  29. package/src/sync.js +575 -21
  30. package/src/task-review.js +51 -4
  31. package/src/verify-postcheck.js +60 -8
  32. package/src/verify-probes.js +3 -0
  33. package/src/workflow.js +4 -0
  34. package/src/worktree-apply.js +4 -4
  35. package/src/worktree.js +6 -4
  36. package/{.worktrees/542c4415/templates/claude-instruction.md → templates/agents-instruction.md} +2 -2
  37. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-archive/SKILL.md +0 -87
  38. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-auto/SKILL.md +0 -93
  39. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-brainstorm/SKILL.md +0 -114
  40. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-commit/SKILL.md +0 -67
  41. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-continue/SKILL.md +0 -47
  42. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-doctor/SKILL.md +0 -76
  43. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-execute/SKILL.md +0 -214
  44. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-explore/SKILL.md +0 -102
  45. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-export/SKILL.md +0 -57
  46. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-init/SKILL.md +0 -177
  47. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-knowledge/SKILL.md +0 -270
  48. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-plan/SKILL.md +0 -156
  49. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-quick/SKILL.md +0 -116
  50. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-resume/SKILL.md +0 -70
  51. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-scan/SKILL.md +0 -79
  52. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-state/SKILL.md +0 -64
  53. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-status/SKILL.md +0 -54
  54. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-verify/SKILL.md +0 -87
  55. package/.claude/worktrees/sillyspec-data-model-research/.claude/skills/sillyspec-workspace/SKILL.md +0 -175
  56. package/.claude/worktrees/sillyspec-data-model-research/.gitattributes +0 -2
  57. package/.claude/worktrees/sillyspec-data-model-research/.husky/pre-push +0 -20
  58. package/.claude/worktrees/sillyspec-data-model-research/README.md +0 -203
  59. package/.claude/worktrees/sillyspec-data-model-research/SKILL.md +0 -91
  60. package/.claude/worktrees/sillyspec-data-model-research/bin/sillyspec.js +0 -2
  61. package/.claude/worktrees/sillyspec-data-model-research/logo.jpg +0 -0
  62. package/.claude/worktrees/sillyspec-data-model-research/package-lock.json +0 -977
  63. package/.claude/worktrees/sillyspec-data-model-research/package.json +0 -39
  64. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/assets/index-Bq_Z2hne.js +0 -7446
  65. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/assets/index-O2W5RV4z.css +0 -1
  66. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/favicon.jpg +0 -0
  67. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/index.html +0 -16
  68. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/logo.jpg +0 -0
  69. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/prototype-dashboard.html +0 -836
  70. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/dist/prototype-overview.html +0 -256
  71. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/package.json +0 -25
  72. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/server/executor.js +0 -95
  73. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/server/index.js +0 -679
  74. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/server/parser.js +0 -526
  75. package/.claude/worktrees/sillyspec-data-model-research/packages/dashboard/server/watcher.js +0 -357
  76. package/.claude/worktrees/sillyspec-data-model-research/src/agent-session-log.js +0 -803
  77. package/.claude/worktrees/sillyspec-data-model-research/src/change-list.js +0 -290
  78. package/.claude/worktrees/sillyspec-data-model-research/src/change-risk-profile.js +0 -270
  79. package/.claude/worktrees/sillyspec-data-model-research/src/check-primitives.js +0 -65
  80. package/.claude/worktrees/sillyspec-data-model-research/src/classify-change.js +0 -109
  81. package/.claude/worktrees/sillyspec-data-model-research/src/commit-suggest.js +0 -202
  82. package/.claude/worktrees/sillyspec-data-model-research/src/config-cat.js +0 -88
  83. package/.claude/worktrees/sillyspec-data-model-research/src/config-schema.js +0 -328
  84. package/.claude/worktrees/sillyspec-data-model-research/src/constants.js +0 -97
  85. package/.claude/worktrees/sillyspec-data-model-research/src/contract-matrix.js +0 -480
  86. package/.claude/worktrees/sillyspec-data-model-research/src/datetime.js +0 -20
  87. package/.claude/worktrees/sillyspec-data-model-research/src/db-engine.js +0 -55
  88. package/.claude/worktrees/sillyspec-data-model-research/src/db.js +0 -381
  89. package/.claude/worktrees/sillyspec-data-model-research/src/decision-distill.js +0 -517
  90. package/.claude/worktrees/sillyspec-data-model-research/src/dispatch/backends/local-agent.js +0 -155
  91. package/.claude/worktrees/sillyspec-data-model-research/src/dispatch/backends/sillyhub-mcp.js +0 -245
  92. package/.claude/worktrees/sillyspec-data-model-research/src/dispatch/probe.js +0 -246
  93. package/.claude/worktrees/sillyspec-data-model-research/src/dispatch/strategy.js +0 -121
  94. package/.claude/worktrees/sillyspec-data-model-research/src/docs-check.js +0 -825
  95. package/.claude/worktrees/sillyspec-data-model-research/src/docs-debt.js +0 -393
  96. package/.claude/worktrees/sillyspec-data-model-research/src/docs-gate.js +0 -107
  97. package/.claude/worktrees/sillyspec-data-model-research/src/doctor-diagnostics.js +0 -1099
  98. package/.claude/worktrees/sillyspec-data-model-research/src/endpoint-extractor.js +0 -420
  99. package/.claude/worktrees/sillyspec-data-model-research/src/foreign-declared.js +0 -78
  100. package/.claude/worktrees/sillyspec-data-model-research/src/fs-atomic.js +0 -73
  101. package/.claude/worktrees/sillyspec-data-model-research/src/git-helper.js +0 -150
  102. package/.claude/worktrees/sillyspec-data-model-research/src/hooks/claude-pre-tool-use.cjs +0 -130
  103. package/.claude/worktrees/sillyspec-data-model-research/src/hooks/worktree-guard.js +0 -892
  104. package/.claude/worktrees/sillyspec-data-model-research/src/index.js +0 -2798
  105. package/.claude/worktrees/sillyspec-data-model-research/src/init.js +0 -626
  106. package/.claude/worktrees/sillyspec-data-model-research/src/knowledge-match.js +0 -231
  107. package/.claude/worktrees/sillyspec-data-model-research/src/local-detect.js +0 -128
  108. package/.claude/worktrees/sillyspec-data-model-research/src/local-register.js +0 -104
  109. package/.claude/worktrees/sillyspec-data-model-research/src/machine-interface.js +0 -543
  110. package/.claude/worktrees/sillyspec-data-model-research/src/migrate.js +0 -127
  111. package/.claude/worktrees/sillyspec-data-model-research/src/module-impact.js +0 -166
  112. package/.claude/worktrees/sillyspec-data-model-research/src/module-resolve.js +0 -222
  113. package/.claude/worktrees/sillyspec-data-model-research/src/modules.js +0 -580
  114. package/.claude/worktrees/sillyspec-data-model-research/src/progress/change-registry.js +0 -336
  115. package/.claude/worktrees/sillyspec-data-model-research/src/progress/consistency-doctor.js +0 -355
  116. package/.claude/worktrees/sillyspec-data-model-research/src/progress/shared.js +0 -36
  117. package/.claude/worktrees/sillyspec-data-model-research/src/progress/stage-machine.js +0 -594
  118. package/.claude/worktrees/sillyspec-data-model-research/src/progress/step-store.js +0 -265
  119. package/.claude/worktrees/sillyspec-data-model-research/src/progress.js +0 -1304
  120. package/.claude/worktrees/sillyspec-data-model-research/src/quick-recommend.js +0 -115
  121. package/.claude/worktrees/sillyspec-data-model-research/src/quicklog.js +0 -852
  122. package/.claude/worktrees/sillyspec-data-model-research/src/review-tier.js +0 -77
  123. package/.claude/worktrees/sillyspec-data-model-research/src/run/command.js +0 -1595
  124. package/.claude/worktrees/sillyspec-data-model-research/src/run/complete-handlers.js +0 -1552
  125. package/.claude/worktrees/sillyspec-data-model-research/src/run/complete.js +0 -1259
  126. package/.claude/worktrees/sillyspec-data-model-research/src/run/concurrent-detect.js +0 -156
  127. package/.claude/worktrees/sillyspec-data-model-research/src/run/gates.js +0 -1084
  128. package/.claude/worktrees/sillyspec-data-model-research/src/run/multi-repo-context.js +0 -208
  129. package/.claude/worktrees/sillyspec-data-model-research/src/run/next.js +0 -128
  130. package/.claude/worktrees/sillyspec-data-model-research/src/run/prompt.js +0 -843
  131. package/.claude/worktrees/sillyspec-data-model-research/src/run/quick-audit.js +0 -186
  132. package/.claude/worktrees/sillyspec-data-model-research/src/run/scan-profile.js +0 -269
  133. package/.claude/worktrees/sillyspec-data-model-research/src/run/shared.js +0 -1562
  134. package/.claude/worktrees/sillyspec-data-model-research/src/run/stage.js +0 -584
  135. package/.claude/worktrees/sillyspec-data-model-research/src/run.js +0 -23
  136. package/.claude/worktrees/sillyspec-data-model-research/src/scan-diff.js +0 -388
  137. package/.claude/worktrees/sillyspec-data-model-research/src/scan-postcheck.js +0 -512
  138. package/.claude/worktrees/sillyspec-data-model-research/src/scan-staleness.js +0 -95
  139. package/.claude/worktrees/sillyspec-data-model-research/src/setup.js +0 -414
  140. package/.claude/worktrees/sillyspec-data-model-research/src/sillyhub-mcp/client.js +0 -597
  141. package/.claude/worktrees/sillyspec-data-model-research/src/sillyhub-mcp/config.js +0 -62
  142. package/.claude/worktrees/sillyspec-data-model-research/src/spec-dir-typo.js +0 -50
  143. package/.claude/worktrees/sillyspec-data-model-research/src/spec-sync.js +0 -358
  144. package/.claude/worktrees/sillyspec-data-model-research/src/stage-contract-engine.js +0 -171
  145. package/.claude/worktrees/sillyspec-data-model-research/src/stage-contract-spec.js +0 -550
  146. package/.claude/worktrees/sillyspec-data-model-research/src/stage-contract.js +0 -889
  147. package/.claude/worktrees/sillyspec-data-model-research/src/stage-review.js +0 -597
  148. package/.claude/worktrees/sillyspec-data-model-research/src/stages/archive.js +0 -199
  149. package/.claude/worktrees/sillyspec-data-model-research/src/stages/brainstorm-auto.js +0 -236
  150. package/.claude/worktrees/sillyspec-data-model-research/src/stages/brainstorm.js +0 -617
  151. package/.claude/worktrees/sillyspec-data-model-research/src/stages/cmd-existence.js +0 -145
  152. package/.claude/worktrees/sillyspec-data-model-research/src/stages/doctor.js +0 -540
  153. package/.claude/worktrees/sillyspec-data-model-research/src/stages/execute.js +0 -1275
  154. package/.claude/worktrees/sillyspec-data-model-research/src/stages/explore.js +0 -43
  155. package/.claude/worktrees/sillyspec-data-model-research/src/stages/index.js +0 -29
  156. package/.claude/worktrees/sillyspec-data-model-research/src/stages/knowledge.js +0 -514
  157. package/.claude/worktrees/sillyspec-data-model-research/src/stages/plan-postcheck.js +0 -1344
  158. package/.claude/worktrees/sillyspec-data-model-research/src/stages/plan.js +0 -650
  159. package/.claude/worktrees/sillyspec-data-model-research/src/stages/quick.js +0 -167
  160. package/.claude/worktrees/sillyspec-data-model-research/src/stages/scan.js +0 -608
  161. package/.claude/worktrees/sillyspec-data-model-research/src/stages/status.js +0 -64
  162. package/.claude/worktrees/sillyspec-data-model-research/src/stages/verify.js +0 -246
  163. package/.claude/worktrees/sillyspec-data-model-research/src/sync.js +0 -1470
  164. package/.claude/worktrees/sillyspec-data-model-research/src/task-review.js +0 -1498
  165. package/.claude/worktrees/sillyspec-data-model-research/src/taskcard.js +0 -210
  166. package/.claude/worktrees/sillyspec-data-model-research/src/verify-postcheck.js +0 -1718
  167. package/.claude/worktrees/sillyspec-data-model-research/src/verify-probes.js +0 -277
  168. package/.claude/worktrees/sillyspec-data-model-research/src/version.js +0 -19
  169. package/.claude/worktrees/sillyspec-data-model-research/src/workflow.js +0 -600
  170. package/.claude/worktrees/sillyspec-data-model-research/src/workspace.js +0 -125
  171. package/.claude/worktrees/sillyspec-data-model-research/src/worktree-apply.js +0 -1446
  172. package/.claude/worktrees/sillyspec-data-model-research/src/worktree-deps.js +0 -576
  173. package/.claude/worktrees/sillyspec-data-model-research/src/worktree.js +0 -1715
  174. package/.claude/worktrees/sillyspec-data-model-research/templates/claude-instruction.md +0 -23
  175. package/.claude/worktrees/sillyspec-data-model-research/templates/prompts/taskcard-rules.md +0 -28
  176. package/.claude/worktrees/sillyspec-data-model-research/templates/prompts/testcase-design.md +0 -12
  177. package/.claude/worktrees/sillyspec-data-model-research/templates/prompts/verify-probes.md +0 -32
  178. package/.claude/worktrees/sillyspec-data-model-research/templates/workflows/archive-impact.yaml +0 -79
  179. package/.claude/worktrees/sillyspec-data-model-research/templates/workflows/scan-docs.yaml +0 -132
  180. package/.npmrc-temp +0 -1
  181. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-archive/SKILL.md +0 -87
  182. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-auto/SKILL.md +0 -93
  183. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-brainstorm/SKILL.md +0 -114
  184. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-commit/SKILL.md +0 -67
  185. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-continue/SKILL.md +0 -47
  186. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-doctor/SKILL.md +0 -76
  187. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-execute/SKILL.md +0 -214
  188. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-explore/SKILL.md +0 -102
  189. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-export/SKILL.md +0 -57
  190. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-init/SKILL.md +0 -177
  191. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-knowledge/SKILL.md +0 -270
  192. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-plan/SKILL.md +0 -156
  193. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-propose/SKILL.md +0 -87
  194. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-quick/SKILL.md +0 -116
  195. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-resume/SKILL.md +0 -70
  196. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-scan/SKILL.md +0 -79
  197. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-state/SKILL.md +0 -64
  198. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-status/SKILL.md +0 -54
  199. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-verify/SKILL.md +0 -87
  200. package/.worktrees/2c37b1d7/.claude/skills/sillyspec-workspace/SKILL.md +0 -175
  201. package/.worktrees/2c37b1d7/.claude/skills/verify-per-user/SKILL.md +0 -6
  202. package/.worktrees/2c37b1d7/.gitattributes +0 -2
  203. package/.worktrees/2c37b1d7/.husky/pre-push +0 -20
  204. package/.worktrees/2c37b1d7/README.md +0 -203
  205. package/.worktrees/2c37b1d7/SKILL.md +0 -91
  206. package/.worktrees/2c37b1d7/architecture-analysis.md +0 -448
  207. package/.worktrees/2c37b1d7/bin/sillyspec.js +0 -2
  208. package/.worktrees/2c37b1d7/eval/README.md +0 -86
  209. package/.worktrees/2c37b1d7/eval/eval.config.json +0 -28
  210. package/.worktrees/2c37b1d7/eval/lib/adapters/cli.mjs +0 -63
  211. package/.worktrees/2c37b1d7/eval/lib/adapters/dryrun.mjs +0 -27
  212. package/.worktrees/2c37b1d7/eval/lib/config.mjs +0 -82
  213. package/.worktrees/2c37b1d7/eval/lib/db.mjs +0 -76
  214. package/.worktrees/2c37b1d7/eval/lib/report.mjs +0 -120
  215. package/.worktrees/2c37b1d7/eval/lib/runner.mjs +0 -157
  216. package/.worktrees/2c37b1d7/eval/lib/tasks.mjs +0 -73
  217. package/.worktrees/2c37b1d7/eval/lib/util.mjs +0 -107
  218. package/.worktrees/2c37b1d7/eval/lib/workdir.mjs +0 -30
  219. package/.worktrees/2c37b1d7/eval/run.mjs +0 -83
  220. package/.worktrees/2c37b1d7/eval/tasks/001-slugify/files/package.json +0 -6
  221. package/.worktrees/2c37b1d7/eval/tasks/001-slugify/solution/src/slugify.mjs +0 -26
  222. package/.worktrees/2c37b1d7/eval/tasks/001-slugify/task.json +0 -6
  223. package/.worktrees/2c37b1d7/eval/tasks/001-slugify/verify.mjs +0 -28
  224. package/.worktrees/2c37b1d7/eval/tasks/002-each-day/files/package.json +0 -6
  225. package/.worktrees/2c37b1d7/eval/tasks/002-each-day/files/src/dates.mjs +0 -4
  226. package/.worktrees/2c37b1d7/eval/tasks/002-each-day/solution/src/dates.mjs +0 -30
  227. package/.worktrees/2c37b1d7/eval/tasks/002-each-day/task.json +0 -6
  228. package/.worktrees/2c37b1d7/eval/tasks/002-each-day/verify.mjs +0 -31
  229. package/.worktrees/2c37b1d7/eval/tasks/003-word-report/files/data/notes.txt +0 -5
  230. package/.worktrees/2c37b1d7/eval/tasks/003-word-report/files/package.json +0 -6
  231. package/.worktrees/2c37b1d7/eval/tasks/003-word-report/solution/bin/report.mjs +0 -36
  232. package/.worktrees/2c37b1d7/eval/tasks/003-word-report/task.json +0 -6
  233. package/.worktrees/2c37b1d7/eval/tasks/003-word-report/verify.mjs +0 -38
  234. package/.worktrees/2c37b1d7/logo.jpg +0 -0
  235. package/.worktrees/2c37b1d7/package-lock.json +0 -977
  236. package/.worktrees/2c37b1d7/package.json +0 -41
  237. package/.worktrees/2c37b1d7/packages/dashboard/dist/assets/index-Bq_Z2hne.js +0 -7446
  238. package/.worktrees/2c37b1d7/packages/dashboard/dist/assets/index-O2W5RV4z.css +0 -1
  239. package/.worktrees/2c37b1d7/packages/dashboard/dist/favicon.jpg +0 -0
  240. package/.worktrees/2c37b1d7/packages/dashboard/dist/index.html +0 -16
  241. package/.worktrees/2c37b1d7/packages/dashboard/dist/logo.jpg +0 -0
  242. package/.worktrees/2c37b1d7/packages/dashboard/dist/prototype-dashboard.html +0 -836
  243. package/.worktrees/2c37b1d7/packages/dashboard/dist/prototype-overview.html +0 -256
  244. package/.worktrees/2c37b1d7/packages/dashboard/package.json +0 -25
  245. package/.worktrees/2c37b1d7/packages/dashboard/server/executor.js +0 -95
  246. package/.worktrees/2c37b1d7/packages/dashboard/server/index.js +0 -679
  247. package/.worktrees/2c37b1d7/packages/dashboard/server/parser.js +0 -526
  248. package/.worktrees/2c37b1d7/packages/dashboard/server/watcher.js +0 -357
  249. package/.worktrees/2c37b1d7/src/agent-session-log.js +0 -803
  250. package/.worktrees/2c37b1d7/src/change-list.js +0 -290
  251. package/.worktrees/2c37b1d7/src/change-risk-profile.js +0 -339
  252. package/.worktrees/2c37b1d7/src/check-primitives.js +0 -65
  253. package/.worktrees/2c37b1d7/src/classify-change.js +0 -109
  254. package/.worktrees/2c37b1d7/src/commit-suggest.js +0 -202
  255. package/.worktrees/2c37b1d7/src/config-cat.js +0 -88
  256. package/.worktrees/2c37b1d7/src/config-schema.js +0 -328
  257. package/.worktrees/2c37b1d7/src/constants.js +0 -97
  258. package/.worktrees/2c37b1d7/src/contract-matrix.js +0 -533
  259. package/.worktrees/2c37b1d7/src/datetime.js +0 -20
  260. package/.worktrees/2c37b1d7/src/db-engine.js +0 -55
  261. package/.worktrees/2c37b1d7/src/db.js +0 -381
  262. package/.worktrees/2c37b1d7/src/decision-distill.js +0 -517
  263. package/.worktrees/2c37b1d7/src/dispatch/backends/local-agent.js +0 -155
  264. package/.worktrees/2c37b1d7/src/dispatch/backends/sillyhub-mcp.js +0 -245
  265. package/.worktrees/2c37b1d7/src/dispatch/probe.js +0 -246
  266. package/.worktrees/2c37b1d7/src/dispatch/strategy.js +0 -121
  267. package/.worktrees/2c37b1d7/src/docs-check.js +0 -825
  268. package/.worktrees/2c37b1d7/src/docs-debt.js +0 -393
  269. package/.worktrees/2c37b1d7/src/docs-gate.js +0 -107
  270. package/.worktrees/2c37b1d7/src/doctor-diagnostics.js +0 -1099
  271. package/.worktrees/2c37b1d7/src/endpoint-extractor.js +0 -409
  272. package/.worktrees/2c37b1d7/src/foreign-declared.js +0 -155
  273. package/.worktrees/2c37b1d7/src/fs-atomic.js +0 -73
  274. package/.worktrees/2c37b1d7/src/git-helper.js +0 -150
  275. package/.worktrees/2c37b1d7/src/hooks/claude-pre-tool-use.cjs +0 -130
  276. package/.worktrees/2c37b1d7/src/hooks/worktree-guard.js +0 -892
  277. package/.worktrees/2c37b1d7/src/index.js +0 -2854
  278. package/.worktrees/2c37b1d7/src/init.js +0 -626
  279. package/.worktrees/2c37b1d7/src/knowledge-match.js +0 -231
  280. package/.worktrees/2c37b1d7/src/local-detect.js +0 -128
  281. package/.worktrees/2c37b1d7/src/local-register.js +0 -104
  282. package/.worktrees/2c37b1d7/src/machine-interface.js +0 -543
  283. package/.worktrees/2c37b1d7/src/migrate.js +0 -127
  284. package/.worktrees/2c37b1d7/src/module-impact.js +0 -166
  285. package/.worktrees/2c37b1d7/src/module-resolve.js +0 -222
  286. package/.worktrees/2c37b1d7/src/modules.js +0 -580
  287. package/.worktrees/2c37b1d7/src/plan-adopt-waves.js +0 -126
  288. package/.worktrees/2c37b1d7/src/progress/change-registry.js +0 -336
  289. package/.worktrees/2c37b1d7/src/progress/consistency-doctor.js +0 -355
  290. package/.worktrees/2c37b1d7/src/progress/shared.js +0 -36
  291. package/.worktrees/2c37b1d7/src/progress/stage-machine.js +0 -594
  292. package/.worktrees/2c37b1d7/src/progress/step-store.js +0 -265
  293. package/.worktrees/2c37b1d7/src/progress.js +0 -1304
  294. package/.worktrees/2c37b1d7/src/quick-recommend.js +0 -115
  295. package/.worktrees/2c37b1d7/src/quicklog.js +0 -883
  296. package/.worktrees/2c37b1d7/src/review-tier.js +0 -77
  297. package/.worktrees/2c37b1d7/src/run/command.js +0 -1641
  298. package/.worktrees/2c37b1d7/src/run/complete-handlers.js +0 -1552
  299. package/.worktrees/2c37b1d7/src/run/complete.js +0 -1259
  300. package/.worktrees/2c37b1d7/src/run/concurrent-detect.js +0 -156
  301. package/.worktrees/2c37b1d7/src/run/gates.js +0 -1111
  302. package/.worktrees/2c37b1d7/src/run/multi-repo-context.js +0 -208
  303. package/.worktrees/2c37b1d7/src/run/next.js +0 -128
  304. package/.worktrees/2c37b1d7/src/run/prompt.js +0 -843
  305. package/.worktrees/2c37b1d7/src/run/quick-audit.js +0 -186
  306. package/.worktrees/2c37b1d7/src/run/scan-profile.js +0 -269
  307. package/.worktrees/2c37b1d7/src/run/shared.js +0 -1562
  308. package/.worktrees/2c37b1d7/src/run/stage.js +0 -587
  309. package/.worktrees/2c37b1d7/src/run.js +0 -23
  310. package/.worktrees/2c37b1d7/src/scan-diff.js +0 -388
  311. package/.worktrees/2c37b1d7/src/scan-postcheck.js +0 -524
  312. package/.worktrees/2c37b1d7/src/scan-staleness.js +0 -95
  313. package/.worktrees/2c37b1d7/src/setup.js +0 -414
  314. package/.worktrees/2c37b1d7/src/sillyhub-mcp/client.js +0 -597
  315. package/.worktrees/2c37b1d7/src/sillyhub-mcp/config.js +0 -62
  316. package/.worktrees/2c37b1d7/src/spec-dir-typo.js +0 -50
  317. package/.worktrees/2c37b1d7/src/spec-sync.js +0 -358
  318. package/.worktrees/2c37b1d7/src/stage-contract-engine.js +0 -171
  319. package/.worktrees/2c37b1d7/src/stage-contract-spec.js +0 -551
  320. package/.worktrees/2c37b1d7/src/stage-contract.js +0 -948
  321. package/.worktrees/2c37b1d7/src/stage-review.js +0 -597
  322. package/.worktrees/2c37b1d7/src/stages/archive.js +0 -199
  323. package/.worktrees/2c37b1d7/src/stages/brainstorm-auto.js +0 -285
  324. package/.worktrees/2c37b1d7/src/stages/brainstorm.js +0 -624
  325. package/.worktrees/2c37b1d7/src/stages/cmd-existence.js +0 -145
  326. package/.worktrees/2c37b1d7/src/stages/doctor.js +0 -540
  327. package/.worktrees/2c37b1d7/src/stages/execute.js +0 -1277
  328. package/.worktrees/2c37b1d7/src/stages/explore.js +0 -43
  329. package/.worktrees/2c37b1d7/src/stages/index.js +0 -29
  330. package/.worktrees/2c37b1d7/src/stages/knowledge.js +0 -514
  331. package/.worktrees/2c37b1d7/src/stages/plan-postcheck.js +0 -1398
  332. package/.worktrees/2c37b1d7/src/stages/plan.js +0 -655
  333. package/.worktrees/2c37b1d7/src/stages/quick.js +0 -167
  334. package/.worktrees/2c37b1d7/src/stages/scan.js +0 -608
  335. package/.worktrees/2c37b1d7/src/stages/status.js +0 -64
  336. package/.worktrees/2c37b1d7/src/stages/verify.js +0 -246
  337. package/.worktrees/2c37b1d7/src/sync.js +0 -1470
  338. package/.worktrees/2c37b1d7/src/task-review.js +0 -1498
  339. package/.worktrees/2c37b1d7/src/taskcard-placeholders.js +0 -21
  340. package/.worktrees/2c37b1d7/src/taskcard.js +0 -250
  341. package/.worktrees/2c37b1d7/src/verify-postcheck.js +0 -1718
  342. package/.worktrees/2c37b1d7/src/verify-probes.js +0 -327
  343. package/.worktrees/2c37b1d7/src/version.js +0 -19
  344. package/.worktrees/2c37b1d7/src/workflow.js +0 -600
  345. package/.worktrees/2c37b1d7/src/workspace.js +0 -125
  346. package/.worktrees/2c37b1d7/src/worktree-apply.js +0 -1611
  347. package/.worktrees/2c37b1d7/src/worktree-deps.js +0 -668
  348. package/.worktrees/2c37b1d7/src/worktree.js +0 -1849
  349. package/.worktrees/2c37b1d7/templates/claude-instruction.md +0 -23
  350. package/.worktrees/2c37b1d7/templates/prompts/taskcard-rules.md +0 -29
  351. package/.worktrees/2c37b1d7/templates/prompts/testcase-design.md +0 -12
  352. package/.worktrees/2c37b1d7/templates/prompts/verify-probes.md +0 -32
  353. package/.worktrees/2c37b1d7/templates/workflows/archive-impact.yaml +0 -79
  354. package/.worktrees/2c37b1d7/templates/workflows/scan-docs.yaml +0 -132
  355. package/.worktrees/542c4415/.claude/skills/sillyspec-archive/SKILL.md +0 -87
  356. package/.worktrees/542c4415/.claude/skills/sillyspec-auto/SKILL.md +0 -93
  357. package/.worktrees/542c4415/.claude/skills/sillyspec-brainstorm/SKILL.md +0 -114
  358. package/.worktrees/542c4415/.claude/skills/sillyspec-commit/SKILL.md +0 -67
  359. package/.worktrees/542c4415/.claude/skills/sillyspec-continue/SKILL.md +0 -47
  360. package/.worktrees/542c4415/.claude/skills/sillyspec-doctor/SKILL.md +0 -76
  361. package/.worktrees/542c4415/.claude/skills/sillyspec-execute/SKILL.md +0 -214
  362. package/.worktrees/542c4415/.claude/skills/sillyspec-explore/SKILL.md +0 -102
  363. package/.worktrees/542c4415/.claude/skills/sillyspec-export/SKILL.md +0 -57
  364. package/.worktrees/542c4415/.claude/skills/sillyspec-init/SKILL.md +0 -177
  365. package/.worktrees/542c4415/.claude/skills/sillyspec-knowledge/SKILL.md +0 -270
  366. package/.worktrees/542c4415/.claude/skills/sillyspec-plan/SKILL.md +0 -156
  367. package/.worktrees/542c4415/.claude/skills/sillyspec-quick/SKILL.md +0 -116
  368. package/.worktrees/542c4415/.claude/skills/sillyspec-resume/SKILL.md +0 -70
  369. package/.worktrees/542c4415/.claude/skills/sillyspec-scan/SKILL.md +0 -79
  370. package/.worktrees/542c4415/.claude/skills/sillyspec-state/SKILL.md +0 -64
  371. package/.worktrees/542c4415/.claude/skills/sillyspec-status/SKILL.md +0 -54
  372. package/.worktrees/542c4415/.claude/skills/sillyspec-verify/SKILL.md +0 -87
  373. package/.worktrees/542c4415/.claude/skills/sillyspec-workspace/SKILL.md +0 -175
  374. package/.worktrees/542c4415/.gitattributes +0 -2
  375. package/.worktrees/542c4415/.husky/pre-push +0 -20
  376. package/.worktrees/542c4415/README.md +0 -203
  377. package/.worktrees/542c4415/SKILL.md +0 -91
  378. package/.worktrees/542c4415/architecture-analysis.md +0 -448
  379. package/.worktrees/542c4415/bin/sillyspec.js +0 -2
  380. package/.worktrees/542c4415/eval/README.md +0 -86
  381. package/.worktrees/542c4415/eval/eval.config.json +0 -28
  382. package/.worktrees/542c4415/eval/lib/adapters/cli.mjs +0 -63
  383. package/.worktrees/542c4415/eval/lib/adapters/dryrun.mjs +0 -27
  384. package/.worktrees/542c4415/eval/lib/config.mjs +0 -82
  385. package/.worktrees/542c4415/eval/lib/db.mjs +0 -76
  386. package/.worktrees/542c4415/eval/lib/report.mjs +0 -120
  387. package/.worktrees/542c4415/eval/lib/runner.mjs +0 -157
  388. package/.worktrees/542c4415/eval/lib/tasks.mjs +0 -73
  389. package/.worktrees/542c4415/eval/lib/util.mjs +0 -107
  390. package/.worktrees/542c4415/eval/lib/workdir.mjs +0 -30
  391. package/.worktrees/542c4415/eval/run.mjs +0 -83
  392. package/.worktrees/542c4415/eval/tasks/001-slugify/files/package.json +0 -6
  393. package/.worktrees/542c4415/eval/tasks/001-slugify/solution/src/slugify.mjs +0 -26
  394. package/.worktrees/542c4415/eval/tasks/001-slugify/task.json +0 -6
  395. package/.worktrees/542c4415/eval/tasks/001-slugify/verify.mjs +0 -28
  396. package/.worktrees/542c4415/eval/tasks/002-each-day/files/package.json +0 -6
  397. package/.worktrees/542c4415/eval/tasks/002-each-day/files/src/dates.mjs +0 -4
  398. package/.worktrees/542c4415/eval/tasks/002-each-day/solution/src/dates.mjs +0 -30
  399. package/.worktrees/542c4415/eval/tasks/002-each-day/task.json +0 -6
  400. package/.worktrees/542c4415/eval/tasks/002-each-day/verify.mjs +0 -31
  401. package/.worktrees/542c4415/eval/tasks/003-word-report/files/data/notes.txt +0 -5
  402. package/.worktrees/542c4415/eval/tasks/003-word-report/files/package.json +0 -6
  403. package/.worktrees/542c4415/eval/tasks/003-word-report/solution/bin/report.mjs +0 -36
  404. package/.worktrees/542c4415/eval/tasks/003-word-report/task.json +0 -6
  405. package/.worktrees/542c4415/eval/tasks/003-word-report/verify.mjs +0 -38
  406. package/.worktrees/542c4415/logo.jpg +0 -0
  407. package/.worktrees/542c4415/package-lock.json +0 -977
  408. package/.worktrees/542c4415/package.json +0 -41
  409. package/.worktrees/542c4415/packages/dashboard/dist/assets/index-Bq_Z2hne.js +0 -7446
  410. package/.worktrees/542c4415/packages/dashboard/dist/assets/index-O2W5RV4z.css +0 -1
  411. package/.worktrees/542c4415/packages/dashboard/dist/favicon.jpg +0 -0
  412. package/.worktrees/542c4415/packages/dashboard/dist/index.html +0 -16
  413. package/.worktrees/542c4415/packages/dashboard/dist/logo.jpg +0 -0
  414. package/.worktrees/542c4415/packages/dashboard/dist/prototype-dashboard.html +0 -836
  415. package/.worktrees/542c4415/packages/dashboard/dist/prototype-overview.html +0 -256
  416. package/.worktrees/542c4415/packages/dashboard/package.json +0 -25
  417. package/.worktrees/542c4415/packages/dashboard/server/executor.js +0 -95
  418. package/.worktrees/542c4415/packages/dashboard/server/index.js +0 -679
  419. package/.worktrees/542c4415/packages/dashboard/server/parser.js +0 -526
  420. package/.worktrees/542c4415/packages/dashboard/server/watcher.js +0 -357
  421. package/.worktrees/542c4415/src/agent-session-log.js +0 -803
  422. package/.worktrees/542c4415/src/change-list.js +0 -290
  423. package/.worktrees/542c4415/src/change-risk-profile.js +0 -339
  424. package/.worktrees/542c4415/src/check-primitives.js +0 -65
  425. package/.worktrees/542c4415/src/classify-change.js +0 -109
  426. package/.worktrees/542c4415/src/commit-suggest.js +0 -202
  427. package/.worktrees/542c4415/src/config-cat.js +0 -88
  428. package/.worktrees/542c4415/src/config-schema.js +0 -328
  429. package/.worktrees/542c4415/src/constants.js +0 -97
  430. package/.worktrees/542c4415/src/contract-matrix.js +0 -533
  431. package/.worktrees/542c4415/src/datetime.js +0 -20
  432. package/.worktrees/542c4415/src/db-engine.js +0 -55
  433. package/.worktrees/542c4415/src/db.js +0 -381
  434. package/.worktrees/542c4415/src/decision-distill.js +0 -517
  435. package/.worktrees/542c4415/src/dispatch/backends/local-agent.js +0 -155
  436. package/.worktrees/542c4415/src/dispatch/backends/sillyhub-mcp.js +0 -245
  437. package/.worktrees/542c4415/src/dispatch/probe.js +0 -246
  438. package/.worktrees/542c4415/src/dispatch/strategy.js +0 -121
  439. package/.worktrees/542c4415/src/docs-check.js +0 -825
  440. package/.worktrees/542c4415/src/docs-debt.js +0 -393
  441. package/.worktrees/542c4415/src/docs-gate.js +0 -107
  442. package/.worktrees/542c4415/src/doctor-diagnostics.js +0 -1099
  443. package/.worktrees/542c4415/src/endpoint-extractor.js +0 -409
  444. package/.worktrees/542c4415/src/foreign-declared.js +0 -155
  445. package/.worktrees/542c4415/src/fs-atomic.js +0 -73
  446. package/.worktrees/542c4415/src/git-helper.js +0 -150
  447. package/.worktrees/542c4415/src/hooks/claude-pre-tool-use.cjs +0 -130
  448. package/.worktrees/542c4415/src/hooks/worktree-guard.js +0 -892
  449. package/.worktrees/542c4415/src/index.js +0 -2854
  450. package/.worktrees/542c4415/src/init.js +0 -626
  451. package/.worktrees/542c4415/src/knowledge-match.js +0 -231
  452. package/.worktrees/542c4415/src/local-detect.js +0 -128
  453. package/.worktrees/542c4415/src/local-register.js +0 -104
  454. package/.worktrees/542c4415/src/machine-interface.js +0 -543
  455. package/.worktrees/542c4415/src/migrate.js +0 -127
  456. package/.worktrees/542c4415/src/module-impact.js +0 -166
  457. package/.worktrees/542c4415/src/module-resolve.js +0 -222
  458. package/.worktrees/542c4415/src/modules.js +0 -580
  459. package/.worktrees/542c4415/src/plan-adopt-waves.js +0 -126
  460. package/.worktrees/542c4415/src/progress/change-registry.js +0 -336
  461. package/.worktrees/542c4415/src/progress/consistency-doctor.js +0 -355
  462. package/.worktrees/542c4415/src/progress/shared.js +0 -36
  463. package/.worktrees/542c4415/src/progress/stage-machine.js +0 -594
  464. package/.worktrees/542c4415/src/progress/step-store.js +0 -265
  465. package/.worktrees/542c4415/src/progress.js +0 -1304
  466. package/.worktrees/542c4415/src/quick-recommend.js +0 -115
  467. package/.worktrees/542c4415/src/quicklog.js +0 -883
  468. package/.worktrees/542c4415/src/review-tier.js +0 -77
  469. package/.worktrees/542c4415/src/run/command.js +0 -1641
  470. package/.worktrees/542c4415/src/run/complete-handlers.js +0 -1552
  471. package/.worktrees/542c4415/src/run/complete.js +0 -1259
  472. package/.worktrees/542c4415/src/run/concurrent-detect.js +0 -156
  473. package/.worktrees/542c4415/src/run/gates.js +0 -1111
  474. package/.worktrees/542c4415/src/run/multi-repo-context.js +0 -208
  475. package/.worktrees/542c4415/src/run/next.js +0 -128
  476. package/.worktrees/542c4415/src/run/prompt.js +0 -843
  477. package/.worktrees/542c4415/src/run/quick-audit.js +0 -186
  478. package/.worktrees/542c4415/src/run/scan-profile.js +0 -269
  479. package/.worktrees/542c4415/src/run/shared.js +0 -1562
  480. package/.worktrees/542c4415/src/run/stage.js +0 -587
  481. package/.worktrees/542c4415/src/run.js +0 -23
  482. package/.worktrees/542c4415/src/scan-diff.js +0 -388
  483. package/.worktrees/542c4415/src/scan-postcheck.js +0 -524
  484. package/.worktrees/542c4415/src/scan-staleness.js +0 -95
  485. package/.worktrees/542c4415/src/setup.js +0 -414
  486. package/.worktrees/542c4415/src/sillyhub-mcp/client.js +0 -597
  487. package/.worktrees/542c4415/src/sillyhub-mcp/config.js +0 -62
  488. package/.worktrees/542c4415/src/spec-dir-typo.js +0 -50
  489. package/.worktrees/542c4415/src/spec-sync.js +0 -358
  490. package/.worktrees/542c4415/src/stage-contract-engine.js +0 -171
  491. package/.worktrees/542c4415/src/stage-contract-spec.js +0 -551
  492. package/.worktrees/542c4415/src/stage-contract.js +0 -948
  493. package/.worktrees/542c4415/src/stage-review.js +0 -597
  494. package/.worktrees/542c4415/src/stages/archive.js +0 -199
  495. package/.worktrees/542c4415/src/stages/brainstorm-auto.js +0 -285
  496. package/.worktrees/542c4415/src/stages/brainstorm.js +0 -624
  497. package/.worktrees/542c4415/src/stages/cmd-existence.js +0 -145
  498. package/.worktrees/542c4415/src/stages/doctor.js +0 -540
  499. package/.worktrees/542c4415/src/stages/execute.js +0 -1277
  500. package/.worktrees/542c4415/src/stages/explore.js +0 -43
  501. package/.worktrees/542c4415/src/stages/index.js +0 -29
  502. package/.worktrees/542c4415/src/stages/knowledge.js +0 -514
  503. package/.worktrees/542c4415/src/stages/plan-postcheck.js +0 -1398
  504. package/.worktrees/542c4415/src/stages/plan.js +0 -655
  505. package/.worktrees/542c4415/src/stages/quick.js +0 -167
  506. package/.worktrees/542c4415/src/stages/scan.js +0 -608
  507. package/.worktrees/542c4415/src/stages/status.js +0 -64
  508. package/.worktrees/542c4415/src/stages/verify.js +0 -246
  509. package/.worktrees/542c4415/src/sync.js +0 -1470
  510. package/.worktrees/542c4415/src/task-review.js +0 -1498
  511. package/.worktrees/542c4415/src/taskcard-placeholders.js +0 -21
  512. package/.worktrees/542c4415/src/taskcard.js +0 -250
  513. package/.worktrees/542c4415/src/verify-postcheck.js +0 -1718
  514. package/.worktrees/542c4415/src/verify-probes.js +0 -327
  515. package/.worktrees/542c4415/src/version.js +0 -19
  516. package/.worktrees/542c4415/src/workflow.js +0 -600
  517. package/.worktrees/542c4415/src/workspace.js +0 -125
  518. package/.worktrees/542c4415/src/worktree-apply.js +0 -1611
  519. package/.worktrees/542c4415/src/worktree-deps.js +0 -668
  520. package/.worktrees/542c4415/src/worktree.js +0 -1849
  521. package/.worktrees/542c4415/templates/prompts/taskcard-rules.md +0 -29
  522. package/.worktrees/542c4415/templates/prompts/testcase-design.md +0 -12
  523. package/.worktrees/542c4415/templates/prompts/verify-probes.md +0 -32
  524. package/.worktrees/542c4415/templates/workflows/archive-impact.yaml +0 -79
  525. package/.worktrees/542c4415/templates/workflows/scan-docs.yaml +0 -132
  526. package/.worktrees/8d2d0392/.claude/skills/sillyspec-archive/SKILL.md +0 -87
  527. package/.worktrees/8d2d0392/.claude/skills/sillyspec-auto/SKILL.md +0 -93
  528. package/.worktrees/8d2d0392/.claude/skills/sillyspec-brainstorm/SKILL.md +0 -114
  529. package/.worktrees/8d2d0392/.claude/skills/sillyspec-commit/SKILL.md +0 -67
  530. package/.worktrees/8d2d0392/.claude/skills/sillyspec-continue/SKILL.md +0 -47
  531. package/.worktrees/8d2d0392/.claude/skills/sillyspec-doctor/SKILL.md +0 -76
  532. package/.worktrees/8d2d0392/.claude/skills/sillyspec-execute/SKILL.md +0 -214
  533. package/.worktrees/8d2d0392/.claude/skills/sillyspec-explore/SKILL.md +0 -102
  534. package/.worktrees/8d2d0392/.claude/skills/sillyspec-export/SKILL.md +0 -57
  535. package/.worktrees/8d2d0392/.claude/skills/sillyspec-init/SKILL.md +0 -177
  536. package/.worktrees/8d2d0392/.claude/skills/sillyspec-knowledge/SKILL.md +0 -270
  537. package/.worktrees/8d2d0392/.claude/skills/sillyspec-plan/SKILL.md +0 -156
  538. package/.worktrees/8d2d0392/.claude/skills/sillyspec-propose/SKILL.md +0 -87
  539. package/.worktrees/8d2d0392/.claude/skills/sillyspec-quick/SKILL.md +0 -116
  540. package/.worktrees/8d2d0392/.claude/skills/sillyspec-resume/SKILL.md +0 -70
  541. package/.worktrees/8d2d0392/.claude/skills/sillyspec-scan/SKILL.md +0 -79
  542. package/.worktrees/8d2d0392/.claude/skills/sillyspec-state/SKILL.md +0 -64
  543. package/.worktrees/8d2d0392/.claude/skills/sillyspec-status/SKILL.md +0 -54
  544. package/.worktrees/8d2d0392/.claude/skills/sillyspec-verify/SKILL.md +0 -87
  545. package/.worktrees/8d2d0392/.claude/skills/sillyspec-workspace/SKILL.md +0 -175
  546. package/.worktrees/8d2d0392/.claude/skills/verify-per-user/SKILL.md +0 -6
  547. package/.worktrees/8d2d0392/.gitattributes +0 -2
  548. package/.worktrees/8d2d0392/.husky/pre-push +0 -20
  549. package/.worktrees/8d2d0392/README.md +0 -203
  550. package/.worktrees/8d2d0392/SKILL.md +0 -91
  551. package/.worktrees/8d2d0392/architecture-analysis.md +0 -448
  552. package/.worktrees/8d2d0392/bin/sillyspec.js +0 -2
  553. package/.worktrees/8d2d0392/eval/README.md +0 -86
  554. package/.worktrees/8d2d0392/eval/eval.config.json +0 -28
  555. package/.worktrees/8d2d0392/eval/lib/adapters/cli.mjs +0 -63
  556. package/.worktrees/8d2d0392/eval/lib/adapters/dryrun.mjs +0 -27
  557. package/.worktrees/8d2d0392/eval/lib/config.mjs +0 -82
  558. package/.worktrees/8d2d0392/eval/lib/db.mjs +0 -76
  559. package/.worktrees/8d2d0392/eval/lib/report.mjs +0 -120
  560. package/.worktrees/8d2d0392/eval/lib/runner.mjs +0 -157
  561. package/.worktrees/8d2d0392/eval/lib/tasks.mjs +0 -73
  562. package/.worktrees/8d2d0392/eval/lib/util.mjs +0 -107
  563. package/.worktrees/8d2d0392/eval/lib/workdir.mjs +0 -30
  564. package/.worktrees/8d2d0392/eval/run.mjs +0 -83
  565. package/.worktrees/8d2d0392/eval/tasks/001-slugify/files/package.json +0 -6
  566. package/.worktrees/8d2d0392/eval/tasks/001-slugify/solution/src/slugify.mjs +0 -26
  567. package/.worktrees/8d2d0392/eval/tasks/001-slugify/task.json +0 -6
  568. package/.worktrees/8d2d0392/eval/tasks/001-slugify/verify.mjs +0 -28
  569. package/.worktrees/8d2d0392/eval/tasks/002-each-day/files/package.json +0 -6
  570. package/.worktrees/8d2d0392/eval/tasks/002-each-day/files/src/dates.mjs +0 -4
  571. package/.worktrees/8d2d0392/eval/tasks/002-each-day/solution/src/dates.mjs +0 -30
  572. package/.worktrees/8d2d0392/eval/tasks/002-each-day/task.json +0 -6
  573. package/.worktrees/8d2d0392/eval/tasks/002-each-day/verify.mjs +0 -31
  574. package/.worktrees/8d2d0392/eval/tasks/003-word-report/files/data/notes.txt +0 -5
  575. package/.worktrees/8d2d0392/eval/tasks/003-word-report/files/package.json +0 -6
  576. package/.worktrees/8d2d0392/eval/tasks/003-word-report/solution/bin/report.mjs +0 -36
  577. package/.worktrees/8d2d0392/eval/tasks/003-word-report/task.json +0 -6
  578. package/.worktrees/8d2d0392/eval/tasks/003-word-report/verify.mjs +0 -38
  579. package/.worktrees/8d2d0392/logo.jpg +0 -0
  580. package/.worktrees/8d2d0392/package-lock.json +0 -977
  581. package/.worktrees/8d2d0392/package.json +0 -41
  582. package/.worktrees/8d2d0392/packages/dashboard/dist/assets/index-Bq_Z2hne.js +0 -7446
  583. package/.worktrees/8d2d0392/packages/dashboard/dist/assets/index-O2W5RV4z.css +0 -1
  584. package/.worktrees/8d2d0392/packages/dashboard/dist/favicon.jpg +0 -0
  585. package/.worktrees/8d2d0392/packages/dashboard/dist/index.html +0 -16
  586. package/.worktrees/8d2d0392/packages/dashboard/dist/logo.jpg +0 -0
  587. package/.worktrees/8d2d0392/packages/dashboard/dist/prototype-dashboard.html +0 -836
  588. package/.worktrees/8d2d0392/packages/dashboard/dist/prototype-overview.html +0 -256
  589. package/.worktrees/8d2d0392/packages/dashboard/package.json +0 -25
  590. package/.worktrees/8d2d0392/packages/dashboard/server/executor.js +0 -95
  591. package/.worktrees/8d2d0392/packages/dashboard/server/index.js +0 -679
  592. package/.worktrees/8d2d0392/packages/dashboard/server/parser.js +0 -526
  593. package/.worktrees/8d2d0392/packages/dashboard/server/watcher.js +0 -357
  594. package/.worktrees/8d2d0392/src/agent-session-log.js +0 -803
  595. package/.worktrees/8d2d0392/src/change-list.js +0 -290
  596. package/.worktrees/8d2d0392/src/change-risk-profile.js +0 -339
  597. package/.worktrees/8d2d0392/src/check-primitives.js +0 -65
  598. package/.worktrees/8d2d0392/src/classify-change.js +0 -109
  599. package/.worktrees/8d2d0392/src/commit-suggest.js +0 -202
  600. package/.worktrees/8d2d0392/src/config-cat.js +0 -88
  601. package/.worktrees/8d2d0392/src/config-schema.js +0 -328
  602. package/.worktrees/8d2d0392/src/constants.js +0 -97
  603. package/.worktrees/8d2d0392/src/contract-matrix.js +0 -533
  604. package/.worktrees/8d2d0392/src/datetime.js +0 -20
  605. package/.worktrees/8d2d0392/src/db-engine.js +0 -55
  606. package/.worktrees/8d2d0392/src/db.js +0 -381
  607. package/.worktrees/8d2d0392/src/decision-distill.js +0 -517
  608. package/.worktrees/8d2d0392/src/dispatch/backends/local-agent.js +0 -155
  609. package/.worktrees/8d2d0392/src/dispatch/backends/sillyhub-mcp.js +0 -245
  610. package/.worktrees/8d2d0392/src/dispatch/probe.js +0 -246
  611. package/.worktrees/8d2d0392/src/dispatch/strategy.js +0 -121
  612. package/.worktrees/8d2d0392/src/docs-check.js +0 -825
  613. package/.worktrees/8d2d0392/src/docs-debt.js +0 -393
  614. package/.worktrees/8d2d0392/src/docs-gate.js +0 -107
  615. package/.worktrees/8d2d0392/src/doctor-diagnostics.js +0 -1099
  616. package/.worktrees/8d2d0392/src/endpoint-extractor.js +0 -409
  617. package/.worktrees/8d2d0392/src/foreign-declared.js +0 -78
  618. package/.worktrees/8d2d0392/src/fs-atomic.js +0 -73
  619. package/.worktrees/8d2d0392/src/git-helper.js +0 -150
  620. package/.worktrees/8d2d0392/src/hooks/claude-pre-tool-use.cjs +0 -130
  621. package/.worktrees/8d2d0392/src/hooks/worktree-guard.js +0 -892
  622. package/.worktrees/8d2d0392/src/index.js +0 -2854
  623. package/.worktrees/8d2d0392/src/init.js +0 -626
  624. package/.worktrees/8d2d0392/src/knowledge-match.js +0 -231
  625. package/.worktrees/8d2d0392/src/local-detect.js +0 -128
  626. package/.worktrees/8d2d0392/src/local-register.js +0 -104
  627. package/.worktrees/8d2d0392/src/machine-interface.js +0 -543
  628. package/.worktrees/8d2d0392/src/migrate.js +0 -127
  629. package/.worktrees/8d2d0392/src/module-impact.js +0 -166
  630. package/.worktrees/8d2d0392/src/module-resolve.js +0 -222
  631. package/.worktrees/8d2d0392/src/modules.js +0 -580
  632. package/.worktrees/8d2d0392/src/plan-adopt-waves.js +0 -126
  633. package/.worktrees/8d2d0392/src/progress/change-registry.js +0 -336
  634. package/.worktrees/8d2d0392/src/progress/consistency-doctor.js +0 -355
  635. package/.worktrees/8d2d0392/src/progress/shared.js +0 -36
  636. package/.worktrees/8d2d0392/src/progress/stage-machine.js +0 -594
  637. package/.worktrees/8d2d0392/src/progress/step-store.js +0 -265
  638. package/.worktrees/8d2d0392/src/progress.js +0 -1304
  639. package/.worktrees/8d2d0392/src/quick-recommend.js +0 -115
  640. package/.worktrees/8d2d0392/src/quicklog.js +0 -883
  641. package/.worktrees/8d2d0392/src/review-tier.js +0 -77
  642. package/.worktrees/8d2d0392/src/run/command.js +0 -1641
  643. package/.worktrees/8d2d0392/src/run/complete-handlers.js +0 -1552
  644. package/.worktrees/8d2d0392/src/run/complete.js +0 -1259
  645. package/.worktrees/8d2d0392/src/run/concurrent-detect.js +0 -156
  646. package/.worktrees/8d2d0392/src/run/gates.js +0 -1094
  647. package/.worktrees/8d2d0392/src/run/multi-repo-context.js +0 -208
  648. package/.worktrees/8d2d0392/src/run/next.js +0 -128
  649. package/.worktrees/8d2d0392/src/run/prompt.js +0 -843
  650. package/.worktrees/8d2d0392/src/run/quick-audit.js +0 -186
  651. package/.worktrees/8d2d0392/src/run/scan-profile.js +0 -269
  652. package/.worktrees/8d2d0392/src/run/shared.js +0 -1562
  653. package/.worktrees/8d2d0392/src/run/stage.js +0 -587
  654. package/.worktrees/8d2d0392/src/run.js +0 -23
  655. package/.worktrees/8d2d0392/src/scan-diff.js +0 -388
  656. package/.worktrees/8d2d0392/src/scan-postcheck.js +0 -524
  657. package/.worktrees/8d2d0392/src/scan-staleness.js +0 -95
  658. package/.worktrees/8d2d0392/src/setup.js +0 -414
  659. package/.worktrees/8d2d0392/src/sillyhub-mcp/client.js +0 -597
  660. package/.worktrees/8d2d0392/src/sillyhub-mcp/config.js +0 -62
  661. package/.worktrees/8d2d0392/src/spec-dir-typo.js +0 -50
  662. package/.worktrees/8d2d0392/src/spec-sync.js +0 -358
  663. package/.worktrees/8d2d0392/src/stage-contract-engine.js +0 -171
  664. package/.worktrees/8d2d0392/src/stage-contract-spec.js +0 -551
  665. package/.worktrees/8d2d0392/src/stage-contract.js +0 -948
  666. package/.worktrees/8d2d0392/src/stage-review.js +0 -597
  667. package/.worktrees/8d2d0392/src/stages/archive.js +0 -199
  668. package/.worktrees/8d2d0392/src/stages/brainstorm-auto.js +0 -285
  669. package/.worktrees/8d2d0392/src/stages/brainstorm.js +0 -624
  670. package/.worktrees/8d2d0392/src/stages/cmd-existence.js +0 -145
  671. package/.worktrees/8d2d0392/src/stages/doctor.js +0 -540
  672. package/.worktrees/8d2d0392/src/stages/execute.js +0 -1277
  673. package/.worktrees/8d2d0392/src/stages/explore.js +0 -43
  674. package/.worktrees/8d2d0392/src/stages/index.js +0 -29
  675. package/.worktrees/8d2d0392/src/stages/knowledge.js +0 -514
  676. package/.worktrees/8d2d0392/src/stages/plan-postcheck.js +0 -1398
  677. package/.worktrees/8d2d0392/src/stages/plan.js +0 -651
  678. package/.worktrees/8d2d0392/src/stages/quick.js +0 -167
  679. package/.worktrees/8d2d0392/src/stages/scan.js +0 -608
  680. package/.worktrees/8d2d0392/src/stages/status.js +0 -64
  681. package/.worktrees/8d2d0392/src/stages/verify.js +0 -246
  682. package/.worktrees/8d2d0392/src/sync.js +0 -1470
  683. package/.worktrees/8d2d0392/src/task-review.js +0 -1498
  684. package/.worktrees/8d2d0392/src/taskcard-placeholders.js +0 -21
  685. package/.worktrees/8d2d0392/src/taskcard.js +0 -217
  686. package/.worktrees/8d2d0392/src/verify-postcheck.js +0 -1718
  687. package/.worktrees/8d2d0392/src/verify-probes.js +0 -327
  688. package/.worktrees/8d2d0392/src/version.js +0 -19
  689. package/.worktrees/8d2d0392/src/workflow.js +0 -600
  690. package/.worktrees/8d2d0392/src/workspace.js +0 -125
  691. package/.worktrees/8d2d0392/src/worktree-apply.js +0 -1611
  692. package/.worktrees/8d2d0392/src/worktree-deps.js +0 -576
  693. package/.worktrees/8d2d0392/src/worktree.js +0 -1838
  694. package/.worktrees/8d2d0392/templates/claude-instruction.md +0 -23
  695. package/.worktrees/8d2d0392/templates/prompts/taskcard-rules.md +0 -29
  696. package/.worktrees/8d2d0392/templates/prompts/testcase-design.md +0 -12
  697. package/.worktrees/8d2d0392/templates/prompts/verify-probes.md +0 -32
  698. package/.worktrees/8d2d0392/templates/workflows/archive-impact.yaml +0 -79
  699. package/.worktrees/8d2d0392/templates/workflows/scan-docs.yaml +0 -132
  700. package/.worktrees/c1eae35e/.claude/skills/sillyspec-archive/SKILL.md +0 -87
  701. package/.worktrees/c1eae35e/.claude/skills/sillyspec-auto/SKILL.md +0 -93
  702. package/.worktrees/c1eae35e/.claude/skills/sillyspec-brainstorm/SKILL.md +0 -114
  703. package/.worktrees/c1eae35e/.claude/skills/sillyspec-commit/SKILL.md +0 -67
  704. package/.worktrees/c1eae35e/.claude/skills/sillyspec-continue/SKILL.md +0 -47
  705. package/.worktrees/c1eae35e/.claude/skills/sillyspec-doctor/SKILL.md +0 -76
  706. package/.worktrees/c1eae35e/.claude/skills/sillyspec-execute/SKILL.md +0 -214
  707. package/.worktrees/c1eae35e/.claude/skills/sillyspec-explore/SKILL.md +0 -102
  708. package/.worktrees/c1eae35e/.claude/skills/sillyspec-export/SKILL.md +0 -57
  709. package/.worktrees/c1eae35e/.claude/skills/sillyspec-init/SKILL.md +0 -177
  710. package/.worktrees/c1eae35e/.claude/skills/sillyspec-knowledge/SKILL.md +0 -270
  711. package/.worktrees/c1eae35e/.claude/skills/sillyspec-plan/SKILL.md +0 -156
  712. package/.worktrees/c1eae35e/.claude/skills/sillyspec-quick/SKILL.md +0 -116
  713. package/.worktrees/c1eae35e/.claude/skills/sillyspec-resume/SKILL.md +0 -70
  714. package/.worktrees/c1eae35e/.claude/skills/sillyspec-scan/SKILL.md +0 -79
  715. package/.worktrees/c1eae35e/.claude/skills/sillyspec-state/SKILL.md +0 -64
  716. package/.worktrees/c1eae35e/.claude/skills/sillyspec-status/SKILL.md +0 -54
  717. package/.worktrees/c1eae35e/.claude/skills/sillyspec-verify/SKILL.md +0 -87
  718. package/.worktrees/c1eae35e/.claude/skills/sillyspec-workspace/SKILL.md +0 -175
  719. package/.worktrees/c1eae35e/.gitattributes +0 -2
  720. package/.worktrees/c1eae35e/.husky/pre-push +0 -20
  721. package/.worktrees/c1eae35e/README.md +0 -203
  722. package/.worktrees/c1eae35e/SKILL.md +0 -91
  723. package/.worktrees/c1eae35e/architecture-analysis.md +0 -448
  724. package/.worktrees/c1eae35e/bin/sillyspec.js +0 -2
  725. package/.worktrees/c1eae35e/eval/README.md +0 -86
  726. package/.worktrees/c1eae35e/eval/eval.config.json +0 -28
  727. package/.worktrees/c1eae35e/eval/lib/adapters/cli.mjs +0 -63
  728. package/.worktrees/c1eae35e/eval/lib/adapters/dryrun.mjs +0 -27
  729. package/.worktrees/c1eae35e/eval/lib/config.mjs +0 -82
  730. package/.worktrees/c1eae35e/eval/lib/db.mjs +0 -76
  731. package/.worktrees/c1eae35e/eval/lib/report.mjs +0 -120
  732. package/.worktrees/c1eae35e/eval/lib/runner.mjs +0 -157
  733. package/.worktrees/c1eae35e/eval/lib/tasks.mjs +0 -73
  734. package/.worktrees/c1eae35e/eval/lib/util.mjs +0 -107
  735. package/.worktrees/c1eae35e/eval/lib/workdir.mjs +0 -30
  736. package/.worktrees/c1eae35e/eval/run.mjs +0 -83
  737. package/.worktrees/c1eae35e/eval/tasks/001-slugify/files/package.json +0 -6
  738. package/.worktrees/c1eae35e/eval/tasks/001-slugify/solution/src/slugify.mjs +0 -26
  739. package/.worktrees/c1eae35e/eval/tasks/001-slugify/task.json +0 -6
  740. package/.worktrees/c1eae35e/eval/tasks/001-slugify/verify.mjs +0 -28
  741. package/.worktrees/c1eae35e/eval/tasks/002-each-day/files/package.json +0 -6
  742. package/.worktrees/c1eae35e/eval/tasks/002-each-day/files/src/dates.mjs +0 -4
  743. package/.worktrees/c1eae35e/eval/tasks/002-each-day/solution/src/dates.mjs +0 -30
  744. package/.worktrees/c1eae35e/eval/tasks/002-each-day/task.json +0 -6
  745. package/.worktrees/c1eae35e/eval/tasks/002-each-day/verify.mjs +0 -31
  746. package/.worktrees/c1eae35e/eval/tasks/003-word-report/files/data/notes.txt +0 -5
  747. package/.worktrees/c1eae35e/eval/tasks/003-word-report/files/package.json +0 -6
  748. package/.worktrees/c1eae35e/eval/tasks/003-word-report/solution/bin/report.mjs +0 -36
  749. package/.worktrees/c1eae35e/eval/tasks/003-word-report/task.json +0 -6
  750. package/.worktrees/c1eae35e/eval/tasks/003-word-report/verify.mjs +0 -38
  751. package/.worktrees/c1eae35e/logo.jpg +0 -0
  752. package/.worktrees/c1eae35e/package-lock.json +0 -977
  753. package/.worktrees/c1eae35e/package.json +0 -41
  754. package/.worktrees/c1eae35e/packages/dashboard/dist/assets/index-Bq_Z2hne.js +0 -7446
  755. package/.worktrees/c1eae35e/packages/dashboard/dist/assets/index-O2W5RV4z.css +0 -1
  756. package/.worktrees/c1eae35e/packages/dashboard/dist/favicon.jpg +0 -0
  757. package/.worktrees/c1eae35e/packages/dashboard/dist/index.html +0 -16
  758. package/.worktrees/c1eae35e/packages/dashboard/dist/logo.jpg +0 -0
  759. package/.worktrees/c1eae35e/packages/dashboard/dist/prototype-dashboard.html +0 -836
  760. package/.worktrees/c1eae35e/packages/dashboard/dist/prototype-overview.html +0 -256
  761. package/.worktrees/c1eae35e/packages/dashboard/package.json +0 -25
  762. package/.worktrees/c1eae35e/packages/dashboard/server/executor.js +0 -95
  763. package/.worktrees/c1eae35e/packages/dashboard/server/index.js +0 -679
  764. package/.worktrees/c1eae35e/packages/dashboard/server/parser.js +0 -526
  765. package/.worktrees/c1eae35e/packages/dashboard/server/watcher.js +0 -357
  766. package/.worktrees/c1eae35e/src/agent-session-log.js +0 -803
  767. package/.worktrees/c1eae35e/src/change-list.js +0 -290
  768. package/.worktrees/c1eae35e/src/change-risk-profile.js +0 -339
  769. package/.worktrees/c1eae35e/src/check-primitives.js +0 -65
  770. package/.worktrees/c1eae35e/src/classify-change.js +0 -109
  771. package/.worktrees/c1eae35e/src/commit-suggest.js +0 -202
  772. package/.worktrees/c1eae35e/src/config-cat.js +0 -88
  773. package/.worktrees/c1eae35e/src/config-schema.js +0 -328
  774. package/.worktrees/c1eae35e/src/constants.js +0 -97
  775. package/.worktrees/c1eae35e/src/contract-matrix.js +0 -533
  776. package/.worktrees/c1eae35e/src/datetime.js +0 -20
  777. package/.worktrees/c1eae35e/src/db-engine.js +0 -55
  778. package/.worktrees/c1eae35e/src/db.js +0 -381
  779. package/.worktrees/c1eae35e/src/decision-distill.js +0 -517
  780. package/.worktrees/c1eae35e/src/dispatch/backends/local-agent.js +0 -155
  781. package/.worktrees/c1eae35e/src/dispatch/backends/sillyhub-mcp.js +0 -245
  782. package/.worktrees/c1eae35e/src/dispatch/probe.js +0 -246
  783. package/.worktrees/c1eae35e/src/dispatch/strategy.js +0 -121
  784. package/.worktrees/c1eae35e/src/docs-check.js +0 -825
  785. package/.worktrees/c1eae35e/src/docs-debt.js +0 -393
  786. package/.worktrees/c1eae35e/src/docs-gate.js +0 -107
  787. package/.worktrees/c1eae35e/src/doctor-diagnostics.js +0 -1099
  788. package/.worktrees/c1eae35e/src/endpoint-extractor.js +0 -409
  789. package/.worktrees/c1eae35e/src/foreign-declared.js +0 -155
  790. package/.worktrees/c1eae35e/src/fs-atomic.js +0 -73
  791. package/.worktrees/c1eae35e/src/git-helper.js +0 -150
  792. package/.worktrees/c1eae35e/src/hooks/claude-pre-tool-use.cjs +0 -130
  793. package/.worktrees/c1eae35e/src/hooks/worktree-guard.js +0 -892
  794. package/.worktrees/c1eae35e/src/index.js +0 -2854
  795. package/.worktrees/c1eae35e/src/init.js +0 -626
  796. package/.worktrees/c1eae35e/src/knowledge-match.js +0 -231
  797. package/.worktrees/c1eae35e/src/local-detect.js +0 -128
  798. package/.worktrees/c1eae35e/src/local-register.js +0 -104
  799. package/.worktrees/c1eae35e/src/machine-interface.js +0 -543
  800. package/.worktrees/c1eae35e/src/migrate.js +0 -127
  801. package/.worktrees/c1eae35e/src/module-impact.js +0 -166
  802. package/.worktrees/c1eae35e/src/module-resolve.js +0 -222
  803. package/.worktrees/c1eae35e/src/modules.js +0 -580
  804. package/.worktrees/c1eae35e/src/plan-adopt-waves.js +0 -126
  805. package/.worktrees/c1eae35e/src/progress/change-registry.js +0 -336
  806. package/.worktrees/c1eae35e/src/progress/consistency-doctor.js +0 -355
  807. package/.worktrees/c1eae35e/src/progress/shared.js +0 -36
  808. package/.worktrees/c1eae35e/src/progress/stage-machine.js +0 -594
  809. package/.worktrees/c1eae35e/src/progress/step-store.js +0 -265
  810. package/.worktrees/c1eae35e/src/progress.js +0 -1304
  811. package/.worktrees/c1eae35e/src/quick-recommend.js +0 -115
  812. package/.worktrees/c1eae35e/src/quicklog.js +0 -883
  813. package/.worktrees/c1eae35e/src/review-tier.js +0 -77
  814. package/.worktrees/c1eae35e/src/run/command.js +0 -1641
  815. package/.worktrees/c1eae35e/src/run/complete-handlers.js +0 -1552
  816. package/.worktrees/c1eae35e/src/run/complete.js +0 -1259
  817. package/.worktrees/c1eae35e/src/run/concurrent-detect.js +0 -156
  818. package/.worktrees/c1eae35e/src/run/gates.js +0 -1111
  819. package/.worktrees/c1eae35e/src/run/multi-repo-context.js +0 -208
  820. package/.worktrees/c1eae35e/src/run/next.js +0 -128
  821. package/.worktrees/c1eae35e/src/run/prompt.js +0 -843
  822. package/.worktrees/c1eae35e/src/run/quick-audit.js +0 -186
  823. package/.worktrees/c1eae35e/src/run/scan-profile.js +0 -269
  824. package/.worktrees/c1eae35e/src/run/shared.js +0 -1562
  825. package/.worktrees/c1eae35e/src/run/stage.js +0 -587
  826. package/.worktrees/c1eae35e/src/run.js +0 -23
  827. package/.worktrees/c1eae35e/src/scan-diff.js +0 -388
  828. package/.worktrees/c1eae35e/src/scan-postcheck.js +0 -524
  829. package/.worktrees/c1eae35e/src/scan-staleness.js +0 -95
  830. package/.worktrees/c1eae35e/src/setup.js +0 -414
  831. package/.worktrees/c1eae35e/src/sillyhub-mcp/client.js +0 -597
  832. package/.worktrees/c1eae35e/src/sillyhub-mcp/config.js +0 -62
  833. package/.worktrees/c1eae35e/src/spec-dir-typo.js +0 -50
  834. package/.worktrees/c1eae35e/src/spec-sync.js +0 -358
  835. package/.worktrees/c1eae35e/src/stage-contract-engine.js +0 -171
  836. package/.worktrees/c1eae35e/src/stage-contract-spec.js +0 -551
  837. package/.worktrees/c1eae35e/src/stage-contract.js +0 -948
  838. package/.worktrees/c1eae35e/src/stage-review.js +0 -597
  839. package/.worktrees/c1eae35e/src/stages/archive.js +0 -199
  840. package/.worktrees/c1eae35e/src/stages/brainstorm-auto.js +0 -285
  841. package/.worktrees/c1eae35e/src/stages/brainstorm.js +0 -624
  842. package/.worktrees/c1eae35e/src/stages/cmd-existence.js +0 -145
  843. package/.worktrees/c1eae35e/src/stages/doctor.js +0 -540
  844. package/.worktrees/c1eae35e/src/stages/execute.js +0 -1277
  845. package/.worktrees/c1eae35e/src/stages/explore.js +0 -43
  846. package/.worktrees/c1eae35e/src/stages/index.js +0 -29
  847. package/.worktrees/c1eae35e/src/stages/knowledge.js +0 -514
  848. package/.worktrees/c1eae35e/src/stages/plan-postcheck.js +0 -1398
  849. package/.worktrees/c1eae35e/src/stages/plan.js +0 -655
  850. package/.worktrees/c1eae35e/src/stages/quick.js +0 -167
  851. package/.worktrees/c1eae35e/src/stages/scan.js +0 -608
  852. package/.worktrees/c1eae35e/src/stages/status.js +0 -64
  853. package/.worktrees/c1eae35e/src/stages/verify.js +0 -246
  854. package/.worktrees/c1eae35e/src/sync.js +0 -1470
  855. package/.worktrees/c1eae35e/src/task-review.js +0 -1498
  856. package/.worktrees/c1eae35e/src/taskcard-placeholders.js +0 -21
  857. package/.worktrees/c1eae35e/src/taskcard.js +0 -250
  858. package/.worktrees/c1eae35e/src/verify-postcheck.js +0 -1718
  859. package/.worktrees/c1eae35e/src/verify-probes.js +0 -327
  860. package/.worktrees/c1eae35e/src/version.js +0 -19
  861. package/.worktrees/c1eae35e/src/workflow.js +0 -600
  862. package/.worktrees/c1eae35e/src/workspace.js +0 -125
  863. package/.worktrees/c1eae35e/src/worktree-apply.js +0 -1611
  864. package/.worktrees/c1eae35e/src/worktree-deps.js +0 -668
  865. package/.worktrees/c1eae35e/src/worktree.js +0 -1849
  866. package/.worktrees/c1eae35e/templates/claude-instruction.md +0 -23
  867. package/.worktrees/c1eae35e/templates/prompts/taskcard-rules.md +0 -29
  868. package/.worktrees/c1eae35e/templates/prompts/testcase-design.md +0 -12
  869. package/.worktrees/c1eae35e/templates/prompts/verify-probes.md +0 -32
  870. package/.worktrees/c1eae35e/templates/workflows/archive-impact.yaml +0 -79
  871. package/.worktrees/c1eae35e/templates/workflows/scan-docs.yaml +0 -132
  872. package/.worktrees/dafc71ad/.claude/skills/sillyspec-archive/SKILL.md +0 -87
  873. package/.worktrees/dafc71ad/.claude/skills/sillyspec-auto/SKILL.md +0 -93
  874. package/.worktrees/dafc71ad/.claude/skills/sillyspec-brainstorm/SKILL.md +0 -114
  875. package/.worktrees/dafc71ad/.claude/skills/sillyspec-commit/SKILL.md +0 -67
  876. package/.worktrees/dafc71ad/.claude/skills/sillyspec-continue/SKILL.md +0 -47
  877. package/.worktrees/dafc71ad/.claude/skills/sillyspec-doctor/SKILL.md +0 -76
  878. package/.worktrees/dafc71ad/.claude/skills/sillyspec-execute/SKILL.md +0 -214
  879. package/.worktrees/dafc71ad/.claude/skills/sillyspec-explore/SKILL.md +0 -102
  880. package/.worktrees/dafc71ad/.claude/skills/sillyspec-export/SKILL.md +0 -57
  881. package/.worktrees/dafc71ad/.claude/skills/sillyspec-init/SKILL.md +0 -177
  882. package/.worktrees/dafc71ad/.claude/skills/sillyspec-knowledge/SKILL.md +0 -270
  883. package/.worktrees/dafc71ad/.claude/skills/sillyspec-plan/SKILL.md +0 -156
  884. package/.worktrees/dafc71ad/.claude/skills/sillyspec-propose/SKILL.md +0 -87
  885. package/.worktrees/dafc71ad/.claude/skills/sillyspec-quick/SKILL.md +0 -116
  886. package/.worktrees/dafc71ad/.claude/skills/sillyspec-resume/SKILL.md +0 -70
  887. package/.worktrees/dafc71ad/.claude/skills/sillyspec-scan/SKILL.md +0 -79
  888. package/.worktrees/dafc71ad/.claude/skills/sillyspec-state/SKILL.md +0 -64
  889. package/.worktrees/dafc71ad/.claude/skills/sillyspec-status/SKILL.md +0 -54
  890. package/.worktrees/dafc71ad/.claude/skills/sillyspec-verify/SKILL.md +0 -87
  891. package/.worktrees/dafc71ad/.claude/skills/sillyspec-workspace/SKILL.md +0 -175
  892. package/.worktrees/dafc71ad/.gitattributes +0 -2
  893. package/.worktrees/dafc71ad/.husky/pre-push +0 -20
  894. package/.worktrees/dafc71ad/README.md +0 -203
  895. package/.worktrees/dafc71ad/SKILL.md +0 -91
  896. package/.worktrees/dafc71ad/analysis.md +0 -366
  897. package/.worktrees/dafc71ad/architecture-analysis.md +0 -448
  898. package/.worktrees/dafc71ad/bin/sillyspec.js +0 -2
  899. package/.worktrees/dafc71ad/eval/README.md +0 -86
  900. package/.worktrees/dafc71ad/eval/eval.config.json +0 -28
  901. package/.worktrees/dafc71ad/eval/lib/adapters/cli.mjs +0 -63
  902. package/.worktrees/dafc71ad/eval/lib/adapters/dryrun.mjs +0 -27
  903. package/.worktrees/dafc71ad/eval/lib/config.mjs +0 -82
  904. package/.worktrees/dafc71ad/eval/lib/db.mjs +0 -76
  905. package/.worktrees/dafc71ad/eval/lib/report.mjs +0 -120
  906. package/.worktrees/dafc71ad/eval/lib/runner.mjs +0 -157
  907. package/.worktrees/dafc71ad/eval/lib/tasks.mjs +0 -73
  908. package/.worktrees/dafc71ad/eval/lib/util.mjs +0 -107
  909. package/.worktrees/dafc71ad/eval/lib/workdir.mjs +0 -30
  910. package/.worktrees/dafc71ad/eval/run.mjs +0 -83
  911. package/.worktrees/dafc71ad/eval/tasks/001-slugify/files/package.json +0 -6
  912. package/.worktrees/dafc71ad/eval/tasks/001-slugify/solution/src/slugify.mjs +0 -26
  913. package/.worktrees/dafc71ad/eval/tasks/001-slugify/task.json +0 -6
  914. package/.worktrees/dafc71ad/eval/tasks/001-slugify/verify.mjs +0 -28
  915. package/.worktrees/dafc71ad/eval/tasks/002-each-day/files/package.json +0 -6
  916. package/.worktrees/dafc71ad/eval/tasks/002-each-day/files/src/dates.mjs +0 -4
  917. package/.worktrees/dafc71ad/eval/tasks/002-each-day/solution/src/dates.mjs +0 -30
  918. package/.worktrees/dafc71ad/eval/tasks/002-each-day/task.json +0 -6
  919. package/.worktrees/dafc71ad/eval/tasks/002-each-day/verify.mjs +0 -31
  920. package/.worktrees/dafc71ad/eval/tasks/003-word-report/files/data/notes.txt +0 -5
  921. package/.worktrees/dafc71ad/eval/tasks/003-word-report/files/package.json +0 -6
  922. package/.worktrees/dafc71ad/eval/tasks/003-word-report/solution/bin/report.mjs +0 -36
  923. package/.worktrees/dafc71ad/eval/tasks/003-word-report/task.json +0 -6
  924. package/.worktrees/dafc71ad/eval/tasks/003-word-report/verify.mjs +0 -38
  925. package/.worktrees/dafc71ad/logo.jpg +0 -0
  926. package/.worktrees/dafc71ad/package-lock.json +0 -977
  927. package/.worktrees/dafc71ad/package.json +0 -41
  928. package/.worktrees/dafc71ad/packages/dashboard/dist/assets/index-Bq_Z2hne.js +0 -7446
  929. package/.worktrees/dafc71ad/packages/dashboard/dist/assets/index-O2W5RV4z.css +0 -1
  930. package/.worktrees/dafc71ad/packages/dashboard/dist/favicon.jpg +0 -0
  931. package/.worktrees/dafc71ad/packages/dashboard/dist/index.html +0 -16
  932. package/.worktrees/dafc71ad/packages/dashboard/dist/logo.jpg +0 -0
  933. package/.worktrees/dafc71ad/packages/dashboard/dist/prototype-dashboard.html +0 -836
  934. package/.worktrees/dafc71ad/packages/dashboard/dist/prototype-overview.html +0 -256
  935. package/.worktrees/dafc71ad/packages/dashboard/package.json +0 -25
  936. package/.worktrees/dafc71ad/packages/dashboard/server/executor.js +0 -95
  937. package/.worktrees/dafc71ad/packages/dashboard/server/index.js +0 -679
  938. package/.worktrees/dafc71ad/packages/dashboard/server/parser.js +0 -526
  939. package/.worktrees/dafc71ad/packages/dashboard/server/watcher.js +0 -357
  940. package/.worktrees/dafc71ad/src/agent-session-log.js +0 -803
  941. package/.worktrees/dafc71ad/src/change-list.js +0 -290
  942. package/.worktrees/dafc71ad/src/change-risk-profile.js +0 -339
  943. package/.worktrees/dafc71ad/src/check-primitives.js +0 -65
  944. package/.worktrees/dafc71ad/src/classify-change.js +0 -109
  945. package/.worktrees/dafc71ad/src/commit-suggest.js +0 -202
  946. package/.worktrees/dafc71ad/src/config-cat.js +0 -88
  947. package/.worktrees/dafc71ad/src/config-schema.js +0 -328
  948. package/.worktrees/dafc71ad/src/constants.js +0 -97
  949. package/.worktrees/dafc71ad/src/contract-matrix.js +0 -533
  950. package/.worktrees/dafc71ad/src/datetime.js +0 -20
  951. package/.worktrees/dafc71ad/src/db-engine.js +0 -55
  952. package/.worktrees/dafc71ad/src/db.js +0 -381
  953. package/.worktrees/dafc71ad/src/decision-distill.js +0 -517
  954. package/.worktrees/dafc71ad/src/dispatch/backends/local-agent.js +0 -155
  955. package/.worktrees/dafc71ad/src/dispatch/backends/sillyhub-mcp.js +0 -245
  956. package/.worktrees/dafc71ad/src/dispatch/probe.js +0 -246
  957. package/.worktrees/dafc71ad/src/dispatch/strategy.js +0 -121
  958. package/.worktrees/dafc71ad/src/docs-check.js +0 -825
  959. package/.worktrees/dafc71ad/src/docs-debt.js +0 -393
  960. package/.worktrees/dafc71ad/src/docs-gate.js +0 -107
  961. package/.worktrees/dafc71ad/src/doctor-diagnostics.js +0 -1099
  962. package/.worktrees/dafc71ad/src/endpoint-extractor.js +0 -409
  963. package/.worktrees/dafc71ad/src/foreign-declared.js +0 -155
  964. package/.worktrees/dafc71ad/src/fs-atomic.js +0 -73
  965. package/.worktrees/dafc71ad/src/git-helper.js +0 -150
  966. package/.worktrees/dafc71ad/src/hooks/claude-pre-tool-use.cjs +0 -130
  967. package/.worktrees/dafc71ad/src/hooks/worktree-guard.js +0 -892
  968. package/.worktrees/dafc71ad/src/index.js +0 -2854
  969. package/.worktrees/dafc71ad/src/init.js +0 -626
  970. package/.worktrees/dafc71ad/src/knowledge-match.js +0 -231
  971. package/.worktrees/dafc71ad/src/local-detect.js +0 -128
  972. package/.worktrees/dafc71ad/src/local-register.js +0 -104
  973. package/.worktrees/dafc71ad/src/machine-interface.js +0 -543
  974. package/.worktrees/dafc71ad/src/migrate.js +0 -127
  975. package/.worktrees/dafc71ad/src/module-impact.js +0 -166
  976. package/.worktrees/dafc71ad/src/module-resolve.js +0 -222
  977. package/.worktrees/dafc71ad/src/modules.js +0 -580
  978. package/.worktrees/dafc71ad/src/plan-adopt-waves.js +0 -126
  979. package/.worktrees/dafc71ad/src/progress/change-registry.js +0 -336
  980. package/.worktrees/dafc71ad/src/progress/consistency-doctor.js +0 -355
  981. package/.worktrees/dafc71ad/src/progress/shared.js +0 -36
  982. package/.worktrees/dafc71ad/src/progress/stage-machine.js +0 -594
  983. package/.worktrees/dafc71ad/src/progress/step-store.js +0 -265
  984. package/.worktrees/dafc71ad/src/progress.js +0 -1304
  985. package/.worktrees/dafc71ad/src/quick-recommend.js +0 -115
  986. package/.worktrees/dafc71ad/src/quicklog.js +0 -883
  987. package/.worktrees/dafc71ad/src/review-tier.js +0 -77
  988. package/.worktrees/dafc71ad/src/run/command.js +0 -1641
  989. package/.worktrees/dafc71ad/src/run/complete-handlers.js +0 -1552
  990. package/.worktrees/dafc71ad/src/run/complete.js +0 -1259
  991. package/.worktrees/dafc71ad/src/run/concurrent-detect.js +0 -156
  992. package/.worktrees/dafc71ad/src/run/gates.js +0 -1111
  993. package/.worktrees/dafc71ad/src/run/multi-repo-context.js +0 -208
  994. package/.worktrees/dafc71ad/src/run/next.js +0 -128
  995. package/.worktrees/dafc71ad/src/run/prompt.js +0 -843
  996. package/.worktrees/dafc71ad/src/run/quick-audit.js +0 -186
  997. package/.worktrees/dafc71ad/src/run/scan-profile.js +0 -269
  998. package/.worktrees/dafc71ad/src/run/shared.js +0 -1562
  999. package/.worktrees/dafc71ad/src/run/stage.js +0 -587
  1000. package/.worktrees/dafc71ad/src/run.js +0 -23
  1001. package/.worktrees/dafc71ad/src/scan-diff.js +0 -388
  1002. package/.worktrees/dafc71ad/src/scan-postcheck.js +0 -524
  1003. package/.worktrees/dafc71ad/src/scan-staleness.js +0 -95
  1004. package/.worktrees/dafc71ad/src/setup.js +0 -414
  1005. package/.worktrees/dafc71ad/src/sillyhub-mcp/client.js +0 -597
  1006. package/.worktrees/dafc71ad/src/sillyhub-mcp/config.js +0 -62
  1007. package/.worktrees/dafc71ad/src/spec-dir-typo.js +0 -50
  1008. package/.worktrees/dafc71ad/src/spec-sync.js +0 -358
  1009. package/.worktrees/dafc71ad/src/stage-contract-engine.js +0 -171
  1010. package/.worktrees/dafc71ad/src/stage-contract-spec.js +0 -551
  1011. package/.worktrees/dafc71ad/src/stage-contract.js +0 -948
  1012. package/.worktrees/dafc71ad/src/stage-review.js +0 -597
  1013. package/.worktrees/dafc71ad/src/stages/archive.js +0 -199
  1014. package/.worktrees/dafc71ad/src/stages/brainstorm-auto.js +0 -285
  1015. package/.worktrees/dafc71ad/src/stages/brainstorm.js +0 -624
  1016. package/.worktrees/dafc71ad/src/stages/cmd-existence.js +0 -145
  1017. package/.worktrees/dafc71ad/src/stages/doctor.js +0 -540
  1018. package/.worktrees/dafc71ad/src/stages/execute.js +0 -1277
  1019. package/.worktrees/dafc71ad/src/stages/explore.js +0 -43
  1020. package/.worktrees/dafc71ad/src/stages/index.js +0 -29
  1021. package/.worktrees/dafc71ad/src/stages/knowledge.js +0 -514
  1022. package/.worktrees/dafc71ad/src/stages/plan-postcheck.js +0 -1398
  1023. package/.worktrees/dafc71ad/src/stages/plan.js +0 -655
  1024. package/.worktrees/dafc71ad/src/stages/quick.js +0 -167
  1025. package/.worktrees/dafc71ad/src/stages/scan.js +0 -608
  1026. package/.worktrees/dafc71ad/src/stages/status.js +0 -64
  1027. package/.worktrees/dafc71ad/src/stages/verify.js +0 -246
  1028. package/.worktrees/dafc71ad/src/sync.js +0 -1470
  1029. package/.worktrees/dafc71ad/src/task-review.js +0 -1498
  1030. package/.worktrees/dafc71ad/src/taskcard-placeholders.js +0 -21
  1031. package/.worktrees/dafc71ad/src/taskcard.js +0 -250
  1032. package/.worktrees/dafc71ad/src/verify-postcheck.js +0 -1718
  1033. package/.worktrees/dafc71ad/src/verify-probes.js +0 -327
  1034. package/.worktrees/dafc71ad/src/version.js +0 -19
  1035. package/.worktrees/dafc71ad/src/workflow.js +0 -600
  1036. package/.worktrees/dafc71ad/src/workspace.js +0 -125
  1037. package/.worktrees/dafc71ad/src/worktree-apply.js +0 -1611
  1038. package/.worktrees/dafc71ad/src/worktree-deps.js +0 -668
  1039. package/.worktrees/dafc71ad/src/worktree.js +0 -1849
  1040. package/.worktrees/dafc71ad/templates/claude-instruction.md +0 -23
  1041. package/.worktrees/dafc71ad/templates/prompts/taskcard-rules.md +0 -29
  1042. package/.worktrees/dafc71ad/templates/prompts/testcase-design.md +0 -12
  1043. package/.worktrees/dafc71ad/templates/prompts/verify-probes.md +0 -32
  1044. package/.worktrees/dafc71ad/templates/workflows/archive-impact.yaml +0 -79
  1045. package/.worktrees/dafc71ad/templates/workflows/scan-docs.yaml +0 -132
  1046. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-archive/SKILL.md +0 -87
  1047. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-auto/SKILL.md +0 -93
  1048. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-brainstorm/SKILL.md +0 -114
  1049. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-commit/SKILL.md +0 -67
  1050. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-continue/SKILL.md +0 -47
  1051. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-doctor/SKILL.md +0 -76
  1052. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-execute/SKILL.md +0 -214
  1053. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-explore/SKILL.md +0 -102
  1054. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-export/SKILL.md +0 -57
  1055. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-init/SKILL.md +0 -177
  1056. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-knowledge/SKILL.md +0 -270
  1057. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-plan/SKILL.md +0 -156
  1058. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-propose/SKILL.md +0 -87
  1059. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-quick/SKILL.md +0 -116
  1060. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-resume/SKILL.md +0 -70
  1061. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-scan/SKILL.md +0 -79
  1062. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-state/SKILL.md +0 -64
  1063. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-status/SKILL.md +0 -54
  1064. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-verify/SKILL.md +0 -87
  1065. package/.worktrees/e58fcc4c/.claude/skills/sillyspec-workspace/SKILL.md +0 -175
  1066. package/.worktrees/e58fcc4c/.gitattributes +0 -2
  1067. package/.worktrees/e58fcc4c/.husky/pre-push +0 -20
  1068. package/.worktrees/e58fcc4c/README.md +0 -203
  1069. package/.worktrees/e58fcc4c/SKILL.md +0 -91
  1070. package/.worktrees/e58fcc4c/architecture-analysis.md +0 -503
  1071. package/.worktrees/e58fcc4c/bin/sillyspec.js +0 -2
  1072. package/.worktrees/e58fcc4c/eval/README.md +0 -86
  1073. package/.worktrees/e58fcc4c/eval/eval.config.json +0 -28
  1074. package/.worktrees/e58fcc4c/eval/lib/adapters/cli.mjs +0 -63
  1075. package/.worktrees/e58fcc4c/eval/lib/adapters/dryrun.mjs +0 -27
  1076. package/.worktrees/e58fcc4c/eval/lib/config.mjs +0 -82
  1077. package/.worktrees/e58fcc4c/eval/lib/db.mjs +0 -76
  1078. package/.worktrees/e58fcc4c/eval/lib/report.mjs +0 -120
  1079. package/.worktrees/e58fcc4c/eval/lib/runner.mjs +0 -157
  1080. package/.worktrees/e58fcc4c/eval/lib/tasks.mjs +0 -73
  1081. package/.worktrees/e58fcc4c/eval/lib/util.mjs +0 -107
  1082. package/.worktrees/e58fcc4c/eval/lib/workdir.mjs +0 -30
  1083. package/.worktrees/e58fcc4c/eval/run.mjs +0 -83
  1084. package/.worktrees/e58fcc4c/eval/tasks/001-slugify/files/package.json +0 -6
  1085. package/.worktrees/e58fcc4c/eval/tasks/001-slugify/solution/src/slugify.mjs +0 -26
  1086. package/.worktrees/e58fcc4c/eval/tasks/001-slugify/task.json +0 -6
  1087. package/.worktrees/e58fcc4c/eval/tasks/001-slugify/verify.mjs +0 -28
  1088. package/.worktrees/e58fcc4c/eval/tasks/002-each-day/files/package.json +0 -6
  1089. package/.worktrees/e58fcc4c/eval/tasks/002-each-day/files/src/dates.mjs +0 -4
  1090. package/.worktrees/e58fcc4c/eval/tasks/002-each-day/solution/src/dates.mjs +0 -30
  1091. package/.worktrees/e58fcc4c/eval/tasks/002-each-day/task.json +0 -6
  1092. package/.worktrees/e58fcc4c/eval/tasks/002-each-day/verify.mjs +0 -31
  1093. package/.worktrees/e58fcc4c/eval/tasks/003-word-report/files/data/notes.txt +0 -5
  1094. package/.worktrees/e58fcc4c/eval/tasks/003-word-report/files/package.json +0 -6
  1095. package/.worktrees/e58fcc4c/eval/tasks/003-word-report/solution/bin/report.mjs +0 -36
  1096. package/.worktrees/e58fcc4c/eval/tasks/003-word-report/task.json +0 -6
  1097. package/.worktrees/e58fcc4c/eval/tasks/003-word-report/verify.mjs +0 -38
  1098. package/.worktrees/e58fcc4c/logo.jpg +0 -0
  1099. package/.worktrees/e58fcc4c/package-lock.json +0 -977
  1100. package/.worktrees/e58fcc4c/package.json +0 -41
  1101. package/.worktrees/e58fcc4c/packages/dashboard/dist/assets/index-Bq_Z2hne.js +0 -7446
  1102. package/.worktrees/e58fcc4c/packages/dashboard/dist/assets/index-O2W5RV4z.css +0 -1
  1103. package/.worktrees/e58fcc4c/packages/dashboard/dist/favicon.jpg +0 -0
  1104. package/.worktrees/e58fcc4c/packages/dashboard/dist/index.html +0 -16
  1105. package/.worktrees/e58fcc4c/packages/dashboard/dist/logo.jpg +0 -0
  1106. package/.worktrees/e58fcc4c/packages/dashboard/dist/prototype-dashboard.html +0 -836
  1107. package/.worktrees/e58fcc4c/packages/dashboard/dist/prototype-overview.html +0 -256
  1108. package/.worktrees/e58fcc4c/packages/dashboard/package.json +0 -25
  1109. package/.worktrees/e58fcc4c/packages/dashboard/server/executor.js +0 -95
  1110. package/.worktrees/e58fcc4c/packages/dashboard/server/index.js +0 -679
  1111. package/.worktrees/e58fcc4c/packages/dashboard/server/parser.js +0 -526
  1112. package/.worktrees/e58fcc4c/packages/dashboard/server/watcher.js +0 -357
  1113. package/.worktrees/e58fcc4c/src/agent-session-log.js +0 -803
  1114. package/.worktrees/e58fcc4c/src/change-list.js +0 -290
  1115. package/.worktrees/e58fcc4c/src/change-risk-profile.js +0 -339
  1116. package/.worktrees/e58fcc4c/src/check-primitives.js +0 -65
  1117. package/.worktrees/e58fcc4c/src/classify-change.js +0 -109
  1118. package/.worktrees/e58fcc4c/src/commit-suggest.js +0 -202
  1119. package/.worktrees/e58fcc4c/src/config-cat.js +0 -88
  1120. package/.worktrees/e58fcc4c/src/config-schema.js +0 -328
  1121. package/.worktrees/e58fcc4c/src/constants.js +0 -97
  1122. package/.worktrees/e58fcc4c/src/contract-matrix.js +0 -533
  1123. package/.worktrees/e58fcc4c/src/datetime.js +0 -20
  1124. package/.worktrees/e58fcc4c/src/db-engine.js +0 -55
  1125. package/.worktrees/e58fcc4c/src/db.js +0 -381
  1126. package/.worktrees/e58fcc4c/src/decision-distill.js +0 -517
  1127. package/.worktrees/e58fcc4c/src/dispatch/backends/local-agent.js +0 -155
  1128. package/.worktrees/e58fcc4c/src/dispatch/backends/sillyhub-mcp.js +0 -245
  1129. package/.worktrees/e58fcc4c/src/dispatch/probe.js +0 -246
  1130. package/.worktrees/e58fcc4c/src/dispatch/strategy.js +0 -121
  1131. package/.worktrees/e58fcc4c/src/docs-check.js +0 -825
  1132. package/.worktrees/e58fcc4c/src/docs-debt.js +0 -393
  1133. package/.worktrees/e58fcc4c/src/docs-gate.js +0 -107
  1134. package/.worktrees/e58fcc4c/src/doctor-diagnostics.js +0 -1099
  1135. package/.worktrees/e58fcc4c/src/endpoint-extractor.js +0 -409
  1136. package/.worktrees/e58fcc4c/src/foreign-declared.js +0 -155
  1137. package/.worktrees/e58fcc4c/src/fs-atomic.js +0 -73
  1138. package/.worktrees/e58fcc4c/src/git-helper.js +0 -150
  1139. package/.worktrees/e58fcc4c/src/hooks/claude-pre-tool-use.cjs +0 -130
  1140. package/.worktrees/e58fcc4c/src/hooks/worktree-guard.js +0 -892
  1141. package/.worktrees/e58fcc4c/src/index.js +0 -2854
  1142. package/.worktrees/e58fcc4c/src/init.js +0 -626
  1143. package/.worktrees/e58fcc4c/src/knowledge-match.js +0 -231
  1144. package/.worktrees/e58fcc4c/src/local-detect.js +0 -128
  1145. package/.worktrees/e58fcc4c/src/local-register.js +0 -104
  1146. package/.worktrees/e58fcc4c/src/machine-interface.js +0 -543
  1147. package/.worktrees/e58fcc4c/src/migrate.js +0 -127
  1148. package/.worktrees/e58fcc4c/src/module-impact.js +0 -166
  1149. package/.worktrees/e58fcc4c/src/module-resolve.js +0 -222
  1150. package/.worktrees/e58fcc4c/src/modules.js +0 -580
  1151. package/.worktrees/e58fcc4c/src/plan-adopt-waves.js +0 -126
  1152. package/.worktrees/e58fcc4c/src/progress/change-registry.js +0 -336
  1153. package/.worktrees/e58fcc4c/src/progress/consistency-doctor.js +0 -355
  1154. package/.worktrees/e58fcc4c/src/progress/shared.js +0 -36
  1155. package/.worktrees/e58fcc4c/src/progress/stage-machine.js +0 -594
  1156. package/.worktrees/e58fcc4c/src/progress/step-store.js +0 -265
  1157. package/.worktrees/e58fcc4c/src/progress.js +0 -1304
  1158. package/.worktrees/e58fcc4c/src/quick-recommend.js +0 -115
  1159. package/.worktrees/e58fcc4c/src/quicklog.js +0 -883
  1160. package/.worktrees/e58fcc4c/src/review-tier.js +0 -77
  1161. package/.worktrees/e58fcc4c/src/run/command.js +0 -1641
  1162. package/.worktrees/e58fcc4c/src/run/complete-handlers.js +0 -1552
  1163. package/.worktrees/e58fcc4c/src/run/complete.js +0 -1259
  1164. package/.worktrees/e58fcc4c/src/run/concurrent-detect.js +0 -156
  1165. package/.worktrees/e58fcc4c/src/run/gates.js +0 -1111
  1166. package/.worktrees/e58fcc4c/src/run/multi-repo-context.js +0 -208
  1167. package/.worktrees/e58fcc4c/src/run/next.js +0 -128
  1168. package/.worktrees/e58fcc4c/src/run/prompt.js +0 -843
  1169. package/.worktrees/e58fcc4c/src/run/quick-audit.js +0 -186
  1170. package/.worktrees/e58fcc4c/src/run/scan-profile.js +0 -269
  1171. package/.worktrees/e58fcc4c/src/run/shared.js +0 -1562
  1172. package/.worktrees/e58fcc4c/src/run/stage.js +0 -587
  1173. package/.worktrees/e58fcc4c/src/run.js +0 -23
  1174. package/.worktrees/e58fcc4c/src/scan-diff.js +0 -388
  1175. package/.worktrees/e58fcc4c/src/scan-postcheck.js +0 -524
  1176. package/.worktrees/e58fcc4c/src/scan-staleness.js +0 -95
  1177. package/.worktrees/e58fcc4c/src/setup.js +0 -414
  1178. package/.worktrees/e58fcc4c/src/sillyhub-mcp/client.js +0 -597
  1179. package/.worktrees/e58fcc4c/src/sillyhub-mcp/config.js +0 -62
  1180. package/.worktrees/e58fcc4c/src/spec-dir-typo.js +0 -50
  1181. package/.worktrees/e58fcc4c/src/spec-sync.js +0 -358
  1182. package/.worktrees/e58fcc4c/src/stage-contract-engine.js +0 -171
  1183. package/.worktrees/e58fcc4c/src/stage-contract-spec.js +0 -551
  1184. package/.worktrees/e58fcc4c/src/stage-contract.js +0 -948
  1185. package/.worktrees/e58fcc4c/src/stage-review.js +0 -597
  1186. package/.worktrees/e58fcc4c/src/stages/archive.js +0 -199
  1187. package/.worktrees/e58fcc4c/src/stages/brainstorm-auto.js +0 -285
  1188. package/.worktrees/e58fcc4c/src/stages/brainstorm.js +0 -624
  1189. package/.worktrees/e58fcc4c/src/stages/cmd-existence.js +0 -145
  1190. package/.worktrees/e58fcc4c/src/stages/doctor.js +0 -540
  1191. package/.worktrees/e58fcc4c/src/stages/execute.js +0 -1277
  1192. package/.worktrees/e58fcc4c/src/stages/explore.js +0 -43
  1193. package/.worktrees/e58fcc4c/src/stages/index.js +0 -29
  1194. package/.worktrees/e58fcc4c/src/stages/knowledge.js +0 -514
  1195. package/.worktrees/e58fcc4c/src/stages/plan-postcheck.js +0 -1398
  1196. package/.worktrees/e58fcc4c/src/stages/plan.js +0 -655
  1197. package/.worktrees/e58fcc4c/src/stages/quick.js +0 -167
  1198. package/.worktrees/e58fcc4c/src/stages/scan.js +0 -608
  1199. package/.worktrees/e58fcc4c/src/stages/status.js +0 -64
  1200. package/.worktrees/e58fcc4c/src/stages/verify.js +0 -246
  1201. package/.worktrees/e58fcc4c/src/sync.js +0 -1470
  1202. package/.worktrees/e58fcc4c/src/task-review.js +0 -1498
  1203. package/.worktrees/e58fcc4c/src/taskcard-placeholders.js +0 -21
  1204. package/.worktrees/e58fcc4c/src/taskcard.js +0 -250
  1205. package/.worktrees/e58fcc4c/src/verify-postcheck.js +0 -1718
  1206. package/.worktrees/e58fcc4c/src/verify-probes.js +0 -327
  1207. package/.worktrees/e58fcc4c/src/version.js +0 -19
  1208. package/.worktrees/e58fcc4c/src/workflow.js +0 -600
  1209. package/.worktrees/e58fcc4c/src/workspace.js +0 -125
  1210. package/.worktrees/e58fcc4c/src/worktree-apply.js +0 -1611
  1211. package/.worktrees/e58fcc4c/src/worktree-deps.js +0 -668
  1212. package/.worktrees/e58fcc4c/src/worktree.js +0 -1849
  1213. package/.worktrees/e58fcc4c/templates/claude-instruction.md +0 -23
  1214. package/.worktrees/e58fcc4c/templates/prompts/taskcard-rules.md +0 -29
  1215. package/.worktrees/e58fcc4c/templates/prompts/testcase-design.md +0 -12
  1216. package/.worktrees/e58fcc4c/templates/prompts/verify-probes.md +0 -32
  1217. package/.worktrees/e58fcc4c/templates/workflows/archive-impact.yaml +0 -79
  1218. package/.worktrees/e58fcc4c/templates/workflows/scan-docs.yaml +0 -132
  1219. package/templates/claude-instruction.md +0 -23
@@ -1,1304 +0,0 @@
1
- /**
2
- * SillySpec ProgressManager — 进度恢复管理
3
- *
4
- * 纯 Node.js,无外部依赖。支持多变更并行。
5
- *
6
- * 存储结构:
7
- * .sillyspec/.runtime/sillyspec.db — SQLite 数据库(权威状态源,含全局状态/项目名/活跃变更)
8
- *
9
- * 历史迁移:v1/v2 使用 progress.json 文件,v3 已全部迁移至 SQLite。
10
- * worktree-guard hook 直读 sillyspec.db,不再有 gate-status.json 缓存双源(task-10 废除)。
11
- */
12
-
13
- import { existsSync, mkdirSync, readFileSync, writeFileSync, renameSync, unlinkSync, appendFileSync, copyFileSync, readdirSync, statSync } from 'fs';
14
- import { join, basename, dirname, resolve, sep } from 'path';
15
- import { tmpdir } from 'os';
16
- import { writeAtomicSync } from './fs-atomic.js';
17
- import { DB } from './db.js';
18
- import { checkExecuteCodeEvidence } from './stage-contract.js';
19
- import { ConsistencyDoctor } from './progress/consistency-doctor.js';
20
- import { ChangeRegistry } from './progress/change-registry.js';
21
- import { StepStore } from './progress/step-store.js';
22
- import { StageMachine } from './progress/stage-machine.js';
23
- import { stageRegistry } from './stages/index.js';
24
- import { STAGE_ORDER, MAIN_FLOW_ORDER, VALID_STAGES, STAGE_LABELS, SPEC_DIR_NAME, CURRENT_VERSION, emptyStage } from './progress/shared.js';
25
- // resolveSpecDir 单一真相源在 src/run/shared.js(含 home 拒绝守卫,坑 cwd-correction-home-collision
26
- // 根治:home 下 .sillyspec 恒不命中,防 smoke/临时目录污染自我延续)。此处 re-export 保持
27
- // 既有 import 路径兼容;run/shared.js 对 progress.js 只有动态 import,无静态循环。
28
- import { resolveSpecDir } from './run/shared.js';
29
- import { checkPlatformManaged, PLATFORM_MANAGED_FILENAME } from './run/shared.js';
30
- export { resolveSpecDir };
31
-
32
- // 默认规范目录名(相对于 cwd)
33
- // SPEC_DIR_NAME → ./progress/shared.js(W6 Step9d)
34
- const RUNTIME_SUBDIR = '.runtime';
35
-
36
- /**
37
- * 向上查找含 .sillyspec 目录的祖先目录——实现已收敛至 src/run/shared.js(单一真相源,
38
- * 含 home 拒绝守卫),此处 re-export。见顶部 import 说明。
39
- */
40
-
41
- /**
42
- * 平台指针不可达错误。pointer 存在但失效时抛出,阻止静默回退到本地孤儿 db。
43
- * 逃生口:显式 --spec-dir 绕过 pointer 校验。
44
- */
45
- export class PointerUnreachableError extends Error {
46
- constructor({ pointerPath, specRoot, reason, hint }) {
47
- super(
48
- `平台指针不可用:${reason}\n` +
49
- ` pointer: ${pointerPath}\n` +
50
- ` specRoot: ${specRoot || '(缺失)'}\n` +
51
- `修复:${hint}`
52
- );
53
- this.name = 'PointerUnreachableError';
54
- this.pointerPath = pointerPath;
55
- this.specRoot = specRoot || null;
56
- }
57
- }
58
-
59
- /**
60
- * 平台接管声明生效错误(指针缺失但声明存在)。fail-closed 入口一:
61
- * 防指针被 cleanup/STALE 清理或项目挪动后裸调静默建本地进度库(状态分裂根因)。
62
- *
63
- * ⚠️ 不覆写 this.name(保持父类的 'PointerUnreachableError')——CLI 顶层 catch 按
64
- * err?.name === 'PointerUnreachableError' 严格字符串匹配(index.js),子类改名会
65
- * 落通用错误分支打 stack noise。靠 message 首行"平台接管声明生效"区分场景。
66
- */
67
- export class PlatformManagedError extends PointerUnreachableError {
68
- constructor({ declarationPath, specRoot }) {
69
- super({
70
- pointerPath: declarationPath,
71
- specRoot,
72
- reason: `平台接管声明生效——本项目已由平台托管,但恢复指针缺失(可能被 platform pointer --cleanup 清理或项目目录被移动),拒绝静默回退本地模式`,
73
- hint: `① 重跑平台 scan/init(带 --spec-root)重建指针;② 确认不再使用平台:sillyspec platform disconnect(删除接管声明);③ 显式 --spec-dir <路径> 临时指定目录`,
74
- });
75
- this.declarationPath = declarationPath;
76
- }
77
- }
78
-
79
- /**
80
- * 平台感知的 specDir 解析(fail-closed,所有 CLI 子命令统一入口)。
81
- *
82
- * 优先级:显式 --spec-dir > pointer.specRoot(可达)> resolveSpecDir(cwd)。
83
- *
84
- * fail-closed 语义(修复"状态穿越"定时炸弹):
85
- * 一旦项目进入过平台模式(pointer 文件存在),pointer 失效(specRoot 不可达 /
86
- * 损坏 / 缺字段)不再静默回退到本地——否则会读到切平台前的过期本地 db。
87
- * 此时抛 PointerUnreachableError,由 CLI 顶层捕获并打印修复引导。
88
- *
89
- * 无 pointer = 纯本地项目(从未平台 scan),正常走本地解析,不受影响。
90
- */
91
- export function resolvePlatformSpecDir(cwd, explicitSpecDir = null) {
92
- if (explicitSpecDir) return resolve(explicitSpecDir);
93
- const pointerPath = join(resolve(cwd), '.sillyspec-platform.json');
94
- if (!existsSync(pointerPath)) {
95
- // 指针缺失:查平台接管声明(fail-closed 入口一)。声明存在 = 项目进过平台模式,
96
- // 指针丢失不该静默当纯本地项目处理(会建本地进度库 → 状态分裂)。
97
- const decl = checkPlatformManaged(cwd);
98
- if (decl) {
99
- throw new PlatformManagedError({
100
- declarationPath: join(resolve(cwd), PLATFORM_MANAGED_FILENAME),
101
- specRoot: decl.specRoot,
102
- });
103
- }
104
- return resolveSpecDir(cwd);
105
- }
106
- // pointer 存在 = 进过平台模式,严格校验,不静默回退
107
- let ptr;
108
- try {
109
- ptr = JSON.parse(readFileSync(pointerPath, 'utf8'));
110
- } catch (e) {
111
- throw new PointerUnreachableError({
112
- pointerPath,
113
- specRoot: null,
114
- reason: `pointer 文件损坏(${e.message})`,
115
- hint: `sillyspec platform pointer --cleanup 删除后重跑平台 scan`,
116
- });
117
- }
118
- if (!ptr.specRoot) {
119
- throw new PointerUnreachableError({
120
- pointerPath,
121
- specRoot: null,
122
- reason: 'pointer 缺少 specRoot 字段',
123
- hint: `sillyspec platform pointer --cleanup 删除后重跑平台 scan`,
124
- });
125
- }
126
- if (!existsSync(ptr.specRoot)) {
127
- throw new PointerUnreachableError({
128
- pointerPath,
129
- specRoot: ptr.specRoot,
130
- reason: 'pointer.specRoot 路径不存在(daemon 未起?已迁移?)',
131
- hint: `启动 SillyHub daemon;或 sillyspec doctor --json 诊断;或显式 --spec-dir <本地路径> 临时走本地`,
132
- });
133
- }
134
- // 驾驭:pointer 指向 OS temp 目录几乎肯定是陈旧测试/CI 残留(合法项目不会把 specRoot 放 temp)。
135
- // 历史:npm test 等会写 pointer 到 Temp/spec-dir-test-*,不清理则污染真实环境,所有命令静默落错库。
136
- // 非阻断警告:让 agent 知道当前解析到的 specDir 可疑,而非静默写到死库。
137
- const resolvedTmp = resolve(tmpdir());
138
- if (resolve(ptr.specRoot) === resolvedTmp || resolve(ptr.specRoot).startsWith(resolvedTmp + sep)) {
139
- console.warn(
140
- `⚠️ 平台 pointer 的 specRoot 指向系统 temp 目录:${ptr.specRoot}\n` +
141
- ` 这通常是陈旧的测试/CI 残留,命令会写进这个可疑库而非你当前项目。\n` +
142
- ` 修复:sillyspec platform pointer --cleanup(删除 ${pointerPath}),或删除该 pointer 文件后回到项目目录重跑。`
143
- );
144
- }
145
- return ptr.specRoot;
146
- }
147
-
148
- const CHANGES_SUBDIR = 'changes';
149
- // CURRENT_VERSION → ./progress/shared.js(W6 Step9d)
150
- // VALID_STAGES → ./progress/shared.js(W6 Step9c)
151
- // VALID_STATUSES → ./progress/step-store.js(updateStep 专用,本地化)
152
-
153
-
154
- // ── ProgressManager ──
155
-
156
- export class ProgressManager {
157
- /** 模块级 DB 连接池:Map<dbPath, DB>(SEC-09/PERF-10,见 _ensureDB 注释) */
158
- static _dbPool = new Map();
159
-
160
- /**
161
- * @param {object} [opts]
162
- * @param {string} [opts.specDir] - 规范目录绝对路径(默认 cwd/.sillyspec)
163
- */
164
- constructor(opts = {}) {
165
- this._customSpecDir = opts.specDir || null;
166
- this._consistency = new ConsistencyDoctor(this);
167
- this._changeRegistry = new ChangeRegistry(this);
168
- this._stepStore = new StepStore(this);
169
- this._stageMachine = new StageMachine(this);
170
- }
171
-
172
- // ── 路径工具 ──
173
-
174
- /** 获取 specDir(优先自定义,否则向上查找含 .sillyspec 的目录,fallback 到 cwd/.sillyspec) */
175
- _getSpecDir(cwd) {
176
- if (this._customSpecDir) return this._customSpecDir;
177
- // specDir 对给定 cwd 在进程生命周期内不变(.sillyspec 目录不会被移动),
178
- // 按 cwd 缓存,避免每次路径解析都向上 existsSync 遍历目录树(热路径)。
179
- if (!this._specDirCache) this._specDirCache = new Map();
180
- const cached = this._specDirCache.get(cwd);
181
- if (cached) return cached;
182
- const resolved = resolveSpecDir(cwd);
183
- this._specDirCache.set(cwd, resolved);
184
- return resolved;
185
- }
186
-
187
- _runtimePath(cwd, ...parts) {
188
- return join(this._getSpecDir(cwd), RUNTIME_SUBDIR, ...parts);
189
- }
190
-
191
- _changePath(cwd, changeName, ...parts) {
192
- return join(this._getSpecDir(cwd), CHANGES_SUBDIR, changeName, ...parts);
193
- }
194
-
195
- _ensureRuntimeDir(cwd) {
196
- const runtimeDir = this._runtimePath(cwd);
197
- if (!existsSync(runtimeDir)) {
198
- mkdirSync(runtimeDir, { recursive: true });
199
- for (const d of ['artifacts', 'history', 'logs', 'templates']) {
200
- mkdirSync(join(runtimeDir, d), { recursive: true });
201
- }
202
- }
203
- }
204
-
205
- /**
206
- * 懒初始化 DB 连接,缓存在实例上(better-sqlite3 同步 API,init 无 async)。
207
- *
208
- * SEC-09/PERF-10(2026-08-20 体检):连接额外进模块级 Map<dbPath, DB> 单例——
209
- * 一条平台命令此前会 new 多个 ProgressManager(triggerPull / sync / import 各建),
210
- * 同一 sillyspec.db 被 open 3-5 次,每次重跑 PRAGMA + schema 探测,且多连接
211
- * 提升 SQLITE_BUSY 概率、Windows 残留句柄影响文件替换。CLI 短进程生命周期内
212
- * dbPath 不变,进程退出由 OS 回收句柄(node:sqlite 无显式泄漏);进程内共享
213
- * 单连接后 WAL 写竞争面反而缩小。
214
- */
215
- _ensureDB(cwd) {
216
- if (!this._db) {
217
- const dbPath = this._runtimePath(cwd, 'sillyspec.db');
218
- let db = ProgressManager._dbPool.get(dbPath);
219
- if (!db) {
220
- db = new DB(dbPath);
221
- db.init();
222
- ProgressManager._dbPool.set(dbPath, db);
223
- }
224
- this._db = db;
225
- }
226
- return this._db;
227
- }
228
-
229
- _ensureChangeDir(cwd, changeName) {
230
- const dir = this._changePath(cwd, changeName);
231
- if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
232
- return dir;
233
- }
234
-
235
- // ── 全局状态 ──
236
-
237
- readGlobal(cwd) {
238
- // SQL: SELECT FROM project + changes
239
- const db = this._ensureDB(cwd);
240
- const sqlDb = db.getDb();
241
-
242
- // 读取 project 行(id=1)
243
- const row = sqlDb.prepare('SELECT name, schema_version FROM project WHERE id = 1').get();
244
- if (row === undefined) return null;
245
- const { name, schema_version: schemaVersion } = row;
246
-
247
- // 读取 active 变更列表
248
- const changeRows = sqlDb.prepare("SELECT name FROM changes WHERE status = 'active' ORDER BY name").all();
249
- const activeChanges = changeRows.map(r => r.name);
250
-
251
- return {
252
- _version: schemaVersion,
253
- project: name,
254
- activeChanges,
255
- };
256
- }
257
-
258
- // ── 变更级别状态 ──
259
-
260
- /**
261
- * 读取指定变更的 progress(SQL 版)
262
- * @param {string} cwd
263
- * @param {string|null} changeName - 变更名,null 时尝试自动检测
264
- * @returns {object|null} 与 SQLite 查询结果一致的 JS 对象
265
- */
266
- read(cwd, changeName = null) {
267
- // 自动检测变更名(listChanges 已在 task-08 同步化,此处直接拿到活跃变更数组)
268
- if (!changeName) {
269
- const changes = this.listChanges(cwd);
270
- if (changes.length === 1) {
271
- changeName = changes[0];
272
- } else {
273
- // 多个或零个活跃变更,无法确定
274
- return null;
275
- }
276
- }
277
-
278
- const db = this._ensureDB(cwd);
279
- const sqlDb = db.getDb();
280
-
281
- // 1. 从 changes 表获取基本信息
282
- const changeRow = sqlDb.prepare('SELECT id, name, current_stage, no_worktree, last_active FROM changes WHERE name = ?').get(changeName);
283
- if (changeRow === undefined) return null;
284
- const { id: changeId, name: cName, current_stage: currentStage, no_worktree: noWorktree, last_active: lastActive } = changeRow;
285
-
286
- // 2. 从 stages 表获取所有阶段(含 revision 列)
287
- const stageRows = sqlDb.prepare('SELECT id, stage, status, started_at, completed_at, revision, reopened_from_step, reopened_at, stale_reason FROM stages WHERE change_id = ? ORDER BY id').all(changeId);
288
- const stageMap = {};
289
- const stageIds = [];
290
- for (const row of stageRows) {
291
- const { id: sId, stage, status, started_at: startedAt, completed_at: completedAt, revision, reopened_from_step: reopenedFromStep, reopened_at: reopenedAt, stale_reason: staleReason } = row;
292
- stageMap[stage] = { _dbId: sId, status, startedAt, completedAt,
293
- ...(revision != null ? { revision } : {}),
294
- ...(reopenedFromStep ? { reopenedFromStep } : {}),
295
- ...(reopenedAt ? { reopenedAt } : {}),
296
- ...(staleReason ? { staleReason } : {}),
297
- };
298
- stageIds.push(sId);
299
- }
300
-
301
- // 3. 从 steps 表获取所有步骤
302
- const stepsByStage = {};
303
- if (stageIds.length > 0) {
304
- const placeholders = stageIds.map(() => '?').join(',');
305
- const stepRows = sqlDb.prepare(
306
- `SELECT stage_id, name, status, output, completed_at, ordering, wait_reason, wait_options, wait_answer, waited_at, wait_answers, wait_round, max_wait_rounds FROM steps WHERE stage_id IN (${placeholders}) ORDER BY stage_id, ordering`
307
- ).all(...stageIds);
308
- // 按阶段分组步骤
309
- for (const row of stepRows) {
310
- const { stage_id: stageId, name, status, output, completed_at: completedAt, wait_reason: waitReason, wait_options: waitOptions, wait_answer: waitAnswer, waited_at: waitedAt, wait_answers: waitAnswersJson, wait_round: waitRound, max_wait_rounds: maxWaitRounds } = row;
311
- if (!stepsByStage[stageId]) stepsByStage[stageId] = [];
312
- let waitAnswers = null;
313
- if (waitAnswersJson) {
314
- try { waitAnswers = JSON.parse(waitAnswersJson); } catch (e) { console.warn(`[progress] waitAnswers JSON 损坏,已跳过: ${e.message}`); }
315
- }
316
- stepsByStage[stageId].push({
317
- name, status, output, completedAt,
318
- ...(waitReason ? { waitReason } : {}),
319
- ...(waitOptions ? { waitOptions } : {}),
320
- ...(waitAnswer ? { waitAnswer } : {}),
321
- ...(waitedAt ? { waitedAt } : {}),
322
- ...(waitAnswers ? { waitAnswers } : {}),
323
- ...(waitRound != null ? { waitRound } : {}),
324
- ...(maxWaitRounds != null ? { maxWaitRounds } : {}),
325
- });
326
- }
327
- }
328
-
329
- // 4. 从 batch_progress 表获取批量进度
330
- const batchRow = sqlDb.prepare('SELECT total, completed, failed, skipped FROM batch_progress WHERE change_id = ?').get(changeId);
331
- let batchProgress = undefined;
332
- if (batchRow !== undefined) {
333
- const { total, completed, failed, skipped } = batchRow;
334
- batchProgress = { total, completed, failed, skipped };
335
- }
336
-
337
- // 5. 获取项目名
338
- const projectRow = sqlDb.prepare('SELECT name FROM project WHERE id = 1').get();
339
- const projectName = projectRow !== undefined ? projectRow.name : '';
340
-
341
- // 6. 组装为兼容对象
342
- const stages = {};
343
- // 先填充所有 VALID_STAGES
344
- for (const s of VALID_STAGES) {
345
- stages[s] = emptyStage();
346
- }
347
- // 用 DB 数据覆盖
348
- for (const [stage, info] of Object.entries(stageMap)) {
349
- const steps = (stepsByStage[info._dbId] || []).map(s => ({
350
- name: s.name,
351
- status: s.status,
352
- output: s.output,
353
- completedAt: s.completedAt,
354
- ...(s.waitReason ? { waitReason: s.waitReason } : {}),
355
- ...(s.waitOptions ? { waitOptions: s.waitOptions } : {}),
356
- ...(s.waitAnswer ? { waitAnswer: s.waitAnswer } : {}),
357
- ...(s.waitedAt ? { waitedAt: s.waitedAt } : {}),
358
- ...(s.waitAnswers ? { waitAnswers: s.waitAnswers } : {}),
359
- ...(s.waitRound != null ? { waitRound: s.waitRound } : {}),
360
- ...(s.maxWaitRounds != null ? { maxWaitRounds: s.maxWaitRounds } : {}),
361
- }));
362
- stages[stage] = {
363
- status: info.status,
364
- steps,
365
- startedAt: info.startedAt,
366
- completedAt: info.completedAt,
367
- // Revision v1 fields
368
- ...(info.revision ? { revision: info.revision } : {}),
369
- ...(info.reopenedFromStep ? { reopenedFromStep: info.reopenedFromStep } : {}),
370
- ...(info.reopenedAt ? { reopenedAt: info.reopenedAt } : {}),
371
- ...(info.staleReason ? { staleReason: info.staleReason } : {}),
372
- };
373
- }
374
-
375
- const result = {
376
- _version: 5,
377
- project: projectName,
378
- currentChange: cName,
379
- currentStage: currentStage || '',
380
- lastActive: lastActive || null,
381
- stages,
382
- };
383
-
384
- // noWorktree
385
- if (noWorktree) result.noWorktree = true;
386
-
387
- // batchProgress(仅在 DB 中有记录时才包含)
388
- if (batchProgress) result.batchProgress = batchProgress;
389
-
390
- return result;
391
- }
392
-
393
- /**
394
- * 同步专用六表完整序列化(design §8/B1,task-02 / D-005@v2 / FR-07)。
395
- * 与 read()(聚合视图,不读 approvals 且 changes 只投影五列)不同,本方法输出真正六表投影,
396
- * 作为同步载体(ProgressManager.import() 的逆运算,task-03)。
397
- *
398
- * 输出契约(字段名 = DB 列名 snake_case,import 直接对列写回,round-trip 无映射损耗):
399
- * project { name, schema_version } —— 全局单行稳定字段(id/created_at/updated_at 本地元数据不同步)
400
- * changes [{ name, current_stage, status, last_active,
401
- * last_synced_platform_ts, last_local_modified_ts }] —— 只投影流程进度列;
402
- * 排除 isolation_* 系列 与 platform_* 系列(platform_change_id/workspace_id/last_sync/sync_enabled)
403
- * 以及 created_at(本地强相关,不同步,B2)
404
- * stages [{ change_name, stage, status, started_at, completed_at,
405
- * revision, reopened_from_step, reopened_at, stale_reason }] —— 用 change_name+stage 替代 id 外键
406
- * steps [{ change_name, stage, name, status, output, completed_at, ordering,
407
- * wait_reason, wait_options, wait_answer, waited_at, wait_answers,
408
- * wait_round, max_wait_rounds }] —— wait_options/wait_answers 透传 DB JSON 字符串
409
- * batch_progress [{ change_name, total, completed, failed, skipped }]
410
- * approvals [{ change_name, status, requested_at, approved_by, approved_at, rejection_reason }]
411
- * 可空列归一为 null(非 undefined,保证 JSON 往返键稳定);不含 user/base_ts/pushed_at(D-015,sync.js 放 HTTP header)。
412
- *
413
- * @param {string} cwd
414
- * @param {string|null} [changeName] - 空时单活跃变更自动推导(对齐 read());多/零活跃返回 null
415
- * @returns {object|null} 六键同步 JSON;change 不存在或无法推导返回 null
416
- */
417
- serializeForSync(cwd, changeName = null) {
418
- // 自动检测变更名(与 read() 同口径):单活跃变更推导,多/零无法确定返回 null
419
- if (!changeName) {
420
- const changes = this.listChanges(cwd);
421
- if (changes.length === 1) {
422
- changeName = changes[0];
423
- } else {
424
- return null;
425
- }
426
- }
427
-
428
- const db = this._ensureDB(cwd);
429
- const sqlDb = db.getDb();
430
-
431
- // 1. changes 行(投影流程进度列 + name 标识)
432
- const changeRow = sqlDb.prepare(
433
- `SELECT id, name, current_stage, status, last_active, last_synced_platform_ts, last_local_modified_ts
434
- FROM changes WHERE name = ?`
435
- ).get(changeName);
436
- if (changeRow === undefined) return null;
437
- const changeId = changeRow.id;
438
- const changeProj = {
439
- name: changeRow.name,
440
- current_stage: changeRow.current_stage,
441
- status: changeRow.status,
442
- last_active: changeRow.last_active,
443
- last_synced_platform_ts: changeRow.last_synced_platform_ts ?? null,
444
- last_local_modified_ts: changeRow.last_local_modified_ts ?? null,
445
- };
446
-
447
- // 2. project 全局单行(只投影稳定字段 name/schema_version;created_at/updated_at 是本地库元数据,
448
- // 同步无意义且破坏 round-trip 跨库等值——与 changes 排除 created_at 同理,B2)
449
- const projectRow = sqlDb.prepare(
450
- 'SELECT name, schema_version FROM project WHERE id = 1'
451
- ).get();
452
-
453
- // 3. stages(该 change 下,用 change_name+stage 表达外键)
454
- const stageRows = sqlDb.prepare(
455
- `SELECT id, stage, status, started_at, completed_at, revision, reopened_from_step, reopened_at, stale_reason
456
- FROM stages WHERE change_id = ? ORDER BY id`
457
- ).all(changeId);
458
- const stageJson = stageRows.map(r => ({
459
- change_name: changeRow.name,
460
- stage: r.stage,
461
- status: r.status,
462
- started_at: r.started_at ?? null,
463
- completed_at: r.completed_at ?? null,
464
- revision: r.revision ?? null,
465
- reopened_from_step: r.reopened_from_step ?? null,
466
- reopened_at: r.reopened_at ?? null,
467
- stale_reason: r.stale_reason ?? null,
468
- }));
469
-
470
- // 4. steps(stage_id IN;用 change_name+stage 关联回 stage)
471
- const stageIds = stageRows.map(r => r.id);
472
- const stageIdToName = new Map(stageRows.map(r => [r.id, r.stage]));
473
- let stepJson = [];
474
- if (stageIds.length > 0) {
475
- const placeholders = stageIds.map(() => '?').join(',');
476
- const stepRows = sqlDb.prepare(
477
- `SELECT stage_id, name, status, output, completed_at, ordering, wait_reason, wait_options,
478
- wait_answer, waited_at, wait_answers, wait_round, max_wait_rounds
479
- FROM steps WHERE stage_id IN (${placeholders}) ORDER BY stage_id, ordering`
480
- ).all(...stageIds);
481
- stepJson = stepRows.map(r => ({
482
- change_name: changeRow.name,
483
- stage: stageIdToName.get(r.stage_id),
484
- name: r.name,
485
- status: r.status,
486
- output: r.output ?? null,
487
- completed_at: r.completed_at ?? null,
488
- ordering: r.ordering ?? null,
489
- wait_reason: r.wait_reason ?? null,
490
- wait_options: r.wait_options ?? null,
491
- wait_answer: r.wait_answer ?? null,
492
- waited_at: r.waited_at ?? null,
493
- wait_answers: r.wait_answers ?? null,
494
- wait_round: r.wait_round ?? null,
495
- max_wait_rounds: r.max_wait_rounds ?? null,
496
- }));
497
- }
498
-
499
- // 5. batch_progress(无行则空数组,import 侧幂等)
500
- const batchRow = sqlDb.prepare(
501
- 'SELECT total, completed, failed, skipped FROM batch_progress WHERE change_id = ?'
502
- ).get(changeId);
503
- const batchJson = batchRow !== undefined ? [{
504
- change_name: changeRow.name,
505
- total: batchRow.total,
506
- completed: batchRow.completed,
507
- failed: batchRow.failed,
508
- skipped: batchRow.skipped,
509
- }] : [];
510
-
511
- // 6. approvals(read() 不读此表,serializeForSync 补齐;无行则空数组)
512
- const approvalRow = sqlDb.prepare(
513
- 'SELECT status, requested_at, approved_by, approved_at, rejection_reason FROM approvals WHERE change_id = ?'
514
- ).get(changeId);
515
- const approvalJson = approvalRow !== undefined ? [{
516
- change_name: changeRow.name,
517
- status: approvalRow.status,
518
- requested_at: approvalRow.requested_at ?? null,
519
- approved_by: approvalRow.approved_by ?? null,
520
- approved_at: approvalRow.approved_at ?? null,
521
- rejection_reason: approvalRow.rejection_reason ?? null,
522
- }] : [];
523
-
524
- return {
525
- project: projectRow || null,
526
- changes: [changeProj],
527
- stages: stageJson,
528
- steps: stepJson,
529
- batch_progress: batchJson,
530
- approvals: approvalJson,
531
- };
532
- }
533
-
534
- /**
535
- * serializeForSync 的逆运算:把平台权威 JSON 原子写回本地 DB 的该 change 行(design §8/B1,task-03 / D-005@v2 / D-011 / FR-07)。
536
- * ⚠️ 必须保护真实资产:import 前对 DB 做【独立】snapshot `.runtime/sillyspec.db.pre-import-<ts>.bak`,
537
- * 不抢 _openWithFallback 的 `${dbPath}.bak`(gap5/R-08);任何失败本地进度库不损坏。
538
- *
539
- * 语义:
540
- * - 单个 DB.transaction() 包裹,原子重建 stages/steps/batch_progress/approvals 四表(任一失败整体回滚)
541
- * - changes 行用 UPDATE 选择投影列(current_stage/status/last_active/last_synced_platform_ts/last_local_modified_ts),
542
- * 保留 isolation_* / platform_* / created_at(本地强相关状态不被覆盖,B2;change 不存在时 INSERT 兜底平台新增)
543
- * - import 后 last_synced_platform_ts 与 last_local_modified_ts 均置为 progressObj.pushed_at(D-013 例外:
544
- * 不更新 now()——否则 now()>base_ts 下次 pull 误判冲突;pushed_at 由 sync.js pull() 从响应 header attach)
545
- * - 本地确定性操作,失败 throw 中文(非 sync 类 Best Effort,CONVENTIONS #4)
546
- *
547
- * @param {string} cwd
548
- * @param {object} progressObj - serializeForSync 输出 + sync.js 附加的 pushed_at
549
- * @param {string|null} [changeName] - 空则从 progressObj.changes[0].name 推导
550
- * @returns {ImportResult} { ok:true, imported:changeName, reason?, bakPath }
551
- */
552
- import(cwd, progressObj, changeName = null) {
553
- if (!progressObj || typeof progressObj !== 'object') {
554
- throw new Error('import 参数无效:progressObj 必须是 serializeForSync() 输出的六表 JSON 对象');
555
- }
556
-
557
- const cn = changeName || (progressObj.changes && progressObj.changes[0] && progressObj.changes[0].name);
558
- if (!cn) {
559
- throw new Error('import 缺少 changeName:无法定位目标 change(progressObj.changes[0].name 为空)');
560
- }
561
-
562
- // ⚠️ 必须保护真实资产:独立 .bak snapshot(前缀 pre-import- 区分于主 .bak 备份机制)
563
- const dbPath = this._runtimePath(cwd, 'sillyspec.db');
564
- if (!existsSync(dbPath)) {
565
- throw new Error(`本地进度库不存在,无法 import:${dbPath}`);
566
- }
567
- const bakTs = new Date().toISOString().replace(/[:.]/g, '-');
568
- const bakPath = this._runtimePath(cwd, `sillyspec.db.pre-import-${bakTs}.bak`);
569
- // 体检 BUG-18:WAL 模式下最近已提交事务可能仍在 -wal 侧车,直接 copy 主库文件会拿到
570
- // 缺尾部提交的快照(恢复时静默回退进度)。先尽力 checkpoint(TRUNCATE) 把 WAL 合并回主库;
571
- // 他进程持连接致 checkpoint 不完全时,把 -wal 侧车一并备份,恢复侧才有完整提交
572
- try {
573
- this._ensureDB(cwd).getDb().exec('PRAGMA wal_checkpoint(TRUNCATE)');
574
- } catch { /* best-effort:失败退化为连 -wal 一起备份 */ }
575
- copyFileSync(dbPath, bakPath);
576
- const walSidecar = `${dbPath}-wal`;
577
- if (existsSync(walSidecar)) {
578
- try { copyFileSync(walSidecar, `${bakPath}-wal`); } catch { /* 侧车消失=已 checkpoint,无碍 */ }
579
- }
580
-
581
- const pushedAt = progressObj.pushed_at ?? null;
582
- const now = new Date().toISOString();
583
-
584
- try {
585
- const db = this._ensureDB(cwd);
586
- db.transaction(() => {
587
- const sqlDb = db.getDb();
588
-
589
- // 1. changes 行:INSERT OR IGNORE 兜底平台新增 change;UPDATE 只覆盖投影列(保留本地隔离/平台/created_at 列)
590
- sqlDb.prepare(
591
- `INSERT OR IGNORE INTO changes (name, current_stage, status, created_at, last_active)
592
- VALUES (?, '', 'active', ?, ?)`
593
- ).run(cn, now, now);
594
- const ch = progressObj.changes && progressObj.changes[0];
595
- sqlDb.prepare(
596
- `UPDATE changes SET
597
- current_stage = ?, status = ?, last_active = ?,
598
- last_synced_platform_ts = ?, last_local_modified_ts = ?
599
- WHERE name = ?`
600
- ).run(
601
- ch && ch.current_stage != null ? ch.current_stage : '',
602
- ch && ch.status != null ? ch.status : 'active',
603
- ch && ch.last_active != null ? ch.last_active : now,
604
- pushedAt, pushedAt, cn
605
- );
606
- const changeRow = sqlDb.prepare('SELECT id FROM changes WHERE name = ?').get(cn);
607
- const changeId = changeRow.id;
608
-
609
- // 2. project 行:幂等确保存在(不覆盖已有全局行,round-trip 等值不受影响;仅补缺失)
610
- const projExists = sqlDb.prepare('SELECT id FROM project WHERE id = 1').get();
611
- if (projExists === undefined) {
612
- const pj = progressObj.project || {};
613
- sqlDb.prepare(
614
- `INSERT INTO project (id, name, schema_version, created_at, updated_at)
615
- VALUES (1, ?, ?, ?, ?)`
616
- ).run(pj.name != null ? pj.name : 'project', pj.schema_version != null ? pj.schema_version : CURRENT_VERSION, now, now);
617
- }
618
-
619
- // 3. 重建 stages + steps:DELETE stages(ON DELETE CASCADE 级联删 steps),按 JSON 重建
620
- sqlDb.prepare('DELETE FROM stages WHERE change_id = ?').run(changeId);
621
- const stageToId = new Map();
622
- for (const s of (progressObj.stages || [])) {
623
- if (!s || !s.stage) continue;
624
- sqlDb.prepare(
625
- `INSERT INTO stages (change_id, stage, status, started_at, completed_at, revision, reopened_from_step, reopened_at, stale_reason)
626
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
627
- ).run(changeId, s.stage, s.status != null ? s.status : 'pending', s.started_at ?? null, s.completed_at ?? null,
628
- s.revision != null ? s.revision : 0, s.reopened_from_step ?? null, s.reopened_at ?? null, s.stale_reason ?? null);
629
- const row = sqlDb.prepare('SELECT id FROM stages WHERE change_id = ? AND stage = ?').get(changeId, s.stage);
630
- stageToId.set(s.stage, row.id);
631
- }
632
- for (const st of (progressObj.steps || [])) {
633
- if (!st || !st.name) continue;
634
- const stageId = stageToId.get(st.stage);
635
- if (stageId === undefined) continue; // 孤儿 step(stage 不在 JSON)跳过,不破坏完整性
636
- sqlDb.prepare(
637
- `INSERT INTO steps (stage_id, name, status, output, completed_at, ordering, wait_reason, wait_options, wait_answer, waited_at, wait_answers, wait_round, max_wait_rounds)
638
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
639
- ).run(stageId, st.name, st.status != null ? st.status : 'pending', st.output ?? null, st.completed_at ?? null,
640
- st.ordering != null ? st.ordering : 0, st.wait_reason ?? null, st.wait_options ?? null, st.wait_answer ?? null,
641
- st.waited_at ?? null, st.wait_answers ?? null, st.wait_round ?? null, st.max_wait_rounds ?? null);
642
- }
643
-
644
- // 4. 重建 batch_progress(DELETE 再插,无行则清空)
645
- sqlDb.prepare('DELETE FROM batch_progress WHERE change_id = ?').run(changeId);
646
- const bp = progressObj.batch_progress && progressObj.batch_progress[0];
647
- if (bp) {
648
- sqlDb.prepare(
649
- `INSERT INTO batch_progress (change_id, total, completed, failed, skipped)
650
- VALUES (?, ?, ?, ?, ?)`
651
- ).run(changeId, bp.total != null ? bp.total : 0, bp.completed != null ? bp.completed : 0,
652
- bp.failed != null ? bp.failed : 0, bp.skipped != null ? bp.skipped : 0);
653
- }
654
-
655
- // 5. 重建 approvals(DELETE 再插,无行则清空)
656
- sqlDb.prepare('DELETE FROM approvals WHERE change_id = ?').run(changeId);
657
- const ap = progressObj.approvals && progressObj.approvals[0];
658
- if (ap) {
659
- sqlDb.prepare(
660
- `INSERT INTO approvals (change_id, status, requested_at, approved_by, approved_at, rejection_reason)
661
- VALUES (?, ?, ?, ?, ?, ?)`
662
- ).run(changeId, ap.status != null ? ap.status : 'not_required', ap.requested_at ?? null, ap.approved_by ?? null,
663
- ap.approved_at ?? null, ap.rejection_reason ?? null);
664
- }
665
- });
666
- } catch (e) {
667
- // 事务失败自动回滚(DB 未变),.bak 保留可恢复;fail-loud 中文
668
- throw new Error(`import 失败,本地进度库已回滚(snapshot: ${bakPath}):${e.message}`);
669
- }
670
-
671
- return { ok: true, imported: cn, reason: undefined, bakPath };
672
- }
673
-
674
- /**
675
- * 本地脏度标记(D-013 / task-04):写入路径末尾更新 changes.last_local_modified_ts。
676
- * 在写方法的事务内调用则属于该事务(原子,失败整体回滚);import 是例外不调本方法
677
- * (import 自己把 last_local_modified_ts 置为 pushed_at,表示本地=平台干净)。
678
- * @param {string} cwd
679
- * @param {string} changeName
680
- * @param {string} [ts] - 复用调用方事务内的时间戳,保证与本次写入同时刻
681
- */
682
- _touchLocalModified(cwd, changeName, ts = null) {
683
- if (!changeName) return;
684
- const db = this._ensureDB(cwd);
685
- const stamp = ts || new Date().toISOString();
686
- db.getDb().prepare('UPDATE changes SET last_local_modified_ts = ? WHERE name = ?').run(stamp, changeName);
687
- }
688
-
689
- /**
690
- * 写入指定变更的 progress
691
- * @param {string} cwd
692
- * @param {object} data
693
- * @param {string|null} changeName - 从 data.currentChange 推导,或显式传入
694
- *
695
- * 持锁窗口评估(task-05 / R-08):本方法采用全量 UPSERT——无条件 UPDATE changes 行 +
696
- * 遍历所有 stages(每 stage UPSERT stages 行 + 每 step 先 DELETE 再 INSERT 全量 + 末尾
697
- * DELETE data 中不存在的多余 step)。评估过改"只写 diff(仅写变更过的 change/stage/step 行)"
698
- * 以缩小事务持锁窗口、降低 BUSY 概率,结论:保持现状(全量 UPSERT)。
699
- * 理由:
700
- * 1. steps 表无 UNIQUE 约束(见循环内 DELETE-then-INSERT 注释),diff 写需先读现状再逐条
701
- * 比较,复杂度高易错,易引入孤儿/缺失步骤破坏 FK 级联语义(design §3/§8);
702
- * 2. busy_timeout=5000 + DB 层 SQLITE_BUSY 应用层有限重试(见 db.js transaction)已兜底
703
- * 并发冲突,全量 UPSERT 的持锁窗口在此兜底下不是瓶颈;
704
- * 3. 单进程内调用串行(design §9),事务窗口短(毫秒级),全量写正确性远高于 diff 的边际收益。
705
- * 结论:全量 UPSERT 的简单正确性 > 持锁窗口优化的边际收益,不强行改 diff。
706
- */
707
- _write(cwd, data, changeName = null) {
708
- const cn = changeName || data.currentChange;
709
- if (!cn) {
710
- console.warn('⚠️ _write: 无变更名,跳过写入');
711
- return;
712
- }
713
-
714
- const db = this._ensureDB(cwd);
715
- db.transaction(() => {
716
- const sqlDb = db.getDb();
717
- // 1. 更新 changes 表(last_local_modified_ts 脏度:D-013 / task-04)
718
- const now = new Date().toISOString();
719
- const noWorktree = data.noWorktree ? 1 : 0;
720
- sqlDb.prepare(
721
- 'UPDATE changes SET current_stage = ?, last_active = ?, no_worktree = ?, last_local_modified_ts = ? WHERE name = ?'
722
- ).run(data.currentStage || '', now, noWorktree, now, cn);
723
-
724
- // 2. 获取 change_id
725
- const changeRow = sqlDb.prepare('SELECT id FROM changes WHERE name = ?').get(cn);
726
- if (changeRow === undefined) return;
727
- const changeId = changeRow.id;
728
-
729
- // 3. 遍历 stages,UPSERT stages 表和 steps 表
730
- if (data.stages && typeof data.stages === 'object') {
731
- for (const [stageName, stageData] of Object.entries(data.stages)) {
732
- // UPSERT stages 行(含 revision 列)
733
- sqlDb.prepare(
734
- `INSERT INTO stages (change_id, stage, status, started_at, completed_at, revision, reopened_from_step, reopened_at, stale_reason)
735
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
736
- ON CONFLICT(change_id, stage) DO UPDATE SET
737
- status = excluded.status,
738
- started_at = excluded.started_at,
739
- completed_at = excluded.completed_at,
740
- revision = COALESCE(excluded.revision, stages.revision),
741
- reopened_from_step = excluded.reopened_from_step,
742
- reopened_at = excluded.reopened_at,
743
- stale_reason = excluded.stale_reason`
744
- ).run(changeId, stageName, stageData.status || 'pending', stageData.startedAt || null, stageData.completedAt || null,
745
- stageData.revision || 0, stageData.reopenedFromStep || null, stageData.reopenedAt || null, stageData.staleReason || null);
746
-
747
- // 获取 stage_id
748
- const stageRow = sqlDb.prepare('SELECT id FROM stages WHERE change_id = ? AND stage = ?').get(changeId, stageName);
749
- if (stageRow === undefined) continue;
750
- const stageId = stageRow.id;
751
-
752
- // 收集 data 中的步骤名
753
- const stepNames = new Set();
754
- if (Array.isArray(stageData.steps)) {
755
- for (let i = 0; i < stageData.steps.length; i++) {
756
- const step = stageData.steps[i];
757
- stepNames.add(step.name);
758
- // UPSERT 步骤(先删再插,steps 表无 UNIQUE 约束)
759
- sqlDb.prepare('DELETE FROM steps WHERE stage_id = ? AND name = ?').run(stageId, step.name);
760
- sqlDb.prepare(
761
- 'INSERT INTO steps (stage_id, name, status, output, completed_at, ordering, wait_reason, wait_options, wait_answer, waited_at, wait_answers, wait_round, max_wait_rounds) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
762
- ).run(stageId, step.name, step.status || 'pending', step.output || null, step.completedAt || null, i,
763
- step.waitReason ?? null, Array.isArray(step.waitOptions) ? JSON.stringify(step.waitOptions) : (step.waitOptions ?? null), step.waitAnswer ?? null, step.waitedAt ?? null,
764
- Array.isArray(step.waitAnswers) ? JSON.stringify(step.waitAnswers) : null,
765
- step.waitRound ?? null, step.maxWaitRounds ?? null);
766
- }
767
- }
768
-
769
- // 删除 data 中不存在的多余步骤
770
- if (stepNames.size > 0) {
771
- const namePlaceholders = [...stepNames].map(() => '?').join(',');
772
- sqlDb.prepare(
773
- `DELETE FROM steps WHERE stage_id = ? AND name NOT IN (${namePlaceholders})`
774
- ).run(stageId, ...stepNames);
775
- } else {
776
- // data 中没有步骤,清空该阶段所有步骤
777
- sqlDb.prepare('DELETE FROM steps WHERE stage_id = ?').run(stageId);
778
- }
779
- }
780
- }
781
-
782
- // 4. UPSERT batch_progress
783
- if (data.batchProgress && typeof data.batchProgress === 'object') {
784
- sqlDb.prepare(
785
- `INSERT INTO batch_progress (change_id, total, completed, failed, skipped)
786
- VALUES (?, ?, ?, ?, ?)
787
- ON CONFLICT(change_id) DO UPDATE SET
788
- total = excluded.total,
789
- completed = excluded.completed,
790
- failed = excluded.failed,
791
- skipped = excluded.skipped`
792
- ).run(changeId, data.batchProgress.total || 0, data.batchProgress.completed || 0, data.batchProgress.failed || 0, data.batchProgress.skipped || 0);
793
- }
794
- });
795
- }
796
-
797
- // ── 变更管理 ──
798
-
799
- listChanges(cwd) { return this._changeRegistry.listChanges(cwd); }
800
-
801
- // 单变更阶段查询(quick 轻量归档阶段闸):无行 null,读失败抛(调用方 fail-closed)
802
- getChangeStage(cwd, changeName) { return this._changeRegistry.getChangeStage(cwd, changeName); }
803
-
804
- registerChange(cwd, changeName) { return this._changeRegistry.registerChange(cwd, changeName); }
805
-
806
- updateChangeIsolation(cwd, changeName, isolation) { return this._changeRegistry.updateChangeIsolation(cwd, changeName, isolation); }
807
-
808
- readChangeIsolation(cwd, changeName) { return this._changeRegistry.readChangeIsolation(cwd, changeName); }
809
-
810
- // syncedTs 透传(ql-20260818-008):push 成功推进 base_ts,facade 曾丢参致列永不写入
811
- _updatePlatformLastSync(cwd, changeName, syncedTs = null) { return this._changeRegistry._updatePlatformLastSync(cwd, changeName, syncedTs); }
812
-
813
- _updateApprovalStatus(cwd, changeName, status, reason = null) { return this._changeRegistry._updateApprovalStatus(cwd, changeName, status, reason); }
814
-
815
- renameChange(cwd, oldName, newName) { return this._changeRegistry.renameChange(cwd, oldName, newName); }
816
-
817
- // opts.archiveStepNames 给定时做归档终态一致化收尾(见 change-registry.unregisterChange 注释,
818
- // 坑 manual-archive-desync-status-only);archiveStepNamesForArchive() 取 stageRegistry 单一真相
819
- //(stages/* 不反向依赖 progress.js,静态 import 无环)。
820
- unregisterChange(cwd, changeName, opts) { return this._changeRegistry.unregisterChange(cwd, changeName, opts); }
821
-
822
- archiveStepNamesForArchive() {
823
- if (!this._archiveStepNamesCache) {
824
- const defs = stageRegistry?.archive?.steps
825
- this._archiveStepNamesCache = Array.isArray(defs) ? defs.map(s => s.name) : []
826
- }
827
- return this._archiveStepNamesCache
828
- }
829
-
830
- updateChangeMeta(cwd, changeName, meta) { return this._changeRegistry.updateChangeMeta(cwd, changeName, meta); }
831
-
832
- // ── CLI 命令 ──
833
-
834
- init(cwd) {
835
- this._ensureRuntimeDir(cwd);
836
-
837
- // 初始化 DB(如不存在则创建文件 + 建表)
838
- const db = this._ensureDB(cwd);
839
- db.transaction(() => {
840
- const sqlDb = db.getDb();
841
- const now = new Date().toISOString();
842
- const projectName = basename(cwd) || 'project';
843
-
844
- // 检查 project id=1 是否已存在
845
- const existing = sqlDb.prepare('SELECT id FROM project WHERE id = 1').get();
846
- if (existing === undefined) {
847
- sqlDb.prepare(
848
- `INSERT INTO project (id, name, schema_version, created_at, updated_at)
849
- VALUES (1, ?, ?, ?, ?)`
850
- ).run(projectName, CURRENT_VERSION, now, now);
851
- console.log(`✅ 已创建全局状态文件(SQLite)`);
852
- } else {
853
- console.log(`ℹ️ 全局状态文件已存在,跳过`);
854
- }
855
- });
856
-
857
- // 创建 user-inputs.md
858
- const inputsPath = this._runtimePath(cwd, 'user-inputs.md');
859
- if (!existsSync(inputsPath)) {
860
- writeFileSync(inputsPath, '# 用户输入记录\n\n> 每步完成时由 AI 自动追加,记录用户所有原话。\n\n');
861
- }
862
-
863
- this._ensureGitignore(cwd);
864
- return this.readGlobal(cwd);
865
- }
866
-
867
- /**
868
- * 初始化指定变更的 progress
869
- * SQL: INSERT changes + 批量 INSERT stages
870
- */
871
- initChange(cwd, changeName, meta = {}) {
872
- if (!changeName) {
873
- console.warn('⚠️ initChange: changeName 为空,跳过');
874
- return null;
875
- }
876
- // quick 会话 id(quick-<uuid8>,见 run.js QUICK_SID_RE)只作 progress 的跨进程 session key,
877
- // 进度存 SQL 不需要实体 change 目录——跳过避免 changes/quick-<uuid>/ 空目录残留。
878
- if (!/^quick-[0-9a-f]{8}$/.test(changeName)) {
879
- this._ensureChangeDir(cwd, changeName);
880
- }
881
-
882
- const db = this._ensureDB(cwd);
883
- db.transaction(() => {
884
- const sqlDb = db.getDb();
885
- const now = new Date().toISOString();
886
-
887
- // 检查变更是否已存在
888
- const existing = sqlDb.prepare('SELECT id FROM changes WHERE name = ?').get(changeName);
889
- if (existing === undefined) {
890
- // 插入 changes 行
891
- sqlDb.prepare(
892
- `INSERT INTO changes (name, current_stage, status, created_at, last_active, title, quicklog_id)
893
- VALUES (?, 'scan', 'active', ?, ?, ?, ?)`
894
- ).run(changeName, now, now, meta.title || null, meta.quicklogId || null);
895
- }
896
-
897
- // 获取 change_id
898
- const changeRow = sqlDb.prepare('SELECT id FROM changes WHERE name = ?').get(changeName);
899
- const changeId = changeRow.id;
900
-
901
- // 批量插入所有合法阶段(INSERT OR IGNORE 跳过已存在的);沿用顶部 import 的 VALID_STAGES 单一源
902
- for (const stage of VALID_STAGES) {
903
- sqlDb.prepare(
904
- `INSERT OR IGNORE INTO stages (change_id, stage, status)
905
- VALUES (?, ?, 'pending')`
906
- ).run(changeId, stage);
907
- }
908
- // 本地脏度(D-013 / task-04):新建 change 视为有未同步数据
909
- this._touchLocalModified(cwd, changeName, now);
910
- });
911
-
912
- // 不再需要写文件:read() 已改为 SQL
913
- return this.read(cwd, changeName);
914
- }
915
-
916
- setStage(cwd, stage, changeName = null) { return this._stepStore.setStage(cwd, stage, changeName); }
917
-
918
- addStep(cwd, stage, stepName, changeName = null) { return this._stepStore.addStep(cwd, stage, stepName, changeName); }
919
-
920
- updateStep(cwd, stage, stepName, options = {}, changeName = null) { return this._stepStore.updateStep(cwd, stage, stepName, options, changeName); }
921
-
922
- _appendAuditLog(cwd, entry) { return this._consistency._appendAuditLog(cwd, entry); }
923
-
924
- _validateStageArtifacts(cwd, stage, changeName) { return this._stageMachine._validateStageArtifacts(cwd, stage, changeName); }
925
-
926
- completeStage(cwd, stage, changeName = null, opts = {}) { return this._stageMachine.completeStage(cwd, stage, changeName, opts); }
927
-
928
- show(cwd, changeName = null) { return this._stageMachine.show(cwd, changeName); }
929
-
930
- _showChange(cwd, changeName) { return this._stageMachine._showChange(cwd, changeName); }
931
-
932
- _getNextSuggestion(data) { return this._stageMachine._getNextSuggestion(data); }
933
-
934
- status(cwd, changeName = null) { return this._stageMachine.status(cwd, changeName); }
935
-
936
- checkConsistency(cwd, changeName = null) { return this._consistency.checkConsistency(cwd, changeName); }
937
-
938
- repairConsistency(cwd, opts = {}) { return this._consistency.repairConsistency(cwd, opts); }
939
-
940
- validate(cwd, changeName = null) { return this._stageMachine.validate(cwd, changeName); }
941
-
942
- reopenStage(cwd, stage, opts = {}) { return this._stageMachine.reopenStage(cwd, stage, opts); }
943
-
944
- _getDownstreamStages(stage) { return this._stageMachine._getDownstreamStages(stage); }
945
-
946
- reset(cwd, stage, changeName = null) { return this._stageMachine.reset(cwd, stage, changeName); }
947
-
948
- // ── 内部辅助 ──
949
-
950
- _readOrInit(cwd, changeName = null) {
951
- let data = this.read(cwd, changeName);
952
- if (!data) {
953
- // 尝试自动检测变更名
954
- if (!changeName) {
955
- const changes = this.listChanges(cwd);
956
- if (changes.length === 1) changeName = changes[0];
957
- }
958
- if (changeName) {
959
- // 确保变更在 DB 中已初始化
960
- const db = this._ensureDB(cwd);
961
- db.transaction(() => {
962
- const sqlDb = db.getDb();
963
- const now = new Date().toISOString();
964
- const ins = sqlDb.prepare(
965
- `INSERT OR IGNORE INTO changes (name, current_stage, status, created_at, last_active) VALUES (?, 'scan', 'active', ?, ?)`
966
- ).run(changeName, now, now);
967
- const changeRow = sqlDb.prepare('SELECT id FROM changes WHERE name = ?').get(changeName);
968
- if (changeRow !== undefined) {
969
- const changeId = changeRow.id;
970
- for (const s of VALID_STAGES) {
971
- sqlDb.prepare(`INSERT OR IGNORE INTO stages (change_id, stage, status) VALUES (?, ?, 'pending')`).run(changeId, s);
972
- }
973
- }
974
- // 只在真正创建 change 时标脏(D-013/task-04);读路径(change 已存在)不标,避免 pull 误判本地有未同步改动
975
- if (ins.changes > 0) this._touchLocalModified(cwd, changeName, now);
976
- });
977
- this.registerChange(cwd, changeName);
978
- }
979
- if (!data) {
980
- data = this.read(cwd, changeName);
981
- }
982
- if (!data) {
983
- console.log('❌ 无法确定当前变更,请指定 --change <name>');
984
- return null;
985
- }
986
- }
987
- return data;
988
- }
989
-
990
- _requireStage(cwd, stage, changeName = null) {
991
- if (!VALID_STAGES.includes(stage)) {
992
- console.log(`❌ 未知阶段: ${stage},可选: ${VALID_STAGES.join(', ')}`);
993
- return null;
994
- }
995
- const data = this._readOrInit(cwd, changeName);
996
- if (!data) return null;
997
- if (!data.stages[stage]) data.stages[stage] = emptyStage();
998
- return data;
999
- }
1000
-
1001
- _timeAgo(dateStr) { return this._stageMachine._timeAgo(dateStr); }
1002
-
1003
- // ── 批量进度 ──
1004
-
1005
- updateBatchProgress(cwd, batchData, changeName = null) { return this._stepStore.updateBatchProgress(cwd, batchData, changeName); }
1006
-
1007
- readBatchProgress(cwd, changeName = null) { return this._stepStore.readBatchProgress(cwd, changeName); }
1008
-
1009
- _renderBatchProgress(batchProgress) { return this._stepStore._renderBatchProgress(batchProgress); }
1010
-
1011
- _ensureGitignore(cwd) {
1012
- // 外部 specDir 不需要修改项目 .gitignore
1013
- if (this._customSpecDir) return;
1014
- const gitignorePath = join(cwd, '.gitignore');
1015
- const rule = '.sillyspec/.runtime/';
1016
- if (existsSync(gitignorePath)) {
1017
- const content = readFileSync(gitignorePath, 'utf8');
1018
- if (content.includes(rule)) return;
1019
- // 按既有 EOL 追加(2026-08-21 审查 BUG-9):CRLF 检出的文件混入 LF 行产生全文件
1020
- // diff 噪声/autocrlf 折腾;写走原子 rename 防并发 init 双跑交错
1021
- const eol = content.includes('\r\n') ? '\r\n' : '\n';
1022
- writeAtomicSync(gitignorePath, content.trimEnd() + eol + rule + eol);
1023
- } else {
1024
- writeAtomicSync(gitignorePath, rule + '\n');
1025
- }
1026
- }
1027
-
1028
- // ── plan.md 对齐(doctor --align-execute-progress 入口)──
1029
-
1030
- /**
1031
- * 解析 changeDir/tasks.md(任务注册表唯一真相)的 task checkbox 统计。
1032
- * 2026-08-20-task-truth-unify:源从「plan.md 优先回退 tasks.md」改为 tasks.md 唯一源——
1033
- * 旧顺序下新契约 plan.md(纯 ID 引用行)恒 total=0,doctor --align-execute-progress 会静默失效。
1034
- * tasks.md 缺失时回退 plan.md(旧归档变更兼容读侧,不写侧迁移)。
1035
- * 仅匹配 `- [ ] task-NN` / `- [x] task-NN` 形态的行(task- 前缀锚定,避免误捞非任务项)。
1036
- * @param {string} changeDir - 变更目录绝对路径(含 tasks.md/plan.md)
1037
- * @returns {{ total: number, checked: number }}
1038
- */
1039
- readPlanCheckboxStatus(changeDir) {
1040
- if (!changeDir || typeof changeDir !== 'string') {
1041
- throw new Error('changeDir 不能为空');
1042
- }
1043
- const tasksPath = join(changeDir, 'tasks.md');
1044
- const planPath = join(changeDir, 'plan.md');
1045
- let content = null;
1046
- if (existsSync(tasksPath)) {
1047
- content = readFileSync(tasksPath, 'utf8');
1048
- } else if (existsSync(planPath)) {
1049
- content = readFileSync(planPath, 'utf8');
1050
- } else {
1051
- return { total: 0, checked: 0 };
1052
- }
1053
- // 匹配 `- [ ] task-NN` / `- [x] task-NN`(允许 [x] 大小写、空格弹性、task- 前缀)
1054
- const re = /^\s*[-*]\s+\[([ xX])\]\s+task-\d+/gm;
1055
- let total = 0;
1056
- let checked = 0;
1057
- let m;
1058
- while ((m = re.exec(content)) !== null) {
1059
- total++;
1060
- if (m[1] === 'x' || m[1] === 'X') checked++;
1061
- }
1062
- return { total, checked };
1063
- }
1064
-
1065
- /**
1066
- * 按 plan.md 声明对齐 execute 阶段派生进度戳。
1067
- * 仅当 plan.md 所有 task checkbox 全勾时,把 execute 阶段所有非 completed step 标 completed,
1068
- * 并显式置 execute stageData.status='completed' + completedAt(绕过 completeStep 推导,D-003@v2)。
1069
- * 不复核代码,信任 plan.md 声明(与 archive 同源,verify 阶段兜底,D-002/D-004)。
1070
- *
1071
- * @param {string} cwd
1072
- * @param {string} changeName
1073
- * @param {string} specBase - platformOpts.specRoot || join(cwd, '.sillyspec'),用于定位 changes 目录
1074
- * @param {object} [opts]
1075
- * @param {boolean} [opts.confirm=false] - 默认 dry-run,仅当 confirm=true 才落盘
1076
- * @returns {{ ok: boolean, aligned: number, skipped: number, planTotal: number, planChecked: number, reason?: string, dryRun?: boolean }}
1077
- */
1078
- alignExecuteToPlan(cwd, changeName, specBase, opts = {}) {
1079
- if (!changeName) throw new Error('changeName 不能为空');
1080
- const { confirm = false } = opts;
1081
-
1082
- // 1. 读 progress;无 progress / 无 execute 阶段 → 拒绝
1083
- const progress = this.read(cwd, changeName);
1084
- if (!progress || !progress.stages || !progress.stages.execute) {
1085
- return { ok: false, aligned: 0, skipped: 0, planTotal: 0, planChecked: 0, reason: 'execute 阶段无进度数据' };
1086
- }
1087
- const executeStage = progress.stages.execute;
1088
- const steps = Array.isArray(executeStage.steps) ? executeStage.steps : [];
1089
- if (steps.length === 0) {
1090
- return { ok: false, aligned: 0, skipped: 0, planTotal: 0, planChecked: 0, reason: 'execute 阶段无进度数据' };
1091
- }
1092
-
1093
- // 2. 读 plan.md checkbox;未全勾 → 拒绝(D-002)
1094
- const specRoot = specBase || this._getSpecDir(cwd);
1095
- const changeDir = join(specRoot, CHANGES_SUBDIR, changeName);
1096
- const { total: planTotal, checked: planChecked } = this.readPlanCheckboxStatus(changeDir);
1097
- if (planTotal === 0) {
1098
- return { ok: false, aligned: 0, skipped: 0, planTotal, planChecked, reason: 'plan.md 无 task checkbox(无法判定完成度)' };
1099
- }
1100
- if (planChecked < planTotal) {
1101
- return {
1102
- ok: false,
1103
- aligned: 0,
1104
- skipped: 0,
1105
- planTotal,
1106
- planChecked,
1107
- reason: `plan.md 有未勾选 task(${planChecked}/${planTotal}),拒绝对齐`,
1108
- };
1109
- }
1110
-
1111
- // 2.5 最低事实核验:plan.md checkbox 可被手动勾选伪造,
1112
- // 对齐前用 git 客观核验是否存在真实代码变更(能确证零变更时才拒绝,
1113
- // unknown 不阻断——worktree 已清理且变更已提交的正常场景无法对账)。
1114
- try {
1115
- const evidence = checkExecuteCodeEvidence(cwd, changeName);
1116
- if (evidence.status === 'unchanged') {
1117
- return {
1118
- ok: false,
1119
- aligned: 0,
1120
- skipped: 0,
1121
- planTotal,
1122
- planChecked,
1123
- reason: `plan.md 全勾但代码零变更(${evidence.detail}),拒绝对齐 — 请先运行 sillyspec doctor --json 诊断`,
1124
- };
1125
- }
1126
- } catch (e) {
1127
- console.warn(`⚠️ 代码变更核验异常(不阻断对齐): ${e.message}`);
1128
- }
1129
-
1130
- // 3. 全勾:计算将补哪些 step
1131
- const now = new Date().toISOString();
1132
- let aligned = 0;
1133
- let skipped = 0;
1134
- for (const step of steps) {
1135
- if (step.status === 'completed') {
1136
- skipped++;
1137
- continue;
1138
- }
1139
- aligned++;
1140
- if (confirm) {
1141
- step.status = 'completed';
1142
- step.completedAt = now;
1143
- }
1144
- }
1145
-
1146
- // dry-run:只报告,不落盘
1147
- if (!confirm) {
1148
- return { ok: true, aligned, skipped, planTotal, planChecked, dryRun: true };
1149
- }
1150
-
1151
- // 4. confirm:显式置 execute stageData.status='completed' + completedAt(D-003@v2,复刻 run.js:2303-2304)
1152
- executeStage.status = 'completed';
1153
- executeStage.completedAt = now;
1154
- progress.currentStage = progress.currentStage || 'execute';
1155
- progress.lastActive = now;
1156
- this._write(cwd, progress, changeName);
1157
-
1158
- return { ok: true, aligned, skipped, planTotal, planChecked };
1159
- }
1160
-
1161
- // ── 只读 dump(task-01/02/03:daemon 进度读取)──
1162
-
1163
- /**
1164
- * dump 输出的时间戳规范化:DB 内部两类形态(步骤推进时 JS Date 变量序列化
1165
- * 的 ISO 形态、部分历史路径写入的 `YYYY/M/D H:mm:ss` 斜杠形态)统一转 ISO。
1166
- * backend pydantic datetime 只吃 ISO(斜杠形态校验失败),斜杠 → new Date
1167
- * 可解析;解析失败原样返回(backend 侧按无效丢弃)。
1168
- */
1169
- _dumpIso(ts) {
1170
- if (!ts) return ts;
1171
- if (typeof ts === 'string' && /^\d{4}-\d{2}-\d{2}/.test(ts)) return ts;
1172
- const d = new Date(ts);
1173
- if (Number.isNaN(d.getTime())) return ts;
1174
- return d.toISOString();
1175
- }
1176
-
1177
- /**
1178
- * 只读导出进度数据,供 daemon 通过 `sillyspec progress dump --json` 消费。
1179
- *
1180
- * 纯读路径:打开 DB 只读、读 user-inputs.md、列 artifacts 目录,不写任何状态。
1181
- * 无活跃变更或 DB 不存在时返回 null(不抛异常,daemon 按 null 处理空数据)。
1182
- *
1183
- * 输出字段 snake_case + ISO 时间戳(2026-08-19-runtime-live-daemon-read
1184
- * acceptance review P0 修复):契约消费端 backend RuntimeProgress pydantic
1185
- * 是 snake_case(current_stage/last_active/started_at/size_bytes),
1186
- * dump 早期误用内部 camelCase;跨端字段名断裂会让 pydantic 静默忽略
1187
- * 未知字段导致前端核心字段全空。
1188
- *
1189
- * @param {string} cwd - specDir(`.sillyspec` 目录),由 CLI 层 --spec-dir 传入
1190
- * @returns {object|null} 结构化进度数据,格式见 design.md §6.2
1191
- */
1192
- dump(cwd) {
1193
- const specRoot = this._getSpecDir(cwd);
1194
- const dbPath = this._runtimePath(cwd, 'sillyspec.db');
1195
-
1196
- // DB 不存在 → 返回 null(项目未初始化进度)
1197
- if (!existsSync(dbPath)) return null;
1198
-
1199
- const db = this._ensureDB(cwd);
1200
- const sqlDb = db.getDb();
1201
-
1202
- // 1. project 行
1203
- const projectRow = sqlDb.prepare('SELECT name FROM project WHERE id = 1').get();
1204
- if (projectRow === undefined) return null;
1205
- const projectName = projectRow.name;
1206
-
1207
- // 2. 活跃变更(取 last_active 最新的一个)
1208
- // ql-20260821-003:多活跃仓(变更隔离是常态,单仓可同时存在 N 个 active)下
1209
- // 原 ORDER BY name 恒取字典序最前(通常是最老的变更),「当前变更/最后活动」
1210
- // 停留在历史数据。dump 语义是「当前工作流状态」→ 取最近活跃的那个。
1211
- const changeRows = sqlDb.prepare("SELECT id, name, current_stage, last_active FROM changes WHERE status = 'active' ORDER BY last_active DESC").all();
1212
- if (changeRows.length === 0) {
1213
- // 无活跃变更 → 返回仅含 project 的骨架
1214
- return {
1215
- project: projectName,
1216
- current_stage: null,
1217
- current_change: null,
1218
- last_active: null,
1219
- stages: {},
1220
- user_inputs: this._readUserInputs(cwd),
1221
- artifacts: this._listArtifacts(cwd),
1222
- };
1223
- }
1224
-
1225
- const change = changeRows[0];
1226
- const { id: changeId, name: changeName, current_stage: currentStage, last_active: lastActive } = change;
1227
-
1228
- // 3. stages
1229
- const stageRows = sqlDb.prepare(
1230
- 'SELECT id, stage, status, started_at, completed_at, revision FROM stages WHERE change_id = ? ORDER BY id'
1231
- ).all(changeId);
1232
-
1233
- const stages = {};
1234
- for (const s of VALID_STAGES) {
1235
- stages[s] = { status: 'pending', steps: [] };
1236
- }
1237
- // PERF-06:一次 IN (...) 批量取全部 steps 再按 stage_id 分组(原逐 stage 查询是 N+1,
1238
- // dump 是 daemon 轮询接口;与 read() :283-287 的批量读法对齐)
1239
- const stepsByStage = new Map();
1240
- if (stageRows.length > 0) {
1241
- const placeholders = stageRows.map(() => '?').join(', ');
1242
- const allStepRows = sqlDb.prepare(
1243
- `SELECT stage_id, name, status, output, completed_at FROM steps WHERE stage_id IN (${placeholders}) ORDER BY stage_id, ordering`
1244
- ).all(...stageRows.map(r => r.id));
1245
- for (const sr of allStepRows) {
1246
- if (!stepsByStage.has(sr.stage_id)) stepsByStage.set(sr.stage_id, []);
1247
- stepsByStage.get(sr.stage_id).push(sr);
1248
- }
1249
- }
1250
- for (const row of stageRows) {
1251
- const stepRows = stepsByStage.get(row.id) || [];
1252
- stages[row.stage] = {
1253
- status: row.status,
1254
- started_at: this._dumpIso(row.started_at) || undefined,
1255
- completed_at: this._dumpIso(row.completed_at) || undefined,
1256
- ...(row.revision ? { revision: row.revision } : {}),
1257
- steps: stepRows.map(sr => ({
1258
- name: sr.name,
1259
- status: sr.status,
1260
- ...(sr.output ? { output: sr.output } : {}),
1261
- ...(sr.completed_at ? { completed_at: this._dumpIso(sr.completed_at) } : {}),
1262
- })),
1263
- };
1264
- }
1265
-
1266
- return {
1267
- project: projectName,
1268
- current_stage: currentStage || null,
1269
- current_change: changeName,
1270
- last_active: this._dumpIso(lastActive) || null,
1271
- stages,
1272
- user_inputs: this._readUserInputs(cwd),
1273
- artifacts: this._listArtifacts(cwd),
1274
- };
1275
- }
1276
-
1277
- /** 只读 user-inputs.md 内容(不存在返回 null) */
1278
- _readUserInputs(cwd) {
1279
- const p = this._runtimePath(cwd, 'user-inputs.md');
1280
- if (!existsSync(p)) return null;
1281
- return readFileSync(p, 'utf8');
1282
- }
1283
-
1284
- /** 列 artifacts 目录(不存在返回空数组) */
1285
- _listArtifacts(cwd) {
1286
- const dir = this._runtimePath(cwd, 'artifacts');
1287
- if (!existsSync(dir)) return [];
1288
- try {
1289
- return readdirSync(dir, { withFileTypes: true })
1290
- .filter(e => e.isFile())
1291
- .map(e => {
1292
- const fullPath = join(dir, e.name);
1293
- const st = statSync(fullPath);
1294
- return {
1295
- filename: e.name,
1296
- size_bytes: st.size,
1297
- last_modified: st.mtime.toISOString(),
1298
- };
1299
- });
1300
- } catch {
1301
- return [];
1302
- }
1303
- }
1304
- }