specdojo 0.4.7 → 0.6.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 (312) hide show
  1. package/.github/agents/specdojo-orchestrator.md +16 -9
  2. package/CHANGELOG.md +106 -0
  3. package/dist/catalog/generate.js +144 -13
  4. package/dist/commands/init.js +4 -0
  5. package/dist/commands/night-orchestrator.js +33 -4
  6. package/dist/dashboard/dashboard.js +5 -6
  7. package/dist/dashboard/timeline-build.js +5 -1
  8. package/dist/dashboard/timeline.js +6 -3
  9. package/dist/deliverable/deliverable.js +77 -4
  10. package/dist/docs/yaml-pages.js +17 -17
  11. package/dist/exec/core.js +3 -0
  12. package/dist/exec/parent-validation.js +7 -0
  13. package/dist/exec/pipeline-state.js +5 -2
  14. package/dist/exec/plans-core.js +49 -3
  15. package/dist/exec/plans-generation.js +48 -8
  16. package/dist/exec/plans-grade-findings.js +16 -0
  17. package/dist/exec/plans-planning.js +43 -0
  18. package/dist/exec/plans-storage.js +6 -2
  19. package/dist/exec/product-branch-records.js +105 -0
  20. package/dist/exec/product-branches.js +52 -0
  21. package/dist/exec/register-product-message.js +50 -0
  22. package/dist/exec/register.js +22 -1
  23. package/dist/exec/repo-integration-sync.js +11 -0
  24. package/dist/exec/repo-integration.js +58 -6
  25. package/dist/exec/repo-trace.js +19 -4
  26. package/dist/exec/results.js +11 -5
  27. package/dist/exec/run/register-command.js +16 -0
  28. package/dist/exec/run/register-core.js +11 -0
  29. package/dist/exec/run/register-mode.js +19 -1
  30. package/dist/exec/run/register-resume.js +33 -1
  31. package/dist/exec/run/register-worktree.js +52 -8
  32. package/dist/exec/run/schedule-prepare.js +7 -3
  33. package/dist/exec/strategy.js +4 -1
  34. package/dist/exec/task-repos.js +92 -16
  35. package/dist/exec/worktree-command.js +2 -2
  36. package/dist/exec/worktree-ops-commit.js +7 -1
  37. package/dist/exec/worktree.js +3 -3
  38. package/dist/grade/apply.js +6 -2
  39. package/dist/grade/markdown.js +7 -2
  40. package/dist/grade/plan.js +6 -4
  41. package/dist/register/approach.js +19 -0
  42. package/dist/register/catalog-status.js +49 -0
  43. package/dist/register/core.js +8 -0
  44. package/dist/register/create-commands.js +86 -4
  45. package/dist/register/deliverable-target.js +24 -17
  46. package/dist/register/dependency.js +123 -0
  47. package/dist/register/derivation.js +2 -2
  48. package/dist/register/epic.js +42 -0
  49. package/dist/register/event-merge.js +9 -2
  50. package/dist/register/events.js +10 -0
  51. package/dist/register/external-project.js +6 -0
  52. package/dist/register/input.js +168 -0
  53. package/dist/register/item.js +71 -0
  54. package/dist/register/maintenance-commands.js +7 -1
  55. package/dist/register/planning.js +37 -0
  56. package/dist/register/register.js +7 -3
  57. package/dist/register/renumber.js +16 -4
  58. package/dist/register/update.js +6 -0
  59. package/dist/register/views.js +55 -4
  60. package/dist/schedule/approach.js +9 -0
  61. package/dist/schedule/schedule.js +3 -1
  62. package/dist/schedule/strategy-generate-scope.js +5 -1
  63. package/dist/schedule/strategy-generate.js +1 -0
  64. package/dist/schedule/strategy-profiles.js +22 -2
  65. package/dist/shared/agent-types.js +7 -1
  66. package/dist/shared/branch-template.js +26 -0
  67. package/dist/shared/commit-message-template.js +38 -0
  68. package/dist/shared/commit-types.js +15 -0
  69. package/dist/shared/grade-result.js +23 -5
  70. package/dist/shared/markdownlint-config.js +38 -0
  71. package/dist/shared/markdownlint-scaffold.js +2 -9
  72. package/dist/shared/specdojo-config.js +42 -4
  73. package/dist/shared/specdojo-gitignore.js +4 -0
  74. package/docs/ja/specdojo/exec-templates/xep-catalog-planning-template.md +24 -0
  75. package/docs/ja/specdojo/exec-templates/xep-draft-template.md +93 -0
  76. package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +9 -2
  77. package/docs/ja/specdojo/exec-templates/xep-register-investigate-template.md +2 -0
  78. package/docs/ja/specdojo/exec-templates/xep-register-template.md +2 -0
  79. package/docs/ja/specdojo/exec-templates/xep-strategy-planning-template.md +24 -0
  80. package/docs/ja/specdojo/exec-templates/xer-human-bootstrap-finalize-template.md +2 -0
  81. package/docs/ja/specdojo/exec-templates/xer-human-draft-template.md +23 -0
  82. package/docs/ja/specdojo/exec-templates/xer-human-finalize-template.md +2 -0
  83. package/docs/ja/specdojo/exec-templates/xrp-fully-guided-template.md +7 -4
  84. package/docs/ja/specdojo/guides/docs-editing-guide.md +14 -1
  85. package/docs/ja/specdojo/guides/docs-structure-guide.md +10 -8
  86. package/docs/ja/specdojo/guides/exec-config-guide.md +3 -1
  87. package/docs/ja/specdojo/guides/exec-operation-guide.md +111 -16
  88. package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +19 -1
  89. package/docs/ja/specdojo/guides/practice-system-composition-guide.md +2 -0
  90. package/docs/ja/specdojo/guides/quick-start-guide.md +37 -14
  91. package/docs/ja/specdojo/guides/register-operation-guide.md +58 -16
  92. package/docs/ja/specdojo/guides/remote-host-development-guide.md +1 -1
  93. package/docs/ja/specdojo/guides/ryu-guide.md +114 -23
  94. package/docs/ja/specdojo/guides/schedule-design-guide.md +31 -4
  95. package/docs/ja/specdojo/guides/specdojo-overview-guide.md +16 -16
  96. package/docs/ja/specdojo/guides/timeline-design-guide.md +37 -33
  97. package/docs/ja/specdojo/recipes/exec-human-finalize-recipe.md +1 -0
  98. package/docs/ja/specdojo/recipes/tsd-recipe.md +206 -0
  99. package/docs/ja/specdojo/references/command-reference.md +86 -15
  100. package/docs/ja/specdojo/references/specdojo-config-reference.md +81 -8
  101. package/docs/ja/specdojo/rulebooks/atc-index-rulebook.md +1 -0
  102. package/docs/ja/specdojo/rulebooks/atc-rulebook.md +1 -0
  103. package/docs/ja/specdojo/rulebooks/bac-rulebook.md +5 -4
  104. package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +3 -2
  105. package/docs/ja/specdojo/rulebooks/bds-rulebook.md +4 -3
  106. package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +8 -7
  107. package/docs/ja/specdojo/rulebooks/bes-rulebook.md +4 -3
  108. package/docs/ja/specdojo/rulebooks/bps-rulebook.md +1 -0
  109. package/docs/ja/specdojo/rulebooks/br-rulebook.md +1 -0
  110. package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +1 -0
  111. package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +1 -0
  112. package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +1 -0
  113. package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +1 -0
  114. package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +1 -0
  115. package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +3 -2
  116. package/docs/ja/specdojo/rulebooks/cld-rulebook.md +2 -1
  117. package/docs/ja/specdojo/rulebooks/cnd-mermaid-rulebook.md +1 -0
  118. package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +1 -0
  119. package/docs/ja/specdojo/rulebooks/cop-index-rulebook.md +2 -1
  120. package/docs/ja/specdojo/rulebooks/cop-rulebook.md +3 -2
  121. package/docs/ja/specdojo/rulebooks/cpd-mermaid-rulebook.md +1 -0
  122. package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +1 -0
  123. package/docs/ja/specdojo/rulebooks/cstd-rulebook.md +1 -0
  124. package/docs/ja/specdojo/rulebooks/cxd-mermaid-rulebook.md +1 -0
  125. package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +1 -0
  126. package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +1 -0
  127. package/docs/ja/specdojo/rulebooks/dct-rulebook.md +9 -0
  128. package/docs/ja/specdojo/rulebooks/dec-rulebook.md +1 -0
  129. package/docs/ja/specdojo/rulebooks/dmd-index-rulebook.md +2 -1
  130. package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +2 -1
  131. package/docs/ja/specdojo/rulebooks/etc-index-rulebook.md +1 -0
  132. package/docs/ja/specdojo/rulebooks/etc-rulebook.md +1 -0
  133. package/docs/ja/specdojo/rulebooks/gl-rulebook.md +9 -6
  134. package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +1 -0
  135. package/docs/ja/specdojo/rulebooks/ifx-api-rulebook.md +3 -1
  136. package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +2 -1
  137. package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +2 -1
  138. package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +2 -0
  139. package/docs/ja/specdojo/rulebooks/ifx-msg-rulebook.md +4 -2
  140. package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +1 -0
  141. package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +1 -0
  142. package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +1 -0
  143. package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +1 -0
  144. package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +1 -0
  145. package/docs/ja/specdojo/rulebooks/itc-index-rulebook.md +1 -0
  146. package/docs/ja/specdojo/rulebooks/itc-rulebook.md +1 -0
  147. package/docs/ja/specdojo/rulebooks/mip-index-rulebook.md +2 -1
  148. package/docs/ja/specdojo/rulebooks/mm-rulebook.md +1 -0
  149. package/docs/ja/specdojo/rulebooks/mtp-rulebook.md +4 -3
  150. package/docs/ja/specdojo/rulebooks/nfr-availability-rulebook.md +9 -8
  151. package/docs/ja/specdojo/rulebooks/nfr-index-rulebook.md +10 -9
  152. package/docs/ja/specdojo/rulebooks/nfr-integrity-rulebook.md +9 -8
  153. package/docs/ja/specdojo/rulebooks/nfr-maintainability-rulebook.md +9 -8
  154. package/docs/ja/specdojo/rulebooks/nfr-operations-rulebook.md +9 -8
  155. package/docs/ja/specdojo/rulebooks/nfr-performance-rulebook.md +9 -8
  156. package/docs/ja/specdojo/rulebooks/nfr-reliability-rulebook.md +10 -9
  157. package/docs/ja/specdojo/rulebooks/nfr-security-safety-rulebook.md +9 -8
  158. package/docs/ja/specdojo/rulebooks/nfr-usability-rulebook.md +9 -8
  159. package/docs/ja/specdojo/rulebooks/ntp-rulebook.md +7 -6
  160. package/docs/ja/specdojo/rulebooks/opd-index-rulebook.md +1 -0
  161. package/docs/ja/specdojo/rulebooks/opd-rulebook.md +1 -0
  162. package/docs/ja/specdojo/rulebooks/opr-index-rulebook.md +1 -0
  163. package/docs/ja/specdojo/rulebooks/opr-rulebook.md +1 -0
  164. package/docs/ja/specdojo/rulebooks/otp-index-rulebook.md +2 -1
  165. package/docs/ja/specdojo/rulebooks/otp-rulebook.md +2 -1
  166. package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +54 -36
  167. package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +1 -0
  168. package/docs/ja/specdojo/rulebooks/pm-communication-plan-rulebook.md +1 -0
  169. package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +1 -0
  170. package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +1 -0
  171. package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +1 -0
  172. package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +1 -0
  173. package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +1 -0
  174. package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +1 -0
  175. package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +1 -0
  176. package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +1 -0
  177. package/docs/ja/specdojo/rulebooks/pr-rulebook.md +1 -0
  178. package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +1 -0
  179. package/docs/ja/specdojo/rulebooks/prj-charter-rulebook.md +1 -0
  180. package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +1 -0
  181. package/docs/ja/specdojo/rulebooks/prj-issues-and-approach-rulebook.md +1 -0
  182. package/docs/ja/specdojo/rulebooks/prj-overview-rulebook.md +1 -0
  183. package/docs/ja/specdojo/rulebooks/prj-scope-rulebook.md +1 -0
  184. package/docs/ja/specdojo/rulebooks/prj-stakeholder-register-rulebook.md +1 -0
  185. package/docs/ja/specdojo/rulebooks/prj-success-criteria-and-acceptance-criteria-rulebook.md +1 -0
  186. package/docs/ja/specdojo/rulebooks/sac-rulebook.md +3 -2
  187. package/docs/ja/specdojo/rulebooks/sch-rulebook.md +4 -1
  188. package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +7 -6
  189. package/docs/ja/specdojo/rulebooks/sf-rulebook.md +4 -3
  190. package/docs/ja/specdojo/rulebooks/sld-rulebook.md +2 -1
  191. package/docs/ja/specdojo/rulebooks/stc-index-rulebook.md +1 -0
  192. package/docs/ja/specdojo/rulebooks/stc-rulebook.md +1 -0
  193. package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +1 -0
  194. package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +1 -0
  195. package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +2 -1
  196. package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +9 -8
  197. package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +2 -1
  198. package/docs/ja/specdojo/rulebooks/sysd-rulebook.md +1 -0
  199. package/docs/ja/specdojo/rulebooks/tml-rulebook.md +1 -0
  200. package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +1 -0
  201. package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +1 -0
  202. package/docs/ja/specdojo/rulebooks/tsd-index-rulebook.md +80 -61
  203. package/docs/ja/specdojo/rulebooks/tsd-rulebook.md +111 -63
  204. package/docs/ja/specdojo/rulebooks/tsp-index-rulebook.md +1 -0
  205. package/docs/ja/specdojo/rulebooks/uis-rulebook.md +3 -2
  206. package/docs/ja/specdojo/rulebooks/utc-index-rulebook.md +1 -0
  207. package/docs/ja/specdojo/rulebooks/utc-rulebook.md +1 -0
  208. package/docs/ja/specdojo/samples/atc-index-sample.md +1 -1
  209. package/docs/ja/specdojo/samples/atc-sample.md +1 -1
  210. package/docs/ja/specdojo/samples/bac-sample.md +1 -1
  211. package/docs/ja/specdojo/samples/bdd-sample.yaml +1 -1
  212. package/docs/ja/specdojo/samples/bds-sample.md +1 -1
  213. package/docs/ja/specdojo/samples/bes-index-sample.md +1 -1
  214. package/docs/ja/specdojo/samples/bes-sample.md +1 -1
  215. package/docs/ja/specdojo/samples/ccd-sample.md +1 -1
  216. package/docs/ja/specdojo/samples/cdfd-sample.md +1 -1
  217. package/docs/ja/specdojo/samples/cdfd-uc-sample.md +1 -1
  218. package/docs/ja/specdojo/samples/cdsd-sample.md +1 -1
  219. package/docs/ja/specdojo/samples/cld-sample.md +1 -1
  220. package/docs/ja/specdojo/samples/cnd-sample.md +1 -1
  221. package/docs/ja/specdojo/samples/cop-index-sample.md +1 -1
  222. package/docs/ja/specdojo/samples/cop-sample.md +1 -1
  223. package/docs/ja/specdojo/samples/cpd-sample.md +1 -1
  224. package/docs/ja/specdojo/samples/cstd-sample.md +1 -1
  225. package/docs/ja/specdojo/samples/cxd-sample.md +1 -1
  226. package/docs/ja/specdojo/samples/dct-sample.yaml +5 -1
  227. package/docs/ja/specdojo/samples/dmd-index-sample.md +1 -1
  228. package/docs/ja/specdojo/samples/dmd-sample.md +1 -1
  229. package/docs/ja/specdojo/samples/etc-index-sample.md +1 -1
  230. package/docs/ja/specdojo/samples/etc-sample.md +1 -1
  231. package/docs/ja/specdojo/samples/gl-sample.yaml +2 -0
  232. package/docs/ja/specdojo/samples/ifd-sample.md +1 -1
  233. package/docs/ja/specdojo/samples/ifx-api-sample.yaml +1 -0
  234. package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +1 -1
  235. package/docs/ja/specdojo/samples/ifx-file-sample.md +1 -1
  236. package/docs/ja/specdojo/samples/ifx-index-sample.yaml +1 -0
  237. package/docs/ja/specdojo/samples/ifx-msg-sample.yaml +2 -1
  238. package/docs/ja/specdojo/samples/itc-index-sample.md +1 -1
  239. package/docs/ja/specdojo/samples/itc-sample.md +1 -1
  240. package/docs/ja/specdojo/samples/mtp-sample.md +1 -1
  241. package/docs/ja/specdojo/samples/nfr-availability-sample.md +1 -1
  242. package/docs/ja/specdojo/samples/nfr-index-sample.md +1 -1
  243. package/docs/ja/specdojo/samples/nfr-integrity-sample.md +1 -1
  244. package/docs/ja/specdojo/samples/nfr-maintainability-sample.md +1 -1
  245. package/docs/ja/specdojo/samples/nfr-operations-sample.md +1 -1
  246. package/docs/ja/specdojo/samples/nfr-performance-sample.md +1 -1
  247. package/docs/ja/specdojo/samples/nfr-reliability-sample.md +1 -1
  248. package/docs/ja/specdojo/samples/nfr-security-safety-sample.md +1 -1
  249. package/docs/ja/specdojo/samples/nfr-usability-sample.md +1 -1
  250. package/docs/ja/specdojo/samples/ntp-sample.md +1 -1
  251. package/docs/ja/specdojo/samples/opd-sample.md +1 -1
  252. package/docs/ja/specdojo/samples/opr-sample.md +1 -1
  253. package/docs/ja/specdojo/samples/otp-index-sample.md +1 -1
  254. package/docs/ja/specdojo/samples/otp-sample.md +1 -1
  255. package/docs/ja/specdojo/samples/prj-stakeholder-register-sample.md +1 -1
  256. package/docs/ja/specdojo/samples/sac-sample.md +1 -1
  257. package/docs/ja/specdojo/samples/sf-index-sample.md +1 -1
  258. package/docs/ja/specdojo/samples/sf-sample.md +1 -1
  259. package/docs/ja/specdojo/samples/sld-sample.md +1 -1
  260. package/docs/ja/specdojo/samples/stc-index-sample.md +1 -1
  261. package/docs/ja/specdojo/samples/stc-sample.md +1 -1
  262. package/docs/ja/specdojo/samples/stsd-sample.md +1 -1
  263. package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +1 -1
  264. package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +1 -1
  265. package/docs/ja/specdojo/samples/sysd-index-sample.md +1 -1
  266. package/docs/ja/specdojo/samples/tsd-index-sample.md +22 -16
  267. package/docs/ja/specdojo/samples/tsd-sample.md +241 -21
  268. package/docs/ja/specdojo/samples/tsp-index-sample.md +1 -1
  269. package/docs/ja/specdojo/samples/uis-sample.md +1 -1
  270. package/docs/ja/specdojo/samples/utc-index-sample.md +1 -1
  271. package/docs/ja/specdojo/samples/utc-sample.md +1 -1
  272. package/docs/ja/specdojo/standards/document-metadata-standard.md +44 -3
  273. package/docs/ja/specdojo/standards/exec-human-finalize-standard.md +1 -0
  274. package/docs/ja/specdojo/standards/guide-authoring-standard.md +2 -1
  275. package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +2 -0
  276. package/docs/ja/specdojo/standards/philosophy-authoring-standard.md +1 -0
  277. package/docs/ja/specdojo/standards/recipe-authoring-standard.md +2 -1
  278. package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +18 -12
  279. package/docs/ja/specdojo/standards/sample-authoring-standard.md +1 -0
  280. package/docs/ja/specdojo/standards/standard-authoring-standard.md +2 -1
  281. package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +1 -1
  282. package/docs/ja/specdojo/templates/pjr-change-request-template.md +10 -4
  283. package/docs/ja/specdojo/templates/pjr-dependent-items-template.md +22 -0
  284. package/docs/ja/specdojo/templates/pjr-epic-items-template.md +22 -0
  285. package/docs/ja/specdojo/templates/pjr-epic-template.md +44 -0
  286. package/docs/ja/specdojo/templates/pjr-index-template.md +4 -2
  287. package/docs/ja/specdojo/templates/pjr-issue-template.md +10 -4
  288. package/docs/ja/specdojo/templates/pjr-question-template.md +11 -5
  289. package/docs/ja/specdojo/templates/pjr-risk-template.md +10 -4
  290. package/docs/ja/specdojo/templates/pjr-todo-template.md +10 -4
  291. package/docs/specdojo/schemas/v1/bdd.schema.yaml +1 -1
  292. package/docs/specdojo/schemas/v1/dct.schema.yaml +9 -0
  293. package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +24 -16
  294. package/docs/specdojo/schemas/v1/exec-common.schema.yaml +5 -1
  295. package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +1 -0
  296. package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +1 -1
  297. package/docs/specdojo/schemas/v1/gl.schema.yaml +8 -0
  298. package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +5 -1
  299. package/docs/specdojo/schemas/v1/pipeline-state.schema.yaml +2 -1
  300. package/docs/specdojo/schemas/v1/register-events.schema.yaml +21 -0
  301. package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +75 -3
  302. package/docs/specdojo/schemas/v1/rulebook-frontmatter.schema.yaml +5 -0
  303. package/docs/specdojo/schemas/v1/sch-strategy.schema.yaml +1 -0
  304. package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +43 -0
  305. package/package.json +4 -3
  306. package/templates/antigravity/orchestrator.md +16 -9
  307. package/templates/claude/agents/specdojo-orchestrator.md +16 -9
  308. package/templates/codex/agents/specdojo-orchestrator.toml +16 -9
  309. package/templates/codex/orchestrator.md +16 -9
  310. package/templates/copilot/README.md +2 -1
  311. package/templates/devcontainer/remote-host/specdojo-tmux.sh.sample +14 -8
  312. package/templates/opencode/agents/specdojo-orchestrator.md +16 -9
@@ -1,3 +1,4 @@
1
+ import { setRegisterInput } from "./input.js";
1
2
  import { randomInt, randomUUID } from "node:crypto";
2
3
  import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
3
4
  import { basename, dirname, join, resolve } from "node:path";
@@ -257,6 +258,7 @@ export function formatTableRow(item) {
257
258
  item.completed,
258
259
  item.conclusion,
259
260
  item.ticket,
261
+ item.dependsOn?.join(", ") || CELL_NONE,
260
262
  ]
261
263
  .map(toCell)
262
264
  .map(inlineCodeAnglePlaceholders);
@@ -361,12 +363,15 @@ export function buildRegisterItemContent(opts) {
361
363
  if (!isPlaceholderCell(opts.fields.description)) {
362
364
  content = setRegisterItemDescription(content, opts.fields.description);
363
365
  }
366
+ if (opts.fields.inputs !== undefined)
367
+ content = setRegisterInput(content, opts.fields.inputs);
364
368
  return applyRegisterItemFields(content, registerItemFieldsFromItem({
365
369
  id: opts.displayId,
366
370
  status: opts.fields.status,
367
371
  title: opts.fields.title,
368
372
  description: opts.fields.description,
369
373
  type: opts.fields.type,
374
+ ...(opts.fields.track ? { track: opts.fields.track } : {}),
370
375
  priority: opts.fields.priority,
371
376
  ...(opts.fields.difficulty ? { difficulty: opts.fields.difficulty } : {}),
372
377
  owner: opts.fields.owner,
@@ -381,5 +386,8 @@ export function buildRegisterItemContent(opts) {
381
386
  ...(opts.fields.targetRulebook ? { targetRulebook: opts.fields.targetRulebook } : {}),
382
387
  ...(opts.fields.sources ? { sources: opts.fields.sources } : {}),
383
388
  ...(opts.fields.derivedFrom ? { derivedFrom: opts.fields.derivedFrom } : {}),
389
+ ...(opts.fields.dependsOn ? { dependsOn: opts.fields.dependsOn } : {}),
390
+ ...(opts.fields.commitType ? { commitType: opts.fields.commitType } : {}),
391
+ ...(opts.fields.commitScope ? { commitScope: opts.fields.commitScope } : {}),
384
392
  }));
385
393
  }
@@ -1,14 +1,17 @@
1
+ import { normalizeRegisterInput } from "./input.js";
1
2
  import { existsSync, mkdirSync } from "node:fs";
2
3
  import { join } from "node:path";
3
4
  import { inlineCodeAnglePlaceholders } from "../shared/text.js";
4
5
  import { APPROACHES } from "../shared/agent-types.js";
5
6
  import { appendRegisterEvent, buildRegisterEvent, registerEventFilePath } from "./events.js";
6
7
  import { nowUtcTimestamp } from "./date.js";
7
- import { CELL_NONE, CELL_TODO, REMOVE_REGISTER_ITEM_FIELD, VALID_PRIORITIES, VALID_DIFFICULTIES, VALID_STATUSES, VALID_TYPES, } from "./item.js";
8
+ import { readRegisterItemContent, CELL_NONE, CELL_TODO, REMOVE_REGISTER_ITEM_FIELD, VALID_PRIORITIES, VALID_DIFFICULTIES, VALID_STATUSES, VALID_TYPES, VALID_COMMIT_TYPES, COMMIT_SCOPE_RE, } from "./item.js";
8
9
  import { resolveSpecdojoTemplatePath } from "../docs/template-resolution.js";
9
10
  import { validateRegisterApproachTargetsForProject } from "./approach.js";
11
+ import { normalizeDependsOn, validateRegisterDependencies } from "./dependency.js";
10
12
  import { normalizeDerivedFrom, validateDerivedFrom } from "./derivation.js";
11
13
  import { delegateExternalRegisterAdd } from "./external-project.js";
14
+ import { validateRegisterTrack } from "./epic.js";
12
15
  import { isAuthoringApproach } from "../kata/authoring.js";
13
16
  function collectTarget(value, previous = []) {
14
17
  return [...previous, value];
@@ -72,7 +75,9 @@ export function registerCreateCommands(reg, dependencies) {
72
75
  const addCmd = reg.command("add").description("Add a new item to pjr-index.md");
73
76
  addProjectOption(addCmd);
74
77
  addCmd.requiredOption("--type <type>", `Item type: ${VALID_TYPES.join(" | ")}`);
78
+ addCmd.option("--track <track>", "Track governed by an epic (required for epic)");
75
79
  addCmd.requiredOption("--title <title>", "Short title for the item");
80
+ addCmd.option("--input <text>", "Premise recorded in the ticket (repeatable)", collectTarget);
76
81
  addCmd.option("--description <text>", "Description shown in the list", "_TODO_");
77
82
  addCmd.option("--priority <priority>", `Priority: ${VALID_PRIORITIES.join(" | ")}`, "medium");
78
83
  addCmd.option("--difficulty <difficulty>", `Difficulty: ${VALID_DIFFICULTIES.join(" | ")}`);
@@ -85,9 +90,12 @@ export function registerCreateCommands(reg, dependencies) {
85
90
  addCmd.option("--target-path <path>", "Repository-relative deliverable file path");
86
91
  addCmd.option("--target-rulebook <doc-id>", "Deliverable rulebook id (new id for bootstrap)");
87
92
  addCmd.option("--approach <approach>", `Execution approach: ${APPROACHES.join(" | ")}`);
88
- addCmd.option("--target <doc-id>", "Target document id (repeatable; authoring accepts legacy exemplar targets after the first)", collectTarget);
93
+ addCmd.option("--target <target>", "Document id, domain:<id> for catalog-planning, or track:<id> for strategy-planning (repeatable)", collectTarget);
89
94
  addCmd.option("--source <ref>", "Read-only exemplar for *-authoring (repeatable: doc id, path, or <repo>:<path>)", collectTarget);
90
95
  addCmd.option("--from <item-id>", "Register item this item derives from (repeatable)", collectTarget);
96
+ addCmd.option("--depends-on <item-id>", "Predecessor item ID (repeatable; use - to remove)", collectTarget);
97
+ addCmd.option("--commit-type <type>", `Conventional Commits type: ${VALID_COMMIT_TYPES.join(" | ")}`);
98
+ addCmd.option("--commit-scope <scope>", "Conventional Commits scope");
91
99
  addCmd.option("--id <id>", "Display ID (e.g., PJR-0061); auto-incremented if omitted");
92
100
  addCmd.option("--topic <topic>", "Topic slug for ticket filename; derived from --title if omitted");
93
101
  addCmd.option("--by <actor>", "Actor recorded in the append-only register event");
@@ -117,6 +125,14 @@ export function registerCreateCommands(reg, dependencies) {
117
125
  !VALID_DIFFICULTIES.includes(opts.difficulty)) {
118
126
  throw new Error(`Invalid difficulty: "${opts.difficulty}". Must be one of: ${VALID_DIFFICULTIES.join(", ")}`);
119
127
  }
128
+ if (opts.commitType !== undefined &&
129
+ !VALID_COMMIT_TYPES.includes(opts.commitType)) {
130
+ throw new Error(`Invalid commit type: "${opts.commitType}". Must be one of: ${VALID_COMMIT_TYPES.join(", ")}`);
131
+ }
132
+ const commitScope = opts.commitScope?.trim();
133
+ if (commitScope !== undefined && !COMMIT_SCOPE_RE.test(commitScope)) {
134
+ throw new Error(`Invalid commit scope: "${commitScope}". Must match ${COMMIT_SCOPE_RE}`);
135
+ }
120
136
  if (opts.target?.some((target) => target.trim() === "-")) {
121
137
  throw new Error("--target - is only valid with register update");
122
138
  }
@@ -139,10 +155,14 @@ export function registerCreateCommands(reg, dependencies) {
139
155
  ...(explicitSources !== undefined ? { sources: explicitSources } : {}),
140
156
  validateTargetsWithoutApproach: opts.target !== undefined || opts.source !== undefined,
141
157
  });
158
+ const track = opts.track?.trim();
159
+ validateRegisterTrack(paths.projectId, opts.type, track);
142
160
  const fields = {
161
+ ...(track !== undefined ? { track } : {}),
143
162
  type: opts.type,
144
163
  title: opts.title,
145
164
  description: opts.description,
165
+ inputs: normalizeRegisterInput(opts.input),
146
166
  priority: opts.priority,
147
167
  ...(opts.difficulty !== undefined ? { difficulty: opts.difficulty } : {}),
148
168
  status: opts.status,
@@ -158,6 +178,8 @@ export function registerCreateCommands(reg, dependencies) {
158
178
  ? { targetRulebook: opts.targetRulebook.trim() }
159
179
  : {}),
160
180
  ...(sources !== undefined ? { sources } : {}),
181
+ ...(opts.commitType !== undefined ? { commitType: opts.commitType } : {}),
182
+ ...(commitScope !== undefined ? { commitScope } : {}),
161
183
  };
162
184
  const templatePath = resolveSpecdojoTemplatePath(`pjr-${opts.type}-template.md`);
163
185
  const { assignedId: displayId, ticketFilename } = planRegisterItem({
@@ -174,6 +196,7 @@ export function registerCreateCommands(reg, dependencies) {
174
196
  });
175
197
  if (derivedFrom !== undefined)
176
198
  fields.derivedFrom = derivedFrom;
199
+ fields.dependsOn = normalizeDependsOn(opts.dependsOn);
177
200
  const ticketPath = join(paths.projectRegisterPath, ticketFilename);
178
201
  const content = buildRegisterItemContent({
179
202
  projectId: paths.projectId,
@@ -182,6 +205,10 @@ export function registerCreateCommands(reg, dependencies) {
182
205
  fields,
183
206
  templatePath,
184
207
  });
208
+ const dependencyItem = readRegisterItemContent(content, ticketFilename)?.item;
209
+ if (!dependencyItem)
210
+ throw new Error(`Failed to read item ${displayId}`);
211
+ validateRegisterDependencies(paths, dependencyItem);
185
212
  const addEvent = buildRegisterEvent({
186
213
  afterContent: content,
187
214
  filename: ticketFilename,
@@ -230,6 +257,7 @@ export function registerUpdateCommand(reg, dependencies) {
230
257
  const updateCmd = reg.command("update").description("Update fields of a register item");
231
258
  addProjectOption(updateCmd);
232
259
  updateCmd.requiredOption("--id <id>", "Item ID (PJR-XXXX)");
260
+ updateCmd.option("--track <track>", "Replace the track governed by an epic");
233
261
  updateCmd.option("--title <title>", "Update title");
234
262
  updateCmd.option("--description <text>", "Update description");
235
263
  updateCmd.option("--priority <priority>", `Update priority: ${VALID_PRIORITIES.join(" | ")}`);
@@ -242,9 +270,13 @@ export function registerUpdateCommand(reg, dependencies) {
242
270
  updateCmd.option("--target-path <path>", "Replace deliverable path; use - to remove");
243
271
  updateCmd.option("--target-rulebook <doc-id>", "Replace deliverable rulebook id; use - to remove");
244
272
  updateCmd.option("--approach <approach>", `Update execution approach (${APPROACHES.join(" | ")}; use - to remove)`);
245
- updateCmd.option("--target <doc-id>", "Replace target document ids (repeatable; legacy authoring exemplars may follow; use - to remove)", collectTarget);
273
+ updateCmd.option("--target <target>", "Replace target document ids (repeatable; legacy authoring exemplars may follow; use - to remove)", collectTarget);
274
+ updateCmd.option("--input <text>", "Replace ticket premises (repeatable; use - to remove)", collectTarget);
246
275
  updateCmd.option("--source <ref>", "Replace read-only *-authoring exemplars (repeatable; use - to remove)", collectTarget);
247
276
  updateCmd.option("--from <item-id>", "Replace source register item IDs (repeatable; use - to remove)", collectTarget);
277
+ updateCmd.option("--depends-on <item-id>", "Replace predecessor IDs (repeatable; use - to remove)", collectTarget);
278
+ updateCmd.option("--commit-type <type>", `Update Conventional Commits type (${VALID_COMMIT_TYPES.join(" | ")}; use - to remove)`);
279
+ updateCmd.option("--commit-scope <scope>", "Update Conventional Commits scope; use - to remove");
248
280
  updateCmd.option("--topic <topic>", "Update the topic slug in the ticket filename and document ID");
249
281
  updateCmd.option("--by <actor>", "Actor recorded in the append-only register event");
250
282
  updateCmd.option("--reason <text>", "Reason recorded in the append-only register event");
@@ -256,6 +288,7 @@ export function registerUpdateCommand(reg, dependencies) {
256
288
  const view = loadItemForUpdate(paths, opts.id);
257
289
  const item = view.item;
258
290
  const hasUpdates = [
291
+ "track",
259
292
  "title",
260
293
  "description",
261
294
  "priority",
@@ -268,13 +301,17 @@ export function registerUpdateCommand(reg, dependencies) {
268
301
  "approach",
269
302
  "target",
270
303
  "source",
304
+ "input",
271
305
  "targetPath",
272
306
  "targetRulebook",
273
307
  "from",
308
+ "dependsOn",
309
+ "commitType",
310
+ "commitScope",
274
311
  "topic",
275
312
  ].some((key) => opts[key] !== undefined);
276
313
  if (!hasUpdates) {
277
- throw new Error("At least one field option must be specified (--title, --description, --priority, --difficulty, --owner, --due, --conclusion, --block-reason, --autopilot, --approach, --target, --source, --from, --topic)");
314
+ throw new Error("At least one field option must be specified (--track, --title, --description, --priority, --difficulty, --owner, --due, --conclusion, --block-reason, --autopilot, --approach, --target, --source, --input, --from, --depends-on, --commit-type, --commit-scope, --topic)");
278
315
  }
279
316
  if (opts.priority !== undefined &&
280
317
  !VALID_PRIORITIES.includes(opts.priority)) {
@@ -288,6 +325,15 @@ export function registerUpdateCommand(reg, dependencies) {
288
325
  if (opts.due !== undefined && !/^(\d{4}-\d{2}-\d{2}|-|_TODO_)$/.test(opts.due)) {
289
326
  throw new Error(`Invalid due: "${opts.due}". Must be YYYY-MM-DD, -, or _TODO_`);
290
327
  }
328
+ if (opts.commitType !== undefined &&
329
+ opts.commitType !== "-" &&
330
+ !VALID_COMMIT_TYPES.includes(opts.commitType)) {
331
+ throw new Error(`Invalid commit type: "${opts.commitType}". Must be one of: ${VALID_COMMIT_TYPES.join(", ")}, -`);
332
+ }
333
+ const commitScope = opts.commitScope?.trim();
334
+ if (commitScope !== undefined && commitScope !== "-" && !COMMIT_SCOPE_RE.test(commitScope)) {
335
+ throw new Error(`Invalid commit scope: "${commitScope}". Must match ${COMMIT_SCOPE_RE}, or -`);
336
+ }
291
337
  const topic = opts.topic?.trim();
292
338
  if (topic !== undefined && !registerTopicPattern.test(topic)) {
293
339
  throw new Error(`Invalid topic: "${topic}". Must use lowercase letters, numbers, and single hyphens`);
@@ -357,6 +403,8 @@ export function registerUpdateCommand(reg, dependencies) {
357
403
  ? explicitSources
358
404
  : item.sources;
359
405
  const normalizedNextSources = nextSources && nextSources.length > 0 ? nextSources : undefined;
406
+ const nextDependsOn = opts.dependsOn === undefined ? item.dependsOn : normalizeDependsOn(opts.dependsOn);
407
+ validateRegisterDependencies(paths, { ...item, dependsOn: nextDependsOn });
360
408
  const nextDerivedFrom = opts.from === undefined
361
409
  ? item.derivedFrom
362
410
  : normalizeDerivedFrom(opts.from, { allowRemove: true });
@@ -384,6 +432,9 @@ export function registerUpdateCommand(reg, dependencies) {
384
432
  (authoring && opts.source !== undefined && (item.targets?.length ?? 0) > 1);
385
433
  const shouldUpdateSources = opts.source !== undefined || (authoring && providedLegacySources.length > 0);
386
434
  const approachTargetUpdates = {
435
+ ...(opts.dependsOn !== undefined
436
+ ? { depends_on: nextDependsOn ?? REMOVE_REGISTER_ITEM_FIELD }
437
+ : {}),
387
438
  ...(opts.targetPath !== undefined
388
439
  ? { target_path: nextTargetPath ?? REMOVE_REGISTER_ITEM_FIELD }
389
440
  : {}),
@@ -415,9 +466,24 @@ export function registerUpdateCommand(reg, dependencies) {
415
466
  derived_from: nextDerivedFrom ?? REMOVE_REGISTER_ITEM_FIELD,
416
467
  }
417
468
  : {}),
469
+ ...(opts.commitType !== undefined
470
+ ? {
471
+ commit_type: opts.commitType === "-" ? REMOVE_REGISTER_ITEM_FIELD : opts.commitType,
472
+ }
473
+ : {}),
474
+ ...(commitScope !== undefined
475
+ ? {
476
+ commit_scope: commitScope === "-" ? REMOVE_REGISTER_ITEM_FIELD : commitScope,
477
+ }
478
+ : {}),
418
479
  };
480
+ const track = opts.track === undefined ? item.track : opts.track.trim();
481
+ validateRegisterTrack(paths.projectId, item.type, track);
482
+ const inputs = normalizeRegisterInput(opts.input, true);
419
483
  const updated = {
420
484
  ...item,
485
+ ...(inputs !== undefined ? { inputs } : {}),
486
+ ...(track !== undefined ? { track } : {}),
421
487
  ...(opts.title !== undefined ? { title: opts.title } : {}),
422
488
  ...(opts.description !== undefined ? { description: opts.description } : {}),
423
489
  ...(opts.priority !== undefined ? { priority: opts.priority } : {}),
@@ -427,9 +493,17 @@ export function registerUpdateCommand(reg, dependencies) {
427
493
  ...(opts.owner !== undefined ? { owner: opts.owner } : {}),
428
494
  ...(opts.due !== undefined ? { due: opts.due } : {}),
429
495
  ...(opts.conclusion !== undefined ? { conclusion: opts.conclusion } : {}),
496
+ ...(opts.commitType !== undefined && opts.commitType !== "-"
497
+ ? { commitType: opts.commitType }
498
+ : {}),
499
+ ...(commitScope !== undefined && commitScope !== "-" ? { commitScope } : {}),
430
500
  };
431
501
  if (opts.difficulty === "-")
432
502
  delete updated.difficulty;
503
+ if (opts.commitType === "-")
504
+ delete updated.commitType;
505
+ if (commitScope === "-")
506
+ delete updated.commitScope;
433
507
  if (opts.autopilot !== undefined) {
434
508
  if (opts.autopilot === "-")
435
509
  delete updated.autopilot;
@@ -472,6 +546,12 @@ export function registerUpdateCommand(reg, dependencies) {
472
546
  else
473
547
  updated.derivedFrom = nextDerivedFrom;
474
548
  }
549
+ if (opts.dependsOn !== undefined) {
550
+ if (nextDependsOn === undefined)
551
+ delete updated.dependsOn;
552
+ else
553
+ updated.dependsOn = nextDependsOn;
554
+ }
475
555
  const currentTopic = view.ticketFilename
476
556
  ? ticketTopicFromFilename(opts.id, view.ticketFilename)
477
557
  : undefined;
@@ -487,6 +567,7 @@ export function registerUpdateCommand(reg, dependencies) {
487
567
  id: opts.id,
488
568
  topic,
489
569
  updated,
570
+ ...(inputs !== undefined ? { inputs } : {}),
490
571
  dryRun: opts.dryRun,
491
572
  ...(blockReasonUpdates ||
492
573
  autopilotUpdates ||
@@ -511,6 +592,7 @@ export function registerUpdateCommand(reg, dependencies) {
511
592
  paths,
512
593
  view,
513
594
  updated,
595
+ ...(inputs !== undefined ? { inputs } : {}),
514
596
  dryRun: opts.dryRun,
515
597
  action: "fields updated",
516
598
  ...(opts.title !== undefined ? { title: opts.title } : {}),
@@ -10,6 +10,7 @@ import { loadConfig } from "../shared/specdojo-config.js";
10
10
  import { parsePracticeId } from "../shared/practice-id.js";
11
11
  import { load } from "../shared/yaml.js";
12
12
  export const CATALOG_LESS_APPROACHES = [
13
+ "draft",
13
14
  "fully-guided",
14
15
  "recipe-guided",
15
16
  "freeform",
@@ -47,6 +48,28 @@ export function validateDeliverablePath(root, value) {
47
48
  }
48
49
  return path;
49
50
  }
51
+ export function validateDeliverableTargetPath(repoRoot, targetId, targetPath, docIndexEntries) {
52
+ const entries = docIndexEntries ?? collectDocIndexEntries(resolve(repoRoot, "docs"), repoRoot);
53
+ const indexed = entries[targetId]?.replace(/:\d+$/, "");
54
+ const indexedPath = indexed ? relative(repoRoot, resolve(repoRoot, indexed)) : undefined;
55
+ if (!targetPath && !indexedPath) {
56
+ throw new Error(`Target ${targetId} is not indexed; specify --target-path and --target-rulebook (catalog_path is not configured)`);
57
+ }
58
+ const path = validateDeliverablePath(repoRoot, targetPath ?? indexedPath ?? "");
59
+ if (indexedPath && path !== validateDeliverablePath(repoRoot, indexedPath)) {
60
+ throw new Error(`--target-path conflicts with the indexed document ${targetId}: ${indexedPath}`);
61
+ }
62
+ const absolute = resolve(repoRoot, path);
63
+ const existing = existsSync(absolute);
64
+ const fm = existing ? metadata(absolute) : {};
65
+ if (existing && fm.id !== targetId) {
66
+ throw new Error(`--target-path is occupied by another document: ${path} (expected ${targetId})`);
67
+ }
68
+ if (AUTHORING_KINDS.includes(fm.type)) {
69
+ throw new Error(`Target ${targetId} is a kata, not a deliverable`);
70
+ }
71
+ return path;
72
+ }
50
73
  export function resolveRegisterDeliverableTarget(opts) {
51
74
  if (opts.catalogPath) {
52
75
  try {
@@ -65,26 +88,10 @@ export function resolveRegisterDeliverableTarget(opts) {
65
88
  throw new Error(`Approach "${opts.approach}" requires a deliverable target from the project catalog (catalog_path)`);
66
89
  }
67
90
  const entries = collectDocIndexEntries(resolve(opts.repoRoot, "docs"), opts.repoRoot);
68
- const indexed = entries[opts.targetId]?.replace(/:\d+$/, "");
69
- const indexedPath = indexed
70
- ? relative(opts.repoRoot, resolve(opts.repoRoot, indexed))
71
- : undefined;
72
- if (!opts.targetPath && !indexedPath) {
73
- throw new Error(`Target ${opts.targetId} is not indexed; specify --target-path and --target-rulebook (catalog_path is not configured)`);
74
- }
75
- const path = validateDeliverablePath(opts.repoRoot, opts.targetPath ?? indexedPath ?? "");
76
- if (indexedPath && path !== validateDeliverablePath(opts.repoRoot, indexedPath)) {
77
- throw new Error(`--target-path conflicts with the indexed document ${opts.targetId}: ${indexedPath}`);
78
- }
91
+ const path = validateDeliverableTargetPath(opts.repoRoot, opts.targetId, opts.targetPath, entries);
79
92
  const absolute = resolve(opts.repoRoot, path);
80
93
  const existing = existsSync(absolute);
81
94
  const fm = existing ? metadata(absolute) : {};
82
- if (existing && fm.id !== opts.targetId) {
83
- throw new Error(`--target-path is occupied by another document: ${path} (expected ${opts.targetId})`);
84
- }
85
- if (AUTHORING_KINDS.includes(fm.type)) {
86
- throw new Error(`Target ${opts.targetId} is a kata, not a deliverable`);
87
- }
88
95
  const declaredRulebook = typeof fm.rulebook === "string" ? fm.rulebook : undefined;
89
96
  if (opts.targetRulebook && declaredRulebook && opts.targetRulebook !== declaredRulebook) {
90
97
  throw new Error(`--target-rulebook conflicts with specdojo.rulebook of ${opts.targetId}: ${declaredRulebook}`);
@@ -0,0 +1,123 @@
1
+ import { basename } from "node:path";
2
+ import { gitOutput, gitResult } from "../shared/git.js";
3
+ import { getProjectRegisterPath, loadConfig, specdojoRootDir } from "../shared/specdojo-config.js";
4
+ import { resolveProjectIntegrationBranch } from "./cross-project.js";
5
+ import { parseRegisterItemRef } from "./derivation.js";
6
+ import { loadRegisterItemDocs, readRegisterItemContent } from "./item.js";
7
+ export function normalizeDependsOn(values) {
8
+ if (values === undefined)
9
+ return undefined;
10
+ const refs = [...new Set(values.map((value) => value.trim()).filter(Boolean))];
11
+ if (refs.includes("-")) {
12
+ if (refs.length !== 1)
13
+ throw new Error("--depends-on - cannot be combined with other item IDs");
14
+ return undefined;
15
+ }
16
+ if (refs.length === 0)
17
+ throw new Error("--depends-on must contain a register item ID");
18
+ return refs;
19
+ }
20
+ // Each operation gets a fresh snapshot. Other projects are read from the same local
21
+ // integration branches used to verify derived_from, never from unrelated worktrees.
22
+ function dependencyGraph(paths, replacement) {
23
+ const projects = new Map();
24
+ const local = new Map(loadRegisterItemDocs(paths.projectRegisterPath).map((doc) => [doc.id, doc.item]));
25
+ if (replacement)
26
+ local.set(replacement.id, replacement);
27
+ projects.set(paths.projectId, local);
28
+ const projectItems = (projectId) => {
29
+ const cached = projects.get(projectId);
30
+ if (cached)
31
+ return cached;
32
+ const { config } = loadConfig();
33
+ const project = config?.projects[projectId];
34
+ if (!project)
35
+ throw new Error(`depends_on: unknown project ${projectId}`);
36
+ const registerPath = getProjectRegisterPath(project);
37
+ if (!registerPath)
38
+ throw new Error(`depends_on: project_register_path is not set for ${projectId}`);
39
+ const root = specdojoRootDir();
40
+ const branch = resolveProjectIntegrationBranch(projectId, project);
41
+ if (gitResult(root, ["show-ref", "--verify", "--quiet", `refs/heads/${branch}`]).status !== 0) {
42
+ throw new Error(`depends_on: integration branch does not exist locally: ${branch}`);
43
+ }
44
+ const files = gitOutput(root, [
45
+ "ls-tree",
46
+ "-r",
47
+ "--name-only",
48
+ branch,
49
+ "--",
50
+ registerPath.replaceAll("\\", "/"),
51
+ ]);
52
+ const items = new Map();
53
+ for (const file of files.split(/\r?\n/).filter(Boolean)) {
54
+ if (!/^pjr-[0-9a-z]{4}-.+\.md$/.test(basename(file)))
55
+ continue;
56
+ const parsed = readRegisterItemContent(gitOutput(root, ["show", `${branch}:${file}`]), basename(file));
57
+ if (parsed)
58
+ items.set(parsed.id, parsed.item);
59
+ }
60
+ projects.set(projectId, items);
61
+ return items;
62
+ };
63
+ const lookup = (ref, projectId) => {
64
+ const parsed = parseRegisterItemRef(ref, projectId);
65
+ if (!parsed)
66
+ throw new Error(`Invalid depends_on item ID: "${ref}". Use PJR-XXXX or <project-id>:PJR-XXXX`);
67
+ const item = projectItems(parsed.projectId).get(parsed.itemId);
68
+ if (!item)
69
+ throw new Error(`Depends-on item not found: ${ref} (searched configured project ${parsed.projectId})`);
70
+ return { ...parsed, key: `${parsed.projectId}:${parsed.itemId}`, item };
71
+ };
72
+ const visited = new Set();
73
+ const visiting = [];
74
+ const visit = (item, projectId) => {
75
+ const key = `${projectId}:${item.id}`;
76
+ if (visiting.includes(key))
77
+ throw new Error(`depends_on cycle: ${[...visiting, key].join(" -> ")}`);
78
+ if (visited.has(key))
79
+ return;
80
+ visiting.push(key);
81
+ for (const ref of item.dependsOn ?? []) {
82
+ const target = lookup(ref, projectId);
83
+ if (target.key === key)
84
+ throw new Error(`Item ${key} cannot depend on itself`);
85
+ visit(target.item, target.projectId);
86
+ }
87
+ visiting.pop();
88
+ visited.add(key);
89
+ };
90
+ return { local, lookup, visit };
91
+ }
92
+ export function validateRegisterDependencies(paths, replacement) {
93
+ const graph = dependencyGraph(paths, replacement);
94
+ for (const item of graph.local.values())
95
+ graph.visit(item, paths.projectId);
96
+ }
97
+ export function validateRegisterDependencyDocs(paths) {
98
+ try {
99
+ validateRegisterDependencies(paths);
100
+ return [];
101
+ }
102
+ catch (error) {
103
+ return [error instanceof Error ? error.message : String(error)];
104
+ }
105
+ }
106
+ export function registerDependencyBlockReason(paths, item) {
107
+ if (!item.dependsOn?.length)
108
+ return undefined;
109
+ try {
110
+ const graph = dependencyGraph(paths, item);
111
+ graph.visit(item, paths.projectId);
112
+ const pending = item.dependsOn.flatMap((ref) => {
113
+ const target = graph.lookup(ref, paths.projectId);
114
+ return ["done", "decided"].includes(target.item.status)
115
+ ? []
116
+ : [`${ref} (${target.item.status})`];
117
+ });
118
+ return pending.length ? `Unfinished depends_on: ${pending.join(", ")}` : undefined;
119
+ }
120
+ catch (error) {
121
+ return error instanceof Error ? error.message : String(error);
122
+ }
123
+ }
@@ -147,11 +147,11 @@ function configuredExternalRegisterDirectories(paths) {
147
147
  return existsSync(absolutePath) ? [{ projectId, registerPath: absolutePath }] : [];
148
148
  });
149
149
  }
150
- export function collectDerivedRegisterRelations(paths, currentItems) {
150
+ export function collectDerivedRegisterRelations(paths, currentItems, relationField = "derivedFrom") {
151
151
  const relations = [];
152
152
  const collect = (projectId, items) => {
153
153
  for (const item of items) {
154
- for (const ref of item.item.derivedFrom ?? []) {
154
+ for (const ref of item.item[relationField] ?? []) {
155
155
  const source = parseRegisterItemRef(ref, projectId);
156
156
  if (!source || source.projectId !== paths.projectId)
157
157
  continue;
@@ -0,0 +1,42 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join, resolve } from "node:path";
3
+ import { getProjectTimelinePath, loadConfig, specdojoRootDir } from "../shared/specdojo-config.js";
4
+ import { loadTimelineIndex } from "../shared/timeline-index.js";
5
+ import { loadRegisterItemDocs } from "./item.js";
6
+ // track は epic の担当単位。timeline がない project でも同じ形式の識別子を保持する。
7
+ export function validateRegisterTrack(projectId, itemType, track) {
8
+ if (itemType !== "epic") {
9
+ if (track !== undefined)
10
+ throw new Error("--track is only valid for epic items");
11
+ return;
12
+ }
13
+ if (!track || !/^[a-z0-9][a-z0-9-]*$/.test(track)) {
14
+ throw new Error("An epic requires --track with a lowercase track identifier");
15
+ }
16
+ const { config } = loadConfig();
17
+ const project = config?.projects[projectId];
18
+ if (!project)
19
+ throw new Error(`Cannot validate epic track: unknown project ${projectId}`);
20
+ const indexPath = resolve(specdojoRootDir(), getProjectTimelinePath(project), "tml-index.yaml");
21
+ if (!existsSync(indexPath))
22
+ return;
23
+ const { index, errors } = loadTimelineIndex(indexPath);
24
+ if (errors.length > 0)
25
+ throw new Error(`${indexPath}: ${errors.join("; ")}`);
26
+ if (!index.tracks.some((entry) => entry.track === track)) {
27
+ throw new Error(`Undefined epic track "${track}" in ${indexPath}`);
28
+ }
29
+ }
30
+ export function validateRegisterEpicDocs(paths) {
31
+ return loadRegisterItemDocs(paths.projectRegisterPath).flatMap((doc) => {
32
+ try {
33
+ validateRegisterTrack(paths.projectId, doc.item.type, doc.item.track);
34
+ return [];
35
+ }
36
+ catch (error) {
37
+ return [
38
+ `${join(paths.projectRegisterPath, doc.filename)}: ${error instanceof Error ? error.message : String(error)}`,
39
+ ];
40
+ }
41
+ });
42
+ }
@@ -125,6 +125,8 @@ function fieldUpdateFromChange(change) {
125
125
  switch (change.field) {
126
126
  case "type":
127
127
  return isUnset ? undefined : { item_type: value };
128
+ case "track":
129
+ return { track: isUnset ? REMOVE_REGISTER_ITEM_FIELD : value };
128
130
  case "priority":
129
131
  return isUnset ? undefined : { priority: value };
130
132
  case "difficulty":
@@ -158,13 +160,14 @@ function fieldUpdateFromChange(change) {
158
160
  return undefined;
159
161
  }
160
162
  }
163
+ case "depends_on":
161
164
  case "derived_from": {
162
165
  if (isUnset)
163
- return { derived_from: REMOVE_REGISTER_ITEM_FIELD };
166
+ return { [change.field]: REMOVE_REGISTER_ITEM_FIELD };
164
167
  try {
165
168
  const parsed = JSON.parse(value);
166
169
  return Array.isArray(parsed) && parsed.every((ref) => typeof ref === "string")
167
- ? { derived_from: parsed }
170
+ ? { [change.field]: parsed }
168
171
  : undefined;
169
172
  }
170
173
  catch {
@@ -177,6 +180,10 @@ function fieldUpdateFromChange(change) {
177
180
  : value === "approved"
178
181
  ? { autopilot: "approved" }
179
182
  : undefined;
183
+ case "commit_type":
184
+ return isUnset ? { commit_type: REMOVE_REGISTER_ITEM_FIELD } : { commit_type: value };
185
+ case "commit_scope":
186
+ return isUnset ? { commit_scope: REMOVE_REGISTER_ITEM_FIELD } : { commit_scope: value };
180
187
  default:
181
188
  return undefined;
182
189
  }
@@ -12,7 +12,9 @@ export const REGISTER_EVENT_FIELDS = [
12
12
  "status",
13
13
  "title",
14
14
  "description",
15
+ "input",
15
16
  "type",
17
+ "track",
16
18
  "priority",
17
19
  "difficulty",
18
20
  "owner",
@@ -27,7 +29,10 @@ export const REGISTER_EVENT_FIELDS = [
27
29
  "target_path",
28
30
  "target_rulebook",
29
31
  "derived_from",
32
+ "depends_on",
30
33
  "autopilot",
34
+ "commit_type",
35
+ "commit_scope",
31
36
  ];
32
37
  export const REGISTER_EVENT_ACTIONS = [
33
38
  "add",
@@ -68,7 +73,9 @@ export function registerEventFieldValues(content, filename, timeZone) {
68
73
  status: item.status,
69
74
  title: item.title,
70
75
  description: item.description,
76
+ input: item.inputs?.length ? JSON.stringify(item.inputs) : CELL_NONE,
71
77
  type: item.type,
78
+ track: item.track ?? CELL_NONE,
72
79
  priority: item.priority,
73
80
  difficulty: item.difficulty ?? CELL_NONE,
74
81
  owner: item.owner,
@@ -83,7 +90,10 @@ export function registerEventFieldValues(content, filename, timeZone) {
83
90
  target_rulebook: item.targetRulebook ?? CELL_NONE,
84
91
  sources: item.sources ? JSON.stringify(item.sources) : CELL_NONE,
85
92
  derived_from: item.derivedFrom ? JSON.stringify(item.derivedFrom) : CELL_NONE,
93
+ depends_on: item.dependsOn ? JSON.stringify(item.dependsOn) : CELL_NONE,
86
94
  autopilot: item.autopilot ?? CELL_NONE,
95
+ commit_type: item.commitType ?? CELL_NONE,
96
+ commit_scope: item.commitScope ?? CELL_NONE,
87
97
  };
88
98
  }
89
99
  function isUnsetFieldValue(value) {
@@ -40,9 +40,12 @@ export function buildExternalRegisterAddArgs(alias, externalProject, opts) {
40
40
  "--conclusion",
41
41
  opts.conclusion,
42
42
  ];
43
+ addValue(args, "--track", opts.track);
43
44
  addValue(args, "--difficulty", opts.difficulty);
44
45
  addValue(args, "--registered", opts.registered);
45
46
  addValue(args, "--approach", opts.approach);
47
+ for (const input of opts.input ?? [])
48
+ addValue(args, "--input", input);
46
49
  for (const target of opts.target ?? [])
47
50
  addValue(args, "--target", target);
48
51
  for (const source of opts.source ?? [])
@@ -50,6 +53,9 @@ export function buildExternalRegisterAddArgs(alias, externalProject, opts) {
50
53
  for (const source of opts.from ?? []) {
51
54
  addValue(args, "--from", rewriteExternalDerivedFrom(source, alias, externalProject.project_id));
52
55
  }
56
+ for (const predecessor of opts.dependsOn ?? []) {
57
+ addValue(args, "--depends-on", rewriteExternalDerivedFrom(predecessor, alias, externalProject.project_id));
58
+ }
53
59
  addValue(args, "--id", opts.id);
54
60
  addValue(args, "--topic", opts.topic);
55
61
  addValue(args, "--by", opts.by);