specdojo 0.4.6 → 0.5.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 (310) hide show
  1. package/.github/agents/specdojo-orchestrator.md +14 -9
  2. package/CHANGELOG.md +62 -0
  3. package/dist/catalog/document-target.js +75 -0
  4. package/dist/commands/agent.js +2 -80
  5. package/dist/commands/init.js +3 -0
  6. package/dist/commands/night-orchestrator.js +33 -4
  7. package/dist/dashboard/dashboard.js +5 -6
  8. package/dist/dashboard/timeline-build.js +5 -1
  9. package/dist/dashboard/timeline.js +6 -3
  10. package/dist/docs/yaml-pages.js +17 -17
  11. package/dist/exec/agent-config.js +28 -16
  12. package/dist/exec/agent-plan.js +108 -0
  13. package/dist/exec/commands.js +3 -3
  14. package/dist/exec/core.js +2 -0
  15. package/dist/exec/grade-checkpoint.js +12 -0
  16. package/dist/exec/pipeline-state.js +5 -2
  17. package/dist/exec/plans-core.js +7 -67
  18. package/dist/exec/plans-generation.js +28 -7
  19. package/dist/exec/plans-grade-findings.js +16 -0
  20. package/dist/exec/plans-planning.js +43 -0
  21. package/dist/exec/plans-storage.js +5 -2
  22. package/dist/exec/project.js +4 -1
  23. package/dist/exec/register.js +82 -6
  24. package/dist/exec/repo-integration-sync.js +9 -0
  25. package/dist/exec/repo-integration.js +17 -2
  26. package/dist/exec/repo-trace.js +17 -4
  27. package/dist/exec/results.js +2 -0
  28. package/dist/exec/run/lifecycle-commands.js +2 -0
  29. package/dist/exec/run/register-core.js +11 -0
  30. package/dist/exec/run/register-mode.js +19 -1
  31. package/dist/exec/run/register-resume.js +23 -0
  32. package/dist/exec/run/register-state.js +4 -1
  33. package/dist/exec/run/register-worktree.js +28 -1
  34. package/dist/exec/run/schedule-prepare.js +7 -1
  35. package/dist/exec/strategy.js +2 -0
  36. package/dist/exec/task-repos.js +18 -4
  37. package/dist/exec/worktree-command.js +8 -1
  38. package/dist/exec/worktree-ops-commit.js +7 -1
  39. package/dist/exec/worktree-ops-merge.js +40 -1
  40. package/dist/grade/apply.js +13 -7
  41. package/dist/grade/command-inspect.js +2 -1
  42. package/dist/grade/command-run.js +39 -0
  43. package/dist/grade/grade.js +3 -1
  44. package/dist/grade/markdown.js +11 -6
  45. package/dist/grade/pipeline-state.js +8 -6
  46. package/dist/grade/plan.js +14 -10
  47. package/dist/grade/run.js +307 -0
  48. package/dist/grade/target-discovery.js +1 -1
  49. package/dist/grade/targets.js +44 -22
  50. package/dist/register/approach.js +35 -0
  51. package/dist/register/catalog-status.js +49 -0
  52. package/dist/register/core.js +5 -0
  53. package/dist/register/create-commands.js +83 -5
  54. package/dist/register/deliverable-target.js +215 -0
  55. package/dist/register/dependency.js +123 -0
  56. package/dist/register/derivation.js +2 -2
  57. package/dist/register/epic.js +42 -0
  58. package/dist/register/event-merge.js +5 -2
  59. package/dist/register/events.js +8 -0
  60. package/dist/register/external-project.js +4 -0
  61. package/dist/register/item.js +18 -0
  62. package/dist/register/maintenance-commands.js +7 -1
  63. package/dist/register/planning.js +37 -0
  64. package/dist/register/register.js +5 -1
  65. package/dist/register/renumber.js +12 -4
  66. package/dist/register/views.js +55 -4
  67. package/dist/review/grade.js +19 -17
  68. package/dist/schedule/schedule.js +3 -1
  69. package/dist/schedule/strategy-generate-scope.js +5 -1
  70. package/dist/schedule/strategy-generate.js +1 -0
  71. package/dist/schedule/strategy-profiles.js +1 -1
  72. package/dist/shared/agent-plan.js +1 -0
  73. package/dist/shared/agent-types.js +3 -0
  74. package/dist/shared/grade-result.js +23 -5
  75. package/dist/shared/markdownlint-config.js +38 -0
  76. package/dist/shared/markdownlint-scaffold.js +2 -9
  77. package/dist/shared/provider-scaffold.js +5 -3
  78. package/dist/shared/specdojo-config.js +10 -3
  79. package/dist/shared/specdojo-gitignore.js +4 -0
  80. package/dist/specdojo.js +5 -1
  81. package/docs/ja/specdojo/exec-templates/xep-catalog-planning-template.md +24 -0
  82. package/docs/ja/specdojo/exec-templates/xep-strategy-planning-template.md +24 -0
  83. package/docs/ja/specdojo/exec-templates/xrp-freeform-template.md +2 -2
  84. package/docs/ja/specdojo/exec-templates/xrp-fully-guided-template.md +2 -2
  85. package/docs/ja/specdojo/exec-templates/xrp-recipe-guided-template.md +2 -2
  86. package/docs/ja/specdojo/exec-templates/xrp-recipe-maintenance-template.md +2 -2
  87. package/docs/ja/specdojo/exec-templates/xrp-retrofit-template.md +2 -2
  88. package/docs/ja/specdojo/exec-templates/xrp-rulebook-maintenance-template.md +2 -2
  89. package/docs/ja/specdojo/exec-templates/xrp-sample-maintenance-template.md +2 -2
  90. package/docs/ja/specdojo/exec-templates/xrp-template-maintenance-template.md +2 -2
  91. package/docs/ja/specdojo/exec-templates/xrp-template.md +2 -2
  92. package/docs/ja/specdojo/guides/docs-editing-guide.md +14 -1
  93. package/docs/ja/specdojo/guides/docs-structure-guide.md +10 -8
  94. package/docs/ja/specdojo/guides/exec-config-guide.md +44 -12
  95. package/docs/ja/specdojo/guides/exec-operation-guide.md +20 -15
  96. package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +19 -1
  97. package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +3 -1
  98. package/docs/ja/specdojo/guides/practice-system-composition-guide.md +2 -0
  99. package/docs/ja/specdojo/guides/quick-start-guide.md +59 -16
  100. package/docs/ja/specdojo/guides/register-operation-guide.md +44 -15
  101. package/docs/ja/specdojo/guides/remote-host-development-guide.md +15 -1
  102. package/docs/ja/specdojo/guides/review-guide.md +2 -2
  103. package/docs/ja/specdojo/guides/ryu-guide.md +12 -0
  104. package/docs/ja/specdojo/guides/specdojo-overview-guide.md +16 -16
  105. package/docs/ja/specdojo/guides/timeline-design-guide.md +37 -33
  106. package/docs/ja/specdojo/recipes/tsd-recipe.md +198 -0
  107. package/docs/ja/specdojo/references/command-reference.md +92 -29
  108. package/docs/ja/specdojo/references/specdojo-config-reference.md +49 -16
  109. package/docs/ja/specdojo/rulebooks/atc-index-rulebook.md +1 -0
  110. package/docs/ja/specdojo/rulebooks/atc-rulebook.md +1 -0
  111. package/docs/ja/specdojo/rulebooks/bac-rulebook.md +5 -4
  112. package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +3 -2
  113. package/docs/ja/specdojo/rulebooks/bds-rulebook.md +4 -3
  114. package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +8 -7
  115. package/docs/ja/specdojo/rulebooks/bes-rulebook.md +4 -3
  116. package/docs/ja/specdojo/rulebooks/bps-rulebook.md +1 -0
  117. package/docs/ja/specdojo/rulebooks/br-rulebook.md +1 -0
  118. package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +1 -0
  119. package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +1 -0
  120. package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +1 -0
  121. package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +1 -0
  122. package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +1 -0
  123. package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +3 -2
  124. package/docs/ja/specdojo/rulebooks/cld-rulebook.md +2 -1
  125. package/docs/ja/specdojo/rulebooks/cnd-mermaid-rulebook.md +1 -0
  126. package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +1 -0
  127. package/docs/ja/specdojo/rulebooks/cop-index-rulebook.md +2 -1
  128. package/docs/ja/specdojo/rulebooks/cop-rulebook.md +3 -2
  129. package/docs/ja/specdojo/rulebooks/cpd-mermaid-rulebook.md +1 -0
  130. package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +1 -0
  131. package/docs/ja/specdojo/rulebooks/cstd-rulebook.md +1 -0
  132. package/docs/ja/specdojo/rulebooks/cxd-mermaid-rulebook.md +1 -0
  133. package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +1 -0
  134. package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +1 -0
  135. package/docs/ja/specdojo/rulebooks/dct-rulebook.md +1 -0
  136. package/docs/ja/specdojo/rulebooks/dec-rulebook.md +1 -0
  137. package/docs/ja/specdojo/rulebooks/dmd-index-rulebook.md +2 -1
  138. package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +2 -1
  139. package/docs/ja/specdojo/rulebooks/etc-index-rulebook.md +1 -0
  140. package/docs/ja/specdojo/rulebooks/etc-rulebook.md +1 -0
  141. package/docs/ja/specdojo/rulebooks/gl-rulebook.md +9 -6
  142. package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +1 -0
  143. package/docs/ja/specdojo/rulebooks/ifx-api-rulebook.md +3 -1
  144. package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +2 -1
  145. package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +2 -1
  146. package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +2 -0
  147. package/docs/ja/specdojo/rulebooks/ifx-msg-rulebook.md +4 -2
  148. package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +1 -0
  149. package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +1 -0
  150. package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +1 -0
  151. package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +1 -0
  152. package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +1 -0
  153. package/docs/ja/specdojo/rulebooks/itc-index-rulebook.md +1 -0
  154. package/docs/ja/specdojo/rulebooks/itc-rulebook.md +1 -0
  155. package/docs/ja/specdojo/rulebooks/mip-index-rulebook.md +2 -1
  156. package/docs/ja/specdojo/rulebooks/mm-rulebook.md +1 -0
  157. package/docs/ja/specdojo/rulebooks/mtp-rulebook.md +4 -3
  158. package/docs/ja/specdojo/rulebooks/nfr-availability-rulebook.md +9 -8
  159. package/docs/ja/specdojo/rulebooks/nfr-index-rulebook.md +10 -9
  160. package/docs/ja/specdojo/rulebooks/nfr-integrity-rulebook.md +9 -8
  161. package/docs/ja/specdojo/rulebooks/nfr-maintainability-rulebook.md +9 -8
  162. package/docs/ja/specdojo/rulebooks/nfr-operations-rulebook.md +9 -8
  163. package/docs/ja/specdojo/rulebooks/nfr-performance-rulebook.md +9 -8
  164. package/docs/ja/specdojo/rulebooks/nfr-reliability-rulebook.md +10 -9
  165. package/docs/ja/specdojo/rulebooks/nfr-security-safety-rulebook.md +9 -8
  166. package/docs/ja/specdojo/rulebooks/nfr-usability-rulebook.md +9 -8
  167. package/docs/ja/specdojo/rulebooks/ntp-rulebook.md +7 -6
  168. package/docs/ja/specdojo/rulebooks/opd-index-rulebook.md +1 -0
  169. package/docs/ja/specdojo/rulebooks/opd-rulebook.md +1 -0
  170. package/docs/ja/specdojo/rulebooks/opr-index-rulebook.md +1 -0
  171. package/docs/ja/specdojo/rulebooks/opr-rulebook.md +1 -0
  172. package/docs/ja/specdojo/rulebooks/otp-index-rulebook.md +2 -1
  173. package/docs/ja/specdojo/rulebooks/otp-rulebook.md +2 -1
  174. package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +56 -36
  175. package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +1 -0
  176. package/docs/ja/specdojo/rulebooks/pm-communication-plan-rulebook.md +1 -0
  177. package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +1 -0
  178. package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +1 -0
  179. package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +1 -0
  180. package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +1 -0
  181. package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +1 -0
  182. package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +1 -0
  183. package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +1 -0
  184. package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +1 -0
  185. package/docs/ja/specdojo/rulebooks/pr-rulebook.md +1 -0
  186. package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +1 -0
  187. package/docs/ja/specdojo/rulebooks/prj-charter-rulebook.md +1 -0
  188. package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +1 -0
  189. package/docs/ja/specdojo/rulebooks/prj-issues-and-approach-rulebook.md +1 -0
  190. package/docs/ja/specdojo/rulebooks/prj-overview-rulebook.md +1 -0
  191. package/docs/ja/specdojo/rulebooks/prj-scope-rulebook.md +1 -0
  192. package/docs/ja/specdojo/rulebooks/prj-stakeholder-register-rulebook.md +1 -0
  193. package/docs/ja/specdojo/rulebooks/prj-success-criteria-and-acceptance-criteria-rulebook.md +1 -0
  194. package/docs/ja/specdojo/rulebooks/sac-rulebook.md +3 -2
  195. package/docs/ja/specdojo/rulebooks/sch-rulebook.md +1 -0
  196. package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +7 -6
  197. package/docs/ja/specdojo/rulebooks/sf-rulebook.md +4 -3
  198. package/docs/ja/specdojo/rulebooks/sld-rulebook.md +2 -1
  199. package/docs/ja/specdojo/rulebooks/stc-index-rulebook.md +1 -0
  200. package/docs/ja/specdojo/rulebooks/stc-rulebook.md +1 -0
  201. package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +1 -0
  202. package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +1 -0
  203. package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +2 -1
  204. package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +9 -8
  205. package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +2 -1
  206. package/docs/ja/specdojo/rulebooks/sysd-rulebook.md +1 -0
  207. package/docs/ja/specdojo/rulebooks/tml-rulebook.md +1 -0
  208. package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +1 -0
  209. package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +1 -0
  210. package/docs/ja/specdojo/rulebooks/tsd-index-rulebook.md +80 -61
  211. package/docs/ja/specdojo/rulebooks/tsd-rulebook.md +111 -63
  212. package/docs/ja/specdojo/rulebooks/tsp-index-rulebook.md +1 -0
  213. package/docs/ja/specdojo/rulebooks/uis-rulebook.md +3 -2
  214. package/docs/ja/specdojo/rulebooks/utc-index-rulebook.md +1 -0
  215. package/docs/ja/specdojo/rulebooks/utc-rulebook.md +1 -0
  216. package/docs/ja/specdojo/samples/atc-index-sample.md +1 -1
  217. package/docs/ja/specdojo/samples/atc-sample.md +1 -1
  218. package/docs/ja/specdojo/samples/bac-sample.md +1 -1
  219. package/docs/ja/specdojo/samples/bdd-sample.yaml +1 -1
  220. package/docs/ja/specdojo/samples/bds-sample.md +1 -1
  221. package/docs/ja/specdojo/samples/bes-index-sample.md +1 -1
  222. package/docs/ja/specdojo/samples/bes-sample.md +1 -1
  223. package/docs/ja/specdojo/samples/ccd-sample.md +1 -1
  224. package/docs/ja/specdojo/samples/cdfd-sample.md +1 -1
  225. package/docs/ja/specdojo/samples/cdfd-uc-sample.md +1 -1
  226. package/docs/ja/specdojo/samples/cdsd-sample.md +1 -1
  227. package/docs/ja/specdojo/samples/cld-sample.md +1 -1
  228. package/docs/ja/specdojo/samples/cnd-sample.md +1 -1
  229. package/docs/ja/specdojo/samples/cop-index-sample.md +1 -1
  230. package/docs/ja/specdojo/samples/cop-sample.md +1 -1
  231. package/docs/ja/specdojo/samples/cpd-sample.md +1 -1
  232. package/docs/ja/specdojo/samples/cstd-sample.md +1 -1
  233. package/docs/ja/specdojo/samples/cxd-sample.md +1 -1
  234. package/docs/ja/specdojo/samples/dmd-index-sample.md +1 -1
  235. package/docs/ja/specdojo/samples/dmd-sample.md +1 -1
  236. package/docs/ja/specdojo/samples/etc-index-sample.md +1 -1
  237. package/docs/ja/specdojo/samples/etc-sample.md +1 -1
  238. package/docs/ja/specdojo/samples/gl-sample.yaml +2 -0
  239. package/docs/ja/specdojo/samples/ifd-sample.md +1 -1
  240. package/docs/ja/specdojo/samples/ifx-api-sample.yaml +1 -0
  241. package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +1 -1
  242. package/docs/ja/specdojo/samples/ifx-file-sample.md +1 -1
  243. package/docs/ja/specdojo/samples/ifx-index-sample.yaml +1 -0
  244. package/docs/ja/specdojo/samples/ifx-msg-sample.yaml +2 -1
  245. package/docs/ja/specdojo/samples/itc-index-sample.md +1 -1
  246. package/docs/ja/specdojo/samples/itc-sample.md +1 -1
  247. package/docs/ja/specdojo/samples/mtp-sample.md +1 -1
  248. package/docs/ja/specdojo/samples/nfr-availability-sample.md +1 -1
  249. package/docs/ja/specdojo/samples/nfr-index-sample.md +1 -1
  250. package/docs/ja/specdojo/samples/nfr-integrity-sample.md +1 -1
  251. package/docs/ja/specdojo/samples/nfr-maintainability-sample.md +1 -1
  252. package/docs/ja/specdojo/samples/nfr-operations-sample.md +1 -1
  253. package/docs/ja/specdojo/samples/nfr-performance-sample.md +1 -1
  254. package/docs/ja/specdojo/samples/nfr-reliability-sample.md +1 -1
  255. package/docs/ja/specdojo/samples/nfr-security-safety-sample.md +1 -1
  256. package/docs/ja/specdojo/samples/nfr-usability-sample.md +1 -1
  257. package/docs/ja/specdojo/samples/ntp-sample.md +1 -1
  258. package/docs/ja/specdojo/samples/opd-sample.md +1 -1
  259. package/docs/ja/specdojo/samples/opr-sample.md +1 -1
  260. package/docs/ja/specdojo/samples/otp-index-sample.md +1 -1
  261. package/docs/ja/specdojo/samples/otp-sample.md +1 -1
  262. package/docs/ja/specdojo/samples/prj-stakeholder-register-sample.md +1 -1
  263. package/docs/ja/specdojo/samples/sac-sample.md +1 -1
  264. package/docs/ja/specdojo/samples/sf-index-sample.md +1 -1
  265. package/docs/ja/specdojo/samples/sf-sample.md +1 -1
  266. package/docs/ja/specdojo/samples/sld-sample.md +1 -1
  267. package/docs/ja/specdojo/samples/stc-index-sample.md +1 -1
  268. package/docs/ja/specdojo/samples/stc-sample.md +1 -1
  269. package/docs/ja/specdojo/samples/stsd-sample.md +1 -1
  270. package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +1 -1
  271. package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +1 -1
  272. package/docs/ja/specdojo/samples/sysd-index-sample.md +1 -1
  273. package/docs/ja/specdojo/samples/tsd-index-sample.md +22 -16
  274. package/docs/ja/specdojo/samples/tsd-sample.md +241 -21
  275. package/docs/ja/specdojo/samples/tsp-index-sample.md +1 -1
  276. package/docs/ja/specdojo/samples/uis-sample.md +1 -1
  277. package/docs/ja/specdojo/samples/utc-index-sample.md +1 -1
  278. package/docs/ja/specdojo/samples/utc-sample.md +1 -1
  279. package/docs/ja/specdojo/standards/document-metadata-standard.md +28 -3
  280. package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +2 -0
  281. package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +16 -11
  282. package/docs/ja/specdojo/standards/sample-authoring-standard.md +1 -0
  283. package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +1 -1
  284. package/docs/ja/specdojo/templates/pjr-dependent-items-template.md +22 -0
  285. package/docs/ja/specdojo/templates/pjr-epic-items-template.md +22 -0
  286. package/docs/ja/specdojo/templates/pjr-epic-template.md +44 -0
  287. package/docs/ja/specdojo/templates/pjr-index-template.md +4 -2
  288. package/docs/specdojo/schemas/v1/bdd.schema.yaml +1 -1
  289. package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +24 -16
  290. package/docs/specdojo/schemas/v1/exec-common.schema.yaml +4 -1
  291. package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +1 -1
  292. package/docs/specdojo/schemas/v1/gl.schema.yaml +8 -0
  293. package/docs/specdojo/schemas/v1/grade-pipeline-state.schema.yaml +1 -1
  294. package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +5 -1
  295. package/docs/specdojo/schemas/v1/pipeline-state.schema.yaml +2 -1
  296. package/docs/specdojo/schemas/v1/register-events.schema.yaml +20 -0
  297. package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +73 -4
  298. package/docs/specdojo/schemas/v1/rulebook-frontmatter.schema.yaml +5 -0
  299. package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +21 -3
  300. package/package.json +2 -2
  301. package/templates/antigravity/orchestrator.md +14 -9
  302. package/templates/claude/agents/specdojo-orchestrator.md +14 -9
  303. package/templates/codex/agents/specdojo-orchestrator.toml +14 -9
  304. package/templates/codex/orchestrator.md +14 -9
  305. package/templates/copilot/README.md +2 -1
  306. package/templates/devcontainer/devcontainer.json +1 -0
  307. package/templates/init-agent-members.yaml +46 -3
  308. package/templates/opencode/README.md +118 -14
  309. package/templates/opencode/agents/specdojo-orchestrator.md +15 -10
  310. package/templates/opencode/opencode.json +25 -0
@@ -229,6 +229,15 @@ export function syncTaskWorktreesWithIntegrationTargets(params) {
229
229
  const synced = [];
230
230
  for (const product of params.worktree.repos ?? []) {
231
231
  const target = productIntegrationTarget(product);
232
+ if (product.integrationStrategy === "branch-only") {
233
+ synced.push({
234
+ repo: product.name,
235
+ target,
236
+ status: "skipped",
237
+ detail: "product-side review (branch-only)",
238
+ });
239
+ continue;
240
+ }
232
241
  if (params.integratedProducts?.has(product.name)) {
233
242
  synced.push({ repo: product.name, target, status: "skipped", detail: "already integrated" });
234
243
  continue;
@@ -245,6 +245,10 @@ export function productMergeBlockers(product) {
245
245
  blockers.push(block(`uncommitted changes outside the commit scope: ` +
246
246
  leftover.map((path) => `${product.name}:${path}`).join(", ")));
247
247
  }
248
+ // Product-side review owns mergeability and the integration target's checkout.
249
+ // The exec worktree must still be clean before its project-side result is accepted.
250
+ if (product.integrationStrategy === "branch-only")
251
+ return blockers;
248
252
  const target = productIntegrationTarget(product);
249
253
  if (target === "HEAD" || !branchExists(product.repoRoot, target)) {
250
254
  blockers.push(block(`integration branch ${target === "HEAD" ? "(detached HEAD)" : target} is not a local ` +
@@ -419,7 +423,8 @@ function errorMessage(error) {
419
423
  *
420
424
  * 1. check every product that still has commits to integrate and the project (`checkProject`); if
421
425
  * any repository cannot be integrated, nothing is merged
422
- * 2. merge the products in declaration order, skipping those already merged (resume)
426
+ * 2. process products in declaration order: retain branch-only exec branches, otherwise merge,
427
+ * skipping those already merged (resume)
423
428
  * 3. run `beforeProjectMerge` (record and commit the project-side state) and `mergeProject`
424
429
  *
425
430
  * Each repository's state is passed to `record`. The project is recorded as merged before
@@ -436,7 +441,7 @@ export function integrateTaskRepositories(params) {
436
441
  const record = params.record ?? (() => undefined);
437
442
  const order = [...products.map((product) => product.name), PROJECT_REPO_NAME];
438
443
  const done = new Set();
439
- // 統合済み(merge 済み、または統合する変更が無い)のリポジトリ。
444
+ // 処理済み(merge 済み、変更なし、または branch-only の保持)のリポジトリ。
440
445
  const integratedLabels = () => order.filter((name) => done.has(name));
441
446
  const pendingNames = () => order.filter((name) => !done.has(name));
442
447
  const fail = (repo, cause) => {
@@ -450,6 +455,10 @@ export function integrateTaskRepositories(params) {
450
455
  };
451
456
  const states = new Map();
452
457
  for (const product of products) {
458
+ if (product.integrationStrategy === "branch-only") {
459
+ states.set(product.name, "pending");
460
+ continue;
461
+ }
453
462
  const state = productMergeState(product);
454
463
  states.set(product.name, state);
455
464
  if (state === "pending")
@@ -492,6 +501,12 @@ export function integrateTaskRepositories(params) {
492
501
  for (const product of products) {
493
502
  if (states.get(product.name) !== "pending")
494
503
  continue;
504
+ if (product.integrationStrategy === "branch-only") {
505
+ done.add(product.name);
506
+ record(product.name, { status: "branch-only", commit: null, merged_at: null });
507
+ process.stdout.write(` [integrate] ${product.name}: not merged; retained exec branch ${product.branch}\n`);
508
+ continue;
509
+ }
495
510
  let lockDir = "";
496
511
  let commit;
497
512
  try {
@@ -65,11 +65,12 @@ function pullRequestOf(repoRoot, commit) {
65
65
  /** Integration snapshot of one product repository, read from the Git state after integration. */
66
66
  export function productIntegrationTrace(product) {
67
67
  const integrationBranch = productIntegrationTarget(product);
68
- const state = productMergeState(product);
68
+ const state = product.integrationStrategy === "branch-only" ? "branch-only" : productMergeState(product);
69
69
  const commit = state === "merged" ? integrationCommitOf(product, integrationBranch) : null;
70
70
  return {
71
71
  repo: product.name,
72
72
  integrationBranch,
73
+ execBranch: product.branch,
73
74
  state,
74
75
  commit,
75
76
  pullRequest: commit ? pullRequestOf(product.repoRoot, commit) : null,
@@ -81,6 +82,8 @@ function traceRows(key, traces, recordedAt) {
81
82
  `\`${key}\``,
82
83
  `\`${trace.repo}\``,
83
84
  `\`${trace.integrationBranch}\``,
85
+ `\`${trace.execBranch}\``,
86
+ trace.state,
84
87
  trace.pullRequest ?? NOT_APPLICABLE,
85
88
  trace.commit
86
89
  ? `\`${trace.commit}\``
@@ -103,14 +106,24 @@ function renderTable(header, rows) {
103
106
  }
104
107
  /** Body of the trace section (without the heading). */
105
108
  export function renderResultTraceBody(params) {
106
- const table = renderTable(["trace key", "repository", "integration branch", "PR", "commit snapshot", "recorded at"], traceRows(params.traceKey, params.traces, params.recordedAt));
109
+ const table = renderTable([
110
+ "trace key",
111
+ "repository",
112
+ "integration branch",
113
+ "exec branch",
114
+ "state",
115
+ "PR",
116
+ "commit snapshot",
117
+ "recorded at",
118
+ ], traceRows(params.traceKey, params.traces, params.recordedAt));
107
119
  // PJR-9KST: result は利用側プロジェクトの markdownlint 設定で検査され、既定の MD013(80 文字)が
108
120
  // 効くことがある。説明文は文ごとに改行して短く保ち、行長を内容で決められない表だけ MD013 を外す。
109
121
  return [
110
- "runner がプロダクトリポジトリを統合した後に記録した、統合先の commit snapshot です。",
122
+ "runner がプロダクトリポジトリの処理後に記録した状態と、統合先の commit snapshot です。",
111
123
  "プロジェクトリポジトリの統合は、この result を含む merge commit で確認します。",
112
124
  `その merge commit には \`Refs: ${params.traceKey}\` を付けます。`,
113
- "PR が `not applicable` の行は、runner がローカルで統合し PR を経由していません。",
125
+ "`branch-only` の行は未統合です。exec branch を保持し、push と PR 作成はプロダクト側で行います。",
126
+ "PR が `not applicable` の行では、runner は PR を作成していません。",
114
127
  "",
115
128
  "<!-- markdownlint-disable MD013 -->",
116
129
  "",
@@ -774,6 +774,8 @@ export function parseResultTaskIdentity(resultContent) {
774
774
  "recipe-guided",
775
775
  "freeform",
776
776
  "bootstrap",
777
+ "catalog-planning",
778
+ "strategy-planning",
777
779
  "rulebook-authoring",
778
780
  "recipe-authoring",
779
781
  "sample-authoring",
@@ -1,3 +1,4 @@
1
+ import { gradeCheckpointPaths } from "../grade-checkpoint.js";
1
2
  import { existsSync } from "node:fs";
2
3
  import { join } from "node:path";
3
4
  import { loadExecDefaultsConfig, providerSlotPoolPath, resolveMaxConcurrency, resolveMaxConcurrentRuns, } from "../agent-config.js";
@@ -277,6 +278,7 @@ export function prepareScheduleIntegrationResume(params) {
277
278
  join(executionPath, "exec", "plans", `${task.id}-plan.md`),
278
279
  resultPath,
279
280
  ...(claimEventPath ? [claimEventPath] : []),
281
+ ...gradeCheckpointPaths({ repoRoot, executionPath }),
280
282
  ];
281
283
  return {
282
284
  task,
@@ -1,3 +1,4 @@
1
+ import { registerDependencyBlockReason } from "../../register/dependency.js";
1
2
  import { existsSync, readFileSync } from "node:fs";
2
3
  import { basename } from "node:path";
3
4
  import { resolveMemberCommand, } from "../agent-config.js";
@@ -244,6 +245,16 @@ export function registerReporterManagedPaths(registerPaths) {
244
245
  export async function runSingleRegisterItem(context, opts, pjrId) {
245
246
  const { projectId, schedulePath, executionPath, repoRoot } = context;
246
247
  const { registerPaths, item } = resolveRegisterRunTarget(projectId, pjrId);
248
+ const dependencyReason = registerDependencyBlockReason(registerPaths, item);
249
+ if (dependencyReason)
250
+ return {
251
+ id: item.id,
252
+ title: item.title,
253
+ outcome: "skipped",
254
+ transition: "none",
255
+ commit: "skipped",
256
+ reason: dependencyReason,
257
+ };
247
258
  // 状態遷移の書き込み先(登録項目の正本)。commit 対象に必ず含める。
248
259
  const ticketPath = ticketPathFromItem(item, registerPaths.projectRegisterPath);
249
260
  requireRunnableRegisterItem(item);
@@ -1,3 +1,4 @@
1
+ import { registerDependencyBlockReason } from "../../register/dependency.js";
1
2
  import { join } from "node:path";
2
3
  import { loadExecDefaultsConfig, ProviderConcurrencyGate } from "../agent-config.js";
3
4
  import { activateResolvedProjectPaths, resolveProjectPaths } from "../project.js";
@@ -38,12 +39,29 @@ export async function runRegisterMode(opts) {
38
39
  limit: opts.registerLimit,
39
40
  })
40
41
  : undefined;
42
+ const registerPaths = resolveRegisterPaths({ project: projectId });
41
43
  const selectedIds = selectionFilter
42
- ? selectRegisterItems(loadRegisterItems(resolveRegisterPaths({ project: projectId })).map((view) => view.item), selectionFilter).map((item) => item.id)
44
+ ? selectRegisterItems(loadRegisterItems(registerPaths).map((view) => view.item), { ...selectionFilter, limit: undefined })
45
+ .filter((item) => {
46
+ const reason = registerDependencyBlockReason(registerPaths, item);
47
+ if (reason)
48
+ process.stdout.write(`Skipping ${item.id}: ${reason}\n`);
49
+ return !reason;
50
+ })
51
+ .slice(0, selectionFilter.limit)
52
+ .map((item) => item.id)
43
53
  : undefined;
44
54
  const { ids, duplicates } = selectedIds
45
55
  ? { ids: selectedIds, duplicates: [] }
46
56
  : parseRegisterIds(opts.register);
57
+ if (!selectionFilter) {
58
+ for (const id of ids) {
59
+ const target = resolveRegisterRunTarget(projectId, id);
60
+ const reason = registerDependencyBlockReason(target.registerPaths, target.item);
61
+ if (reason)
62
+ throw new Error(`Cannot run ${id}: ${reason}`);
63
+ }
64
+ }
47
65
  const executorSelection = parseRegisterExecutorSelection(opts.executorBy, ids);
48
66
  if (ids.length === 0) {
49
67
  process.stdout.write("No matching register items.\n");
@@ -1,3 +1,4 @@
1
+ import { registerDependencyBlockReason } from "../../register/dependency.js";
1
2
  import { existsSync, readFileSync } from "node:fs";
2
3
  import { resolve } from "node:path";
3
4
  import { qualifyTaskId } from "../shared.js";
@@ -147,6 +148,16 @@ export async function resumeRegisterIntegration(params) {
147
148
  export async function resumeSingleRegisterItemWorktree(context, opts, pjrId, lifecycleLock) {
148
149
  const { projectId, schedulePath, executionPath, repoRoot } = context;
149
150
  const { registerPaths, item } = resolveRegisterRunTarget(projectId, pjrId);
151
+ const dependencyReason = registerDependencyBlockReason(registerPaths, item);
152
+ if (dependencyReason)
153
+ return {
154
+ id: item.id,
155
+ title: item.title,
156
+ outcome: "skipped",
157
+ transition: "none",
158
+ commit: "skipped",
159
+ reason: dependencyReason,
160
+ };
150
161
  const ticketPath = ticketPathFromItem(item, registerPaths.projectRegisterPath);
151
162
  requireRunnableRegisterItem(item);
152
163
  // 再開できない場合は register の状態も worktree も変更せず、理由だけを返す。
@@ -214,6 +225,7 @@ export async function resumeSingleRegisterItemWorktree(context, opts, pjrId, lif
214
225
  // 再開開始前に集合を固定せず finalize の直前に評価する。
215
226
  const bookkeepingPaths = () => registerBookkeepingPaths({
216
227
  repoRoot,
228
+ executionPath,
217
229
  registerPaths,
218
230
  planPath: resolve(repoRoot, artifacts.planRef),
219
231
  resultPath: resolve(repoRoot, artifacts.resultRef),
@@ -226,6 +238,17 @@ export async function resumeSingleRegisterItemWorktree(context, opts, pjrId, lif
226
238
  // 実行中の状態が root からも見えるようにする(merge 前に解放する)。
227
239
  const begin = async (actor, transitionReason) => {
228
240
  const start = () => {
241
+ const current = resolveRegisterRunTarget(projectId, pjrId);
242
+ const reason = registerDependencyBlockReason(current.registerPaths, current.item);
243
+ if (reason)
244
+ return {
245
+ id: item.id,
246
+ title: item.title,
247
+ outcome: "skipped",
248
+ transition: "none",
249
+ commit: "skipped",
250
+ reason,
251
+ };
229
252
  if (!spawnRegisterTransition(projectId, ["start", "--id", item.id, "--by", actor, "--reason", transitionReason], worktree.path)) {
230
253
  return refuse(`register start failed: ${item.id}`);
231
254
  }
@@ -1,3 +1,4 @@
1
+ import { gradeCheckpointPaths } from "../grade-checkpoint.js";
1
2
  import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2
3
  import { basename, dirname, resolve } from "node:path";
3
4
  import { sanitizeRegisterConclusion, } from "../register.js";
@@ -157,7 +158,9 @@ export function registerTransitionPaths(registerPaths, ticketPath) {
157
158
  // runner 管理パスとして扱う。この集合を失敗時の wait commit、merge 前の root 解放で使う。
158
159
  export function registerBookkeepingPaths(params) {
159
160
  const { repoRoot, registerPaths, planPath, resultPath, ticketPath } = params;
160
- return registerRunnerManagedPaths(repoRoot, registerPaths, planPath, resultPath, worktreeStatusPaths(repoRoot), ticketPath).map((path) => resolve(repoRoot, path));
161
+ return registerRunnerManagedPaths(repoRoot, registerPaths, planPath, resultPath, worktreeStatusPaths(repoRoot), ticketPath)
162
+ .map((path) => resolve(repoRoot, path))
163
+ .concat(gradeCheckpointPaths(params));
161
164
  }
162
165
  // root の登録簿派生ビュー(pjr-index / generated)は非追跡の生成物で、merge や複製では更新され
163
166
  // ない。個票の状態を root 側へ反映したあとに再生成して、root の表示を個票と揃える。失敗しても
@@ -1,3 +1,5 @@
1
+ import { registerDependencyBlockReason } from "../../register/dependency.js";
2
+ import { gradeCheckpointPaths } from "../grade-checkpoint.js";
1
3
  import { existsSync, readFileSync } from "node:fs";
2
4
  import { resolve } from "node:path";
3
5
  import { qualifyTaskId, randomHex } from "../shared.js";
@@ -393,6 +395,16 @@ export async function runSingleRegisterItemWorktree(context, opts, pjrId, lifecy
393
395
  const { projectId, schedulePath, executionPath, repoRoot, worktreeBase } = context;
394
396
  const wtContext = { repoRoot, schedulePath, executionPath };
395
397
  const { registerPaths, item } = resolveRegisterRunTarget(projectId, pjrId);
398
+ const dependencyReason = registerDependencyBlockReason(registerPaths, item);
399
+ if (dependencyReason)
400
+ return {
401
+ id: item.id,
402
+ title: item.title,
403
+ outcome: "skipped",
404
+ transition: "none",
405
+ commit: "skipped",
406
+ reason: dependencyReason,
407
+ };
396
408
  // 状態遷移の書き込み先(登録項目の正本)。commit 対象に必ず含める。
397
409
  const ticketPath = ticketPathFromItem(item, registerPaths.projectRegisterPath);
398
410
  requireRunnableRegisterItem(item);
@@ -424,6 +436,18 @@ export async function runSingleRegisterItemWorktree(context, opts, pjrId, lifecy
424
436
  const integrationBranchOverrides = integrationBranchOverrideRecord(opts.integrationBranch);
425
437
  // Phase 1: plan/result 生成 → register start → checkpoint → worktree 作成(root で直列化)。
426
438
  const setup = async () => {
439
+ // Recheck after acquiring the lifecycle lock: dependencies may change while waiting.
440
+ const current = resolveRegisterRunTarget(projectId, pjrId);
441
+ const reason = registerDependencyBlockReason(current.registerPaths, current.item);
442
+ if (reason)
443
+ return {
444
+ id: item.id,
445
+ title: item.title,
446
+ outcome: "skipped",
447
+ transition: "none",
448
+ commit: "skipped",
449
+ reason,
450
+ };
427
451
  // executor が成功した run の worktree を、全体再実行が破棄しないよう保護する。
428
452
  // discardStaleExecWorktree は worktree と exec ブランチを強制削除するため、未コミットの
429
453
  // executor 成果が失われる。この場合は何も壊さずに中断し、再開か明示的な破棄を促す。
@@ -476,7 +500,10 @@ export async function runSingleRegisterItemWorktree(context, opts, pjrId, lifecy
476
500
  throw new Error(`register start failed: ${item.id}`);
477
501
  }
478
502
  const checkpointRel = registerRunnerManagedPaths(repoRoot, registerPaths, planPath, resultPath, worktreeStatusPaths(repoRoot), ticketPath, supersededPaths);
479
- const checkpointPaths = checkpointRel.map((rel) => resolve(repoRoot, rel));
503
+ const checkpointPaths = [
504
+ ...checkpointRel.map((rel) => resolve(repoRoot, rel)),
505
+ ...gradeCheckpointPaths({ repoRoot, executionPath }),
506
+ ];
480
507
  const checkpointFailureLogPath = pipelineRunId
481
508
  ? integrateLogPath(pipelineStateLocation({
482
509
  repoRoot,
@@ -6,12 +6,13 @@ import { buildInitialStateFromStrategy } from "../schedule/initial.js";
6
6
  import { qualifyTaskId, randomHex } from "../shared.js";
7
7
  import { generateSinglePlan, finalizeResultSectionsForDeliverable, targetDocIdsForScheduledTask, reviewGradeSubject, } from "../plans.js";
8
8
  import { ensureReviewGrade } from "../../review/grade.js";
9
+ import { gradeCheckpointPaths } from "../grade-checkpoint.js";
9
10
  import { isResultUnfilled, readResultFrontmatterSnapshot, scaffoldResult } from "../results.js";
10
11
  import { worktreeNameFromTaskId } from "../worktree.js";
11
12
  import { configuredProductRepos, plannedProjectWorktreePath } from "../task-repos.js";
12
13
  import { checkpointAndEnsureWorktree, discardStaleExecWorktree } from "../worktree-ops.js";
13
14
  import { pipelineStateLocation } from "../pipeline-state.js";
14
- import { collectBusyActors, pinnedExecutor, pinnedReporter, resolveAgentOverride, resolvePinnedRateLimitRunOptions, resolveTaskPhaseContext, selectCandidates, } from "./shared.js";
15
+ import { collectBusyActors, pinnedExecutor, pinnedReporter, resolveAgentOverride, resolveExecDefaultsPath, resolvePinnedRateLimitRunOptions, resolveTaskPhaseContext, selectCandidates, } from "./shared.js";
15
16
  import { buildExecutorPrompt, executorRequirements, loadPrompt, reportProductWorktrees, reporterRequirements, resolveReporterAgentCandidates, } from "./agent.js";
16
17
  import { integrateLogPath, spawnClaim, spawnRelease } from "./mode-shared.js";
17
18
  export function findClaimEventPath(schedulePath, taskId) {
@@ -38,6 +39,8 @@ export async function gradeBeforeReviewPlan(params) {
38
39
  target: subject.target,
39
40
  repoRoot: params.repoRoot,
40
41
  dryRun: params.dryRun,
42
+ by: params.by,
43
+ execDefaultsPath: params.execDefaultsPath,
41
44
  });
42
45
  const summary = outcome.action === "skipped"
43
46
  ? "skipped: content_hash matches the stored grade"
@@ -165,6 +168,8 @@ export async function prepareSingleTask(task, projectId, repoRoot, schedulePath,
165
168
  catalogPath: planGenPaths.catalogPath,
166
169
  repoRoot,
167
170
  dryRun,
171
+ by: agentCandidates[0]?.actor,
172
+ execDefaultsPath: resolveExecDefaultsPath(rateLimitOverrides, schedulePath),
168
173
  });
169
174
  // Plans are generated on demand here; `exec refresh` does not manage them.
170
175
  await generateSinglePlan({
@@ -279,6 +284,7 @@ export async function prepareSingleTask(task, projectId, repoRoot, schedulePath,
279
284
  join(executionPath, "exec", "plans", `${task.id}-plan.md`),
280
285
  resultPath,
281
286
  claimEventPath,
287
+ ...gradeCheckpointPaths({ repoRoot, executionPath }),
282
288
  ];
283
289
  const checkpointFailureLogPath = pipelineRunId
284
290
  ? integrateLogPath(pipelineStateLocation({
@@ -8,6 +8,8 @@ function isApproach(value) {
8
8
  value === "recipe-guided" ||
9
9
  value === "freeform" ||
10
10
  value === "bootstrap" ||
11
+ value === "catalog-planning" ||
12
+ value === "strategy-planning" ||
11
13
  value === "rulebook-authoring" ||
12
14
  value === "recipe-authoring" ||
13
15
  value === "sample-authoring" ||
@@ -69,6 +69,7 @@ export function resolveProductRepos(rootDir, project, integrationBranches) {
69
69
  name: repo.name,
70
70
  repoRoot: resolveRepoRoot(rootDir, repo),
71
71
  ...(integrationBranch ? { integrationBranch } : {}),
72
+ ...(repo.integration_strategy ? { integrationStrategy: repo.integration_strategy } : {}),
72
73
  install: repo.setup?.install ?? true,
73
74
  build: repo.setup?.build ?? true,
74
75
  };
@@ -101,6 +102,7 @@ export function configuredProductCheckouts(schedulePath) {
101
102
  branch: productIntegrationTarget(product),
102
103
  created: false,
103
104
  ...(product.integrationBranch ? { integrationBranch: product.integrationBranch } : {}),
105
+ ...(product.integrationStrategy ? { integrationStrategy: product.integrationStrategy } : {}),
104
106
  }));
105
107
  }
106
108
  /**
@@ -193,6 +195,7 @@ function toProductWorktree(product, worktree) {
193
195
  branch: worktree.branch,
194
196
  created: worktree.created,
195
197
  ...(product.integrationBranch ? { integrationBranch: product.integrationBranch } : {}),
198
+ ...(product.integrationStrategy ? { integrationStrategy: product.integrationStrategy } : {}),
196
199
  };
197
200
  }
198
201
  /** Registered product worktrees of a task (repositories without one are omitted). */
@@ -282,7 +285,7 @@ export function productWorktreeRemovalBlockers(worktree) {
282
285
  if (dirty.length > 0) {
283
286
  blockers.push(`${product.name} has uncommitted changes: ${dirty.map((path) => `${product.name}:${path}`).join(", ")}`);
284
287
  }
285
- if (!isMergedIntoTarget(product)) {
288
+ if (product.integrationStrategy !== "branch-only" && !isMergedIntoTarget(product)) {
286
289
  blockers.push(`${product.name}: exec branch ${product.branch} is not merged into ${productIntegrationTarget(product)}`);
287
290
  }
288
291
  }
@@ -291,21 +294,22 @@ export function productWorktreeRemovalBlockers(worktree) {
291
294
  /** Remove product worktrees (and optionally their branches). Callers check blockers first. */
292
295
  export function removeProductWorktrees(params) {
293
296
  for (const product of params.worktree.repos ?? []) {
297
+ const deleteBranch = params.deleteBranch && product.integrationStrategy !== "branch-only";
294
298
  if (params.dryRun) {
295
299
  process.stdout.write(`[dry-run] git -C ${product.repoRoot} worktree remove --force ${product.path}\n`);
296
- if (params.deleteBranch) {
300
+ if (deleteBranch) {
297
301
  process.stdout.write(`[dry-run] git -C ${product.repoRoot} branch -d ${product.branch}\n`);
298
302
  }
299
303
  continue;
300
304
  }
301
305
  if (existsSync(product.path)) {
302
- // Guards (clean + merged) already ran; leftovers are ignored/regenerable files.
306
+ // Guards (clean, and merged unless branch-only) already ran.
303
307
  gitOutput(product.repoRoot, ["worktree", "remove", "--force", product.path]);
304
308
  }
305
309
  else {
306
310
  gitResult(product.repoRoot, ["worktree", "prune"]);
307
311
  }
308
- if (params.deleteBranch) {
312
+ if (deleteBranch) {
309
313
  // `-d` compares with the main checkout's HEAD, which may differ from integration_branch.
310
314
  // Use `-D` only for a branch verified to be merged into its integration target; otherwise
311
315
  // keep Git's safe `-d` so unintegrated product work is never deleted.
@@ -334,6 +338,16 @@ export function removeEmptyTaskDirectory(worktree) {
334
338
  * or cancelled lifecycle). Mirrors discardStaleExecWorktree for each product repository.
335
339
  */
336
340
  export function discardStaleProductWorktrees(products, taskId) {
341
+ // A retained branch is product-side review work, not abandoned scheduler residue.
342
+ // Check every product before removing anything, including a previous task's project worktree.
343
+ for (const product of products) {
344
+ if (product.integrationStrategy === "branch-only" &&
345
+ existsSync(product.repoRoot) &&
346
+ execBranchExists(product.repoRoot, taskId)) {
347
+ throw new Error(`${product.name}: retained exec branch exec/${worktreeNameFromTaskId(taskId)} already exists; ` +
348
+ `resume the existing run or finish product-side review and rename/remove the branch before a fresh run`);
349
+ }
350
+ }
337
351
  const discarded = [];
338
352
  for (const product of products) {
339
353
  if (!existsSync(product.repoRoot))
@@ -1,3 +1,4 @@
1
+ import { gradeCheckpointPaths } from "./grade-checkpoint.js";
1
2
  import { spawn } from "node:child_process";
2
3
  import { existsSync } from "node:fs";
3
4
  import { join, resolve } from "node:path";
@@ -190,7 +191,12 @@ async function prepare(opts) {
190
191
  context,
191
192
  worktreeTaskId,
192
193
  base,
193
- checkpointPaths: [planPath, resultPath, lockedState.claimEventPath],
194
+ checkpointPaths: [
195
+ planPath,
196
+ resultPath,
197
+ lockedState.claimEventPath,
198
+ ...gradeCheckpointPaths(context),
199
+ ],
194
200
  commitMessage: `exec(${opts.task}): prepare execution`,
195
201
  products,
196
202
  });
@@ -332,6 +338,7 @@ function merge(opts) {
332
338
  join(context.executionPath, "exec", "plans", `${opts.task}-plan.md`),
333
339
  join(context.executionPath, "exec", "results", `${opts.task}-result.md`),
334
340
  ...(claimEventPath ? [claimEventPath] : []),
341
+ ...gradeCheckpointPaths(context),
335
342
  ];
336
343
  mergeWorktreeIntoCurrent({
337
344
  context,
@@ -9,6 +9,7 @@ import { agentProtectedConfigPaths, agentProtectedConfigViolation, qualifiedRepo
9
9
  import { recordProtectedConfigBlockAcrossRepos } from "./protection-handoff.js";
10
10
  import { assertNoPendingProductChanges, productIntegrationTarget } from "./task-repos.js";
11
11
  import { specdojoPackageRootDir } from "../shared/package-paths.js";
12
+ import { DEFAULT_MARKDOWNLINT_CONFIG, hasMarkdownlintConfig, } from "../shared/markdownlint-config.js";
12
13
  import { repoRelative, stageCommitTargets, worktreeStatusPaths as statusPaths, } from "../shared/git.js";
13
14
  export { repoRelative, selectStageablePaths, stageCommitTargets, worktreeStatusPaths, } from "../shared/git.js";
14
15
  import { appendGitFailureLog, appendGitResultFailureLog, formatGitResultFailure, gitEnvironment, gitOutput, gitResult, summarizeGitHookFailure, worktreeNameFromTaskId, } from "./worktree.js";
@@ -442,7 +443,12 @@ export function assertResultMarkdownlint(context, worktree, taskId) {
442
443
  process.stdout.write(`result-markdownlint: markdownlint-cli not found; skipped pre-commit lint of ${resultRel}\n`);
443
444
  return;
444
445
  }
445
- const result = spawnSync(executable, [resultRel], {
446
+ // Only supply defaults when markdownlint-cli has no repository configuration.
447
+ // --disable is followed by -- so the result path is not consumed as a rule name.
448
+ const args = hasMarkdownlintConfig(worktree.path)
449
+ ? [resultRel]
450
+ : ["--disable", ...Object.keys(DEFAULT_MARKDOWNLINT_CONFIG), "--", resultRel];
451
+ const result = spawnSync(executable, args, {
446
452
  cwd: worktree.path,
447
453
  encoding: "utf8",
448
454
  env: gitEnvironment(),
@@ -5,6 +5,7 @@ import { acquireSchedulerLock, releaseSchedulerLock } from "./events.js";
5
5
  import { rebuildRegisterTicketFromEvents, unionRegisterEventLogs, } from "../register/event-merge.js";
6
6
  import { displayIdFromRegisterEventFilename, REGISTER_EVENTS_DIRNAME } from "../register/events.js";
7
7
  import { displayIdFromTicketFilename } from "../register/item.js";
8
+ import { isGradeCheckpointPath } from "./grade-checkpoint.js";
8
9
  import { appendGitFailureLog, gitOutput, gitResult, summarizeGitHookFailure, } from "./worktree.js";
9
10
  import { commitTargetPaths, currentBranch, repoRelative, rootDirtyPaths, zeroSeparatedPaths, } from "./worktree-ops-commit.js";
10
11
  const DEFAULT_LOCK_TIMEOUT_MS = 10_000;
@@ -198,7 +199,7 @@ export function mergeWorktreeIntoCurrent(params) {
198
199
  let lockDir = "";
199
200
  let released = [];
200
201
  let merged = false;
201
- const releasePaths = (params.releaseRootPaths ?? []).map((path) => repoRelative(context.repoRoot, path));
202
+ let releasePaths = (params.releaseRootPaths ?? []).map((path) => repoRelative(context.repoRoot, path));
202
203
  const releasePathSet = new Set(releasePaths);
203
204
  try {
204
205
  if (!params.dryRun) {
@@ -207,6 +208,44 @@ export function mergeWorktreeIntoCurrent(params) {
207
208
  lockTimeoutMs: DEFAULT_LOCK_TIMEOUT_MS,
208
209
  lockStaleMs: DEFAULT_LOCK_STALE_MS,
209
210
  });
211
+ // Canonical grades may have been refreshed in the root after branching. Release only
212
+ // the checkpoint copies; refuse to discard a newer root-side evaluation.
213
+ const gradePaths = releasePaths.filter((path) => isGradeCheckpointPath(path, repoRelative(context.repoRoot, context.executionPath)));
214
+ if (gradePaths.length > 0) {
215
+ const base = gitOutput(context.repoRoot, ["merge-base", "HEAD", worktree.branch]).trim();
216
+ const branchPaths = new Set(zeroSeparatedPaths(context.repoRoot, [
217
+ "diff",
218
+ "--no-renames",
219
+ "--name-only",
220
+ "-z",
221
+ `${base}..${worktree.branch}`,
222
+ ]));
223
+ // A grade for a different document may have appeared while the task was running.
224
+ // Leave such root-side work in place; only release grades this branch will merge.
225
+ const gradePathSet = new Set(gradePaths);
226
+ releasePaths = releasePaths.filter((path) => !gradePathSet.has(path) || branchPaths.has(path));
227
+ const sharedGradePaths = gradePaths.filter((path) => branchPaths.has(path));
228
+ if (sharedGradePaths.length > 0) {
229
+ const checkpoint = gitOutput(context.repoRoot, [
230
+ "rev-list",
231
+ "--reverse",
232
+ "--first-parent",
233
+ `${base}..${worktree.branch}`,
234
+ ])
235
+ .trim()
236
+ .split("\n")[0];
237
+ if (!checkpoint)
238
+ throw new Error("Cannot identify grade checkpoint before merge");
239
+ for (const path of sharedGradePaths) {
240
+ const expected = gitResult(context.repoRoot, ["show", `${checkpoint}:${path}`]);
241
+ const absolute = resolve(context.repoRoot, path);
242
+ const current = existsSync(absolute) ? readFileSync(absolute, "utf8") : undefined;
243
+ if ((expected.status === 0 ? expected.stdout : undefined) !== current) {
244
+ throw new Error(`Grade sidecar changed after checkpoint; reconcile before merge: ${path}`);
245
+ }
246
+ }
247
+ }
248
+ }
210
249
  released = releaseRootWorkingCopies(context.repoRoot, releasePaths);
211
250
  }
212
251
  const dirty = commitTargetPaths(context, worktree, taskId);
@@ -5,7 +5,7 @@ import { dump } from "../shared/yaml.js";
5
5
  import { extractJsonText } from "../shared/agent-response.js";
6
6
  import { CRITERION_ID_RE, CRITERION_STATUSES, DONE_CRITERIA_SCHEMA, SEVERITY_LEVEL_CAP, agentViewpoints, correctViewpointLevels, isRecord, levelCapForFindings, parseMarkdown, preserveStoredFindingSeverities, sanitizeCommentText, } from "./core.js";
7
7
  import { applicableDoneCriteria, deterministicResults, gradePlanFilename } from "./plan.js";
8
- import { gradeContentHash, gradeResultPath, markdownDocumentId, readGradeResult, writeGradeResult, } from "./result.js";
8
+ import { gradeContentHash, gradeResultPathForDocument, markdownDocumentId, readGradeResult, writeGradeResult, } from "./result.js";
9
9
  import { gradeMarkdownDocument, resolveGradeReferenceId, scoreDocument, summarizeDoneCriteria, } from "./markdown.js";
10
10
  import { assertRubric, createGradeSourceContext, gradeSourceHashes, repoRelativePath, resolveSafeMarkdownPath, resolveSafeRepositoryPath, } from "./targets.js";
11
11
  import { specdojoRootDir } from "../shared/specdojo-config.js";
@@ -532,8 +532,8 @@ export function validateGradeSubmission(submission, doc, target, options = {}) {
532
532
  }
533
533
  // 詳細ファイルは成果物ごとに1件で、再評価のたびに上書きする。時点の記録は git 履歴が担う。
534
534
  // grade 本体と同じ方式であり、実行ごとにファイルを増やすと最新の評価を判別できなくなる。
535
- export function doneCriteriaDetailPath(criteriaDirectory, documentPath) {
536
- const absolute = resolveSafeMarkdownPath(documentPath);
535
+ export function doneCriteriaDetailPath(criteriaDirectory, documentPath, project) {
536
+ const absolute = resolveSafeMarkdownPath(documentPath, specdojoRootDir(), project);
537
537
  const directory = resolveSafeRepositoryPath(criteriaDirectory, "criteria directory");
538
538
  return join(directory, gradePlanFilename(absolute).replace(/-grade-plan\.md$/, "-done-criteria.yaml"));
539
539
  }
@@ -563,19 +563,23 @@ export function applyGradeSubmission(opts) {
563
563
  ? createGradeSourceContext(opts.project, specdojoRootDir())
564
564
  : undefined;
565
565
  for (const input of opts.submission.documents) {
566
- const absolute = resolveSafeMarkdownPath(input.path);
566
+ const absolute = resolveSafeMarkdownPath(input.path, specdojoRootDir(), opts.project);
567
567
  const rel = repoRelativePath(absolute);
568
568
  const current = readFileSync(absolute, "utf8");
569
569
  const definitions = opts.doneCriteriaByPath?.get(rel);
570
570
  const detailPath = definitions && input.done_criteria && opts.criteriaDirectory
571
- ? doneCriteriaDetailPath(opts.criteriaDirectory, absolute)
571
+ ? doneCriteriaDetailPath(opts.criteriaDirectory, absolute, opts.project)
572
572
  : undefined;
573
573
  if (definitions && input.done_criteria && !detailPath) {
574
574
  throw new Error(`${rel}: criteriaDirectory is required to record done_criteria`);
575
575
  }
576
576
  if (opts.resultsDirectory) {
577
577
  const documentId = markdownDocumentId(current, rel);
578
- const resultPath = gradeResultPath(opts.resultsDirectory, documentId);
578
+ const resultPath = gradeResultPathForDocument({
579
+ documentPath: absolute,
580
+ project: opts.project,
581
+ resultsDirectory: opts.resultsDirectory,
582
+ });
579
583
  const previous = readGradeResult(resultPath);
580
584
  const document = parseMarkdown(current, rel);
581
585
  const agentResults = preserveStoredFindingSeverities(previous, input.viewpoints);
@@ -641,7 +645,9 @@ export function applyGradeSubmission(opts) {
641
645
  path: rel,
642
646
  target: opts.target,
643
647
  rubric: rubric.id,
644
- ...(opts.reference ? { reference: resolveGradeReferenceId(opts.reference) } : {}),
648
+ ...(opts.reference
649
+ ? { reference: resolveGradeReferenceId(opts.reference, opts.project) }
650
+ : {}),
645
651
  verdict: summary.verdict,
646
652
  score: summary.score,
647
653
  graded_at: gradedAt,
@@ -4,6 +4,7 @@ import { listExhaustedGradePipelineStates, readGradePipelineState, recordGradePi
4
4
  import { migrateInlineGrades, validateGradeResultForDocument } from "./markdown.js";
5
5
  import { readGradeResultForDocument } from "./result.js";
6
6
  import { repoRelativePath, resolveSafeMarkdownPath } from "./targets.js";
7
+ import { specdojoRootDir } from "../shared/specdojo-config.js";
7
8
  export function registerGradeInspectionCommands(grade) {
8
9
  addSelection(grade.command("validate").description("Validate stored grade hashes and finding counts")).action((options) => {
9
10
  try {
@@ -41,7 +42,7 @@ export function registerGradeInspectionCommands(grade) {
41
42
  .option("--project <projectId>", "Project id in specdojo.config.json")
42
43
  .action((options) => {
43
44
  try {
44
- const absolute = resolveSafeMarkdownPath(options.path);
45
+ const absolute = resolveSafeMarkdownPath(options.path, specdojoRootDir(), options.project);
45
46
  const rel = repoRelativePath(absolute);
46
47
  const result = readGradeResultForDocument({ documentPath: rel, project: options.project });
47
48
  if (result)