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,7 +1,21 @@
1
- import { existsSync, readdirSync } from "node:fs";
2
- import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
3
- import { loadPipelineResumeCheckpoint } from "./pipeline-state.js";
4
- import { safeSlug } from "./shared.js";
1
+ import { existsSync } from "node:fs";
2
+ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
3
+ import { integratedRepoNames, loadPipelineResumeCheckpoint, } from "./pipeline-state.js";
4
+ import { recordStem, resumeStatePaths, runEvidencePath, taskRecordPaths } from "./run-records.js";
5
+ // 統合の段が止まった run を executor へ戻せない理由を返す。統合が成功済み、または一部の
6
+ // リポジトリを統合済みの run を戻すと、統合済みの成果と食い違うため止める。
7
+ function integratedRunBlocker(state) {
8
+ const integrate = state.stages.integrate;
9
+ if (integrate?.status === "succeeded") {
10
+ return `cannot resume the executor after the integration of run ${state.run_id} succeeded`;
11
+ }
12
+ const integrated = [...integratedRepoNames(state)].sort();
13
+ if (integrated.length > 0) {
14
+ return (`cannot resume the executor from the integrate stage of run ${state.run_id}: ` +
15
+ `already integrated repositories: ${integrated.join(", ")}`);
16
+ }
17
+ return undefined;
18
+ }
5
19
  function executorResumeHandoff(evidence) {
6
20
  if (!evidence)
7
21
  return [];
@@ -23,22 +37,16 @@ function executorResumeHandoff(evidence) {
23
37
  }
24
38
  export function registerEvidenceDir(input) {
25
39
  const executionRel = relative(input.repoRoot, input.executionPath);
26
- return join(input.worktreePath, executionRel, "exec", "evidence", safeSlug(input.taskId));
40
+ return dirname(taskRecordPaths(join(input.worktreePath, executionRel), input.taskId).directory);
27
41
  }
28
42
  // worktree に残っている run ディレクトリを読み、pipeline-state.json を持つものを候補にする。
29
43
  // 壊れた state・別 task の state は loadPipelineResumeCheckpoint が弾くため、ここでは黙って
30
44
  // 候補から外す(再開可否の判定は selectResumableRegisterRun が理由つきで行う)。
31
45
  export function loadRegisterResumeCandidates(input) {
32
- const evidenceDir = registerEvidenceDir(input);
33
- if (!existsSync(evidenceDir))
34
- return [];
35
- const runIds = readdirSync(evidenceDir, { withFileTypes: true })
36
- .filter((entry) => entry.isDirectory())
37
- .map((entry) => entry.name)
38
- .sort();
46
+ const executionPath = join(input.worktreePath, relative(input.repoRoot, input.executionPath));
39
47
  const candidates = [];
40
- for (const runId of runIds) {
41
- const statePath = join(evidenceDir, runId, "pipeline-state.json");
48
+ for (const statePath of resumeStatePaths(executionPath, input.taskId)) {
49
+ const runId = basename(dirname(statePath));
42
50
  if (!existsSync(statePath))
43
51
  continue;
44
52
  const stateRef = relative(input.worktreePath, statePath).split(sep).join("/");
@@ -59,9 +67,7 @@ export function loadRegisterResumeCandidates(input) {
59
67
  ...(checkpoint.evidence
60
68
  ? {
61
69
  evidenceRef: checkpoint.state.stages.executor.artifact_ref ??
62
- relative(input.worktreePath, join(dirname(statePath), "evidence.json"))
63
- .split(sep)
64
- .join("/"),
70
+ relative(input.worktreePath, runEvidencePath(statePath)).split(sep).join("/"),
65
71
  }
66
72
  : {}),
67
73
  });
@@ -170,9 +176,18 @@ export function selectResumableRegisterRun(candidates, options = {}) {
170
176
  const inferredStage = latest.state.stages.reporter.status === "succeeded" ? "integrate" : "reporter";
171
177
  if (options.resumeFrom === "executor") {
172
178
  if (inferredStage !== "reporter") {
179
+ const blocker = options.allowFailedIntegration
180
+ ? integratedRunBlocker(latest.state)
181
+ : `cannot resume the executor from the ${inferredStage} stage of run ${latest.runId}`;
182
+ if (!blocker) {
183
+ const forcedChanges = initialChanges.length > 0
184
+ ? initialChanges
185
+ : (latest.evidence.attempt_changes ?? latest.evidence.changes).map((change) => change.path);
186
+ return { kind: "resumable", target: executorTarget(latest, forcedChanges) };
187
+ }
173
188
  return {
174
189
  kind: "not-resumable",
175
- reason: `cannot resume the executor from the ${inferredStage} stage of run ${latest.runId}`,
190
+ reason: blocker,
176
191
  };
177
192
  }
178
193
  const forcedChanges = initialChanges.length > 0
@@ -197,19 +212,38 @@ export function selectResumableRegisterRun(candidates, options = {}) {
197
212
  export function findResumableRegisterRun(input) {
198
213
  return selectResumableRegisterRun(loadRegisterResumeCandidates(input), input.resumeFrom ? { resumeFrom: input.resumeFrom } : {});
199
214
  }
200
- // plan / result のファイル名は `<pjr-id>-<UTC>-<rand>-(plan|result).md`(buildInPlaceStem)。
201
- // state に artifacts が無い旧 run のために、worktree の result 一覧から最新の stem を復元する。
202
- export function selectLatestRegisterResultStem(fileNames, pjrId) {
203
- const pattern = new RegExp(`^(${pjrId.toLowerCase()}-\\d{8}T\\d{6}Z-[0-9a-f]+)-result\\.md$`, "i");
204
- const stems = [];
205
- for (const name of fileNames) {
206
- const match = name.match(pattern);
207
- if (match)
208
- stems.push(match[1]);
215
+ // Schedule の明示的な executor 再開は、成功済み executor から reporter または統合の段へ進んだ run と、
216
+ // executor の報告が approach の必須項目を欠いて executor の段で止めた run(PJR-1GCD)に限る。
217
+ // 統合の段(commit・検査・merge)で止まった run も、どのリポジトリも統合していなければ
218
+ // worktree の成果を保ったまま executor へ戻す(PJR-ED0K)。run の選択・変更一覧・申し送りの
219
+ // 復元は register と同じ規則を使う。
220
+ export function selectScheduleExecutorResume(candidates) {
221
+ const lookup = selectResumableRegisterRun(candidates, {
222
+ resumeFrom: "executor",
223
+ allowFailedIntegration: true,
224
+ });
225
+ if (lookup.kind !== "resumable")
226
+ return lookup;
227
+ const { state } = lookup.target;
228
+ const candidate = candidates.find((entry) => entry.runId === lookup.target.runId && entry.stateRef === lookup.target.stateRef);
229
+ const evidence = candidate?.executorEvidence ?? candidate?.evidence;
230
+ const rejectedReport = state.stages.executor.status === "blocked" && evidence?.completion_status === "incomplete";
231
+ if (state.stages.executor.status !== "succeeded" && !rejectedReport) {
232
+ return {
233
+ kind: "not-resumable",
234
+ reason: `--resume-from executor requires a succeeded executor stage for run ${state.run_id} (status: ${state.stages.executor.status})`,
235
+ };
209
236
  }
210
- if (stems.length === 0)
211
- return null;
212
- return stems.sort()[stems.length - 1];
237
+ if (evidence?.stage.status !== "succeeded") {
238
+ return {
239
+ kind: "not-resumable",
240
+ reason: `succeeded executor evidence is missing or invalid for run ${state.run_id}`,
241
+ };
242
+ }
243
+ const blocker = integratedRunBlocker(state);
244
+ if (blocker)
245
+ return { kind: "not-resumable", reason: blocker };
246
+ return lookup;
213
247
  }
214
248
  // state はエージェントが書き込める worktree 内のファイルのため、参照が root の外へ出ないことを
215
249
  // 確認してから使う(絶対パスや `..` を含む参照は受け付けない)。
@@ -220,7 +254,7 @@ function isContainedRef(root, ref) {
220
254
  return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
221
255
  }
222
256
  // reporter 段の入力(plan と result)を state から復元する。state に artifacts がある場合は
223
- // それを正本とし、無い旧 run では worktree の result ファイル名から stem を復元する。
257
+ // それを正本とし、無い run では同じ run ディレクトリを参照する。
224
258
  export function resolveRegisterResumeArtifacts(input) {
225
259
  const executionRel = relative(input.repoRoot, input.executionPath).split(sep).join("/");
226
260
  const artifacts = input.state.artifacts;
@@ -229,18 +263,11 @@ export function resolveRegisterResumeArtifacts(input) {
229
263
  !isContainedRef(input.worktreePath, artifacts.result_ref)) {
230
264
  return null;
231
265
  }
232
- const stem = artifacts.result_ref.replace(/^.*\//, "").replace(/-result\.md$/, "");
266
+ const stem = recordStem(artifacts.result_ref);
233
267
  return { planRef: artifacts.plan_ref, resultRef: artifacts.result_ref, stem };
234
268
  }
235
- const resultsDir = join(input.worktreePath, executionRel, "exec", "results");
236
- if (!existsSync(resultsDir))
237
- return null;
238
- const stem = selectLatestRegisterResultStem(readdirSync(resultsDir), input.taskId);
239
- if (!stem)
269
+ const records = taskRecordPaths(executionRel, input.taskId, input.state.run_id);
270
+ if (!existsSync(join(input.worktreePath, records.result)))
240
271
  return null;
241
- return {
242
- planRef: `${executionRel}/exec/plans/${stem}-plan.md`,
243
- resultRef: `${executionRel}/exec/results/${stem}-result.md`,
244
- stem,
245
- };
272
+ return { planRef: records.plan, resultRef: records.result, stem: input.state.run_id };
246
273
  }
@@ -1,23 +1,24 @@
1
- import { readRegisterInput, registerInputSection } from "../register/input.js";
2
- import { resolveRegisterDeliverableTarget, } from "../register/deliverable-target.js";
3
1
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
- import { basename, extname, join, relative, resolve } from "node:path";
5
- import { findRegisterItem, loadRegisterItems, PJR_ID_RE, resolveRegisterPaths, TERMINAL_STATUSES_SET, VALID_PRIORITIES, VALID_STATUSES, VALID_TYPES, } from "../register/register.js";
6
- import { execTemplatePath, injectCommonConventions, MISSING, registerGradeFindingsText, } from "./plans.js";
7
- import { generateRegisterApproachPlan } from "./plans-generation.js";
8
- import { findUniqueDeliverableForKataTarget, findDeliverableByPath, resolveDeliverableByDocId, } from "./plans-core.js";
2
+ import { basename, dirname, extname, join, relative, resolve } from "node:path";
9
3
  import { collectDocIndexEntries } from "../docs/doc-index.js";
10
- import { loadRulebookRefs, resolveKataRefs } from "../kata/kata.js";
4
+ import { buildSpecdojoFrontmatter } from "../docs/frontmatter-namespace.js";
11
5
  import { authoredKataPath, authoringKind, authoringStandardId, authoringStandardPath, } from "../kata/authoring.js";
6
+ import { loadRulebookRefs, resolveKataRefs } from "../kata/kata.js";
12
7
  import { validateRegisterApproachTargets } from "../register/approach.js";
13
- import { buildSpecdojoFrontmatter } from "../docs/frontmatter-namespace.js";
14
- import { escapeMarkdownInline, expandTemplate, inlineCodeAnglePlaceholders, stripTerminalControlSequences, } from "./shared.js";
15
- import { formatMarkdownFile } from "./format.js";
16
- import { loadConfig, specdojoRootDir } from "../shared/specdojo-config.js";
17
8
  import { resolveAuthoringSources, } from "../register/authoring-sources.js";
18
- import { repoEnvironmentVariableName } from "./task-repos.js";
9
+ import { resolveRegisterDeliverableTarget, } from "../register/deliverable-target.js";
10
+ import { readRegisterInput, registerInputSection } from "../register/input.js";
19
11
  import { isPlanningApproach } from "../register/planning.js";
12
+ import { findRegisterItem, loadRegisterItems, PJR_ID_RE, resolveRegisterPaths, TERMINAL_STATUSES_SET, VALID_PRIORITIES, VALID_STATUSES, VALID_TYPES, } from "../register/register.js";
13
+ import { loadConfig, specdojoRootDir } from "../shared/specdojo-config.js";
14
+ import { formatMarkdownFile } from "./format.js";
15
+ import { findDeliverableByPath, findUniqueDeliverableForKataTarget, resolveDeliverableByDocId, } from "./plans-core.js";
16
+ import { generateRegisterApproachPlan } from "./plans-generation.js";
20
17
  import { planningPlanFields } from "./plans-planning.js";
18
+ import { execTemplatePath, injectCommonConventions, MISSING, registerGradeFindingsText, } from "./plans.js";
19
+ import { taskRecordPaths } from "./run-records.js";
20
+ import { escapeMarkdownInline, expandTemplate, inlineCodeAnglePlaceholders, stripTerminalControlSequences, } from "./shared.js";
21
+ import { repoEnvironmentVariableName } from "./task-repos.js";
21
22
  const EDIT_TYPES = new Set(["todo", "issue", "change-request"]);
22
23
  const INVESTIGATE_TYPES = new Set(["question", "risk"]);
23
24
  export function registerItemCategory(itemType) {
@@ -99,6 +100,8 @@ export function formatRegisterRunSummary(summaries) {
99
100
  `transition=${summary.transition}`,
100
101
  `commit=${summary.commit}`,
101
102
  ];
103
+ if (summary.uncommittedFiles)
104
+ parts.push(`uncommitted=${summary.uncommittedFiles}`);
102
105
  if (summary.reason)
103
106
  parts.push(`reason=${summary.reason}`);
104
107
  lines.push(parts.join(" "));
@@ -206,14 +209,12 @@ export function ticketPathFromItem(item, projectRegisterPath) {
206
209
  // 制御文字を除去する(lefthook 等の色付き出力が結論列を破壊するのを防ぐ)。そのうえで
207
210
  // セル内の `|` と改行は表を壊すため置換し、読みやすさのため長さも制限する。
208
211
  const MAX_CONCLUSION_LENGTH = 200;
209
- export function sanitizeRegisterConclusion(reason) {
212
+ export function sanitizeRegisterConclusion(reason, maxLength = MAX_CONCLUSION_LENGTH) {
210
213
  const singleLine = stripTerminalControlSequences(reason)
211
214
  .replace(/\r?\n/g, " ")
212
215
  .replace(/\|/g, "/")
213
216
  .trim();
214
- const truncated = singleLine.length <= MAX_CONCLUSION_LENGTH
215
- ? singleLine
216
- : `${singleLine.slice(0, MAX_CONCLUSION_LENGTH)}…`;
217
+ const truncated = singleLine.length <= maxLength ? singleLine : `${singleLine.slice(0, maxLength)}…`;
217
218
  return inlineCodeAnglePlaceholders(truncated);
218
219
  }
219
220
  // ---------------------------------------------------------------------------
@@ -530,10 +531,10 @@ export async function generateRegisterPlan(opts) {
530
531
  throw new Error(`Template not found: ${templatePath}`);
531
532
  }
532
533
  const template = readFileSync(templatePath, "utf8");
533
- const plansDir = join(opts.executionPath, "exec", "plans");
534
- mkdirSync(plansDir, { recursive: true });
535
- const planPath = opts.outPath ?? join(plansDir, `${opts.stem}-plan.md`);
536
- const resultRef = `${repoRelativePath(opts.executionPath)}/exec/results/${opts.stem}-result.md`;
534
+ const records = taskRecordPaths(opts.executionPath, item.id, opts.stem, "register");
535
+ const planPath = opts.outPath ?? records.plan;
536
+ mkdirSync(dirname(planPath), { recursive: true });
537
+ const resultRef = repoRelativePath(records.result);
537
538
  const values = {
538
539
  _FRONTMATTER_: registerPlanFrontmatter(opts.projectId, opts.stem, item),
539
540
  _PJR_ID_: item.id,
@@ -558,7 +559,10 @@ export async function generateRegisterPlan(opts) {
558
559
  // expandTemplate がまとめる(PJR-283N)。
559
560
  const body = expandTemplate(template, values);
560
561
  // register 項目は対象成果物の schema を特定できないため、schema 検査の項目は落とす。
561
- const content = injectCommonConventions(body, MISSING, new Map());
562
+ const content = injectCommonConventions(body, MISSING, new Map(), "edit", {
563
+ executionPath: opts.executionPath,
564
+ planPath,
565
+ });
562
566
  writeFileSync(planPath, content, "utf8");
563
567
  await formatMarkdownFile(planPath);
564
568
  return { planPath, category };
@@ -95,7 +95,8 @@ function restoreOriginalWorktree(params) {
95
95
  * Merge `target` into the branch checked out at `cwd` (an exec worktree) with a merge commit.
96
96
  * Uncommitted changes (including untracked files) are stashed before the merge and restored
97
97
  * without restoring the old index. Conflicts on `theirsPaths` (repository-relative) take the
98
- * target side. Any other committed conflict aborts the merge. If restoring the stash conflicts,
98
+ * target side and conflicts on `oursPaths` keep the exec branch side. Any other committed conflict
99
+ * aborts the merge. If restoring the stash conflicts,
99
100
  * the merge commit is rolled back and the executor changes are restored on the original HEAD.
100
101
  */
101
102
  export function syncWorktreeWithIntegrationTarget(params) {
@@ -124,13 +125,15 @@ export function syncWorktreeWithIntegrationTarget(params) {
124
125
  try {
125
126
  const conflicted = zeroSeparated(cwd, ["diff", "--name-only", "--diff-filter=U", "-z"]);
126
127
  const theirs = new Set(params.theirsPaths ?? []);
127
- const unexpected = conflicted.filter((path) => !theirs.has(path));
128
+ const ours = new Set(params.oursPaths ?? []);
129
+ const unexpected = conflicted.filter((path) => !theirs.has(path) && !ours.has(path));
128
130
  if (unexpected.length > 0) {
129
131
  throw new Error(`${repo}: merge conflicts with ${target}: ${unexpected.join(", ")}`);
130
132
  }
131
133
  for (const path of conflicted) {
132
- if (hasPathAt(cwd, target, path)) {
133
- gitOutput(cwd, ["checkout", target, "--", path]);
134
+ const side = theirs.has(path) ? target : "HEAD";
135
+ if (hasPathAt(cwd, side, path)) {
136
+ gitOutput(cwd, ["checkout", side, "--", path]);
134
137
  gitOutput(cwd, ["add", "--", path]);
135
138
  }
136
139
  else {
@@ -270,6 +273,7 @@ export function syncTaskWorktreesWithIntegrationTargets(params) {
270
273
  target: params.projectTarget,
271
274
  message: params.message,
272
275
  theirsPaths: params.projectTheirsPaths,
276
+ oursPaths: params.projectOursPaths,
273
277
  }));
274
278
  return synced;
275
279
  }
@@ -3,9 +3,10 @@ import { appendFileSync, existsSync, mkdirSync } from "node:fs";
3
3
  import { dirname, resolve } from "node:path";
4
4
  import { acquireSchedulerLock, releaseSchedulerLock } from "./events.js";
5
5
  import { productIntegrationTarget } from "./task-repos.js";
6
- import { abortMerge, commitTargetPaths, isExecBranchMergedIntoCurrent, recordRootNewFilesHandoff, REGISTER_NEW_FILE_DIR_PREFIXES, repoRelative, stabilizeCommitTargets, stageCommitTargets, worktreeStatusPaths, } from "./worktree-ops.js";
6
+ import { abortMerge, assertCommitScope, UncommittedChangesError, commitTargetPaths, isExecBranchMergedIntoCurrent, recordRootNewFilesHandoff, REGISTER_NEW_FILE_DIR_PREFIXES, repoRelative, stabilizeCommitTargets, stageCommitTargets, worktreeStatusPaths, } from "./worktree-ops.js";
7
7
  import { appendGitFailureLog, appendGitResultFailureLog, formatGitResultFailure, gitOutput, gitResult, listRegisteredWorktrees, summarizeGitHookFailure, } from "./worktree.js";
8
8
  import { resolveRepoQualifiedRef } from "../shared/specdojo-config.js";
9
+ import { stagedMergeBlocker } from "../shared/git.js";
9
10
  import { PROJECT_REPO_NAME, branchExists, dirtyPaths, gitText, mergeInProgress, zeroSeparated, } from "./repo-integration-git.js";
10
11
  export { PROJECT_REPO_NAME } from "./repo-integration-git.js";
11
12
  // PJR-0WAA: 1 つのタスクがプロジェクトリポジトリと宣言済みのプロダクトリポジトリ(`repos`)を
@@ -282,6 +283,9 @@ export function productMergeBlockers(product) {
282
283
  }
283
284
  const checkout = checkoutOfBranch(product.repoRoot, target);
284
285
  if (checkout) {
286
+ const stagedBlocker = stagedMergeBlocker(checkout);
287
+ if (stagedBlocker)
288
+ blockers.push(block(stagedBlocker));
285
289
  if (mergeInProgress(checkout)) {
286
290
  blockers.push(block(`a merge is in progress in ${checkout}`));
287
291
  }
@@ -304,6 +308,14 @@ export function projectMergeBlockers(params) {
304
308
  const { context, worktree } = params;
305
309
  const repoRoot = context.repoRoot;
306
310
  const block = (message) => ({ repo: PROJECT_REPO_NAME, message });
311
+ try {
312
+ assertCommitScope(context, worktree, params.taskId);
313
+ }
314
+ catch (error) {
315
+ if (error instanceof UncommittedChangesError)
316
+ return [block(error.message)];
317
+ throw error;
318
+ }
307
319
  if (isExecBranchMergedIntoCurrent({ context, worktree }))
308
320
  return [];
309
321
  const target = gitText(gitResult(repoRoot, ["branch", "--show-current"]).stdout).trim();
@@ -315,6 +327,9 @@ export function projectMergeBlockers(params) {
315
327
  if (mergeInProgress(repoRoot))
316
328
  return [block(`a merge is in progress in ${repoRoot}`)];
317
329
  const blockers = [];
330
+ const stagedBlocker = stagedMergeBlocker(repoRoot);
331
+ if (stagedBlocker)
332
+ blockers.push(block(stagedBlocker));
318
333
  const uncommitted = commitTargetPaths(context, worktree, params.taskId);
319
334
  if (uncommitted.length > 0) {
320
335
  blockers.push(block(`uncommitted commit-target changes: ${uncommitted.join(", ")}`));
@@ -351,6 +366,11 @@ export function mergeProductIntoTarget(params) {
351
366
  const { product, message } = params;
352
367
  const target = productIntegrationTarget(product);
353
368
  const checkout = checkoutOfBranch(product.repoRoot, target);
369
+ if (checkout) {
370
+ const stagedBlocker = stagedMergeBlocker(checkout);
371
+ if (stagedBlocker)
372
+ throw new Error(stagedBlocker);
373
+ }
354
374
  const header = `=== ${new Date().toISOString()} ${product.name}: merge ${product.branch} into ${target} ===`;
355
375
  if (product.integrationStrategy === "ff") {
356
376
  const parent = gitOutput(product.repoRoot, ["rev-parse", `refs/heads/${target}`]).trim();
@@ -1,9 +1,10 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
2
  import { join, relative, resolve, sep } from "node:path";
3
- import { executorCompletionFailure } from "./evidence.js";
4
- import { PARENT_VALIDATION_PROJECT_REPO, failedParentValidationReason, } from "./parent-validation.js";
5
3
  import { getProjectExecutionPath, resolveRepoRoot, specdojoRootDir, } from "../shared/specdojo-config.js";
4
+ import { executorCompletionFailure } from "./evidence.js";
5
+ import { PARENT_VALIDATION_PROJECT_REPO, failedParentValidationReason, isAggregatedParentValidationSatisfied, } from "./parent-validation.js";
6
6
  import { MAX_TEXT_LENGTH, parseReporterOutput, reporterOutputSchemaForMode, } from "./reporter-output.js";
7
+ import { isRunRecordPath, runnerRecordPrefixes } from "./run-records.js";
7
8
  import { repoEnvironmentVariableName } from "./task-repos.js";
8
9
  export { REPORTER_OUTPUT_SCHEMA, REVIEW_VERDICTS, parseReporterOutput, reporterOutputSchemaForMode, } from "./reporter-output.js";
9
10
  const REPORTER_FORMAT_ATTEMPTS = 3;
@@ -41,6 +42,7 @@ function isRunnerManagedChangePath(path, scope) {
41
42
  const execRoot = repoRelativePath(scope.repoRoot, join(scope.executionPath, "exec"));
42
43
  const managedRoots = [
43
44
  execRoot,
45
+ ...runnerRecordPrefixes(repoRelativePath(scope.repoRoot, scope.executionPath)).map((path) => path.replace(/\/$/u, "")),
44
46
  ...(scope.registerPaths ?? []).map((path) => repoRelativePath(scope.repoRoot, path)),
45
47
  ];
46
48
  const resultPath = scope.resultPath
@@ -69,10 +71,15 @@ export function evidenceForReporter(evidence, scope) {
69
71
  const projectId = scope.projectId ??
70
72
  factOptions.projectId ??
71
73
  projectIdForExecutionPath(config, scope.repoRoot, scope.executionPath);
74
+ const resultPath = scope.resultPath
75
+ ? repoRelativePath(scope.worktreePath, scope.resultPath)
76
+ : undefined;
77
+ const executorAttemptPaths = factOptions.executorAttemptPaths ?? executorAttemptPathsForEvidence(evidence, resultPath);
72
78
  const scopedFactOptions = {
73
79
  ...factOptions,
74
80
  ...(projectId ? { projectId } : {}),
75
81
  changedPaths: changes.map((change) => change.path),
82
+ ...(executorAttemptPaths ? { executorAttemptPaths } : {}),
76
83
  };
77
84
  const mechanicallyNotApplicable = evidence.validations.flatMap((validation) => {
78
85
  if (validation.source === "runner" || validation.status !== "not_run")
@@ -143,6 +150,7 @@ export function deriveReporterFacts(evidence, options = {}) {
143
150
  const packageDependencies = options.packageDependencies ?? defaultPackageDependencies();
144
151
  const specdojoConfig = options.specdojoConfig === undefined ? defaultSpecdojoConfig() : options.specdojoConfig;
145
152
  const projectId = options.projectId ?? evidence.runner_scope?.project_id;
153
+ const executorAttemptPaths = options.executorAttemptPaths ?? executorAttemptPathsForEvidence(evidence);
146
154
  const applicabilityOptions = {
147
155
  packageScripts,
148
156
  packageDependencies,
@@ -152,6 +160,7 @@ export function deriveReporterFacts(evidence, options = {}) {
152
160
  ? { productPackageManifests: options.productPackageManifests }
153
161
  : {}),
154
162
  changedPaths: options.changedPaths ?? evidence.changes.map((change) => change.path),
163
+ ...(executorAttemptPaths ? { executorAttemptPaths } : {}),
155
164
  };
156
165
  const passedCommandsByRepo = new Map();
157
166
  const runnerPassedCommandsByRepo = new Map();
@@ -165,6 +174,11 @@ export function deriveReporterFacts(evidence, options = {}) {
165
174
  // 親検証の結果を正として満たされたものと扱う。executor の failed は runner の結果で
166
175
  // 打ち消さない(PJR-2GZE、PJR-7AW0)。
167
176
  for (const validation of evidence.validations) {
177
+ // runner が変更の種類で流さなかった検証(PJR-T01P)も、委譲先として済んだものと扱う。
178
+ if (validation.source === "runner" && validation.status === "not_applicable") {
179
+ addPassedCommand(runnerPassedCommandsByRepo, validation.repo ?? PARENT_VALIDATION_PROJECT_REPO, normalizeValidationCommand(validation.command));
180
+ continue;
181
+ }
168
182
  if (validation.status !== "passed")
169
183
  continue;
170
184
  if (validation.source === "runner") {
@@ -224,6 +238,11 @@ export function deriveReporterFacts(evidence, options = {}) {
224
238
  isPassedParentValidation(validation.command)) {
225
239
  return false;
226
240
  }
241
+ // 親検証をまとめて書いた 1 行は、挙がった検証がすべて親 runner で通っていれば満たす(PJR-Q2AT)。
242
+ if ((validation.status === "not_run" || validation.status === "not_applicable") &&
243
+ isAggregatedParentValidationSatisfied(validation.command, evidence.validations)) {
244
+ return false;
245
+ }
227
246
  if (validation.status === "not_applicable") {
228
247
  return !isValidNotApplicableValidation(validation.command, validation.reason, applicabilityOptions);
229
248
  }
@@ -288,6 +307,34 @@ function specdojoCommandArgs(command) {
288
307
  return (/^(?:npx\s+)?specdojo\s+(.+)$/u.exec(normalized)?.[1] ??
289
308
  /^(?:(?:node --import tsx|npx tsx|tsx)\s+(?:\.\/)?src\/specdojo\.ts|node\s+(?:\.\/)?dist\/specdojo\.js)\s+(.+)$/u.exec(normalized)?.[1]);
290
309
  }
310
+ function catalogValidateCommandArgs(command, scripts) {
311
+ const normalized = normalizeValidationCommand(command);
312
+ const direct = specdojoCommandArgs(normalized);
313
+ if (direct !== undefined && /^catalog\s+validate(?:\s|$)/u.test(direct)) {
314
+ return direct;
315
+ }
316
+ const helperMatch = /^node\s+(?:--import\s+tsx\s+)?(?:\.\/)?tools\/catalog-validate-if-configured\.mjs(?:\s+(.*))?$/u.exec(normalized);
317
+ if (helperMatch) {
318
+ return `catalog validate${helperMatch[1] ? ` ${helperMatch[1]}` : ""}`;
319
+ }
320
+ const scriptMatch = /^npm run ([A-Za-z0-9:_.-]+)(?:\s+(.*))?$/u.exec(normalized);
321
+ if (!scriptMatch)
322
+ return undefined;
323
+ const [, scriptName, rest] = scriptMatch;
324
+ if (!scriptName || (scripts !== undefined && !hasApplicableScript(scripts, scriptName))) {
325
+ return undefined;
326
+ }
327
+ const suffix = rest ? ` ${rest.replace(/^--\s*/u, "")}` : "";
328
+ if (scriptName === "validate:catalog") {
329
+ return `catalog validate${suffix}`;
330
+ }
331
+ const body = scripts?.[scriptName];
332
+ const bodyArgs = body ? specdojoCommandArgs(body) : undefined;
333
+ if (bodyArgs !== undefined && /^catalog\s+validate(?:\s|$)/u.test(bodyArgs)) {
334
+ return `${bodyArgs}${suffix}`;
335
+ }
336
+ return undefined;
337
+ }
291
338
  /**
292
339
  * Returns why a validation is owned by the runner rather than the executor. `specdojo index build`
293
340
  * writes `.specdojo/doc-index.json`, which agents may not write; the runner regenerates the index
@@ -301,12 +348,45 @@ export function runnerOwnedValidationReason(command) {
301
348
  return "index は runner が worktree の準備と統合の前に再生成する";
302
349
  }
303
350
  const PROJECT_DOCUMENTS_ROOT = "docs/ja/projects/";
351
+ const RUNNER_MANAGED_EXEC_RECORD_PATTERN = /(?:^|\/)exec\/(?:plans|results|evidence|events|\.locks)\//u;
352
+ const EXECUTOR_EDITABLE_EXEC_HISTORY_PATTERN = /(?:^|\/)exec\/(?:plans|results)\/.+\.md$/u;
353
+ function executorAttemptPathsForEvidence(evidence, resultPath) {
354
+ const entries = [
355
+ ...(evidence.attempt_changes ?? []),
356
+ ...(evidence.runner_context?.runner_managed_attempt_changes ?? []),
357
+ ];
358
+ if (entries.length === 0)
359
+ return undefined;
360
+ return new Set(entries
361
+ .flatMap((change) => changedPathSides(change.path))
362
+ .filter((path) => path !== resultPath));
363
+ }
364
+ function isRunnerManagedExecRecordPath(path, executorAttemptPaths) {
365
+ const normalized = path.replaceAll("\\", "/").replace(/^\.\//u, "");
366
+ if (!RUNNER_MANAGED_EXEC_RECORD_PATTERN.test(normalized) && !isRunRecordPath(normalized))
367
+ return false;
368
+ if (executorAttemptPaths?.has(normalized) &&
369
+ (EXECUTOR_EDITABLE_EXEC_HISTORY_PATTERN.test(normalized) ||
370
+ (isRunRecordPath(normalized) && /\/(plan|result)\.md$/u.test(normalized)))) {
371
+ return false;
372
+ }
373
+ return true;
374
+ }
375
+ function isHistoryLinkTargetPath(path) {
376
+ const normalized = path.replaceAll("\\", "/").replace(/^\.\//u, "");
377
+ if (normalized === "pjr-index.md" || normalized.endsWith("/pjr-index.md")) {
378
+ return false;
379
+ }
380
+ return (/(?:^|\/)pjr-[^/]+\.md$/u.test(normalized) ||
381
+ /^docs\/ja\/projects\/.+\/exec\/(?:plans|results)\/.+\.md$/u.test(normalized) ||
382
+ (isRunRecordPath(normalized) && /\/(plan|result)\.md$/u.test(normalized)));
383
+ }
304
384
  const hasExtension = (extensions) => (path) => {
305
385
  const normalized = path.toLowerCase();
306
386
  return extensions.some((extension) => normalized.endsWith(extension));
307
387
  };
308
388
  // The command-to-change mapping is kept in one place and mirrors the change-type rows in
309
- // xep-common-conventions-template.md. Checks such as typecheck intentionally remain outside this
389
+ // xp-common-conventions-template.md. Checks such as typecheck intentionally remain outside this
310
390
  // table: PJR-8WBN requires their existing script-based applicability to stay unchanged.
311
391
  const CHANGE_SCOPED_VALIDATIONS = [
312
392
  {
@@ -326,13 +406,25 @@ const CHANGE_SCOPED_VALIDATIONS = [
326
406
  /^node\s+\S*specdojo-docs-lint\.js\s+markdownlint(?:\s|$)/u.test(command),
327
407
  matchesPath: hasExtension([".md"]),
328
408
  },
409
+ {
410
+ pathCondition: "履歴蓄積ファイル(pjr-*.md など、pjr-index.md と runner が書く plan・result を除く)",
411
+ matchesCommand: (command) => /^npm run validate:history-links(?:\s|$)/u.test(command) ||
412
+ /^(?:npx\s+)?specdojo-docs-lint\s+history-links(?:\s|$)/u.test(command) ||
413
+ /^node\s+\S*specdojo-docs-lint\.js\s+history-links(?:\s|$)/u.test(command),
414
+ matchesPath: isHistoryLinkTargetPath,
415
+ },
329
416
  ];
330
417
  function changedPathSides(path) {
331
418
  return path.split(" -> ").map((side) => side.replaceAll("\\", "/").replace(/^\.\//u, ""));
332
419
  }
333
- function changePathsForCommand(changedPaths, repoName, config, projectId) {
420
+ function deliverableChangedPathSides(changedPaths, executorAttemptPaths) {
421
+ return changedPaths
422
+ .flatMap(changedPathSides)
423
+ .filter((path) => !isRunnerManagedExecRecordPath(path, executorAttemptPaths));
424
+ }
425
+ function changePathsForCommand(changedPaths, repoName, config, projectId, executorAttemptPaths) {
334
426
  const repoNames = declaredRepos(config, projectId).map((repo) => repo.name);
335
- return changedPaths.flatMap(changedPathSides).flatMap((path) => {
427
+ return deliverableChangedPathSides(changedPaths, executorAttemptPaths).flatMap((path) => {
336
428
  if (repoName !== undefined) {
337
429
  const prefix = `${repoName}:`;
338
430
  return path.startsWith(prefix) ? [path.slice(prefix.length)] : [];
@@ -340,13 +432,13 @@ function changePathsForCommand(changedPaths, repoName, config, projectId) {
340
432
  return repoNames.some((name) => path.startsWith(`${name}:`)) ? [] : [path];
341
433
  });
342
434
  }
343
- function changeScopedValidationApplicability(command, changedPaths, repoName, config, projectId) {
435
+ function changeScopedValidationApplicability(command, changedPaths, repoName, config, projectId, executorAttemptPaths) {
344
436
  const validation = CHANGE_SCOPED_VALIDATIONS.find(({ matchesCommand }) => matchesCommand(command));
345
437
  if (!validation)
346
438
  return { recognized: false };
347
439
  if (changedPaths === undefined)
348
440
  return { recognized: true };
349
- const relevantPaths = changePathsForCommand(changedPaths, repoName, config, projectId);
441
+ const relevantPaths = changePathsForCommand(changedPaths, repoName, config, projectId, executorAttemptPaths);
350
442
  return relevantPaths.some(validation.matchesPath)
351
443
  ? { recognized: true, applicable: true }
352
444
  : {
@@ -355,19 +447,19 @@ function changeScopedValidationApplicability(command, changedPaths, repoName, co
355
447
  reason: `変更に ${validation.pathCondition} がない`,
356
448
  };
357
449
  }
358
- function changesReachProjectDocuments(changedPaths) {
359
- return changedPaths
360
- .flatMap((path) => path.split(" -> "))
361
- .some((path) => path.replaceAll("\\", "/").replace(/^\.\//u, "").startsWith(PROJECT_DOCUMENTS_ROOT));
450
+ function changesReachProjectDocuments(changedPaths, executorAttemptPaths) {
451
+ return deliverableChangedPathSides(changedPaths, executorAttemptPaths).some((path) => path.startsWith(PROJECT_DOCUMENTS_ROOT));
362
452
  }
363
453
  function projectOptionOf(args) {
364
454
  return /(?:^|\s)--project(?:=|\s+)([A-Za-z0-9_-]+)(?=\s|$)/u.exec(args)?.[1];
365
455
  }
366
- function specdojoCommandApplicability(command, config, runProjectId, changedPaths) {
367
- const args = specdojoCommandArgs(command);
368
- if (args === undefined)
456
+ function specdojoCommandApplicability(command, config, runProjectId, changedPaths, scripts, executorAttemptPaths) {
457
+ const directArgs = specdojoCommandArgs(command);
458
+ const catalogArgs = catalogValidateCommandArgs(command, scripts);
459
+ if (directArgs === undefined && catalogArgs === undefined)
369
460
  return { recognized: false };
370
- if (!/^catalog\s+validate(?:\s|$)/u.test(args)) {
461
+ const args = catalogArgs ?? directArgs;
462
+ if (args === undefined || !/^catalog\s+validate(?:\s|$)/u.test(args)) {
371
463
  return { recognized: true, applicable: undefined };
372
464
  }
373
465
  const configuredProjectId = config?.current_project;
@@ -381,8 +473,10 @@ function specdojoCommandApplicability(command, config, runProjectId, changedPath
381
473
  return { recognized: true, applicable: undefined };
382
474
  }
383
475
  if (typeof project.catalog_path === "string" && project.catalog_path.trim()) {
384
- // plan の共通規約は catalog validate を docs/ja/projects/ 配下の変更に限って求める。
385
- if (changedPaths !== undefined && !changesReachProjectDocuments(changedPaths)) {
476
+ // plan の共通規約は catalog validate を docs/ja/projects/ 配下の変更(runner が書く
477
+ // exec/ 配下の plan・result などを除く)に限って求める。
478
+ if (changedPaths !== undefined &&
479
+ !changesReachProjectDocuments(changedPaths, executorAttemptPaths)) {
386
480
  return {
387
481
  recognized: true,
388
482
  applicable: false,
@@ -407,12 +501,12 @@ function specdojoCommandApplicability(command, config, runProjectId, changedPath
407
501
  export function mechanicallyNotApplicableReason(command, options = {}) {
408
502
  const normalized = normalizeValidationCommand(command);
409
503
  const config = options.specdojoConfig === undefined ? defaultSpecdojoConfig() : options.specdojoConfig;
410
- const specdojo = specdojoCommandApplicability(normalized, config, options.projectId, options.changedPaths);
504
+ const manifest = commandManifest(normalized, options, config);
505
+ const specdojo = specdojoCommandApplicability(manifest.command, config, options.projectId, options.changedPaths, manifest.scripts, options.executorAttemptPaths);
411
506
  if (specdojo.recognized) {
412
507
  return specdojo.applicable === false ? specdojo.reason : undefined;
413
508
  }
414
- const manifest = commandManifest(normalized, options, config);
415
- const changeScoped = changeScopedValidationApplicability(manifest.command, options.changedPaths, manifest.repoName, config, options.projectId);
509
+ const changeScoped = changeScopedValidationApplicability(manifest.command, options.changedPaths, manifest.repoName, config, options.projectId, options.executorAttemptPaths);
416
510
  if (changeScoped.applicable === false)
417
511
  return changeScoped.reason;
418
512
  const packageJson = manifest.repoName === undefined ? "package.json" : `${manifest.repoName} の package.json`;
@@ -433,13 +527,17 @@ function isValidNotApplicableValidation(command, reason, options) {
433
527
  return false;
434
528
  const normalized = normalizeValidationCommand(command);
435
529
  const config = options.specdojoConfig === undefined ? defaultSpecdojoConfig() : options.specdojoConfig;
436
- const specdojo = specdojoCommandApplicability(normalized, config, options.projectId, options.changedPaths);
530
+ const manifest = commandManifest(normalized, options, config);
531
+ const specdojo = specdojoCommandApplicability(manifest.command, config, options.projectId, options.changedPaths, manifest.scripts, options.executorAttemptPaths);
437
532
  if (specdojo.recognized)
438
533
  return specdojo.applicable !== true;
439
- const manifest = commandManifest(normalized, options, config);
440
- const changeScoped = changeScopedValidationApplicability(manifest.command, options.changedPaths, manifest.repoName, config, options.projectId);
534
+ const changeScoped = changeScopedValidationApplicability(manifest.command, options.changedPaths, manifest.repoName, config, options.projectId, options.executorAttemptPaths);
441
535
  if (changeScoped.applicable === false)
442
536
  return true;
537
+ if (changeScoped.applicable === true &&
538
+ /^node\s+\S*specdojo-docs-lint\.js\s+(?:history-links|markdownlint)(?:\s|$)/u.test(manifest.command)) {
539
+ return false;
540
+ }
443
541
  const scriptName = invokedScriptNameOf(manifest.command);
444
542
  if (scriptName !== undefined && hasApplicableScript(manifest.scripts, scriptName))
445
543
  return false;