specdojo 0.6.0 → 0.8.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 (366) hide show
  1. package/.github/agents/specdojo-orchestrator.md +3 -2
  2. package/CHANGELOG.md +193 -0
  3. package/README.md +2 -2
  4. package/dist/catalog/build.js +24 -1
  5. package/dist/catalog/plan.js +1 -1
  6. package/dist/catalog/scaffold.js +4 -1
  7. package/dist/commands/agent.js +33 -0
  8. package/dist/commands/init.js +6 -1
  9. package/dist/commands/night-orchestrator.js +6 -4
  10. package/dist/commands/orchestrator.js +10 -1
  11. package/dist/dashboard/dashboard-timeline.js +18 -16
  12. package/dist/dashboard/dashboard.js +612 -259
  13. package/dist/dashboard/epic-plan.js +81 -0
  14. package/dist/dashboard/exec-records.js +16 -20
  15. package/dist/dashboard/routines.js +8 -6
  16. package/dist/dashboard/timeline-build.js +5 -9
  17. package/dist/dashboard/timeline.js +9 -4
  18. package/dist/devcontainer/command.js +18 -0
  19. package/dist/devcontainer/host-script.js +21 -0
  20. package/dist/devcontainer/scaffold.js +22 -3
  21. package/dist/docs/frontmatter-namespace.js +1 -48
  22. package/dist/docs/yaml-pages.js +125 -3
  23. package/dist/exec/agent-config.js +22 -0
  24. package/dist/exec/agent-plan.js +3 -2
  25. package/dist/exec/antigravity-session.js +154 -0
  26. package/dist/exec/commands.js +69 -21
  27. package/dist/exec/commit-hook-skips.js +78 -0
  28. package/dist/exec/core.js +19 -7
  29. package/dist/exec/events.js +159 -8
  30. package/dist/exec/evidence.js +64 -16
  31. package/dist/exec/handoff.js +9 -13
  32. package/dist/exec/limit.js +1 -1
  33. package/dist/exec/mechanical-result.js +45 -0
  34. package/dist/exec/migrate-records.js +249 -0
  35. package/dist/exec/parent-validation.js +160 -12
  36. package/dist/exec/pipeline-state.js +27 -5
  37. package/dist/exec/plan-markdownlint.js +89 -0
  38. package/dist/exec/plans-condense-findings.js +89 -0
  39. package/dist/exec/plans-core.js +24 -17
  40. package/dist/exec/plans-generation.js +52 -25
  41. package/dist/exec/plans-grade-findings.js +8 -3
  42. package/dist/exec/plans-kata-findings.js +61 -0
  43. package/dist/exec/plans-planning.js +3 -3
  44. package/dist/exec/plans-storage.js +12 -24
  45. package/dist/exec/register-resume.js +69 -42
  46. package/dist/exec/register.js +26 -22
  47. package/dist/exec/repo-integration-sync.js +8 -4
  48. package/dist/exec/repo-integration.js +21 -1
  49. package/dist/exec/reporter.js +121 -23
  50. package/dist/exec/results.js +85 -24
  51. package/dist/exec/review-completion.js +47 -0
  52. package/dist/exec/review-kata.js +109 -0
  53. package/dist/exec/run/agent-pipeline.js +75 -6
  54. package/dist/exec/run/agent.js +20 -7
  55. package/dist/exec/run/in-place.js +69 -32
  56. package/dist/exec/run/job.js +81 -24
  57. package/dist/exec/run/lifecycle-commands.js +264 -43
  58. package/dist/exec/run/mode-shared.js +11 -3
  59. package/dist/exec/run/register-command.js +12 -10
  60. package/dist/exec/run/register-core.js +20 -13
  61. package/dist/exec/run/register-mode.js +12 -12
  62. package/dist/exec/run/register-post-review.js +21 -9
  63. package/dist/exec/run/register-resume.js +28 -18
  64. package/dist/exec/run/register-state.js +10 -7
  65. package/dist/exec/run/register-worktree.js +60 -30
  66. package/dist/exec/run/schedule-mode.js +26 -6
  67. package/dist/exec/run/schedule-prepare.js +228 -45
  68. package/dist/exec/run/schedule-task.js +132 -25
  69. package/dist/exec/run/shared.js +4 -3
  70. package/dist/exec/run/trailing-records.js +35 -0
  71. package/dist/exec/run-records.js +2 -0
  72. package/dist/exec/strategy.js +1 -0
  73. package/dist/exec/trailing-records.js +242 -0
  74. package/dist/exec/trial-commands.js +3 -2
  75. package/dist/exec/validate-records-commit.js +110 -0
  76. package/dist/exec/validate-records.js +148 -0
  77. package/dist/exec/worktree-command.js +29 -16
  78. package/dist/exec/worktree-ops-commit.js +118 -59
  79. package/dist/exec/worktree-ops-lifecycle.js +77 -44
  80. package/dist/exec/worktree-ops-merge.js +13 -2
  81. package/dist/exec/worktree-ops.js +2 -2
  82. package/dist/exec/worktree.js +19 -2
  83. package/dist/grade/apply.js +32 -6
  84. package/dist/grade/command-inspect.js +2 -2
  85. package/dist/grade/command-run.js +2 -0
  86. package/dist/grade/command-shared.js +1 -1
  87. package/dist/grade/core.js +18 -5
  88. package/dist/grade/markdown.js +3 -3
  89. package/dist/grade/pipeline-state.js +15 -11
  90. package/dist/grade/plan.js +37 -17
  91. package/dist/grade/result.js +3 -3
  92. package/dist/grade/run.js +23 -3
  93. package/dist/grade/target-discovery.js +17 -4
  94. package/dist/grade/targets.js +12 -11
  95. package/dist/job/job.js +31 -17
  96. package/dist/job/noop.js +104 -0
  97. package/dist/register/core.js +2 -0
  98. package/dist/register/create-commands.js +28 -3
  99. package/dist/register/deliverable-target.js +9 -1
  100. package/dist/register/epic.js +104 -26
  101. package/dist/register/event-merge.js +3 -0
  102. package/dist/register/events.js +4 -0
  103. package/dist/register/external-project.js +3 -0
  104. package/dist/register/item.js +6 -0
  105. package/dist/register/maintenance-commands.js +4 -1
  106. package/dist/register/planning.js +7 -14
  107. package/dist/register/register.js +74 -32
  108. package/dist/register/track-domains.js +34 -0
  109. package/dist/register/track-plan.js +78 -0
  110. package/dist/register/transition-commands.js +8 -0
  111. package/dist/register/work-table.js +64 -0
  112. package/dist/review/grade.js +35 -13
  113. package/dist/routine/definition.js +4 -3
  114. package/dist/routine/failure.js +30 -0
  115. package/dist/routine/routine.js +56 -32
  116. package/dist/routine/storage.js +33 -0
  117. package/dist/schedule/schedule.js +1 -0
  118. package/dist/schedule/strategy-generate-document.js +26 -14
  119. package/dist/schedule/strategy-generate-scope.js +17 -45
  120. package/dist/schedule/strategy-generate.js +33 -3
  121. package/dist/schedule/strategy-profiles.js +86 -12
  122. package/dist/shared/agent-types.js +2 -0
  123. package/dist/shared/condense-records.js +25 -0
  124. package/dist/shared/deprecation.js +8 -0
  125. package/dist/shared/document-metadata.js +20 -0
  126. package/dist/shared/finding-cause.js +20 -0
  127. package/dist/shared/frontmatter-namespace.js +48 -0
  128. package/dist/shared/git.js +149 -15
  129. package/dist/shared/grade-result.js +17 -1
  130. package/dist/shared/local-state.js +20 -0
  131. package/dist/shared/markdownlint-config.js +8 -3
  132. package/dist/shared/plan-conventions.js +129 -0
  133. package/dist/shared/plan-templates.js +57 -41
  134. package/dist/shared/provider-scaffold.js +2 -0
  135. package/dist/shared/run-records.js +224 -0
  136. package/dist/shared/specdojo-config.js +39 -21
  137. package/dist/shared/specdojo-gitignore.js +1 -0
  138. package/dist/shared/text.js +65 -5
  139. package/dist/shared/timeline-index.js +2 -0
  140. package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +11 -2
  141. package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +4 -74
  142. package/docs/ja/specdojo/exec-templates/xep-condense-template.md +50 -0
  143. package/docs/ja/specdojo/exec-templates/xep-draft-template.md +17 -5
  144. package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +16 -3
  145. package/docs/ja/specdojo/exec-templates/xep-recipe-guided-template.md +15 -5
  146. package/docs/ja/specdojo/exec-templates/xep-recipe-maintenance-template.md +6 -0
  147. package/docs/ja/specdojo/exec-templates/xep-register-template.md +1 -1
  148. package/docs/ja/specdojo/exec-templates/xep-rulebook-maintenance-template.md +6 -0
  149. package/docs/ja/specdojo/exec-templates/xep-sample-maintenance-template.md +6 -0
  150. package/docs/ja/specdojo/exec-templates/xep-template-maintenance-template.md +6 -0
  151. package/docs/ja/specdojo/exec-templates/xer-condense-template.md +25 -0
  152. package/docs/ja/specdojo/exec-templates/xp-common-conventions-template.md +50 -0
  153. package/docs/ja/specdojo/exec-templates/xrp-common-conventions-template.md +30 -0
  154. package/docs/ja/specdojo/guides/branch-workflow-guide.md +1 -1
  155. package/docs/ja/specdojo/guides/docs-editing-guide.md +48 -0
  156. package/docs/ja/specdojo/guides/docs-structure-guide.md +48 -15
  157. package/docs/ja/specdojo/guides/exec-config-guide.md +61 -28
  158. package/docs/ja/specdojo/guides/exec-operation-guide.md +61 -13
  159. package/docs/ja/specdojo/guides/exec-worktree-guide.md +20 -11
  160. package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +4 -2
  161. package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +92 -55
  162. package/docs/ja/specdojo/guides/project-move-guide.md +381 -0
  163. package/docs/ja/specdojo/guides/quick-start-guide.md +589 -807
  164. package/docs/ja/specdojo/guides/register-operation-guide.md +26 -4
  165. package/docs/ja/specdojo/guides/remote-host-development-guide.md +33 -4
  166. package/docs/ja/specdojo/guides/review-guide.md +22 -19
  167. package/docs/ja/specdojo/guides/routine-operation-guide.md +14 -8
  168. package/docs/ja/specdojo/guides/ryu-guide.md +23 -13
  169. package/docs/ja/specdojo/guides/schedule-design-guide.md +7 -4
  170. package/docs/ja/specdojo/guides/schedule-operation-guide.md +41 -3
  171. package/docs/ja/specdojo/guides/specdojo-overview-guide.md +5 -4
  172. package/docs/ja/specdojo/guides/timeline-design-guide.md +27 -144
  173. package/docs/ja/specdojo/guides/use-case-guide.md +471 -74
  174. package/docs/ja/specdojo/recipes/bac-recipe.md +94 -0
  175. package/docs/ja/specdojo/recipes/bes-recipe.md +105 -0
  176. package/docs/ja/specdojo/recipes/br-recipe.md +84 -0
  177. package/docs/ja/specdojo/recipes/cdfd-overview-recipe.md +88 -86
  178. package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +108 -122
  179. package/docs/ja/specdojo/recipes/cnd-recipe.md +125 -0
  180. package/docs/ja/specdojo/recipes/cpd-recipe.md +126 -0
  181. package/docs/ja/specdojo/recipes/cxd-recipe.md +145 -0
  182. package/docs/ja/specdojo/recipes/ifd-recipe.md +134 -0
  183. package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +135 -86
  184. package/docs/ja/specdojo/recipes/ifx-index-recipe.md +130 -0
  185. package/docs/ja/specdojo/recipes/pm-organization-recipe.md +29 -26
  186. package/docs/ja/specdojo/recipes/pm-plan-recipe.md +35 -26
  187. package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +38 -28
  188. package/docs/ja/specdojo/recipes/pm-raci-recipe.md +39 -31
  189. package/docs/ja/specdojo/recipes/pm-roles-recipe.md +26 -28
  190. package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +10 -8
  191. package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +18 -17
  192. package/docs/ja/specdojo/recipes/stsd-recipe.md +100 -62
  193. package/docs/ja/specdojo/recipes/sysd-critical-flows-recipe.md +106 -0
  194. package/docs/ja/specdojo/recipes/sysd-cross-cutting-policy-recipe.md +137 -0
  195. package/docs/ja/specdojo/recipes/sysd-index-recipe.md +122 -0
  196. package/docs/ja/specdojo/references/command-reference.md +146 -99
  197. package/docs/ja/specdojo/references/deliverables-reference.md +9 -4
  198. package/docs/ja/specdojo/references/directory-layout-reference.md +3 -2
  199. package/docs/ja/specdojo/references/specdojo-config-reference.md +17 -16
  200. package/docs/ja/specdojo/rulebooks/bac-rulebook.md +72 -290
  201. package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +212 -79
  202. package/docs/ja/specdojo/rulebooks/bds-rulebook.md +138 -154
  203. package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +147 -59
  204. package/docs/ja/specdojo/rulebooks/bes-rulebook.md +100 -96
  205. package/docs/ja/specdojo/rulebooks/br-rulebook.md +88 -108
  206. package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +126 -211
  207. package/docs/ja/specdojo/rulebooks/cdfd-d2-rulebook.md +367 -0
  208. package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +6 -5
  209. package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +96 -100
  210. package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +38 -47
  211. package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +132 -106
  212. package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +102 -68
  213. package/docs/ja/specdojo/rulebooks/cdt-rulebook.md +152 -0
  214. package/docs/ja/specdojo/rulebooks/cld-rulebook.md +9 -184
  215. package/docs/ja/specdojo/rulebooks/clis-rulebook.md +187 -0
  216. package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +93 -247
  217. package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +104 -241
  218. package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +124 -257
  219. package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +87 -98
  220. package/docs/ja/specdojo/rulebooks/dct-rulebook.md +9 -7
  221. package/docs/ja/specdojo/rulebooks/dec-rulebook.md +2 -1
  222. package/docs/ja/specdojo/rulebooks/dss-rulebook.md +193 -0
  223. package/docs/ja/specdojo/rulebooks/gl-rulebook.md +100 -54
  224. package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +69 -252
  225. package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +91 -76
  226. package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +252 -226
  227. package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +118 -40
  228. package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +11 -11
  229. package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +9 -9
  230. package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +4 -4
  231. package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +11 -11
  232. package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +11 -11
  233. package/docs/ja/specdojo/rulebooks/mm-rulebook.md +4 -3
  234. package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +34 -29
  235. package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +8 -8
  236. package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +2 -2
  237. package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +50 -56
  238. package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +46 -55
  239. package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +57 -54
  240. package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +50 -65
  241. package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +2 -2
  242. package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +70 -97
  243. package/docs/ja/specdojo/rulebooks/pr-rulebook.md +2 -1
  244. package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +47 -56
  245. package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +61 -135
  246. package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +116 -32
  247. package/docs/ja/specdojo/rulebooks/sf-rulebook.md +118 -61
  248. package/docs/ja/specdojo/rulebooks/sld-rulebook.md +152 -57
  249. package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +51 -39
  250. package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +101 -46
  251. package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +72 -329
  252. package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +74 -263
  253. package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +78 -195
  254. package/docs/ja/specdojo/rulebooks/tml-rulebook.md +4 -9
  255. package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +3 -4
  256. package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +3 -3
  257. package/docs/ja/specdojo/rulebooks/uis-rulebook.md +140 -143
  258. package/docs/ja/specdojo/samples/bac-sample.md +106 -21
  259. package/docs/ja/specdojo/samples/bdd-sample.yaml +143 -35
  260. package/docs/ja/specdojo/samples/bds-sample.md +100 -21
  261. package/docs/ja/specdojo/samples/bes-index-sample.md +59 -20
  262. package/docs/ja/specdojo/samples/bes-sample.md +80 -21
  263. package/docs/ja/specdojo/samples/br-sample.md +68 -14
  264. package/docs/ja/specdojo/samples/ccd-sample.md +81 -19
  265. package/docs/ja/specdojo/samples/cdfd-overview-sample.md +248 -140
  266. package/docs/ja/specdojo/samples/cdfd-sample.md +172 -99
  267. package/docs/ja/specdojo/samples/cdfd-uc-sample.md +130 -97
  268. package/docs/ja/specdojo/samples/cdsd-sample.md +89 -20
  269. package/docs/ja/specdojo/samples/cdt-sample.md +116 -0
  270. package/docs/ja/specdojo/samples/cld-sample.md +3 -30
  271. package/docs/ja/specdojo/samples/clis-sample.md +132 -0
  272. package/docs/ja/specdojo/samples/cnd-sample.md +127 -21
  273. package/docs/ja/specdojo/samples/cpd-sample.md +136 -22
  274. package/docs/ja/specdojo/samples/cxd-sample.md +108 -22
  275. package/docs/ja/specdojo/samples/dct-index-sample.yaml +63 -17
  276. package/docs/ja/specdojo/samples/dss-sample.md +175 -0
  277. package/docs/ja/specdojo/samples/gl-sample.yaml +50 -14
  278. package/docs/ja/specdojo/samples/ifd-sample.md +105 -21
  279. package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +91 -60
  280. package/docs/ja/specdojo/samples/ifx-file-sample.md +462 -21
  281. package/docs/ja/specdojo/samples/ifx-index-sample.yaml +87 -19
  282. package/docs/ja/specdojo/samples/pm-members-sample.yaml +37 -13
  283. package/docs/ja/specdojo/samples/pm-organization-sample.md +52 -20
  284. package/docs/ja/specdojo/samples/pm-plan-sample.md +84 -26
  285. package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +55 -22
  286. package/docs/ja/specdojo/samples/pm-raci-sample.md +69 -28
  287. package/docs/ja/specdojo/samples/pm-roles-sample.yaml +13 -12
  288. package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +50 -26
  289. package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +89 -62
  290. package/docs/ja/specdojo/samples/sf-index-sample.md +89 -20
  291. package/docs/ja/specdojo/samples/sf-sample.md +121 -21
  292. package/docs/ja/specdojo/samples/sld-sample.md +107 -21
  293. package/docs/ja/specdojo/samples/stsd-sample.md +54 -26
  294. package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +166 -21
  295. package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +178 -21
  296. package/docs/ja/specdojo/samples/sysd-index-sample.md +82 -21
  297. package/docs/ja/specdojo/samples/tml-sample.yaml +4 -1
  298. package/docs/ja/specdojo/samples/uis-sample.md +164 -20
  299. package/docs/ja/specdojo/standards/document-metadata-standard.md +33 -4
  300. package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +3 -1
  301. package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +1 -0
  302. package/docs/ja/specdojo/templates/bac-template.md +76 -0
  303. package/docs/ja/specdojo/templates/bes-template.md +56 -0
  304. package/docs/ja/specdojo/templates/br-template.md +64 -0
  305. package/docs/ja/specdojo/templates/cdfd-overview-template.md +161 -83
  306. package/docs/ja/specdojo/templates/cdfd-template.md +81 -54
  307. package/docs/ja/specdojo/templates/cdfd-uc-template.md +130 -89
  308. package/docs/ja/specdojo/templates/cnd-template.md +137 -0
  309. package/docs/ja/specdojo/templates/cpd-template.md +129 -0
  310. package/docs/ja/specdojo/templates/cxd-template.md +105 -0
  311. package/docs/ja/specdojo/templates/dct-data-model-cdt-template.yaml +40 -0
  312. package/docs/ja/specdojo/templates/dct-data-model-cld-template.yaml +7 -14
  313. package/docs/ja/specdojo/templates/dct-index-template.md +9 -20
  314. package/docs/ja/specdojo/templates/dct-project-management-template.yaml +5 -1
  315. package/docs/ja/specdojo/templates/ifd-template.md +86 -0
  316. package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +44 -28
  317. package/docs/ja/specdojo/templates/ifx-index-template.yaml +40 -0
  318. package/docs/ja/specdojo/templates/opr-template.md +2 -4
  319. package/docs/ja/specdojo/templates/pm-organization-template.md +9 -3
  320. package/docs/ja/specdojo/templates/pm-plan-template.md +4 -4
  321. package/docs/ja/specdojo/templates/pm-quality-management-plan-template.md +17 -9
  322. package/docs/ja/specdojo/templates/pm-raci-template.md +24 -13
  323. package/docs/ja/specdojo/templates/pm-roles-template.yaml +3 -2
  324. package/docs/ja/specdojo/templates/prj-assumptions-constraints-dependencies-template.md +6 -3
  325. package/docs/ja/specdojo/templates/prj-comparison-of-alternatives-template.md +22 -19
  326. package/docs/ja/specdojo/templates/stsd-template.md +46 -21
  327. package/docs/ja/specdojo/templates/sysd-critical-flows-template.md +94 -0
  328. package/docs/ja/specdojo/templates/sysd-cross-cutting-policy-template.md +122 -0
  329. package/docs/ja/specdojo/templates/sysd-index-template.md +89 -0
  330. package/docs/specdojo/lib/yaml-metadata.cjs +7 -0
  331. package/docs/specdojo/schemas/v1/bdd.schema.yaml +25 -57
  332. package/docs/specdojo/schemas/v1/condense-records.schema.yaml +26 -0
  333. package/docs/specdojo/schemas/v1/dct.schema.yaml +10 -0
  334. package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +3 -0
  335. package/docs/specdojo/schemas/v1/esil.schema.yaml +7 -141
  336. package/docs/specdojo/schemas/v1/exec-common.schema.yaml +3 -0
  337. package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +54 -3
  338. package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +3 -0
  339. package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +14 -0
  340. package/docs/specdojo/schemas/v1/exec-result-frontmatter.schema.yaml +18 -0
  341. package/docs/specdojo/schemas/v1/finding-cause.schema.yaml +22 -0
  342. package/docs/specdojo/schemas/v1/grade-pipeline-state.schema.yaml +1 -1
  343. package/docs/specdojo/schemas/v1/grade-result.schema.yaml +2 -0
  344. package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +65 -5
  345. package/docs/specdojo/schemas/v1/ifx-index.schema.yaml +142 -0
  346. package/docs/specdojo/schemas/v1/register-events.schema.yaml +2 -0
  347. package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +17 -1
  348. package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +1 -0
  349. package/package.json +6 -3
  350. package/templates/antigravity/README.md +19 -46
  351. package/templates/antigravity/exec-defaults-snippet.yaml +5 -6
  352. package/templates/antigravity/orchestrator.md +3 -2
  353. package/templates/antigravity/settings.edit.json +73 -0
  354. package/templates/antigravity/settings.orchestrator.json +15 -0
  355. package/templates/antigravity/settings.report.json +7 -0
  356. package/templates/antigravity/settings.review.json +7 -0
  357. package/templates/claude/agents/specdojo-orchestrator.md +3 -2
  358. package/templates/codex/agents/specdojo-orchestrator.toml +3 -2
  359. package/templates/codex/orchestrator.md +3 -2
  360. package/templates/devcontainer/remote-host/devcontainer-tmux.sh +217 -0
  361. package/templates/devcontainer/remote-host/specdojo-tmux.sh.sample +8 -96
  362. package/templates/devcontainer/remote-host/ssh-config.sample +3 -1
  363. package/templates/devcontainer/tmux.conf +6 -0
  364. package/templates/init-agent-members.yaml +1 -0
  365. package/templates/init-exec-defaults.yaml +1 -1
  366. package/templates/opencode/agents/specdojo-orchestrator.md +3 -2
@@ -1,4 +1,5 @@
1
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
1
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
+ import { readPlanFile } from "../shared/plan-conventions.js";
2
3
  import { dirname, resolve } from "node:path";
3
4
  import { defaultExecDefaultsPath, loadExecDefaultsConfig, resolveMemberCommand, resolveRateLimitDetection, resolveRateLimitPolicy, } from "./agent-config.js";
4
5
  import { resolveProjectPaths } from "./project.js";
@@ -70,7 +71,7 @@ export function readAgentPlan(planPath) {
70
71
  if (!existsSync(absolutePath)) {
71
72
  throw new Error(`--plan not found: ${planPath}`);
72
73
  }
73
- const prompt = readFileSync(absolutePath, "utf8");
74
+ const prompt = readPlanFile(absolutePath);
74
75
  if (!prompt.trim()) {
75
76
  throw new Error(`--plan is empty: ${planPath}`);
76
77
  }
@@ -0,0 +1,154 @@
1
+ import { existsSync, readFileSync, readdirSync, realpathSync } from "node:fs";
2
+ import { join, resolve } from "node:path";
3
+ import { specdojoPackageRootDir } from "../shared/package-paths.js";
4
+ import { isAgentProtectedConfigPath, PROTECTED_DIRECTORY_PREFIXES, PROTECTED_EXACT_PATHS, } from "./agent-protected-config.js";
5
+ export function antigravityRole(value) {
6
+ if (["edit", "review", "report", "orchestrator"].includes(value)) {
7
+ return value;
8
+ }
9
+ throw new Error(`Invalid Antigravity role: ${value}`);
10
+ }
11
+ function canonicalRoot(root) {
12
+ const absolute = resolve(root);
13
+ const normalized = (existsSync(absolute) ? realpathSync(absolute) : absolute).replaceAll("\\", "/");
14
+ // The permission syntax has no escaping for parentheses or the global wildcard.
15
+ if (/[()*\r\n]/u.test(normalized)) {
16
+ throw new Error(`Unsupported Antigravity workspace path: ${normalized}`);
17
+ }
18
+ return normalized.replace(/\/$/u, "") + "/";
19
+ }
20
+ /** One settings object per launch: never read or modify the user's global settings. */
21
+ export function buildAntigravitySession(options) {
22
+ const { role, cwd } = options;
23
+ const roots = [...new Set([cwd, ...options.repoRoots].map(canonicalRoot))];
24
+ const localProfile = join(cwd, ".specdojo", "antigravity", `settings.${role}.json`);
25
+ const profilePath = existsSync(localProfile)
26
+ ? localProfile
27
+ : join(specdojoPackageRootDir(), "templates", "antigravity", `settings.${role}.json`);
28
+ const profile = JSON.parse(readFileSync(profilePath, "utf8"));
29
+ if (!profile || typeof profile !== "object" || Array.isArray(profile)) {
30
+ throw new Error(`Invalid Antigravity settings: ${profilePath}`);
31
+ }
32
+ const settings = profile;
33
+ const permissions = { allow: [], deny: [], ask: [] };
34
+ if (settings.permissions !== undefined) {
35
+ if (!settings.permissions ||
36
+ typeof settings.permissions !== "object" ||
37
+ Array.isArray(settings.permissions)) {
38
+ throw new Error(`Invalid permissions in ${profilePath}`);
39
+ }
40
+ for (const name of ["allow", "deny", "ask"]) {
41
+ const rules = settings.permissions[name] ?? [];
42
+ if (!Array.isArray(rules) || rules.some((rule) => typeof rule !== "string")) {
43
+ throw new Error(`Invalid permissions.${name} in ${profilePath}`);
44
+ }
45
+ permissions[name] = [...rules];
46
+ }
47
+ }
48
+ for (const root of roots) {
49
+ permissions.allow.push(`read_file(${root})`);
50
+ if (role === "edit" || role === "orchestrator")
51
+ permissions.allow.push(`write_file(${root})`);
52
+ for (const secret of [
53
+ ".env",
54
+ ".env.local",
55
+ ".env.development",
56
+ ".env.production",
57
+ ".env.test",
58
+ ".env.staging",
59
+ ".envrc",
60
+ "secrets/",
61
+ ".ssh/",
62
+ ".aws/",
63
+ ".gemini/",
64
+ ]) {
65
+ permissions.deny.push(`read_file(${root}${secret})`);
66
+ }
67
+ permissions.deny.push(`write_file(${root}.git)`);
68
+ if (role !== "orchestrator") {
69
+ const discovered = existsSync(root)
70
+ ? readdirSync(root).filter(isAgentProtectedConfigPath)
71
+ : [];
72
+ for (const protectedPath of new Set([
73
+ ...PROTECTED_DIRECTORY_PREFIXES,
74
+ ...PROTECTED_EXACT_PATHS,
75
+ ...discovered,
76
+ ])) {
77
+ if (/[()*\r\n]/u.test(protectedPath)) {
78
+ throw new Error(`Unsupported Antigravity protected path: ${protectedPath}`);
79
+ }
80
+ permissions.deny.push(`write_file(${root}${protectedPath})`);
81
+ }
82
+ }
83
+ }
84
+ if (role === "review" || role === "report") {
85
+ // A command or MCP tool can write independently of write_file permissions.
86
+ permissions.deny.push("write_file(*)", "command(*)", "unsandboxed(*)", "mcp(*)", "execute_url(*)");
87
+ }
88
+ permissions.deny.push("command(sudo)", "command(rm -rf)");
89
+ for (const bin of ["", "/usr/bin/", "/usr/local/bin/"]) {
90
+ permissions.deny.push(`command(${bin}git push)`, `command(${bin}gh)`);
91
+ if (role !== "orchestrator") {
92
+ for (const action of ["add", "commit", "config", "reset"])
93
+ permissions.deny.push(`command(${bin}git ${action})`);
94
+ }
95
+ }
96
+ for (const name of ["allow", "deny", "ask"])
97
+ permissions[name] = [...new Set(permissions[name])];
98
+ return {
99
+ roots,
100
+ settings: { ...settings, agentMode: "", toolPermission: "request-review", permissions },
101
+ };
102
+ }
103
+ export function antigravitySessionArguments(options) {
104
+ const { roots, settings } = buildAntigravitySession(options);
105
+ const args = [];
106
+ for (let index = 0; index < options.providerArgs.length; index++) {
107
+ const arg = options.providerArgs[index];
108
+ // Go-style flag parsers may also accept a single dash for long options.
109
+ const flag = arg.startsWith("-") && !arg.startsWith("--") && arg.length > 2 ? `-${arg}` : arg;
110
+ if (arg === "--")
111
+ throw new Error("Antigravity provider argument terminator is not supported");
112
+ if ([
113
+ "-p",
114
+ "-i",
115
+ "--print",
116
+ "--prompt",
117
+ "--prompt-interactive",
118
+ "--model",
119
+ "--effort",
120
+ "--input-format",
121
+ "--output-format",
122
+ "--json-schema",
123
+ "--print-timeout",
124
+ "--log-file",
125
+ ].includes(flag)) {
126
+ const value = options.providerArgs[++index];
127
+ if (value === undefined)
128
+ throw new Error(`Missing value for ${arg}`);
129
+ args.push(arg, value);
130
+ continue;
131
+ }
132
+ if (flag === "--add-dir" || flag.startsWith("--add-dir=")) {
133
+ const dir = flag === "--add-dir" ? options.providerArgs[++index] : flag.slice("--add-dir=".length);
134
+ if (!dir || !roots.includes(canonicalRoot(resolve(options.cwd, dir)))) {
135
+ throw new Error(`Undeclared Antigravity workspace: ${dir ?? "(missing)"}`);
136
+ }
137
+ continue;
138
+ }
139
+ if (/^--(?:settings|dangerously-skip-permissions|mode|project|new-project|continue|conversation|agent)(?:=|$)/u.test(flag) ||
140
+ arg === "-c") {
141
+ throw new Error(`Antigravity session permissions cannot be overridden: ${arg}`);
142
+ }
143
+ if (!arg.startsWith("-")) {
144
+ throw new Error(`Use -p or -i for Antigravity prompts; unexpected argument: ${arg}`);
145
+ }
146
+ args.push(arg);
147
+ }
148
+ return [
149
+ ...args,
150
+ ...roots.flatMap((root) => ["--add-dir", root.replace(/\/$/u, "") || "/"]),
151
+ "--settings",
152
+ JSON.stringify(settings),
153
+ ];
154
+ }
@@ -1,26 +1,31 @@
1
+ import { Option } from "commander";
1
2
  import { existsSync } from "node:fs";
2
3
  import { join, resolve as pathResolve } from "node:path";
3
4
  import { validateCatalogLocalIds, validateRulebookKata } from "../catalog/build.js";
4
- import { acquireSchedulerLock, canBlockTask, canCancelTask, canClaimTask, canCompleteTask, canReleaseTask, canReopenTask, canUnblockTask, computeReadyIds, readAllEventFiles, releaseSchedulerLock, schedulerLockPath, writeEventFile, } from "./events.js";
5
- import { eventsDirForProject, generatedDirForProject } from "./project.js";
6
- import { assertValidActor, getProjectViewpointsPath, loadConfig, specdojoRootDir, } from "../shared/specdojo-config.js";
7
- import { buildScheduleIndex, computeCpm, exitWithCode, printValidateResult, selectNextTask, validateAll, writeCpmFiles, writeGeneratedCore, writeScheduleHashAndDiff, } from "./schedule/schedule.js";
8
- import { readReadySnapshot } from "./schedule/ready.js";
9
- import { displayWidth, nowUtcIsoSeconds, padEndDisplay, requireNonEmpty } from "./shared.js";
10
- import { archivePlan, buildInPlaceStem, generateDeliverablePlan, generateSinglePlan, resolveDeliverableTarget, stemFromPlanPath, } from "./plans.js";
5
+ import { commonViewpointsPath, scaffoldViewpoints } from "../review/plan.js";
11
6
  import { runProviderScaffold, specdojoPackageRootDir } from "../shared/provider-scaffold.js";
7
+ import { assertValidActor, getProjectViewpointsPath, getProjectRoutinesPath, loadConfig, specdojoRootDir, } from "../shared/specdojo-config.js";
8
+ import { DEFAULT_EVENT_MESSAGES, KNOWN_OWNER_LABELS, KNOWN_OWNER_LABELS_TEXT, addCommonAddOptions, addForceOption, addLockOptions, addOwnerOptions, addProjectOptions, addTakeOverOption, ensureActorCanClaimNext, findRosterMember, loadRosterForOpts, loadValidatedExecState, parseApproach, parseTaskMode, printCommandError, resolveClaimOwner, resolveForceOverride, resolveProjectContext, resolveProjectId, resolveSchedulerStrategy, runLockedEventCommand, runReleaseAllBlocked, runSimpleEventCommand, scaffoldClaimResult, } from "./core.js";
9
+ import { acquireSchedulerLock, canBlockTask, canCancelTask, canClaimTask, canCompleteTask, canReleaseTask, canReopenTask, canUnblockTask, claimOwnerOf, computeReadyIds, readAllEventFiles, releaseSchedulerLock, schedulerLockPath, writeEventFile, } from "./events.js";
10
+ import { registerExecHandoffCommands } from "./handoff.js";
11
+ import { registerRecordMigrationCommand } from "./migrate-records.js";
12
+ import { archivePlan, buildInPlaceStem, generateDeliverablePlan, generateSinglePlan, resolveDeliverableTarget, stemFromPlanPath, } from "./plans.js";
13
+ import { eventsDirForProject, generatedDirForProject } from "./project.js";
12
14
  import { generateRegisterPlan, normalizePjrId, resolveRegisterRunTarget } from "./register.js";
13
- import { commonViewpointsPath, scaffoldViewpoints } from "../review/plan.js";
14
15
  import { registerCycleCommand, registerResumeCommand, registerRunCommand, registerSlotsCommand, } from "./run/run.js";
16
+ import { readReadySnapshot } from "./schedule/ready.js";
17
+ import { buildScheduleIndex, computeCpm, exitWithCode, printValidateResult, selectNextTask, validateAll, writeCpmFiles, writeGeneratedCore, writeScheduleHashAndDiff, } from "./schedule/schedule.js";
18
+ import { displayWidth, nowUtcIsoSeconds, padEndDisplay, requireNonEmpty } from "./shared.js";
19
+ import { resolveOwnerForLocalId } from "./strategy.js";
15
20
  import { buildTaskView } from "./task-view.js";
16
- import { registerExecWorktreeCommands } from "./worktree-command.js";
17
21
  import { registerExecTrialCommands } from "./trial.js";
18
- import { registerExecHandoffCommands } from "./handoff.js";
19
- import { resolveOwnerForLocalId } from "./strategy.js";
20
- import { DEFAULT_EVENT_MESSAGES, KNOWN_OWNER_LABELS, KNOWN_OWNER_LABELS_TEXT, addCommonAddOptions, addForceOption, addLockOptions, addOwnerOptions, addProjectOptions, ensureActorCanClaimNext, findRosterMember, loadRosterForOpts, loadValidatedExecState, parseApproach, parseTaskMode, printCommandError, resolveClaimOwner, resolveForceOverride, resolveProjectContext, resolveProjectId, resolveSchedulerStrategy, runLockedEventCommand, runReleaseAllBlocked, runSimpleEventCommand, scaffoldClaimResult, } from "./core.js";
22
+ import { registerExecWorktreeCommands } from "./worktree-command.js";
23
+ import { validateRunRecordLayout } from "./validate-records.js";
24
+ import { validateRunRecordLayoutAtCommit } from "./validate-records-commit.js";
21
25
  export function registerExecCommands(program) {
22
26
  const exec = program.command("exec").description("Execution helpers");
23
27
  registerExecHandoffCommands(exec);
28
+ registerRecordMigrationCommand(exec);
24
29
  const lockedActions = {
25
30
  claim: {
26
31
  type: "claim",
@@ -44,7 +49,10 @@ export function registerExecCommands(program) {
44
49
  },
45
50
  unblock: {
46
51
  type: "unblock",
47
- check: ({ schedule, snapshot }, taskId) => canUnblockTask(schedule, snapshot, taskId),
52
+ check: ({ schedule, snapshot }, taskId, actor, opts) => canUnblockTask(schedule, snapshot, taskId, {
53
+ requested: !!opts.takeOver,
54
+ isHuman: findRosterMember(loadRosterForOpts(opts), actor)?.type === "human",
55
+ }),
48
56
  },
49
57
  release: {
50
58
  type: "release",
@@ -79,6 +87,8 @@ export function registerExecCommands(program) {
79
87
  addOwnerOptions(cmd);
80
88
  if (t === "complete" || t === "block" || t === "release")
81
89
  addForceOption(cmd);
90
+ if (t === "unblock")
91
+ addTakeOverOption(cmd);
82
92
  if (t === "release") {
83
93
  cmd.option("--reset-worktree", "Discard the task's exec worktree and branch after releasing (force removal)", false);
84
94
  cmd.option("--all-blocked", "Release every blocked task in the project back to todo (ignores --task)", false);
@@ -97,13 +107,53 @@ export function registerExecCommands(program) {
97
107
  cmd.action((opts) => runSimpleEventCommand(opts, t));
98
108
  }
99
109
  }
100
- const vcmd = exec.command("validate").description("Validate schedule + events");
110
+ const vcmd = exec
111
+ .command("validate")
112
+ .description("Validate schedule, events and run record layout");
101
113
  addProjectOptions(vcmd);
114
+ vcmd.option("--records-only", "Check only run record layout and runtime lock exclusion", false);
115
+ vcmd.addOption(new Option("--schedule-only", "Check only schedule and events (used before running tasks)")
116
+ .default(false)
117
+ .conflicts("recordsOnly"));
118
+ vcmd.option("--commit <rev>", "With --records-only, check the run records in the tree of <rev> instead of the working tree");
102
119
  vcmd.action((opts) => {
103
120
  try {
104
- const { schedulePath, catalogPath } = resolveProjectContext(opts);
121
+ const { schedulePath, catalogPath, executionPath } = resolveProjectContext(opts);
122
+ const { config } = loadConfig();
123
+ const project = config?.projects[resolveProjectId(opts)];
124
+ const routinesPath = project && getProjectRoutinesPath(project);
125
+ if (opts.commit !== undefined && !opts.recordsOnly)
126
+ throw new Error("--commit requires --records-only");
127
+ const layoutOptions = {
128
+ executionPath,
129
+ repoRoot: specdojoRootDir(),
130
+ ...(routinesPath ? { routinesPath: pathResolve(specdojoRootDir(), routinesPath) } : {}),
131
+ };
132
+ const layoutIssues = opts.scheduleOnly
133
+ ? []
134
+ : typeof opts.commit === "string"
135
+ ? validateRunRecordLayoutAtCommit({ ...layoutOptions, commit: opts.commit })
136
+ : validateRunRecordLayout(layoutOptions);
137
+ if (opts.recordsOnly) {
138
+ for (const issue of layoutIssues)
139
+ process.stdout.write(`ERROR: ${issue.path}: [${issue.reason}] ${issue.message}\n`);
140
+ if (!layoutIssues.length)
141
+ process.stdout.write(`OK: run record layout validation passed${typeof opts.commit === "string" ? ` (${opts.commit})` : ""}\n`);
142
+ exitWithCode(layoutIssues.length === 0);
143
+ return;
144
+ }
105
145
  const res = validateAll(schedulePath);
146
+ for (const issue of layoutIssues) {
147
+ const message = `${issue.path}: [${issue.reason}] ${issue.message}`;
148
+ if (issue.reason !== "missing")
149
+ res.errors.push(message);
150
+ }
151
+ res.ok = res.errors.length === 0;
106
152
  printValidateResult(res);
153
+ for (const issue of layoutIssues) {
154
+ if (issue.reason === "missing")
155
+ process.stdout.write(`WARN: ${issue.path}: [${issue.reason}] ${issue.message}\n`);
156
+ }
107
157
  // Scheduled tasks resolve their deliverable by bare local_id, so warn when a
108
158
  // local_id is not unique project-wide across the catalogs.
109
159
  if (catalogPath && existsSync(catalogPath)) {
@@ -239,12 +289,12 @@ export function registerExecCommands(program) {
239
289
  });
240
290
  const archiveCmd = exec
241
291
  .command("archive")
242
- .description("Archive a completed plan to exec/plans/done/ (or delete it)");
292
+ .description("Keep a completed run plan in its run directory, or delete it");
243
293
  addProjectOptions(archiveCmd);
244
294
  archiveCmd.option("--task <taskId>", "Scheduled task ID whose plan to archive");
245
295
  archiveCmd.option("--deliverable <localId>", "Catalog deliverable local_id (unique project-wide)");
246
296
  archiveCmd.option("--plan <path>", "Plan file to archive (for unique-named in-place plans)");
247
- archiveCmd.option("--delete", "Delete the plan instead of moving it to done/", false);
297
+ archiveCmd.option("--delete", "Delete the plan instead of retaining it", false);
248
298
  archiveCmd.action((opts) => {
249
299
  try {
250
300
  const { executionPath, catalogPath } = resolveProjectContext(opts);
@@ -254,8 +304,6 @@ export function registerExecCommands(program) {
254
304
  if ([hasTask, hasDeliverable, hasPlan].filter(Boolean).length !== 1) {
255
305
  throw new Error("Specify exactly one of --task, --deliverable, or --plan.");
256
306
  }
257
- // `archivePlan` rebuilds `<slug>-plan.md`; for --plan the stem recovered from the filename
258
- // is that slug, so a unique-named in-place plan archives to done/ like a fixed-name one.
259
307
  const slug = hasPlan
260
308
  ? stemFromPlanPath(opts.plan.trim())
261
309
  : hasTask
@@ -508,7 +556,7 @@ export function registerExecCommands(program) {
508
556
  const filterBy = typeof opts.by === "string" ? opts.by.trim() : undefined;
509
557
  const entries = Object.entries(snapshot.tasks)
510
558
  .filter(([, cs]) => cs.state === filterState)
511
- .filter(([, cs]) => !filterBy || cs.last_by === filterBy)
559
+ .filter(([, cs]) => !filterBy || claimOwnerOf(cs) === filterBy)
512
560
  .sort(([a], [b]) => a.localeCompare(b));
513
561
  if (entries.length === 0) {
514
562
  const byMsg = filterBy ? ` for ${filterBy}` : "";
@@ -521,7 +569,7 @@ export function registerExecCommands(program) {
521
569
  const rows = entries.map(([taskId, cs]) => ({
522
570
  taskId,
523
571
  name: schedule.nodes.get(taskId)?.name ?? "-",
524
- by: cs.last_by ?? "-",
572
+ by: claimOwnerOf(cs) ?? "-",
525
573
  ts: cs.last_ts ?? "-",
526
574
  }));
527
575
  // Size every column to its longest value (including the header) so nothing is truncated.
@@ -0,0 +1,78 @@
1
+ import { parentValidationLabels, recordedParentValidationLabel } from "./parent-validation.js";
2
+ import { recordedRunValidations } from "./pipeline-state.js";
3
+ // LEFTHOOK_EXCLUDE はコンマ区切りのため、hook のコマンド名にコンマや空白を許さない。
4
+ const HOOK_NAME_PATTERN = /^[A-Za-z0-9_.-]+$/;
5
+ function isRecord(value) {
6
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7
+ }
8
+ /** Validates `pipeline.commit_hook_skips` against the configured parent validations. */
9
+ export function resolveCommitHookSkips(value, parentValidationEntries) {
10
+ if (value === undefined)
11
+ return [];
12
+ if (!Array.isArray(value)) {
13
+ throw new Error("pipeline.commit_hook_skips in exec-defaults must be an array");
14
+ }
15
+ const labels = new Set(parentValidationLabels(parentValidationEntries));
16
+ const seen = new Set();
17
+ return value.map((entry, index) => {
18
+ const where = `pipeline.commit_hook_skips[${index}] in exec-defaults`;
19
+ if (!isRecord(entry))
20
+ throw new Error(`${where} must be { hook, covered_by }`);
21
+ const unknownKeys = Object.keys(entry).filter((key) => key !== "hook" && key !== "covered_by");
22
+ if (unknownKeys.length > 0) {
23
+ throw new Error(`${where}: unknown key(s) ${unknownKeys.sort().join(", ")}`);
24
+ }
25
+ if (typeof entry.hook !== "string" || !HOOK_NAME_PATTERN.test(entry.hook)) {
26
+ throw new Error(`${where}.hook must match ${String(HOOK_NAME_PATTERN)}`);
27
+ }
28
+ if (seen.has(entry.hook))
29
+ throw new Error(`${where}: duplicate hook ${entry.hook}`);
30
+ seen.add(entry.hook);
31
+ const coveredBy = entry.covered_by;
32
+ if (!Array.isArray(coveredBy) ||
33
+ coveredBy.length === 0 ||
34
+ !coveredBy.every((label) => typeof label === "string")) {
35
+ throw new Error(`${where}.covered_by must be a non-empty array of parent validation ids`);
36
+ }
37
+ const unknownLabels = coveredBy.filter((label) => !labels.has(label));
38
+ if (unknownLabels.length > 0) {
39
+ throw new Error(`${where}.covered_by is not in pipeline.parent_validations: ${unknownLabels.join(", ")}`);
40
+ }
41
+ return { hook: entry.hook, covered_by: [...coveredBy] };
42
+ });
43
+ }
44
+ /**
45
+ * Hook commands the integration commit may skip: those whose every covering parent validation
46
+ * is recorded by the runner as `passed`. A validation skipped by change type (`not_applicable`)
47
+ * does not cover the hook, so the hook still runs when its own glob matches.
48
+ */
49
+ export function integrationCommitHookExclusions(skips, validations) {
50
+ const passed = new Set(validations
51
+ .filter((validation) => validation.source === "runner" && validation.status === "passed")
52
+ .map(recordedParentValidationLabel));
53
+ return skips
54
+ .filter((skip) => skip.covered_by.every((label) => passed.has(label)))
55
+ .map((skip) => skip.hook);
56
+ }
57
+ /** Environment for the integration commit; merges with an inherited LEFTHOOK_EXCLUDE. */
58
+ export function lefthookExcludeEnvironment(hooks, inherited = process.env.LEFTHOOK_EXCLUDE) {
59
+ if (hooks.length === 0)
60
+ return undefined;
61
+ const names = [
62
+ ...new Set([
63
+ ...(inherited ?? "")
64
+ .split(",")
65
+ .map((name) => name.trim())
66
+ .filter(Boolean),
67
+ ...hooks,
68
+ ]),
69
+ ];
70
+ return { LEFTHOOK_EXCLUDE: names.join(",") };
71
+ }
72
+ /** Hook commands to skip in a run's integration commit, from its recorded parent validations. */
73
+ export function integrationCommitSkipHooks(params) {
74
+ const skips = resolveCommitHookSkips(params.pipeline?.commit_hook_skips, params.pipeline?.parent_validations);
75
+ if (skips.length === 0)
76
+ return [];
77
+ return integrationCommitHookExclusions(skips, recordedRunValidations(params.worktreePath, params.pipelineStatePath));
78
+ }
package/dist/exec/core.js CHANGED
@@ -1,19 +1,21 @@
1
- import { acquireSchedulerLock, buildEvent, canReleaseTask, collectRepeatable, findDoingTasksForActor, foldEventsToState, readAllEventFiles, releaseSchedulerLock, writeEventFile, } from "./events.js";
2
- import { activateResolvedProjectPaths, resolveProjectPaths } from "./project.js";
3
1
  import { assertValidActor, loadConfig, loadMemberRoster, specdojoRootDir, } from "../shared/specdojo-config.js";
4
- import { buildScheduleIndex, computeCpm, exitWithCode, printValidateResult, validateAll, writeCpmFiles, writeGeneratedCore, writeScheduleHashAndDiff, } from "./schedule/schedule.js";
5
- import { qualifyTaskId, requireNonEmpty } from "./shared.js";
2
+ import { acquireSchedulerLock, buildEvent, canReleaseTask, collectRepeatable, findDoingTasksForActor, foldEventsToState, readAllEventFiles, releaseSchedulerLock, writeEventFile, } from "./events.js";
6
3
  import { finalizeResultSectionsForDeliverable, targetDocIdsForScheduledTask } from "./plans.js";
4
+ import { activateResolvedProjectPaths, resolveProjectPaths } from "./project.js";
7
5
  import { resetResultForClaim, scaffoldResult } from "./results.js";
8
- import { discardStaleExecWorktree } from "./worktree-ops.js";
9
- import { configuredProductRepos } from "./task-repos.js";
6
+ import { recordPathForRead, recordRef } from "./run-records.js";
10
7
  import { buildInitialStateFromStrategy } from "./schedule/initial.js";
8
+ import { buildScheduleIndex, computeCpm, exitWithCode, printValidateResult, validateAll, writeCpmFiles, writeGeneratedCore, writeScheduleHashAndDiff, } from "./schedule/schedule.js";
9
+ import { qualifyTaskId, requireNonEmpty } from "./shared.js";
11
10
  import { buildPhaseModeIndex, resolveApproach, resolveTaskExecution, resolveTaskMode, } from "./strategy.js";
11
+ import { configuredProductRepos } from "./task-repos.js";
12
+ import { discardStaleExecWorktree } from "./worktree-ops.js";
12
13
  export const KNOWN_OWNER_LABELS = ["PO", "PM", "BA", "ARC", "DEV", "QE", "UX", "OPS"];
13
14
  export const KNOWN_OWNER_LABELS_TEXT = KNOWN_OWNER_LABELS.join("|");
14
15
  const KNOWN_APPROACHES = [
15
16
  "draft",
16
17
  "fully-guided",
18
+ "condense",
17
19
  "recipe-guided",
18
20
  "freeform",
19
21
  "bootstrap",
@@ -58,6 +60,9 @@ export function addLockOptions(cmd) {
58
60
  export function addForceOption(cmd) {
59
61
  return cmd.option("--force", "Human actor only: override the guard on a task held by another actor", false);
60
62
  }
63
+ export function addTakeOverOption(cmd) {
64
+ return cmd.option("--take-over", "Human actor only: become the claim owner instead of keeping the current owner (e.g. an agent run)", false);
65
+ }
61
66
  export function addOwnerOptions(cmd) {
62
67
  return cmd
63
68
  .option("--owner <owner>", `Planned owner label for assignment checks (${KNOWN_OWNER_LABELS_TEXT}; defaults to SPECDOJO_OWNER, roster owner, or actor)`)
@@ -216,7 +221,11 @@ export async function scaffoldClaimResult(opts) {
216
221
  taskId: opts.taskId,
217
222
  mode,
218
223
  projectId: opts.projectId,
219
- ...(execution === "agent" ? { planRef: `exec/plans/${opts.taskId}-plan.md` } : {}),
224
+ ...(execution === "agent"
225
+ ? {
226
+ planRef: recordRef(opts.executionPath, recordPathForRead(opts.executionPath, "plan", opts.taskId)),
227
+ }
228
+ : {}),
220
229
  agent: opts.actor,
221
230
  startedAt: opts.startedAt,
222
231
  execution,
@@ -304,6 +313,9 @@ export async function runLockedEventCommand(opts, action) {
304
313
  event.meta.owner_override = true;
305
314
  }
306
315
  }
316
+ if (action.type === "unblock" && resolvedOpts.takeOver) {
317
+ event.meta = { ...(event.meta ?? {}), take_over: true };
318
+ }
307
319
  if (opts.dryRun) {
308
320
  process.stdout.write(`[dry-run] ${JSON.stringify(event, null, 2)}\n`);
309
321
  if (action.type === "release" && opts.resetWorktree) {