specdojo 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/.github/agents/specdojo-orchestrator.md +3 -2
  2. package/CHANGELOG.md +153 -0
  3. package/dist/catalog/build.js +24 -1
  4. package/dist/catalog/plan.js +1 -1
  5. package/dist/catalog/scaffold.js +4 -1
  6. package/dist/commands/init.js +5 -1
  7. package/dist/commands/night-orchestrator.js +6 -4
  8. package/dist/dashboard/dashboard-timeline.js +18 -16
  9. package/dist/dashboard/dashboard.js +612 -259
  10. package/dist/dashboard/epic-plan.js +81 -0
  11. package/dist/dashboard/exec-records.js +16 -20
  12. package/dist/dashboard/routines.js +8 -6
  13. package/dist/dashboard/timeline-build.js +5 -9
  14. package/dist/dashboard/timeline.js +9 -4
  15. package/dist/devcontainer/scaffold.js +18 -0
  16. package/dist/docs/frontmatter-namespace.js +1 -48
  17. package/dist/docs/yaml-pages.js +125 -3
  18. package/dist/exec/agent-config.js +22 -0
  19. package/dist/exec/agent-plan.js +3 -2
  20. package/dist/exec/commands.js +69 -21
  21. package/dist/exec/commit-hook-skips.js +78 -0
  22. package/dist/exec/core.js +19 -7
  23. package/dist/exec/events.js +159 -8
  24. package/dist/exec/evidence.js +64 -16
  25. package/dist/exec/handoff.js +9 -13
  26. package/dist/exec/limit.js +1 -1
  27. package/dist/exec/mechanical-result.js +45 -0
  28. package/dist/exec/migrate-records.js +249 -0
  29. package/dist/exec/parent-validation.js +153 -12
  30. package/dist/exec/pipeline-state.js +27 -5
  31. package/dist/exec/plans-condense-findings.js +89 -0
  32. package/dist/exec/plans-core.js +24 -17
  33. package/dist/exec/plans-generation.js +48 -25
  34. package/dist/exec/plans-grade-findings.js +8 -3
  35. package/dist/exec/plans-kata-findings.js +61 -0
  36. package/dist/exec/plans-planning.js +3 -3
  37. package/dist/exec/plans-storage.js +12 -24
  38. package/dist/exec/register-resume.js +55 -56
  39. package/dist/exec/register.js +26 -22
  40. package/dist/exec/repo-integration-sync.js +8 -4
  41. package/dist/exec/repo-integration.js +21 -1
  42. package/dist/exec/reporter.js +121 -23
  43. package/dist/exec/results.js +85 -24
  44. package/dist/exec/review-completion.js +47 -0
  45. package/dist/exec/review-kata.js +109 -0
  46. package/dist/exec/run/agent-pipeline.js +75 -6
  47. package/dist/exec/run/agent.js +20 -7
  48. package/dist/exec/run/in-place.js +69 -32
  49. package/dist/exec/run/job.js +81 -24
  50. package/dist/exec/run/lifecycle-commands.js +188 -36
  51. package/dist/exec/run/mode-shared.js +11 -3
  52. package/dist/exec/run/register-command.js +6 -10
  53. package/dist/exec/run/register-core.js +20 -13
  54. package/dist/exec/run/register-mode.js +12 -12
  55. package/dist/exec/run/register-post-review.js +21 -9
  56. package/dist/exec/run/register-resume.js +28 -18
  57. package/dist/exec/run/register-state.js +10 -7
  58. package/dist/exec/run/register-worktree.js +60 -30
  59. package/dist/exec/run/schedule-mode.js +4 -4
  60. package/dist/exec/run/schedule-prepare.js +201 -59
  61. package/dist/exec/run/schedule-task.js +129 -25
  62. package/dist/exec/run/shared.js +4 -3
  63. package/dist/exec/run/trailing-records.js +35 -0
  64. package/dist/exec/run-records.js +2 -0
  65. package/dist/exec/strategy.js +1 -0
  66. package/dist/exec/trailing-records.js +242 -0
  67. package/dist/exec/trial-commands.js +3 -2
  68. package/dist/exec/validate-records-commit.js +110 -0
  69. package/dist/exec/validate-records.js +148 -0
  70. package/dist/exec/worktree-command.js +29 -16
  71. package/dist/exec/worktree-ops-commit.js +119 -48
  72. package/dist/exec/worktree-ops-lifecycle.js +77 -48
  73. package/dist/exec/worktree-ops-merge.js +13 -2
  74. package/dist/exec/worktree-ops.js +2 -2
  75. package/dist/exec/worktree.js +19 -2
  76. package/dist/grade/apply.js +32 -6
  77. package/dist/grade/command-inspect.js +2 -2
  78. package/dist/grade/command-run.js +2 -0
  79. package/dist/grade/command-shared.js +1 -1
  80. package/dist/grade/core.js +18 -5
  81. package/dist/grade/markdown.js +3 -3
  82. package/dist/grade/pipeline-state.js +15 -11
  83. package/dist/grade/plan.js +37 -17
  84. package/dist/grade/result.js +3 -3
  85. package/dist/grade/run.js +23 -3
  86. package/dist/grade/target-discovery.js +17 -4
  87. package/dist/grade/targets.js +12 -11
  88. package/dist/job/job.js +31 -17
  89. package/dist/job/noop.js +104 -0
  90. package/dist/register/core.js +2 -0
  91. package/dist/register/create-commands.js +28 -3
  92. package/dist/register/deliverable-target.js +9 -1
  93. package/dist/register/epic.js +104 -26
  94. package/dist/register/event-merge.js +3 -0
  95. package/dist/register/events.js +4 -0
  96. package/dist/register/external-project.js +3 -0
  97. package/dist/register/item.js +6 -0
  98. package/dist/register/maintenance-commands.js +4 -1
  99. package/dist/register/planning.js +7 -14
  100. package/dist/register/register.js +43 -9
  101. package/dist/register/track-domains.js +34 -0
  102. package/dist/register/track-plan.js +78 -0
  103. package/dist/register/transition-commands.js +8 -0
  104. package/dist/register/work-table.js +64 -0
  105. package/dist/review/grade.js +35 -13
  106. package/dist/routine/definition.js +4 -3
  107. package/dist/routine/failure.js +30 -0
  108. package/dist/routine/routine.js +56 -32
  109. package/dist/routine/storage.js +33 -0
  110. package/dist/schedule/schedule.js +1 -0
  111. package/dist/schedule/strategy-generate-document.js +26 -14
  112. package/dist/schedule/strategy-generate-scope.js +17 -45
  113. package/dist/schedule/strategy-generate.js +33 -3
  114. package/dist/schedule/strategy-profiles.js +86 -12
  115. package/dist/shared/agent-types.js +2 -0
  116. package/dist/shared/condense-records.js +25 -0
  117. package/dist/shared/deprecation.js +8 -0
  118. package/dist/shared/document-metadata.js +20 -0
  119. package/dist/shared/finding-cause.js +20 -0
  120. package/dist/shared/frontmatter-namespace.js +48 -0
  121. package/dist/shared/git.js +142 -15
  122. package/dist/shared/grade-result.js +17 -1
  123. package/dist/shared/local-state.js +20 -0
  124. package/dist/shared/markdownlint-config.js +8 -3
  125. package/dist/shared/plan-conventions.js +129 -0
  126. package/dist/shared/plan-templates.js +57 -41
  127. package/dist/shared/run-records.js +224 -0
  128. package/dist/shared/specdojo-config.js +39 -21
  129. package/dist/shared/text.js +65 -5
  130. package/dist/shared/timeline-index.js +2 -0
  131. package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +9 -2
  132. package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +4 -74
  133. package/docs/ja/specdojo/exec-templates/xep-condense-template.md +50 -0
  134. package/docs/ja/specdojo/exec-templates/xep-draft-template.md +17 -5
  135. package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +16 -3
  136. package/docs/ja/specdojo/exec-templates/xep-recipe-guided-template.md +15 -5
  137. package/docs/ja/specdojo/exec-templates/xep-recipe-maintenance-template.md +6 -0
  138. package/docs/ja/specdojo/exec-templates/xep-register-template.md +1 -1
  139. package/docs/ja/specdojo/exec-templates/xep-rulebook-maintenance-template.md +6 -0
  140. package/docs/ja/specdojo/exec-templates/xep-sample-maintenance-template.md +6 -0
  141. package/docs/ja/specdojo/exec-templates/xep-template-maintenance-template.md +6 -0
  142. package/docs/ja/specdojo/exec-templates/xer-condense-template.md +25 -0
  143. package/docs/ja/specdojo/exec-templates/xp-common-conventions-template.md +50 -0
  144. package/docs/ja/specdojo/exec-templates/xrp-common-conventions-template.md +30 -0
  145. package/docs/ja/specdojo/guides/branch-workflow-guide.md +1 -1
  146. package/docs/ja/specdojo/guides/docs-editing-guide.md +12 -0
  147. package/docs/ja/specdojo/guides/docs-structure-guide.md +48 -15
  148. package/docs/ja/specdojo/guides/exec-config-guide.md +47 -16
  149. package/docs/ja/specdojo/guides/exec-operation-guide.md +53 -17
  150. package/docs/ja/specdojo/guides/exec-worktree-guide.md +20 -11
  151. package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +92 -55
  152. package/docs/ja/specdojo/guides/project-move-guide.md +381 -0
  153. package/docs/ja/specdojo/guides/quick-start-guide.md +70 -14
  154. package/docs/ja/specdojo/guides/register-operation-guide.md +25 -5
  155. package/docs/ja/specdojo/guides/remote-host-development-guide.md +2 -0
  156. package/docs/ja/specdojo/guides/review-guide.md +22 -19
  157. package/docs/ja/specdojo/guides/routine-operation-guide.md +14 -8
  158. package/docs/ja/specdojo/guides/ryu-guide.md +23 -13
  159. package/docs/ja/specdojo/guides/schedule-design-guide.md +7 -4
  160. package/docs/ja/specdojo/guides/schedule-operation-guide.md +27 -3
  161. package/docs/ja/specdojo/guides/specdojo-overview-guide.md +5 -4
  162. package/docs/ja/specdojo/guides/timeline-design-guide.md +27 -144
  163. package/docs/ja/specdojo/guides/use-case-guide.md +92 -155
  164. package/docs/ja/specdojo/recipes/bac-recipe.md +94 -0
  165. package/docs/ja/specdojo/recipes/bes-recipe.md +105 -0
  166. package/docs/ja/specdojo/recipes/br-recipe.md +84 -0
  167. package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +36 -24
  168. package/docs/ja/specdojo/recipes/cnd-recipe.md +125 -0
  169. package/docs/ja/specdojo/recipes/cpd-recipe.md +126 -0
  170. package/docs/ja/specdojo/recipes/cxd-recipe.md +145 -0
  171. package/docs/ja/specdojo/recipes/ifd-recipe.md +134 -0
  172. package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +135 -86
  173. package/docs/ja/specdojo/recipes/ifx-index-recipe.md +130 -0
  174. package/docs/ja/specdojo/recipes/pm-organization-recipe.md +29 -26
  175. package/docs/ja/specdojo/recipes/pm-plan-recipe.md +35 -26
  176. package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +38 -28
  177. package/docs/ja/specdojo/recipes/pm-raci-recipe.md +39 -31
  178. package/docs/ja/specdojo/recipes/pm-roles-recipe.md +26 -28
  179. package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +10 -8
  180. package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +18 -17
  181. package/docs/ja/specdojo/recipes/stsd-recipe.md +100 -62
  182. package/docs/ja/specdojo/recipes/sysd-critical-flows-recipe.md +106 -0
  183. package/docs/ja/specdojo/recipes/sysd-cross-cutting-policy-recipe.md +137 -0
  184. package/docs/ja/specdojo/recipes/sysd-index-recipe.md +122 -0
  185. package/docs/ja/specdojo/references/command-reference.md +79 -64
  186. package/docs/ja/specdojo/references/deliverables-reference.md +9 -4
  187. package/docs/ja/specdojo/references/directory-layout-reference.md +3 -2
  188. package/docs/ja/specdojo/references/specdojo-config-reference.md +17 -16
  189. package/docs/ja/specdojo/rulebooks/bac-rulebook.md +72 -290
  190. package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +212 -79
  191. package/docs/ja/specdojo/rulebooks/bds-rulebook.md +138 -154
  192. package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +147 -59
  193. package/docs/ja/specdojo/rulebooks/bes-rulebook.md +100 -96
  194. package/docs/ja/specdojo/rulebooks/br-rulebook.md +88 -108
  195. package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +126 -211
  196. package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +56 -35
  197. package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +102 -68
  198. package/docs/ja/specdojo/rulebooks/cdt-rulebook.md +152 -0
  199. package/docs/ja/specdojo/rulebooks/cld-rulebook.md +9 -184
  200. package/docs/ja/specdojo/rulebooks/clis-rulebook.md +187 -0
  201. package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +93 -247
  202. package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +104 -241
  203. package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +124 -257
  204. package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +87 -98
  205. package/docs/ja/specdojo/rulebooks/dct-rulebook.md +9 -7
  206. package/docs/ja/specdojo/rulebooks/dec-rulebook.md +2 -1
  207. package/docs/ja/specdojo/rulebooks/dss-rulebook.md +193 -0
  208. package/docs/ja/specdojo/rulebooks/gl-rulebook.md +100 -54
  209. package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +69 -252
  210. package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +91 -76
  211. package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +252 -226
  212. package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +118 -40
  213. package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +11 -11
  214. package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +9 -9
  215. package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +4 -4
  216. package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +11 -11
  217. package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +11 -11
  218. package/docs/ja/specdojo/rulebooks/mm-rulebook.md +4 -3
  219. package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +34 -29
  220. package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +8 -8
  221. package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +2 -2
  222. package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +50 -56
  223. package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +46 -55
  224. package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +57 -54
  225. package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +50 -65
  226. package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +2 -2
  227. package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +70 -97
  228. package/docs/ja/specdojo/rulebooks/pr-rulebook.md +2 -1
  229. package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +47 -56
  230. package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +61 -135
  231. package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +116 -32
  232. package/docs/ja/specdojo/rulebooks/sf-rulebook.md +118 -61
  233. package/docs/ja/specdojo/rulebooks/sld-rulebook.md +152 -57
  234. package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +51 -39
  235. package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +101 -46
  236. package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +72 -329
  237. package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +74 -263
  238. package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +78 -195
  239. package/docs/ja/specdojo/rulebooks/tml-rulebook.md +4 -9
  240. package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +3 -4
  241. package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +3 -3
  242. package/docs/ja/specdojo/rulebooks/uis-rulebook.md +140 -143
  243. package/docs/ja/specdojo/samples/bac-sample.md +106 -21
  244. package/docs/ja/specdojo/samples/bdd-sample.yaml +143 -35
  245. package/docs/ja/specdojo/samples/bds-sample.md +100 -21
  246. package/docs/ja/specdojo/samples/bes-index-sample.md +59 -20
  247. package/docs/ja/specdojo/samples/bes-sample.md +80 -21
  248. package/docs/ja/specdojo/samples/br-sample.md +68 -14
  249. package/docs/ja/specdojo/samples/ccd-sample.md +81 -19
  250. package/docs/ja/specdojo/samples/cdfd-sample.md +172 -99
  251. package/docs/ja/specdojo/samples/cdfd-uc-sample.md +9 -7
  252. package/docs/ja/specdojo/samples/cdsd-sample.md +89 -20
  253. package/docs/ja/specdojo/samples/cdt-sample.md +116 -0
  254. package/docs/ja/specdojo/samples/cld-sample.md +3 -30
  255. package/docs/ja/specdojo/samples/clis-sample.md +132 -0
  256. package/docs/ja/specdojo/samples/cnd-sample.md +127 -21
  257. package/docs/ja/specdojo/samples/cpd-sample.md +136 -22
  258. package/docs/ja/specdojo/samples/cxd-sample.md +108 -22
  259. package/docs/ja/specdojo/samples/dct-index-sample.yaml +63 -17
  260. package/docs/ja/specdojo/samples/dss-sample.md +175 -0
  261. package/docs/ja/specdojo/samples/gl-sample.yaml +50 -14
  262. package/docs/ja/specdojo/samples/ifd-sample.md +105 -21
  263. package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +91 -60
  264. package/docs/ja/specdojo/samples/ifx-file-sample.md +462 -21
  265. package/docs/ja/specdojo/samples/ifx-index-sample.yaml +87 -19
  266. package/docs/ja/specdojo/samples/pm-members-sample.yaml +37 -13
  267. package/docs/ja/specdojo/samples/pm-organization-sample.md +52 -20
  268. package/docs/ja/specdojo/samples/pm-plan-sample.md +84 -26
  269. package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +55 -22
  270. package/docs/ja/specdojo/samples/pm-raci-sample.md +69 -28
  271. package/docs/ja/specdojo/samples/pm-roles-sample.yaml +13 -12
  272. package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +50 -26
  273. package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +89 -62
  274. package/docs/ja/specdojo/samples/sf-index-sample.md +89 -20
  275. package/docs/ja/specdojo/samples/sf-sample.md +121 -21
  276. package/docs/ja/specdojo/samples/sld-sample.md +107 -21
  277. package/docs/ja/specdojo/samples/stsd-sample.md +54 -26
  278. package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +166 -21
  279. package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +178 -21
  280. package/docs/ja/specdojo/samples/sysd-index-sample.md +82 -21
  281. package/docs/ja/specdojo/samples/tml-sample.yaml +4 -1
  282. package/docs/ja/specdojo/samples/uis-sample.md +164 -20
  283. package/docs/ja/specdojo/standards/document-metadata-standard.md +33 -4
  284. package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +3 -1
  285. package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +1 -0
  286. package/docs/ja/specdojo/templates/bac-template.md +76 -0
  287. package/docs/ja/specdojo/templates/bes-template.md +56 -0
  288. package/docs/ja/specdojo/templates/br-template.md +64 -0
  289. package/docs/ja/specdojo/templates/cdfd-template.md +81 -54
  290. package/docs/ja/specdojo/templates/cdfd-uc-template.md +9 -5
  291. package/docs/ja/specdojo/templates/cnd-template.md +137 -0
  292. package/docs/ja/specdojo/templates/cpd-template.md +129 -0
  293. package/docs/ja/specdojo/templates/cxd-template.md +105 -0
  294. package/docs/ja/specdojo/templates/dct-data-model-cdt-template.yaml +40 -0
  295. package/docs/ja/specdojo/templates/dct-data-model-cld-template.yaml +7 -14
  296. package/docs/ja/specdojo/templates/dct-index-template.md +9 -20
  297. package/docs/ja/specdojo/templates/dct-project-management-template.yaml +5 -1
  298. package/docs/ja/specdojo/templates/ifd-template.md +86 -0
  299. package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +44 -28
  300. package/docs/ja/specdojo/templates/ifx-index-template.yaml +40 -0
  301. package/docs/ja/specdojo/templates/opr-template.md +2 -4
  302. package/docs/ja/specdojo/templates/pm-organization-template.md +9 -3
  303. package/docs/ja/specdojo/templates/pm-plan-template.md +4 -4
  304. package/docs/ja/specdojo/templates/pm-quality-management-plan-template.md +17 -9
  305. package/docs/ja/specdojo/templates/pm-raci-template.md +24 -13
  306. package/docs/ja/specdojo/templates/pm-roles-template.yaml +3 -2
  307. package/docs/ja/specdojo/templates/prj-assumptions-constraints-dependencies-template.md +6 -3
  308. package/docs/ja/specdojo/templates/prj-comparison-of-alternatives-template.md +22 -19
  309. package/docs/ja/specdojo/templates/stsd-template.md +46 -21
  310. package/docs/ja/specdojo/templates/sysd-critical-flows-template.md +94 -0
  311. package/docs/ja/specdojo/templates/sysd-cross-cutting-policy-template.md +122 -0
  312. package/docs/ja/specdojo/templates/sysd-index-template.md +89 -0
  313. package/docs/specdojo/lib/yaml-metadata.cjs +7 -0
  314. package/docs/specdojo/schemas/v1/bdd.schema.yaml +25 -57
  315. package/docs/specdojo/schemas/v1/condense-records.schema.yaml +26 -0
  316. package/docs/specdojo/schemas/v1/dct.schema.yaml +10 -0
  317. package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +3 -0
  318. package/docs/specdojo/schemas/v1/esil.schema.yaml +7 -141
  319. package/docs/specdojo/schemas/v1/exec-common.schema.yaml +3 -0
  320. package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +53 -3
  321. package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +3 -0
  322. package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +14 -0
  323. package/docs/specdojo/schemas/v1/exec-result-frontmatter.schema.yaml +18 -0
  324. package/docs/specdojo/schemas/v1/finding-cause.schema.yaml +22 -0
  325. package/docs/specdojo/schemas/v1/grade-pipeline-state.schema.yaml +1 -1
  326. package/docs/specdojo/schemas/v1/grade-result.schema.yaml +2 -0
  327. package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +65 -5
  328. package/docs/specdojo/schemas/v1/ifx-index.schema.yaml +142 -0
  329. package/docs/specdojo/schemas/v1/register-events.schema.yaml +2 -0
  330. package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +17 -1
  331. package/package.json +2 -2
  332. package/templates/antigravity/orchestrator.md +3 -2
  333. package/templates/claude/agents/specdojo-orchestrator.md +3 -2
  334. package/templates/codex/agents/specdojo-orchestrator.toml +3 -2
  335. package/templates/codex/orchestrator.md +3 -2
  336. package/templates/devcontainer/tmux.conf +6 -0
  337. package/templates/opencode/agents/specdojo-orchestrator.md +3 -2
@@ -0,0 +1,81 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { addWorkingDaysToDate, isWorkingDateUtc } from "../exec/schedule/calendar.js";
3
+ import { epicPredecessors, hasReversedEpicDates, orderEpics } from "../register/epic.js";
4
+ import { registerDateFromTimestamp } from "../register/date.js";
5
+ import { loadRegisterItemDocs } from "../register/item.js";
6
+ import { readRegisterEventsFromContent, registerEventFilePath } from "../register/events.js";
7
+ export function computeEpicSchedules(opts) {
8
+ const epics = orderEpics(opts.items, opts.projectId);
9
+ const byId = new Map(epics.map((item) => [item.id, item]));
10
+ const rows = new Map();
11
+ for (const item of epics) {
12
+ const predecessors = epicPredecessors(item, opts.projectId, byId);
13
+ const actualStart = opts.starts.get(item.id);
14
+ const completed = ["done", "decided", "rejected"].includes(item.status);
15
+ let endDate = completed
16
+ ? registerDateFromTimestamp(item.completedAt, opts.timeZone)
17
+ : /^\d{4}-\d{2}-\d{2}$/.test(item.due)
18
+ ? item.due
19
+ : undefined;
20
+ let startDate = item.startOn ??
21
+ (actualStart ? registerDateFromTimestamp(actualStart, opts.timeZone) : undefined);
22
+ if (!startDate && predecessors.length > 0) {
23
+ const ends = predecessors.map((p) => rows.get(p.id)?.endDate);
24
+ if (ends.every((end) => end !== undefined)) {
25
+ startDate = addWorkingDaysToDate(ends.sort().at(-1), 1, opts.calendar);
26
+ }
27
+ }
28
+ if (hasReversedEpicDates(item) || (startDate && endDate && startDate > endDate)) {
29
+ startDate = undefined;
30
+ endDate = undefined;
31
+ }
32
+ // Unknown start/end stays unknown; do not fabricate a date or propagate it downstream.
33
+ let estimateDays;
34
+ if (startDate && endDate && endDate >= startDate) {
35
+ estimateDays = 0;
36
+ const cursor = new Date(`${startDate}T00:00:00Z`);
37
+ const end = new Date(`${endDate}T00:00:00Z`);
38
+ while (cursor <= end) {
39
+ if (isWorkingDateUtc(cursor, opts.calendar))
40
+ estimateDays += 1;
41
+ cursor.setUTCDate(cursor.getUTCDate() + 1);
42
+ }
43
+ }
44
+ rows.set(item.id, {
45
+ id: item.id,
46
+ title: item.title,
47
+ itemStatus: item.status,
48
+ track: item.track,
49
+ domains: item.domains ?? [],
50
+ status: completed ? "primary" : item.status === "open" ? "not_started" : "draft",
51
+ order: rows.size + 1,
52
+ wave: 1 + Math.max(0, ...predecessors.map((p) => rows.get(p.id)?.wave ?? 0)),
53
+ depends_on: predecessors.map((p) => p.track),
54
+ startDate,
55
+ endDate: endDate === "-" || endDate === "_TODO_" ? undefined : endDate,
56
+ estimateDays,
57
+ });
58
+ }
59
+ const schedule = [...rows.values()];
60
+ const plannedStartDate = schedule
61
+ .flatMap((row) => (row.startDate ? [row.startDate] : []))
62
+ .sort()[0];
63
+ return { schedule, plannedStartDate };
64
+ }
65
+ export function loadEpicSchedules(opts) {
66
+ const items = loadRegisterItemDocs(opts.registerPath).map((doc) => doc.item);
67
+ const starts = new Map();
68
+ for (const item of items.filter((item) => item.type === "epic")) {
69
+ const file = registerEventFilePath(opts.registerPath, item.id);
70
+ const events = existsSync(file)
71
+ ? readRegisterEventsFromContent(readFileSync(file, "utf8"), file)
72
+ : [];
73
+ const start = events
74
+ .filter((event) => event.action === "start")
75
+ .map((event) => event.ts)
76
+ .sort()[0];
77
+ if (start)
78
+ starts.set(item.id, start);
79
+ }
80
+ return computeEpicSchedules({ ...opts, items, starts });
81
+ }
@@ -1,5 +1,6 @@
1
- import { existsSync, readFileSync, readdirSync } from "node:fs";
2
- import { join } from "node:path";
1
+ import { readFileSync } from "node:fs";
2
+ import { dirname, relative } from "node:path";
3
+ import { executionRecordLink, listRunRecords } from "../exec/run-records.js";
3
4
  import { load } from "../shared/yaml.js";
4
5
  import { sanitizeDashboardCell } from "./shared.js";
5
6
  export const EXEC_RECORDS_FILE = "exec-records.md";
@@ -29,14 +30,7 @@ function frontmatterText(value) {
29
30
  return value.toISOString();
30
31
  return undefined;
31
32
  }
32
- function listMarkdownFiles(dir, suffix) {
33
- if (!existsSync(dir))
34
- return [];
35
- return readdirSync(dir)
36
- .filter((name) => name.endsWith(suffix))
37
- .sort();
38
- }
39
- // execution/exec/{plans,results} の記録を実行単位(ファイル名の stem)でまとめる。
33
+ // 記録を run 単位でまとめる。
40
34
  // 並びは開始日時の新しい順、開始日時が無いものは後ろに stem 順で置く。
41
35
  export function collectExecRecords(execPath) {
42
36
  const rows = new Map();
@@ -48,17 +42,17 @@ export function collectExecRecords(execPath) {
48
42
  rows.set(stem, created);
49
43
  return created;
50
44
  };
51
- for (const name of listMarkdownFiles(join(execPath, "plans"), "-plan.md")) {
52
- const row = rowFor(name.slice(0, -"-plan.md".length));
53
- const fm = readSpecdojoFrontmatter(join(execPath, "plans", name));
54
- row.planFile = name;
45
+ for (const path of listRunRecords(dirname(execPath), "plan")) {
46
+ const row = rowFor(relative(dirname(execPath), dirname(path)).replaceAll("\\", "/"));
47
+ const fm = readSpecdojoFrontmatter(path);
48
+ row.planFile = relative(execPath, path).replaceAll("\\", "/");
55
49
  row.taskId ??= frontmatterText(fm.task_id);
56
50
  row.mode ??= frontmatterText(fm.mode);
57
51
  }
58
- for (const name of listMarkdownFiles(join(execPath, "results"), "-result.md")) {
59
- const row = rowFor(name.slice(0, -"-result.md".length));
60
- const fm = readSpecdojoFrontmatter(join(execPath, "results", name));
61
- row.resultFile = name;
52
+ for (const path of listRunRecords(dirname(execPath), "result")) {
53
+ const row = rowFor(relative(dirname(execPath), dirname(path)).replaceAll("\\", "/"));
54
+ const fm = readSpecdojoFrontmatter(path);
55
+ row.resultFile = relative(execPath, path).replaceAll("\\", "/");
62
56
  row.taskId = frontmatterText(fm.task_id) ?? row.taskId;
63
57
  row.mode = frontmatterText(fm.mode) ?? row.mode;
64
58
  row.status = frontmatterText(fm.status);
@@ -76,7 +70,9 @@ export function collectExecRecords(execPath) {
76
70
  });
77
71
  }
78
72
  function execRecordLink(dir, file, label) {
79
- return file ? `[${label}](../exec/${dir}/${file})` : "-";
73
+ return file
74
+ ? `[${label}](${executionRecordLink(file, dir === "plans" ? "plan" : "result")})`
75
+ : "-";
80
76
  }
81
77
  export function buildExecRecordsMarkdown(projectId, rows) {
82
78
  const lines = [
@@ -85,7 +81,7 @@ export function buildExecRecordsMarkdown(projectId, rows) {
85
81
  `- project_id: \`${projectId}\``,
86
82
  `- 再生成: \`specdojo dashboard build --project ${projectId}\``,
87
83
  "",
88
- "> このページは `specdojo dashboard build` が生成した派生ビューです。正本は `execution/exec/` 配下の plan / result であり、このページを手編集しても次回のビルドで失われます。実行記録はサイドバーに載せないため、このページから辿ります。",
84
+ "> このページは `specdojo dashboard build` が生成した派生ビューです。正本は `execution/runs/`配下の plan / result であり、このページを手編集しても次回のビルドで失われます。実行記録はサイドバーに載せないため、このページから辿ります。",
89
85
  "",
90
86
  ];
91
87
  if (rows.length === 0) {
@@ -2,19 +2,21 @@ import { existsSync, readFileSync, readdirSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { load } from "../shared/yaml.js";
4
4
  import { readJson } from "../shared/fs.js";
5
- import { cronMatches, cronOccurrences, isRoutineDue, routineActionKindLabel, } from "../routine/routine.js";
6
- // routine ファイル(rtn-*.yaml)を読み、状態ファイル generated/routine-state.json と突き合わせて
5
+ import { migrateRoutineStorage } from "../routine/storage.js";
6
+ import { cronMatches, cronOccurrences, isRoutineDue, routineActionKindLabel, } from "../routine/definition.js";
7
+ // routine ファイル(rtn-*.yaml)を読み、端末側の状態ファイルと突き合わせて
7
8
  // 最終実行・実行結果・due 状況を得る。CLI 出力(routine list)の転記に依存しない。
8
- export function aggregateRoutines(routinesPath) {
9
+ export function aggregateRoutines(routinesPath, repoRoot) {
9
10
  if (!routinesPath || !existsSync(routinesPath))
10
11
  return { rows: [], docs: [], history: [] };
12
+ const storage = migrateRoutineStorage(routinesPath, repoRoot);
11
13
  const result = {
12
14
  rows: [],
13
15
  docs: [],
14
- history: readRoutineRunHistory(join(routinesPath, "generated", "routine-runs.jsonl")),
16
+ history: readRoutineRunHistory(storage.runsPath),
15
17
  error: undefined,
16
18
  };
17
- const stateEntries = readRoutineStateEntries(join(routinesPath, "generated", "routine-state.json"));
19
+ const stateEntries = readRoutineStateEntries(storage.statePath);
18
20
  const now = new Date();
19
21
  const files = readdirSync(routinesPath)
20
22
  .filter((name) => /^rtn-.*\.(ya?ml)$/.test(name))
@@ -172,7 +174,7 @@ export function collapseFrequentRoutineRows(rows) {
172
174
  }
173
175
  return collapsed;
174
176
  }
175
- // generated/routine-state.json の routines.<id> が状態の正本。破損時は空。
177
+ // 端末側の routine-state.json の routines.<id> が状態の正本。破損時は空。
176
178
  function readRoutineStateEntries(statePath) {
177
179
  const entries = {};
178
180
  if (!existsSync(statePath))
@@ -1,4 +1,4 @@
1
- import { existsSync } from "node:fs";
1
+ import { loadTrackPlan } from "../register/track-plan.js";
2
2
  import { join } from "node:path";
3
3
  import { collectCatalogFilesByDomain } from "../shared/catalog-files.js";
4
4
  import { resolveTimelineCatalogStatus } from "../register/catalog-status.js";
@@ -101,11 +101,7 @@ export function buildCatalogScaffoldPlans(tracks, catalogPath) {
101
101
  return { scaffolds, warnings };
102
102
  }
103
103
  export function buildTimeline(opts) {
104
- const indexFile = join(opts.timelinePath, "tml-index.yaml");
105
- if (!existsSync(indexFile)) {
106
- throw new Error(`Timeline index not found: ${indexFile}`);
107
- }
108
- const { index, errors: loadErrors } = loadTimelineIndex(indexFile);
104
+ const { index, errors: loadErrors } = loadTrackPlan(opts);
109
105
  const errors = [...loadErrors];
110
106
  const warnings = [];
111
107
  const derived = resolveTimelineCatalogStatus(index.tracks, opts.registerPath);
@@ -150,8 +146,8 @@ export function renderTimelineOrderMarkdown(result) {
150
146
  lines.push(`- schedule_ready_tracks: \`${result.scheduleReadyTracks.length}\``);
151
147
  lines.push(`- catalog_scaffold_targets: \`${result.scaffolds.length}\``);
152
148
  lines.push("");
153
- lines.push(`この文書は \`tml-index.yaml\` から \`specdojo timeline build\` が生成した派生ビューです。` +
154
- `直接編集せず、計画は \`tml-index.yaml\`、カタログ作成の完了は register の todo に記録してください。`);
149
+ lines.push(`この文書は epic・strategy(互換用 \`tml-index.yaml\`)から非推奨の \`specdojo timeline build\` が生成した派生ビューです。` +
150
+ `計画は register の epic、範囲は strategy の scope、カタログ作成の完了は register の todo に記録し、通常は \`dashboard build\` を使ってください。`);
155
151
  for (const wave of result.waves) {
156
152
  lines.push("");
157
153
  lines.push(`## ${wave.wave}. Wave ${wave.wave}`);
@@ -174,7 +170,7 @@ export function renderCatalogScaffoldMarkdown(result) {
174
170
  lines.push(`- project_id: \`${result.projectId}\``);
175
171
  lines.push(`- targets: \`${result.scaffolds.length}\``);
176
172
  lines.push("");
177
- lines.push(`\`tml-index.yaml\` の各トラックが対象とするドメインのうち、\`dct-<domain>.yaml\` が未作成のものを列挙します。`);
173
+ lines.push(`既存 strategy の scope、epic の domains、互換用 \`tml-index.yaml\` の順で対象を解決し、\`dct-<domain>.yaml\` が未作成のものを列挙します。`);
178
174
  lines.push("");
179
175
  if (result.scaffolds.length === 0) {
180
176
  lines.push(`未作成の成果物カタログはありません。`);
@@ -1,6 +1,7 @@
1
+ import { warnDeprecated } from "../shared/deprecation.js";
1
2
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
3
  import { join, resolve } from "node:path";
3
- import { getProjectCatalogPath, getProjectTimelinePath, getProjectRegisterPath, loadConfig, loadEnv, specdojoRootDir, } from "../shared/specdojo-config.js";
4
+ import { getProjectCatalogPath, getProjectTimelinePath, getProjectSchedulePath, getProjectRegisterPath, loadConfig, loadEnv, specdojoRootDir, } from "../shared/specdojo-config.js";
4
5
  import { buildTimeline, renderCatalogScaffoldMarkdown, renderTimelineOrderMarkdown, } from "./timeline-build.js";
5
6
  function resolveTimelinePaths(opts) {
6
7
  loadEnv();
@@ -23,6 +24,9 @@ function resolveTimelinePaths(opts) {
23
24
  const registerPath = getProjectRegisterPath(project);
24
25
  return {
25
26
  timelinePath: resolve(baseDir, getProjectTimelinePath(project)),
27
+ schedulePath: resolve(baseDir, getProjectSchedulePath(project)),
28
+ repoRoot: baseDir,
29
+ projectId,
26
30
  catalogPath: catalogPath ? resolve(baseDir, catalogPath) : null,
27
31
  ...(registerPath ? { registerPath: resolve(baseDir, registerPath) } : {}),
28
32
  };
@@ -68,13 +72,14 @@ export function registerTimelineCommands(program) {
68
72
  });
69
73
  const bcmd = tml
70
74
  .command("build")
71
- .description("Derive track start order and catalog scaffold targets from tml-index.yaml");
75
+ .description("Deprecated: derive track order and catalog targets from epics and legacy tml-index.yaml");
72
76
  addProjectOption(bcmd);
73
77
  bcmd.option("--dry-run", "Print generated content to stdout without writing", false);
74
78
  bcmd.action((opts) => {
75
79
  try {
76
- const { timelinePath, catalogPath, registerPath } = resolveTimelinePaths(opts);
77
- const result = buildTimeline({ timelinePath, catalogPath, registerPath });
80
+ warnDeprecated("timeline build", "Use dashboard build; move domains and dependencies to register epics.");
81
+ const { timelinePath, ...paths } = resolveTimelinePaths(opts);
82
+ const result = buildTimeline({ timelinePath, ...paths });
78
83
  for (const warning of result.warnings)
79
84
  process.stdout.write(`WARN: ${warning}\n`);
80
85
  for (const error of result.errors)
@@ -192,6 +192,7 @@ export async function runDevcontainerScaffold(opts) {
192
192
  // options に応じて json と script を改変
193
193
  const aptPackages = [];
194
194
  const extraScripts = [];
195
+ let tmuxConfTemplate;
195
196
  let emacsInitTemplate;
196
197
  let vimrcTemplate;
197
198
  if (includesRecommended) {
@@ -207,6 +208,14 @@ fi`);
207
208
  }
208
209
  if (effectiveTmux) {
209
210
  aptPackages.push("tmux");
211
+ tmuxConfTemplate = await readFile(path.join(templateDir, "tmux.conf"), "utf8");
212
+ extraScripts.push(`# Link bundled tmux.conf when tmux is enabled, preserving any non-symlink user configuration.
213
+ SCRIPT_DIR="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
214
+ if [ -f "\${SCRIPT_DIR}/tmux.conf" ]; then
215
+ if [ ! -e "$HOME/.tmux.conf" ] || [ -L "$HOME/.tmux.conf" ]; then
216
+ ln -sfn "\${SCRIPT_DIR}/tmux.conf" "$HOME/.tmux.conf"
217
+ fi
218
+ fi`);
210
219
  }
211
220
  if (effectiveCron) {
212
221
  aptPackages.push("cron");
@@ -386,6 +395,9 @@ fi`);
386
395
  if (dryRun) {
387
396
  process.stdout.write(`[dry-run] would write: .devcontainer/devcontainer.json\n`);
388
397
  process.stdout.write(`[dry-run] would write: .devcontainer/post-create.sh\n`);
398
+ if (tmuxConfTemplate !== undefined) {
399
+ process.stdout.write(`[dry-run] would write: .devcontainer/tmux.conf\n`);
400
+ }
389
401
  if (emacsInitTemplate !== undefined) {
390
402
  process.stdout.write(`[dry-run] would write: .devcontainer/emacs/init.el\n`);
391
403
  }
@@ -402,6 +414,9 @@ fi`);
402
414
  await mkdir(devcontainerDir, { recursive: true });
403
415
  await writeFile(path.join(devcontainerDir, "devcontainer.json"), JSON.stringify(devcontainer, null, 2) + "\n", "utf8");
404
416
  await writeFile(path.join(devcontainerDir, "post-create.sh"), postCreateScript, "utf8");
417
+ if (tmuxConfTemplate !== undefined) {
418
+ await writeFile(path.join(devcontainerDir, "tmux.conf"), tmuxConfTemplate, "utf8");
419
+ }
405
420
  if (emacsInitTemplate !== undefined) {
406
421
  await mkdir(path.join(devcontainerDir, "emacs"), { recursive: true });
407
422
  await writeFile(path.join(devcontainerDir, "emacs", "init.el"), emacsInitTemplate, "utf8");
@@ -420,6 +435,9 @@ fi`);
420
435
  await writeFile(path.join(remoteHostDir, "ssh-config.sample"), sshConfigScript, "utf8");
421
436
  process.stdout.write(`Written: .devcontainer/devcontainer.json\n`);
422
437
  process.stdout.write(`Written: .devcontainer/post-create.sh\n`);
438
+ if (tmuxConfTemplate !== undefined) {
439
+ process.stdout.write(`Written: .devcontainer/tmux.conf\n`);
440
+ }
423
441
  if (emacsInitTemplate !== undefined) {
424
442
  process.stdout.write(`Written: .devcontainer/emacs/init.el\n`);
425
443
  }
@@ -1,48 +1 @@
1
- // SpecDojo が所有する Markdown frontmatter は `specdojo:` 名前空間配下に置く
2
- // (document-metadata-standard.md)。他フレームワークの frontmatter キーとの衝突を避け、
3
- // トップレベルを第三者ツールへ明け渡すための共通ユーティリティ。
4
- //
5
- // 対象は Markdown frontmatter のみ。独立 YAML データファイル(dct-*.yaml / pm-*.yaml /
6
- // sch-*.yaml など)は名前空間化しないため、本モジュールは使わない。
7
- import { load } from "../shared/yaml.js";
8
- const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
9
- function specdojoFromBlock(block) {
10
- let parsed;
11
- try {
12
- parsed = load(block);
13
- }
14
- catch {
15
- return {};
16
- }
17
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
18
- return {};
19
- const namespace = parsed.specdojo;
20
- if (!namespace || typeof namespace !== "object" || Array.isArray(namespace))
21
- return {};
22
- return namespace;
23
- }
24
- // Markdown 文書先頭の frontmatter から `specdojo:` 名前空間オブジェクトを取り出す。
25
- // frontmatter が無い / 解析不能 / `specdojo:` を欠く場合は空オブジェクトを返す。
26
- export function readSpecdojoNamespace(content) {
27
- const match = content.match(FRONTMATTER_RE);
28
- if (!match)
29
- return {};
30
- return specdojoFromBlock(match[1]);
31
- }
32
- // readSpecdojoNamespace と同じだが、frontmatter に続く本文も返す(read-modify-write 用)。
33
- export function parseSpecdojoDocument(content) {
34
- const match = content.match(FRONTMATTER_RE);
35
- if (!match)
36
- return { data: {}, body: content };
37
- return { data: specdojoFromBlock(match[1]), body: match[2] ?? "" };
38
- }
39
- // トップレベルの `key: value` 行群を `specdojo:` 配下へ字下げし、`---` で囲んだ
40
- // frontmatter ブロック文字列にして返す。frontmatter を生成する各所で使う。
41
- export function buildSpecdojoFrontmatter(innerLines) {
42
- return [
43
- "---",
44
- "specdojo:",
45
- ...innerLines.map((line) => (line.length === 0 ? "" : ` ${line}`)),
46
- "---",
47
- ].join("\n");
48
- }
1
+ export { buildSpecdojoFrontmatter, parseSpecdojoDocument, readSpecdojoNamespace, } from "../shared/frontmatter-namespace.js";
@@ -4,8 +4,8 @@ import { dump, load } from "../shared/yaml.js";
4
4
  import { collectDocIndexEntries } from "./doc-index.js";
5
5
  import { isDctTemplateCatalog, renderCatalogTemplateBody } from "../shared/catalog-render.js";
6
6
  // YAML は VitePress のページにならないため、doc-index に載っている YAML ごとに
7
- // 同階層の generated/<name>.md へ表示用ページ(本文を yaml コードブロックで埋め込んだ
8
- // Markdown)を生成する。wikilink・frontmatter リンクはこのページへ解決される。
7
+ // 同階層の generated/<name>.md へ表示用ページを生成する。
8
+ // wikilink・frontmatter リンクはこのページへ解決される。
9
9
  // 自前で生成したページの識別マーカー。これを含まない既存ファイル
10
10
  // (catalog build が生成する dct-*.md 等)は上書きしない。
11
11
  export const YAML_PAGE_MARKER = "<!-- specdojo:generated-by=yaml-pages -->";
@@ -19,6 +19,105 @@ const PAGE_TARGET_PREFIXES = ["docs/ja/", "docs/en/"];
19
19
  function isRecord(value) {
20
20
  return typeof value === "object" && value !== null && !Array.isArray(value);
21
21
  }
22
+ // YAML 内の Markdown(wikilink やインラインコード)は保ち、表の区切りだけを整える。
23
+ function glossaryCell(value) {
24
+ return value
25
+ .replace(/\s*[\r\n]+\s*/g, " ")
26
+ .replace(/(\\*)\|/g, (_match, slashes) => `${slashes}${slashes.length % 2 === 0 ? "\\" : ""}|`);
27
+ }
28
+ function glossaryText(value) {
29
+ return typeof value === "string" ? value : "";
30
+ }
31
+ function escapeAnchorText(value) {
32
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
33
+ }
34
+ function glossaryStrings(value) {
35
+ return Array.isArray(value)
36
+ ? value.filter((item) => typeof item === "string")
37
+ : [];
38
+ }
39
+ function renderGlossaryBody(doc, terms) {
40
+ const byId = new Map(terms.map((term) => [glossaryText(term.id), term]));
41
+ // ほかの用語の分類として使われる用語は先頭の「分類」の章にまとめ、各用語は 1 か所にだけ出す。
42
+ const categoryIds = new Set(terms.map((term) => glossaryText(term.category)).filter((category) => category !== ""));
43
+ const sections = [];
44
+ const categoryTerms = terms.filter((term) => categoryIds.has(glossaryText(term.id)));
45
+ if (categoryTerms.length > 0)
46
+ sections.push({ label: "分類", terms: categoryTerms });
47
+ const byCategory = new Map();
48
+ const others = [];
49
+ for (const term of terms) {
50
+ if (categoryIds.has(glossaryText(term.id)))
51
+ continue;
52
+ const category = glossaryText(term.category);
53
+ if (category === "") {
54
+ others.push(term);
55
+ continue;
56
+ }
57
+ const group = byCategory.get(category) ?? [];
58
+ group.push(term);
59
+ byCategory.set(category, group);
60
+ }
61
+ for (const [category, group] of byCategory) {
62
+ const categoryTerm = byId.get(category);
63
+ const label = categoryTerm
64
+ ? `[${glossaryText(categoryTerm.term).replace(/[[\]\\]/g, "\\$&")}](#${category})(${category})`
65
+ : category;
66
+ sections.push({ label, terms: group });
67
+ }
68
+ if (others.length > 0)
69
+ sections.push({ label: "その他", terms: others });
70
+ const lines = [
71
+ "<!-- prettier-ignore -->",
72
+ "| ID | 言語 | 状態 | 用語の数 |",
73
+ "| --- | --- | --- | --- |",
74
+ `| ${[doc.id, doc.locale, doc.status].map((value) => glossaryCell(glossaryText(value)) || "-").join(" | ")} | ${terms.length} |`,
75
+ ];
76
+ let chapter = 0;
77
+ for (const { label, terms: group } of sections) {
78
+ lines.push("", `## ${++chapter}. ${glossaryCell(label)}`, "", "<!-- prettier-ignore -->", "| 用語(ID) | 英語名と別名 | 定義 | 補足 | 関連 |", "| --- | --- | --- | --- | --- |");
79
+ for (const term of group) {
80
+ const id = glossaryText(term.id);
81
+ const names = [
82
+ term.englishName ? `英語名: ${glossaryText(term.englishName)}` : "",
83
+ glossaryStrings(term.aliases).length
84
+ ? `別名: ${glossaryStrings(term.aliases).join("、")}`
85
+ : "",
86
+ ]
87
+ .filter(Boolean)
88
+ .join(" / ");
89
+ const supplement = [
90
+ ["notes", "注記"],
91
+ ["example", "用例"],
92
+ ["source", "出典"],
93
+ ]
94
+ .flatMap(([key, label]) => {
95
+ const text = glossaryText(term[key]);
96
+ // URL 単独の出典は autolink にして MD034 に合わせる。
97
+ return text ? [`${label}: ${/^https?:\/\/\S+$/.test(text) ? `<${text}>` : text}`] : [];
98
+ })
99
+ .join(" / ");
100
+ const related = glossaryStrings(term.relatedTerms)
101
+ .map((ref) => {
102
+ const target = byId.get(ref);
103
+ const text = glossaryText(target?.term) || ref;
104
+ return target ? `[${text.replace(/[[\]\\]/g, "\\$&")}](#${ref})` : `\`${ref}\``;
105
+ })
106
+ .join("、");
107
+ const cells = [
108
+ // 用語名そのものをページ内の飛び先にする。<a> は空要素ではないため閉じタグを省かない。
109
+ `<a id="${id}">${escapeAnchorText(glossaryText(term.term))}</a>(\`${id}\`)`,
110
+ names,
111
+ glossaryText(term.definition),
112
+ supplement,
113
+ related,
114
+ ];
115
+ lines.push(`| ${cells.map((cell) => glossaryCell(cell) || "-").join(" | ")} |`);
116
+ }
117
+ }
118
+ lines.push("", `## ${++chapter}. YAML の正本`, "");
119
+ return lines.join("\n");
120
+ }
22
121
  // doc-index の "path:42" 形式から行番号サフィックスを除去する。
23
122
  function stripLineSuffix(entry) {
24
123
  const colonIndex = entry.lastIndexOf(":");
@@ -87,7 +186,8 @@ function deriveMeta(yamlRelPath, content) {
87
186
  ...(title ? { title } : {}),
88
187
  };
89
188
  }
90
- // 表示ページの Markdown を組み立てる。YAML 本文はコードブロックで埋め込み、
189
+ // 表示ページの Markdown を組み立てる。用語集は分類ごとの表を描き、
190
+ // YAML 本文はコードブロックで埋め込み、
91
191
  // 本文中のバッククォート連続より長いフェンスを使って壊れないようにする。
92
192
  export function renderYamlPage(yamlRelPath, content) {
93
193
  const { title, ...meta } = deriveMeta(yamlRelPath, content);
@@ -125,6 +225,28 @@ export function renderYamlPage(yamlRelPath, content) {
125
225
  const longestRun = backtickRuns.reduce((max, run) => Math.max(max, run.length), 0);
126
226
  const fence = "`".repeat(Math.max(3, longestRun + 1));
127
227
  const body = content.endsWith("\n") ? content : `${content}\n`;
228
+ if (isRecord(parsed) && parsed.type === "glossary" && Array.isArray(parsed.terms)) {
229
+ const terms = parsed.terms.filter(isRecord);
230
+ return [
231
+ ...header,
232
+ `# ${heading}`,
233
+ "",
234
+ note,
235
+ "",
236
+ YAML_PAGE_MARKER,
237
+ "",
238
+ renderGlossaryBody(parsed, terms),
239
+ "<details>",
240
+ "<summary>YAML の正本を表示</summary>",
241
+ "",
242
+ "<!-- prettier-ignore -->",
243
+ `${fence}yaml`,
244
+ `${body}${fence}`,
245
+ "",
246
+ "</details>",
247
+ "",
248
+ ].join("\n");
249
+ }
128
250
  return [
129
251
  ...header,
130
252
  `# ${heading}`,
@@ -4,6 +4,8 @@ import { listFilesRecursive, readYaml } from "./shared.js";
4
4
  import { acquirePoolSlot, releaseLock } from "./slot-lock.js";
5
5
  import { getProjectExecutionPath, loadConfig, specdojoRootDir, } from "../shared/specdojo-config.js";
6
6
  import { resolveParentValidationConcurrency, resolveParentValidationAssignments, resolveParentValidationDefinitions, } from "./parent-validation.js";
7
+ import { resolveCommitHookSkips } from "./commit-hook-skips.js";
8
+ import { configureIndexLockWait, DEFAULT_INDEX_LOCK_WAIT_MS } from "../shared/git.js";
7
9
  const PLACEHOLDER_PATTERN = /\{([a-z][a-z0-9_]*)\}/g;
8
10
  const BUILTIN_VARIABLE_NAMES = new Set(["nickname", "mode", "proficiency"]);
9
11
  // Mirror of the nickname pattern in docs/specdojo/schemas/v1/agent-members.schema.yaml.
@@ -176,6 +178,18 @@ export function resolveRegisterPostReview(config) {
176
178
  }
177
179
  return raw;
178
180
  }
181
+ export const DEFAULT_GIT_INDEX_LOCK_WAIT_SECONDS = DEFAULT_INDEX_LOCK_WAIT_MS / 1000;
182
+ // How long the runner's Git operations wait for another process to release index.lock. Invalid
183
+ // values are rejected so a typo cannot turn the wait off or make it unbounded.
184
+ export function resolveGitIndexLockWaitSeconds(config) {
185
+ const raw = config.run?.git_index_lock_wait_seconds;
186
+ if (raw === undefined)
187
+ return DEFAULT_GIT_INDEX_LOCK_WAIT_SECONDS;
188
+ if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 0) {
189
+ throw new Error(`run.git_index_lock_wait_seconds in exec-defaults must be a non-negative integer: ${String(raw)}`);
190
+ }
191
+ return raw;
192
+ }
179
193
  // Resolve how many `exec run` processes may run at once for one project. Invalid values fall back
180
194
  // to the default so a typo cannot silently disable the busy guard.
181
195
  export function resolveMaxConcurrentRuns(config) {
@@ -358,7 +372,15 @@ export function loadExecDefaultsConfig(configPath, executionPath) {
358
372
  }
359
373
  resolveParentValidationDefinitions(defaults.pipeline?.parent_validations);
360
374
  resolveParentValidationConcurrency(defaults.pipeline?.parent_validation_concurrency);
375
+ resolveCommitHookSkips(defaults.pipeline?.commit_hook_skips, defaults.pipeline?.parent_validations);
376
+ if (defaults.pipeline?.mechanical_result !== undefined &&
377
+ typeof defaults.pipeline.mechanical_result !== "boolean") {
378
+ throw new Error("pipeline.mechanical_result in exec-defaults must be a boolean");
379
+ }
361
380
  resolveRegisterExecution(defaults);
381
+ // 統合・記帳の git 操作は src/shared/git.ts の gitResult を通るため、読み込んだ設定を
382
+ // この process の index.lock の待ち時間として反映する(PJR-964D)。
383
+ configureIndexLockWait(resolveGitIndexLockWaitSeconds(defaults) * 1000);
362
384
  resolvePinnedRateLimitPolicy(defaults);
363
385
  for (const provider of Object.keys(defaults.providers ?? {})) {
364
386
  if (defaults.providers?.[provider]?.rate_limit_policy) {
@@ -1,4 +1,5 @@
1
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
1
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
+ import { readPlanFile } from "../shared/plan-conventions.js";
2
3
  import { dirname, resolve } from "node:path";
3
4
  import { defaultExecDefaultsPath, loadExecDefaultsConfig, resolveMemberCommand, resolveRateLimitDetection, resolveRateLimitPolicy, } from "./agent-config.js";
4
5
  import { resolveProjectPaths } from "./project.js";
@@ -70,7 +71,7 @@ export function readAgentPlan(planPath) {
70
71
  if (!existsSync(absolutePath)) {
71
72
  throw new Error(`--plan not found: ${planPath}`);
72
73
  }
73
- const prompt = readFileSync(absolutePath, "utf8");
74
+ const prompt = readPlanFile(absolutePath);
74
75
  if (!prompt.trim()) {
75
76
  throw new Error(`--plan is empty: ${planPath}`);
76
77
  }