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
@@ -1,22 +1,31 @@
1
- import { mkdirSync, existsSync, readFileSync, writeFileSync } from "node:fs";
2
- import { join } from "node:path";
1
+ import { mkdirSync, existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
2
+ import { join, relative } from "node:path";
3
3
  import { toArtifactPath } from "../shared/artifact-path.js";
4
4
  import { listFilesRecursive, readJson } from "../shared/fs.js";
5
- import { readAllEventFiles } from "../exec/events.js";
6
- import { getProjectExecutionPath, getProjectRoutinesPath, getProjectSchedulePath, getProjectTimelinePath, loadConfig, loadEnv, specdojoRootDir, } from "../shared/specdojo-config.js";
7
- import { resolveRegisterPaths, loadRegisterItems, } from "../register/register.js";
5
+ import { getProjectExecutionPath, getProjectCatalogPath, getProjectRegisterPath, getProjectRoutinesPath, getProjectSchedulePath, getProjectTimelinePath, loadConfig, loadEnv, specdojoRootDir, } from "../shared/specdojo-config.js";
6
+ import { resolveRegisterPaths, loadRegisterItems, TERMINAL_STATUSES_SET, } from "../register/register.js";
8
7
  import { readRegisterEventsFromContent, registerEventFilePath, } from "../register/events.js";
9
- import { buildTimelineWaves, loadTimelineIndex } from "./timeline-build.js";
8
+ import { loadTimelineIndex, buildTimeline, renderCatalogScaffoldMarkdown, } from "./timeline-build.js";
9
+ import { loadEpicSchedules } from "./epic-plan.js";
10
+ import { resolveRegisterDateTimeZone } from "../register/date.js";
10
11
  import { buildTimelineGanttSvg, computeTimelineTrackSchedules, resolveDashboardCalendar, } from "./dashboard-timeline.js";
11
- import { aggregateRoutines, buildDailyRoutineRows, formatZonedDateTime, ROUTINE_ROW_COLLAPSE_THRESHOLD, zonedDateKey, } from "./routines.js";
12
+ import { aggregateRoutines, buildDailyRoutineRows, formatZonedDateTime, zonedDateKey, } from "./routines.js";
12
13
  import { buildExecRecordsMarkdown, collectExecRecords, EXEC_RECORDS_FILE } from "./exec-records.js";
13
14
  import { sanitizeDashboardCell } from "./shared.js";
14
15
  import { gradeFindingCount, parseGradeResult } from "../grade/result.js";
16
+ import { load } from "../shared/yaml.js";
17
+ import { isDctCatalogFileName } from "../catalog/types.js";
18
+ import { collectResolvedDeliverables, } from "../catalog/build-references.js";
19
+ import { resolveBasePath } from "../catalog/paths.js";
20
+ import { extractLocalId } from "../schedule/phase-sets.js";
21
+ import { buildScheduleIndex } from "../exec/schedule/schedule.js";
22
+ import { readReadySnapshot } from "../exec/schedule/ready.js";
23
+ import { findRunRecord } from "../shared/run-records.js";
15
24
  // ================================
16
25
  // Types
17
26
  // ================================
18
27
  function generatedBanner(command) {
19
- return `> このページは \`${command}\` が生成した派生ビューです。正本は Schedule / Timeline(tml-index.yaml)/ 登録簿個票・event / exec event / routine(rtn-*.yaml・generated/routine-state.json・generated/routine-runs.jsonl)の機械可読な成果物であり、このページを手編集しても次回のビルドで失われます。`;
28
+ return `> このページは \`${command}\` が生成した派生ビューです。正本は Schedule / epic を含む登録簿個票・event / exec event / routine 定義(rtn-*.yaml)と端末側の状態・履歴(routine-state.json・routine-runs.jsonl)であり、このページを手編集しても次回のビルドで失われます。`;
20
29
  }
21
30
  // ================================
22
31
  // Path resolution
@@ -44,7 +53,15 @@ export function resolveDashboardPaths(opts) {
44
53
  const baseDir = specdojoRootDir();
45
54
  return {
46
55
  projectId,
47
- projectPath: join(baseDir, getProjectTimelinePath(project), ".."),
56
+ projectPath: join(baseDir, project.base_path ?? ""),
57
+ catalogPath: getProjectCatalogPath(project)
58
+ ? join(baseDir, getProjectCatalogPath(project))
59
+ : null,
60
+ repoRoot: baseDir,
61
+ registerPath: getProjectRegisterPath(project)
62
+ ? join(baseDir, getProjectRegisterPath(project))
63
+ : undefined,
64
+ registerDateTimeZone: resolveRegisterDateTimeZone(loadConfig().config, projectId),
48
65
  schedulePath: join(baseDir, getProjectSchedulePath(project)),
49
66
  executionGeneratedPath: join(join(baseDir, getProjectExecutionPath(project)), "generated"),
50
67
  timelinePath: join(baseDir, getProjectTimelinePath(project)),
@@ -56,29 +73,75 @@ export function resolveDashboardPaths(opts) {
56
73
  };
57
74
  }
58
75
  export { buildTimelineGanttSvg, computeTimelineTrackSchedules, resolveDashboardCalendar };
59
- function aggregateRegister(projectId) {
60
- const result = {
61
- statusCounts: {},
62
- priorityCounts: {},
63
- total: 0,
64
- };
76
+ const EXECUTABLE_REGISTER_TYPES = new Set(["todo", "issue", "change-request", "question", "risk"]);
77
+ const PRIORITY_RANK = { high: 0, medium: 1, low: 2 };
78
+ export function buildCatalogDocMap(catalogPath) {
79
+ const map = new Map();
80
+ if (!catalogPath || !existsSync(catalogPath))
81
+ return map;
65
82
  try {
66
- const paths = resolveRegisterPaths({ project: projectId });
67
- const items = loadRegisterItems(paths);
68
- for (const view of items) {
69
- const item = view.item;
70
- result.statusCounts[item.status] = (result.statusCounts[item.status] ?? 0) + 1;
71
- result.priorityCounts[item.priority] = (result.priorityCounts[item.priority] ?? 0) + 1;
83
+ const files = readdirSync(catalogPath).filter(isDctCatalogFileName).sort();
84
+ for (const f of files) {
85
+ const filePath = join(catalogPath, f);
86
+ try {
87
+ const doc = load(readFileSync(filePath, "utf8"));
88
+ if (!doc || !Array.isArray(doc.groups))
89
+ continue;
90
+ const deliverables = [];
91
+ collectResolvedDeliverables(doc.groups, resolveBasePath("", doc.base_path), deliverables);
92
+ for (const { item, resolvedPath } of deliverables) {
93
+ if (item.path) {
94
+ map.set(item.local_id, resolvedPath);
95
+ }
96
+ }
97
+ }
98
+ catch {
99
+ // ignore malformed catalog
100
+ }
72
101
  }
73
- result.total = items.length;
74
102
  }
75
- catch (error) {
76
- result.error = error instanceof Error ? error.message : String(error);
103
+ catch {
104
+ // ignore directory read error
77
105
  }
78
- return result;
106
+ return map;
107
+ }
108
+ export function formatTicketLink(view, generatedDir) {
109
+ if (view.ticketPath && existsSync(view.ticketPath)) {
110
+ const rel = relative(generatedDir, view.ticketPath).replaceAll("\\", "/");
111
+ return `[${view.id}](${rel})`;
112
+ }
113
+ return `\`${view.id}\``;
114
+ }
115
+ export function formatTaskLink(taskId, paths, catalogDocMap) {
116
+ const execDir = join(paths.executionGeneratedPath, "..");
117
+ if (paths.schedulePath && existsSync(execDir)) {
118
+ try {
119
+ const plan = findRunRecord(execDir, "plan", taskId);
120
+ if (plan && existsSync(plan)) {
121
+ const rel = relative(paths.executionGeneratedPath, plan).replaceAll("\\", "/");
122
+ return `[${taskId}](${rel})`;
123
+ }
124
+ const result = findRunRecord(execDir, "result", taskId);
125
+ if (result && existsSync(result)) {
126
+ const rel = relative(paths.executionGeneratedPath, result).replaceAll("\\", "/");
127
+ return `[${taskId}](${rel})`;
128
+ }
129
+ }
130
+ catch {
131
+ // ignore run record lookup error
132
+ }
133
+ }
134
+ const localId = extractLocalId(taskId);
135
+ if (localId && catalogDocMap.has(localId)) {
136
+ const docRel = catalogDocMap.get(localId);
137
+ const docFull = join(paths.repoRoot ?? specdojoRootDir(), docRel);
138
+ if (existsSync(docFull)) {
139
+ const rel = relative(paths.executionGeneratedPath, docFull).replaceAll("\\", "/");
140
+ return `[${taskId}](${rel})`;
141
+ }
142
+ }
143
+ return `\`${taskId}\``;
79
144
  }
80
- const EXECUTABLE_REGISTER_TYPES = new Set(["todo", "issue", "change-request", "question", "risk"]);
81
- const PRIORITY_RANK = { high: 0, medium: 1, low: 2 };
82
145
  function dateOnlyMs(value) {
83
146
  if (!/^\d{4}-\d{2}-\d{2}$/.test(value))
84
147
  return undefined;
@@ -107,11 +170,31 @@ function pjrLinks(content) {
107
170
  ...content.matchAll(/\[\[[^\]\n|]*:pjr-([0-9a-z]{4})(?:-[^\]\n|]*)?(?:\|[^\]\n]*)?\]\]/gi),
108
171
  ].map((match) => `PJR-${match[1].toUpperCase()}`);
109
172
  }
110
- function buildRegisterCandidates(paths) {
173
+ export function buildRegisterCandidates(paths) {
111
174
  const views = loadRegisterItems(paths);
175
+ const itemMap = new Map(views.map((v) => [v.id, v.item]));
112
176
  const openIds = new Set(views.filter((view) => view.item.status === "open").map((view) => view.id));
113
177
  return views
114
- .filter((view) => view.item.status === "open" && EXECUTABLE_REGISTER_TYPES.has(view.item.type))
178
+ .filter((view) => {
179
+ const status = view.item.status;
180
+ // 1. deferred, rejected, 終端(done, decided)の除外
181
+ if (status === "deferred" || TERMINAL_STATUSES_SET.has(status)) {
182
+ return false;
183
+ }
184
+ // 2. open かつ着手可能タイプ
185
+ if (status !== "open" || !EXECUTABLE_REGISTER_TYPES.has(view.item.type)) {
186
+ return false;
187
+ }
188
+ // 3. 先行の項目(depends_on)がすべて終わり(done または decided)
189
+ const deps = view.item.dependsOn ?? [];
190
+ for (const depId of deps) {
191
+ const depItem = itemMap.get(depId);
192
+ if (!depItem || (depItem.status !== "done" && depItem.status !== "decided")) {
193
+ return false;
194
+ }
195
+ }
196
+ return true;
197
+ })
115
198
  .map((view) => {
116
199
  const links = view.ticketPath
117
200
  ? pjrLinks(readFileSync(view.ticketPath, "utf8")).filter((id) => id !== view.id && openIds.has(id))
@@ -124,6 +207,8 @@ function buildRegisterCandidates(paths) {
124
207
  due: view.item.due,
125
208
  registeredAt: view.item.registeredAt,
126
209
  relatedOpenPjrCount: new Set(links).size,
210
+ ticketPath: view.ticketPath,
211
+ dependsOn: view.item.dependsOn,
127
212
  };
128
213
  });
129
214
  }
@@ -145,37 +230,87 @@ function readRegisterEvents(view, registerPath) {
145
230
  return [];
146
231
  return readRegisterEventsFromContent(readFileSync(path, "utf8"), path);
147
232
  }
148
- function aggregateAttention(paths) {
233
+ export function aggregateActionRequired(paths, views, catalogDocMap) {
149
234
  const rows = [];
150
- const registerPaths = resolveRegisterPaths({ project: paths.projectId });
151
- const views = loadRegisterItems(registerPaths);
152
- for (const view of views.filter((item) => item.item.status === "waiting")) {
235
+ const registerPath = paths.registerPath ?? join(paths.projectPath, "controls", "project-register");
236
+ // 1. review の項目(close の確認待ち)
237
+ for (const view of views.filter((v) => v.item.status === "review")) {
153
238
  rows.push({
154
- source: "register",
239
+ kind: "review",
155
240
  id: view.id,
156
- reason: latestRegisterWaitReason(readRegisterEvents(view, registerPaths.projectRegisterPath)) ??
157
- "-",
158
- nextAction: `待機理由を解消し \`specdojo register start --project ${paths.projectId} --id ${view.id}\``,
241
+ link: formatTicketLink(view, paths.executionGeneratedPath),
242
+ nextAction: "close の確認待ち",
159
243
  });
160
244
  }
161
- if (!paths.schedulePath)
162
- return rows;
163
- const statePath = join(paths.executionGeneratedPath, "state.json");
164
- if (!existsSync(statePath))
165
- return rows;
166
- const state = readJson(statePath);
167
- const blockedIds = Object.entries(state.tasks)
168
- .filter(([, task]) => task.state === "blocked")
169
- .map(([id]) => id);
170
- const reasons = latestExecBlockReasons(blockedIds, readAllEventFiles(paths.schedulePath).map(({ event }) => event));
171
- for (const id of blockedIds.sort()) {
245
+ // 2. 人の判断を待つ open の decision・question
246
+ for (const view of views.filter((v) => v.item.status === "open" && (v.item.type === "decision" || v.item.type === "question"))) {
172
247
  rows.push({
173
- source: "exec",
174
- id,
175
- reason: reasons.get(id) ?? state.tasks[id].last_msg ?? "-",
176
- nextAction: `原因を解消し \`specdojo exec unblock --project ${paths.projectId} --task ${id} --by <actor> --msg <reason>\``,
248
+ kind: view.item.type,
249
+ id: view.id,
250
+ link: formatTicketLink(view, paths.executionGeneratedPath),
251
+ nextAction: view.item.type === "decision" ? "意思決定を行い状態を更新" : "回答・判断を行い状態を更新",
177
252
  });
178
253
  }
254
+ // 3. waiting の項目
255
+ for (const view of views.filter((v) => v.item.status === "waiting")) {
256
+ const waitReason = latestRegisterWaitReason(readRegisterEvents(view, registerPath));
257
+ rows.push({
258
+ kind: "waiting",
259
+ id: view.id,
260
+ link: formatTicketLink(view, paths.executionGeneratedPath),
261
+ nextAction: waitReason
262
+ ? `待機理由を解消: ${sanitizeDashboardCell(waitReason)}`
263
+ : "待機理由の解消",
264
+ });
265
+ }
266
+ // 4. 人が行う schedule のタスク(execution が human のもの)
267
+ if (paths.schedulePath && existsSync(paths.executionGeneratedPath)) {
268
+ const readyPath = join(paths.executionGeneratedPath, "ready.json");
269
+ const statePath = join(paths.executionGeneratedPath, "state.json");
270
+ const humanTaskIds = new Set();
271
+ if (existsSync(readyPath)) {
272
+ try {
273
+ const ready = readReadySnapshot(readyPath);
274
+ for (const task of ready.tasks) {
275
+ if (task.execution === "human") {
276
+ humanTaskIds.add(task.id);
277
+ rows.push({
278
+ kind: "human",
279
+ id: task.id,
280
+ link: formatTaskLink(task.id, paths, catalogDocMap),
281
+ nextAction: task.name
282
+ ? `${sanitizeDashboardCell(task.name)}を実施`
283
+ : "人手による作業を実施",
284
+ });
285
+ }
286
+ }
287
+ }
288
+ catch {
289
+ // ignore ready.json read error
290
+ }
291
+ }
292
+ if (existsSync(statePath)) {
293
+ try {
294
+ const state = readJson(statePath);
295
+ for (const [taskId, taskState] of Object.entries(state.tasks)) {
296
+ if ((taskState.state === "doing" || taskState.state === "blocked") &&
297
+ !humanTaskIds.has(taskId)) {
298
+ rows.push({
299
+ kind: taskState.state === "blocked" ? "blocked" : "human",
300
+ id: taskId,
301
+ link: formatTaskLink(taskId, paths, catalogDocMap),
302
+ nextAction: taskState.state === "blocked"
303
+ ? `ブロッキング原因を解消: ${sanitizeDashboardCell(taskState.last_msg ?? "-")}`
304
+ : "作業の継続・完了",
305
+ });
306
+ }
307
+ }
308
+ }
309
+ catch {
310
+ // ignore state.json read error
311
+ }
312
+ }
313
+ }
179
314
  return rows;
180
315
  }
181
316
  export { buildDailyRoutineRows, collapseFrequentRoutineRows, computeRoutineDue, formatZonedDateTime, readRoutineRunHistory, } from "./routines.js";
@@ -213,261 +348,446 @@ function countTable(keyLabel, counts, order) {
213
348
  lines.push(`| \`${key}\` | ${counts[key]} |`);
214
349
  return lines.join("\n");
215
350
  }
351
+ function dashboardEpicPlan(paths) {
352
+ try {
353
+ return loadEpicSchedules({
354
+ registerPath: paths.registerPath ?? join(paths.projectPath, "controls", "project-register"),
355
+ projectId: paths.projectId,
356
+ calendar: resolveDashboardCalendar(paths.schedulePath ?? paths.projectPath),
357
+ timeZone: paths.registerDateTimeZone ?? "UTC",
358
+ });
359
+ }
360
+ catch {
361
+ return { schedule: [], plannedStartDate: undefined };
362
+ }
363
+ }
364
+ export function readDashboardGradeResults(resultsPath) {
365
+ if (!existsSync(resultsPath))
366
+ return [];
367
+ return listFilesRecursive(resultsPath)
368
+ .filter((path) => path.endsWith(".yaml") || path.endsWith(".yml"))
369
+ .sort()
370
+ .flatMap((path) => {
371
+ try {
372
+ return [parseGradeResult(readFileSync(path, "utf8"), path)];
373
+ }
374
+ catch {
375
+ return [];
376
+ }
377
+ });
378
+ }
216
379
  // ================================
217
- // Section renderers
380
+ // Section renderers (Action-first layout)
218
381
  // ================================
219
- function renderScheduleSection(paths) {
220
- const lines = ["## 1. Schedule進捗", ""];
221
- if (!existsSync(paths.executionGeneratedPath)) {
222
- lines.push("- Schedule はまだ生成されていません(`specdojo exec refresh` を実行してください)。");
223
- lines.push("");
382
+ function renderActionRequiredSection(paths, views, catalogDocMap) {
383
+ const lines = ["## 1. 人の対応が要るもの", ""];
384
+ const rows = aggregateActionRequired(paths, views, catalogDocMap);
385
+ if (rows.length === 0) {
386
+ lines.push("- ありません", "");
224
387
  return lines;
225
388
  }
389
+ lines.push("| 種別 | 項目 | 次にすること |");
390
+ lines.push("| --- | --- | --- |");
391
+ for (const row of rows) {
392
+ lines.push(`| \`${row.kind}\` | ${row.link} | ${sanitizeDashboardCell(row.nextAction)} |`);
393
+ }
394
+ lines.push("");
395
+ return lines;
396
+ }
397
+ function getRegisterPathsForDashboard(paths) {
398
+ if (paths.registerPath) {
399
+ return {
400
+ projectId: paths.projectId,
401
+ projectRegisterPath: paths.registerPath,
402
+ pjrIndexPath: join(paths.registerPath, "pjr-index.md"),
403
+ generatedPath: join(paths.registerPath, "generated"),
404
+ controlsGeneratedPath: join(paths.registerPath, "generated"),
405
+ registerDateTimeZone: paths.registerDateTimeZone ?? "UTC",
406
+ };
407
+ }
226
408
  try {
227
- const state = existsSync(join(paths.executionGeneratedPath, "state.json"))
228
- ? readJson(join(paths.executionGeneratedPath, "state.json"))
229
- : undefined;
230
- const ready = existsSync(join(paths.executionGeneratedPath, "ready.json"))
231
- ? readJson(join(paths.executionGeneratedPath, "ready.json"))
232
- : undefined;
233
- if (state) {
234
- const counts = {
235
- todo: 0,
236
- doing: 0,
237
- blocked: 0,
238
- done: 0,
239
- cancelled: 0,
240
- };
241
- for (const taskState of Object.values(state.tasks)) {
242
- const s = taskState.state;
243
- if (s in counts)
244
- counts[s] += 1;
245
- }
246
- const total = Object.values(counts).reduce((sum, n) => sum + n, 0);
247
- const doneEquivalent = counts.done + counts.doing * 0.5;
248
- const percent = total > 0 ? ((doneEquivalent / total) * 100).toFixed(1) : "0.0";
249
- lines.push(`- 進捗率(done+doing×0.5): \`${percent}%\``);
250
- lines.push(`- 状態別: \`todo=${counts.todo}, doing=${counts.doing}, blocked=${counts.blocked}, done=${counts.done}, cancelled=${counts.cancelled}\``);
251
- lines.push("");
252
- }
253
- if (ready && typeof ready === "object") {
254
- const r = ready;
255
- lines.push(`- 着手可能タスク(ready): \`${r.ready_count ?? 0}\`件`);
256
- if (r.strategies?.["critical-first"]?.next_task_id) {
257
- lines.push(`- 次の着手候補(critical-first): \`${r.strategies["critical-first"].next_task_id}\``);
258
- }
259
- lines.push("");
409
+ return resolveRegisterPaths({ project: paths.projectId });
410
+ }
411
+ catch {
412
+ return null;
413
+ }
414
+ }
415
+ function renderRecommendedRegisterSection(paths, _views) {
416
+ const lines = ["## 2. おすすめの登録項目", ""];
417
+ let rows = [];
418
+ const today = zonedDateKey(new Date(), paths.registerDateTimeZone ?? "UTC");
419
+ try {
420
+ const regPaths = getRegisterPathsForDashboard(paths);
421
+ if (regPaths) {
422
+ rows = rankRegisterCandidates(buildRegisterCandidates(regPaths), today).slice(0, 10);
260
423
  }
261
424
  }
262
425
  catch {
263
- lines.push("- Schedule の集計に失敗しました(state.json / ready.json が不正)。");
264
- lines.push("");
426
+ rows = [];
265
427
  }
266
- lines.push("- 詳細ガントチャート: [`execution/generated/gantt-chart.md`](./gantt-chart.md)");
267
- lines.push("![Scheduleガントチャート](./gantt-chart.svg)");
428
+ if (rows.length === 0) {
429
+ lines.push("- ありません", "");
430
+ return lines;
431
+ }
432
+ lines.push("| 順位 | id | type | title | 期日 | 優先度 | 関連 open PJR | 登録日時 | 理由 |");
433
+ lines.push("| ---: | --- | --- | --- | --- | --- | ---: | --- | --- |");
434
+ const todayMs = dateOnlyMs(today) ?? 0;
435
+ rows.forEach((row, index) => {
436
+ const dueMs = dateOnlyMs(row.due);
437
+ const dueReason = dueMs === undefined
438
+ ? "期日なし"
439
+ : dueMs < todayMs
440
+ ? `期日超過 ${Math.ceil((todayMs - dueMs) / 86_400_000)}日`
441
+ : `期日まで ${Math.ceil((dueMs - todayMs) / 86_400_000)}日`;
442
+ const link = formatTicketLink({ id: row.id, ticketPath: row.ticketPath }, paths.executionGeneratedPath);
443
+ lines.push(`| ${index + 1} | ${link} | \`${row.type}\` | ${sanitizeDashboardCell(row.title)} | ${row.due} | \`${row.priority}\` | ${row.relatedOpenPjrCount} | ${row.registeredAt} | ${dueReason}、優先度 ${row.priority}、関連 open PJR ${row.relatedOpenPjrCount}件 |`);
444
+ });
268
445
  lines.push("");
269
446
  return lines;
270
447
  }
271
- function renderTimelineSection(paths) {
272
- const lines = ["## 2. タイムライン(トラック着手順序)", ""];
273
- const indexPath = join(paths.timelinePath, "tml-index.yaml");
274
- if (!existsSync(indexPath)) {
275
- lines.push("- タイムラインデータを読み込めませんでした(tml-index.yaml が存在しません)。");
276
- lines.push("");
448
+ function renderActiveEpicsSection(paths, views, catalogDocMap, epicScheduleMap) {
449
+ const lines = ["## 3. 実行中の epic", ""];
450
+ const activeEpics = views.filter((v) => v.item.type === "epic" && (v.item.status === "open" || v.item.status === "in-progress"));
451
+ if (activeEpics.length === 0) {
452
+ lines.push("- ありません", "");
277
453
  return lines;
278
454
  }
279
- try {
280
- const { index } = loadTimelineIndex(indexPath);
281
- const scheduleReadyTracks = index.tracks
282
- .filter((t) => t.catalog_status === "primary")
283
- .map((t) => t.track)
284
- .sort();
285
- const waves = buildTimelineWaves(index.tracks);
286
- const calendar = resolveDashboardCalendar(paths.schedulePath ?? paths.timelinePath);
287
- const { schedule, plannedStartDate } = computeTimelineTrackSchedules(index, calendar);
288
- lines.push(`- 計画開始日(planned_start_date): \`${plannedStartDate ?? "-"}\``);
289
- lines.push(`- wave数: \`${waves.length}\``);
290
- lines.push(`- Schedule展開準備状況(catalog_status=primary): \`${scheduleReadyTracks.join(", ") || "-"}\``);
291
- lines.push("");
292
- lines.push("### Wave・トラック一覧");
293
- lines.push("");
294
- lines.push("| wave | track | catalog_status | 推定稼働日数 | 予定開始日 | 予定終了日 | parallel_group | depends_on |");
295
- lines.push("| ---: | --- | --- | ---: | --- | --- | --- | --- |");
296
- for (const wave of waves) {
297
- for (const tk of wave.tracks) {
298
- const row = schedule.find((s) => s.track === tk.track);
299
- if (!row)
300
- continue;
301
- lines.push(`| ${wave.wave} | \`${tk.track}\` | \`${tk.catalog_status}\` | ${formatEstimate(tk)} | ${row.startDate ?? "-"} | ${row.endDate ?? "-"} | ${sanitizeDashboardCell(row.parallel_group ?? "-")} | ${sanitizeDashboardCell(row.depends_on.join(", ") || "-")} |`);
302
- }
455
+ let scheduleNodes = new Map();
456
+ if (paths.schedulePath && existsSync(paths.schedulePath)) {
457
+ try {
458
+ const schedule = buildScheduleIndex(paths.schedulePath);
459
+ scheduleNodes = schedule.nodes;
460
+ }
461
+ catch {
462
+ // ignore
463
+ }
464
+ }
465
+ let readyTasks = [];
466
+ if (existsSync(join(paths.executionGeneratedPath, "ready.json"))) {
467
+ try {
468
+ const ready = readReadySnapshot(join(paths.executionGeneratedPath, "ready.json"));
469
+ readyTasks = ready.tasks;
470
+ }
471
+ catch {
472
+ // ignore
473
+ }
474
+ }
475
+ let state;
476
+ if (existsSync(join(paths.executionGeneratedPath, "state.json"))) {
477
+ try {
478
+ state = readJson(join(paths.executionGeneratedPath, "state.json"));
479
+ }
480
+ catch {
481
+ // ignore
303
482
  }
304
- lines.push("");
305
- lines.push("### トラック計画ガントチャート");
306
- lines.push("");
307
- lines.push("![トラック計画ガントチャート](./dashboard-timeline-gantt.svg)");
308
- lines.push("");
309
- return lines;
310
483
  }
311
- catch (error) {
312
- const message = error instanceof Error ? error.message : String(error);
313
- lines.push(`- タイムラインの集計に失敗しました: ${message}`);
484
+ for (const epic of activeEpics) {
485
+ const epicLink = formatTicketLink(epic, paths.executionGeneratedPath);
486
+ lines.push(`### ${epicLink} ${sanitizeDashboardCell(epic.item.title)}`, "");
487
+ const track = epic.item.track;
488
+ lines.push(`- track: \`${track ?? "-"}\``);
489
+ const scheduleRow = epicScheduleMap.get(epic.id);
490
+ const startDate = scheduleRow?.startDate ?? "未定";
491
+ const endDate = scheduleRow?.endDate ?? "未定";
492
+ const estimateDays = scheduleRow?.estimateDays !== undefined ? `${scheduleRow.estimateDays}` : "-";
493
+ lines.push(`- 開始日: ${startDate}`);
494
+ lines.push(`- 終了日: ${endDate}`);
495
+ lines.push(`- 稼働日数: ${estimateDays}`);
496
+ if (track && scheduleNodes.size > 0) {
497
+ const trackTasks = [...scheduleNodes.values()].filter((node) => node.kind === "task" &&
498
+ (node.schedule_file.includes(`sch-track-${track}.yaml`) ||
499
+ node.id.startsWith(`T-${track.toUpperCase()}-`)));
500
+ if (trackTasks.length > 0) {
501
+ const stages = [];
502
+ const stageIndex = new Map();
503
+ for (const task of trackTasks) {
504
+ const stageName = task.name || task.phase_id || task.phase_set || "作業";
505
+ let idx = stageIndex.get(stageName);
506
+ if (idx === undefined) {
507
+ idx = stages.length;
508
+ stageIndex.set(stageName, idx);
509
+ stages.push({ name: stageName, total: 0, done: 0 });
510
+ }
511
+ stages[idx].total++;
512
+ if (state?.tasks[task.id]?.state === "done") {
513
+ stages[idx].done++;
514
+ }
515
+ }
516
+ const stageStr = stages.map((s) => `${s.name} ${s.done}/${s.total}`).join(", ");
517
+ lines.push(`- 段ごとの進捗: ${stageStr}`);
518
+ }
519
+ else {
520
+ lines.push("- 段ごとの進捗: schedule 未登録");
521
+ }
522
+ }
523
+ else {
524
+ lines.push("- 段ごとの進捗: schedule 未登録");
525
+ }
526
+ if (track && readyTasks.length > 0) {
527
+ const nextForTrack = readyTasks
528
+ .filter((t) => t.schedule_file?.includes(`sch-track-${track}.yaml`) ||
529
+ t.id.startsWith(`T-${track.toUpperCase()}-`))
530
+ .slice(0, 3);
531
+ if (nextForTrack.length > 0) {
532
+ lines.push("- 次に流せるタスク:");
533
+ for (const t of nextForTrack) {
534
+ lines.push(` - ${formatTaskLink(t.id, paths, catalogDocMap)}`);
535
+ }
536
+ }
537
+ else {
538
+ lines.push("- 次に流せるタスク: なし");
539
+ }
540
+ }
541
+ else {
542
+ lines.push("- 次に流せるタスク: なし");
543
+ }
544
+ const children = views.filter((v) => v.item.derivedFrom?.includes(epic.id));
545
+ const openChildren = children.filter((v) => !TERMINAL_STATUSES_SET.has(v.item.status));
546
+ const doneChildren = children.filter((v) => TERMINAL_STATUSES_SET.has(v.item.status));
547
+ if (children.length === 0) {
548
+ lines.push("- 子の項目: なし");
549
+ }
550
+ else {
551
+ lines.push("- 子の項目:");
552
+ if (openChildren.length > 0) {
553
+ for (const child of openChildren) {
554
+ const childLink = formatTicketLink(child, paths.executionGeneratedPath);
555
+ lines.push(` - ${childLink} (\`${child.item.status}\`): ${sanitizeDashboardCell(child.item.title)}`);
556
+ }
557
+ }
558
+ else {
559
+ lines.push(" - (未完了の項目はありません)");
560
+ }
561
+ if (doneChildren.length > 0) {
562
+ lines.push("");
563
+ lines.push(`::: details 完了した子項目(${doneChildren.length}件)`);
564
+ lines.push("");
565
+ for (const child of doneChildren) {
566
+ const childLink = formatTicketLink(child, paths.executionGeneratedPath);
567
+ lines.push(`- ${childLink} (\`${child.item.status}\`): ${sanitizeDashboardCell(child.item.title)}`);
568
+ }
569
+ lines.push("");
570
+ lines.push(":::");
571
+ }
572
+ }
314
573
  lines.push("");
315
- return lines;
316
574
  }
575
+ return lines;
317
576
  }
318
- function formatEstimate(track) {
319
- return track.catalog_duration_estimate_days === undefined
320
- ? "-"
321
- : String(track.catalog_duration_estimate_days);
322
- }
323
- function renderRegisterSection(projectId) {
324
- const agg = aggregateRegister(projectId);
325
- const lines = ["## 3. 登録簿状況", ""];
326
- if (agg.error) {
327
- lines.push(`- 登録簿の集計に失敗しました: ${agg.error}`);
328
- lines.push("");
577
+ function renderCompletedEpicsSection(paths, views, epicScheduleMap) {
578
+ const lines = ["## 4. 終わった epic", ""];
579
+ const completedEpics = views.filter((v) => v.item.type === "epic" && TERMINAL_STATUSES_SET.has(v.item.status));
580
+ if (completedEpics.length === 0) {
581
+ lines.push("- ありません", "");
329
582
  return lines;
330
583
  }
331
- lines.push(`- 総件数: \`${agg.total}\``);
332
- lines.push("");
333
- lines.push("### 状態別");
584
+ lines.push(`::: details 終わった epic の一覧(${completedEpics.length}件)`);
334
585
  lines.push("");
335
- lines.push(countTable("状態", agg.statusCounts, STATUS_ORDER));
336
- lines.push("");
337
- lines.push("### 優先度別");
586
+ lines.push("| id | title | track | 開始日 | 終了日 | 稼働日数 |");
587
+ lines.push("| --- | --- | --- | --- | --- | ---: |");
588
+ for (const epic of completedEpics) {
589
+ const epicLink = formatTicketLink(epic, paths.executionGeneratedPath);
590
+ const scheduleRow = epicScheduleMap.get(epic.id);
591
+ const startDate = scheduleRow?.startDate ?? "未定";
592
+ const endDate = scheduleRow
593
+ ? (scheduleRow.endDate ?? "未定")
594
+ : epic.item.completedAt
595
+ ? epic.item.completedAt.slice(0, 10)
596
+ : "未定";
597
+ const estimateDays = scheduleRow?.estimateDays !== undefined ? `${scheduleRow.estimateDays}` : "-";
598
+ lines.push(`| ${epicLink} | ${sanitizeDashboardCell(epic.item.title)} | \`${epic.item.track ?? "-"}\` | ${startDate} | ${endDate} | ${estimateDays} |`);
599
+ }
338
600
  lines.push("");
339
- lines.push(countTable("優先度", agg.priorityCounts, PRIORITY_ORDER));
601
+ lines.push(":::");
340
602
  lines.push("");
341
603
  return lines;
342
604
  }
343
605
  function renderRoutineSection(paths) {
344
- const agg = aggregateRoutines(paths.routinesPath);
345
- const lines = ["## 4. routine定義・最終実行", ""];
606
+ const lines = ["## 5. routine", ""];
607
+ const agg = aggregateRoutines(paths.routinesPath, paths.repoRoot);
346
608
  if (agg.error)
347
609
  lines.push(`- routine 集計に失敗しました: ${agg.error}`);
348
610
  if (agg.rows.length === 0) {
349
- lines.push("- (定義された routine がありません)");
350
- lines.push("");
611
+ lines.push("- ありません", "");
351
612
  return lines;
352
613
  }
614
+ const now = new Date();
615
+ const cutoff24h = now.getTime() - 24 * 60 * 60 * 1000;
616
+ const recentFailures = agg.history.filter((h) => {
617
+ const t = Date.parse(h.completed_at || h.started_at);
618
+ return !Number.isNaN(t) && t >= cutoff24h && h.result === "failure";
619
+ });
620
+ if (recentFailures.length === 0) {
621
+ lines.push("- 直近 24 時間に失敗した routine はありません。");
622
+ }
623
+ else {
624
+ lines.push("### 直近 24 時間に失敗した routine");
625
+ lines.push("");
626
+ lines.push("| routine | 実行時刻 | 結果 | Job Run |");
627
+ lines.push("| --- | --- | --- | --- |");
628
+ for (const f of recentFailures) {
629
+ lines.push(`| \`${f.routine_id}\` | ${f.completed_at || f.started_at} | \`${f.result}\` | ${f.job_run_ids.map((id) => `\`${id}\``).join(", ") || "-"} |`);
630
+ }
631
+ lines.push("");
632
+ }
633
+ // 次に動くもの
634
+ const dailyRows = buildDailyRoutineRows(agg.docs, agg.history, now);
635
+ const futureRuns = dailyRows.filter((r) => r.day === "本日" && r.result === "予定" && Date.parse(r.scheduledFor) >= now.getTime());
636
+ if (futureRuns.length > 0) {
637
+ const next = futureRuns[0];
638
+ lines.push(`- 次に動くもの: \`${next.routineId}\`(予定: ${formatZonedDateTime(next.scheduledFor, "Asia/Tokyo")})`);
639
+ }
640
+ else {
641
+ lines.push("- 次に動くもの: 予定なし");
642
+ }
643
+ lines.push("");
644
+ lines.push(`::: details routine 定義一覧(${agg.rows.length}件)`);
645
+ lines.push("");
353
646
  lines.push("| id | name | enabled | 間隔 / cron | kind | 最終実行 / 結果 | due |");
354
647
  lines.push("| --- | --- | --- | --- | --- | --- | :---: |");
355
648
  for (const row of agg.rows) {
356
649
  lines.push(`| \`${row.id}\` | ${sanitizeDashboardCell(row.name ?? "-")} | ${row.enabled ? "enabled" : "disabled"} | \`${sanitizeDashboardCell(row.schedule)}\` | \`${row.kind}\` | ${sanitizeDashboardCell(row.lastRun)} | ${row.due} |`);
357
650
  }
358
651
  lines.push("");
359
- return lines;
360
- }
361
- function renderDailyRoutineSection(paths) {
362
- const lines = ["## 5. routine 実行状況(昨日・本日)", ""];
363
- const agg = aggregateRoutines(paths.routinesPath);
364
- const rows = buildDailyRoutineRows(agg.docs, agg.history, new Date());
365
- if (rows.length === 0) {
366
- lines.push("- (昨日の実行履歴・本日の予定はありません)", "");
367
- return lines;
368
- }
369
- const timeZone = "Asia/Tokyo";
370
- lines.push(`- 時刻は ${timeZone}。1 日に ${ROUTINE_ROW_COLLAPSE_THRESHOLD} 回以上動く routine は最新の実行 1 行に件数をまとめる。`);
371
- lines.push("");
372
- lines.push("| 日 | routine | 予定 | 開始 | 完了 | 結果 | 回数 | Job Run |");
373
- lines.push("| --- | --- | --- | --- | --- | --- | ---: | --- |");
374
- for (const row of rows) {
375
- const fmt = (value) => value === "-" ? "-" : formatZonedDateTime(value, timeZone);
376
- lines.push(`| ${row.day} | \`${row.routineId}\` | ${fmt(row.scheduledFor)} | ${fmt(row.startedAt)} | ${fmt(row.completedAt)} | ${row.result} | ${row.runCount} | ${row.jobRunIds.map((id) => `\`${id}\``).join(", ") || "-"} |`);
377
- }
652
+ lines.push(":::");
378
653
  lines.push("");
379
654
  return lines;
380
655
  }
381
- export function readDashboardGradeResults(resultsPath) {
382
- if (!existsSync(resultsPath))
383
- return [];
384
- return listFilesRecursive(resultsPath)
385
- .filter((path) => path.endsWith(".yaml") || path.endsWith(".yml"))
386
- .sort()
387
- .flatMap((path) => {
388
- try {
389
- return [parseGradeResult(readFileSync(path, "utf8"), path)];
390
- }
391
- catch {
392
- return [];
393
- }
394
- });
395
- }
396
656
  function renderGradeSection(paths) {
397
- const lines = ["## 8. Grade", ""];
657
+ const lines = ["## 6. Grade", ""];
398
658
  const results = paths.gradeResultsPath ? readDashboardGradeResults(paths.gradeResultsPath) : [];
399
659
  if (results.length === 0) {
400
- lines.push("- grade result はまだありません。", "");
660
+ lines.push("- ありません", "");
401
661
  return lines;
402
662
  }
403
- lines.push("| 成果物 | 対象 | verdict | score | findings |", "| --- | --- | --- | ---: | ---: |");
404
- for (const result of results) {
405
- lines.push(`| \`${sanitizeDashboardCell(result.document)}\` | \`${result.target}\` | \`${result.verdict}\` | ${result.score} | ${gradeFindingCount(result)} |`);
663
+ const verdictCounts = {};
664
+ for (const r of results) {
665
+ verdictCounts[r.verdict] = (verdictCounts[r.verdict] ?? 0) + 1;
666
+ }
667
+ const verdictSummary = Object.entries(verdictCounts)
668
+ .sort(([a], [b]) => a.localeCompare(b))
669
+ .map(([v, count]) => `${v}=${count}`)
670
+ .join(", ");
671
+ lines.push(`- verdict 別件数: \`${verdictSummary}\``);
672
+ lines.push("");
673
+ const lowest5 = [...results]
674
+ .sort((a, b) => a.score - b.score || a.document.localeCompare(b.document))
675
+ .slice(0, 5);
676
+ lines.push("### 点の低い 5 件");
677
+ lines.push("");
678
+ lines.push("| 成果物 | 対象 | verdict | score | findings |");
679
+ lines.push("| --- | --- | --- | ---: | ---: |");
680
+ for (const r of lowest5) {
681
+ lines.push(`| \`${sanitizeDashboardCell(r.document)}\` | \`${r.target}\` | \`${r.verdict}\` | ${r.score} | ${gradeFindingCount(r)} |`);
406
682
  }
407
683
  lines.push("");
684
+ lines.push(`::: details 全体の表(${results.length}件)`);
685
+ lines.push("");
686
+ lines.push("| 成果物 | 対象 | verdict | score | findings |");
687
+ lines.push("| --- | --- | --- | ---: | ---: |");
688
+ for (const r of results) {
689
+ lines.push(`| \`${sanitizeDashboardCell(r.document)}\` | \`${r.target}\` | \`${r.verdict}\` | ${r.score} | ${gradeFindingCount(r)} |`);
690
+ }
691
+ lines.push("");
692
+ lines.push(":::");
693
+ lines.push("");
408
694
  return lines;
409
695
  }
410
- function renderRecommendedRegisterSection(projectId) {
411
- const lines = ["## 6. 着手可能な登録項目(おすすめ順)", ""];
412
- let rows;
413
- let today;
414
- try {
415
- const paths = resolveRegisterPaths({ project: projectId });
416
- today = zonedDateKey(new Date(), paths.registerDateTimeZone);
417
- rows = rankRegisterCandidates(buildRegisterCandidates(paths), today).slice(0, 10);
418
- }
419
- catch (error) {
420
- lines.push(`- 登録簿の集計に失敗しました: ${error instanceof Error ? error.message : String(error)}`, "");
696
+ function renderScheduleSectionContent(paths) {
697
+ const lines = [];
698
+ if (!existsSync(paths.executionGeneratedPath)) {
699
+ lines.push("- Schedule はまだ生成されていません。");
700
+ lines.push("");
421
701
  return lines;
422
702
  }
423
- if (rows.length === 0) {
424
- lines.push("- (着手可能な登録項目はありません)", "");
425
- return lines;
703
+ try {
704
+ const state = existsSync(join(paths.executionGeneratedPath, "state.json"))
705
+ ? readJson(join(paths.executionGeneratedPath, "state.json"))
706
+ : undefined;
707
+ if (state) {
708
+ const counts = {
709
+ todo: 0,
710
+ doing: 0,
711
+ blocked: 0,
712
+ done: 0,
713
+ cancelled: 0,
714
+ };
715
+ for (const taskState of Object.values(state.tasks)) {
716
+ const s = taskState.state;
717
+ if (s in counts)
718
+ counts[s] += 1;
719
+ }
720
+ const total = Object.values(counts).reduce((sum, n) => sum + n, 0);
721
+ const doneEquivalent = counts.done + counts.doing * 0.5;
722
+ const percent = total > 0 ? ((doneEquivalent / total) * 100).toFixed(1) : "0.0";
723
+ lines.push(`- 進捗率(done+doing×0.5): \`${percent}%\``);
724
+ lines.push(`- 状態別: \`todo=${counts.todo}, doing=${counts.doing}, blocked=${counts.blocked}, done=${counts.done}, cancelled=${counts.cancelled}\``);
725
+ lines.push("");
726
+ }
426
727
  }
427
- lines.push("| 順位 | id | type | title | 期日 | 優先度 | 関連 open PJR | 登録日時 | 根拠 |");
428
- lines.push("| ---: | --- | --- | --- | --- | --- | ---: | --- | --- |");
429
- const todayMs = dateOnlyMs(today) ?? 0;
430
- rows.forEach((row, index) => {
431
- const dueMs = dateOnlyMs(row.due);
432
- const dueReason = dueMs === undefined
433
- ? "期日なし"
434
- : dueMs < todayMs
435
- ? `期日超過 ${Math.ceil((todayMs - dueMs) / 86_400_000)}日`
436
- : `期日まで ${Math.ceil((dueMs - todayMs) / 86_400_000)}日`;
437
- lines.push(`| ${index + 1} | \`${row.id}\` | \`${row.type}\` | ${sanitizeDashboardCell(row.title)} | ${row.due} | \`${row.priority}\` | ${row.relatedOpenPjrCount} | ${row.registeredAt} | ${dueReason}、優先度 ${row.priority}、関連 open PJR ${row.relatedOpenPjrCount}件 |`);
438
- });
728
+ catch {
729
+ lines.push("- Schedule の集計に失敗しました。");
730
+ lines.push("");
731
+ }
732
+ lines.push("- 詳細ガントチャート: [`execution/generated/gantt-chart.md`](./gantt-chart.md)");
733
+ lines.push("![Scheduleガントチャート](./gantt-chart.svg)");
439
734
  lines.push("");
440
735
  return lines;
441
736
  }
442
- function renderAttentionSection(paths) {
443
- const lines = ["## 7. 要対応(解除待ち)", ""];
444
- try {
445
- const rows = aggregateAttention(paths);
446
- if (rows.length === 0) {
447
- lines.push("- (解除待ちの登録項目・exec タスクはありません)", "");
448
- return lines;
449
- }
450
- lines.push("| 種別 | id | 理由 | 次の行動 |");
451
- lines.push("| --- | --- | --- | --- |");
452
- for (const row of rows) {
453
- lines.push(`| ${row.source} | \`${row.id}\` | ${sanitizeDashboardCell(row.reason)} | ${sanitizeDashboardCell(row.nextAction)} |`);
454
- }
737
+ function renderRegisterSectionContent(views) {
738
+ const lines = [];
739
+ const statusCounts = {};
740
+ const priorityCounts = {};
741
+ for (const view of views) {
742
+ statusCounts[view.item.status] = (statusCounts[view.item.status] ?? 0) + 1;
743
+ priorityCounts[view.item.priority] = (priorityCounts[view.item.priority] ?? 0) + 1;
455
744
  }
456
- catch (error) {
457
- lines.push(`- 要対応一覧の集計に失敗しました: ${error instanceof Error ? error.message : String(error)}`);
745
+ lines.push(`- 総件数: \`${views.length}\``);
746
+ lines.push("");
747
+ lines.push("#### 状態別");
748
+ lines.push("");
749
+ lines.push(countTable("状態", statusCounts, STATUS_ORDER));
750
+ lines.push("");
751
+ lines.push("#### 優先度別");
752
+ lines.push("");
753
+ lines.push(countTable("優先度", priorityCounts, PRIORITY_ORDER));
754
+ lines.push("");
755
+ return lines;
756
+ }
757
+ function renderAggregationSection(paths, views) {
758
+ const lines = ["## 7. 全体の集計", ""];
759
+ const hasSchedule = existsSync(paths.executionGeneratedPath) &&
760
+ existsSync(join(paths.executionGeneratedPath, "state.json"));
761
+ const hasRegister = views.length > 0;
762
+ if (!hasSchedule && !hasRegister) {
763
+ lines.push("- ありません", "");
764
+ return lines;
458
765
  }
766
+ lines.push("::: details 全体の集計");
767
+ lines.push("");
768
+ lines.push("### Schedule 進捗");
769
+ lines.push("");
770
+ lines.push(...renderScheduleSectionContent(paths));
771
+ lines.push("### 登録簿状況");
772
+ lines.push("");
773
+ lines.push(...renderRegisterSectionContent(views));
774
+ lines.push("### 全体計画ガントチャート");
775
+ lines.push("");
776
+ lines.push("![全体計画ガントチャート](./dashboard-timeline-gantt.svg)");
777
+ lines.push("");
778
+ lines.push(":::");
459
779
  lines.push("");
460
780
  return lines;
461
781
  }
462
782
  // ================================
463
- // 9. Exec records (plan / result 一覧)
783
+ // 8. Exec records (plan / result 一覧)
464
784
  // ================================
465
785
  export { buildExecRecordsMarkdown, collectExecRecords, EXEC_RECORDS_FILE };
466
786
  function execRecordsPath(paths) {
467
787
  return join(paths.executionGeneratedPath, "..", "exec");
468
788
  }
469
789
  function renderExecRecordsSection(paths) {
470
- const lines = ["## 9. 実行記録", ""];
790
+ const lines = ["## 8. 実行記録", ""];
471
791
  const rows = collectExecRecords(execRecordsPath(paths));
472
792
  const plans = rows.filter((row) => row.planFile).length;
473
793
  const results = rows.filter((row) => row.resultFile).length;
@@ -485,14 +805,26 @@ export function buildDashboardMarkdown(paths) {
485
805
  lines.push("");
486
806
  lines.push(generatedBanner("specdojo dashboard build"));
487
807
  lines.push("");
488
- lines.push(...renderScheduleSection(paths));
489
- lines.push(...renderTimelineSection(paths));
490
- lines.push(...renderRegisterSection(paths.projectId));
808
+ let views = [];
809
+ try {
810
+ const regPaths = getRegisterPathsForDashboard(paths);
811
+ if (regPaths) {
812
+ views = loadRegisterItems(regPaths);
813
+ }
814
+ }
815
+ catch {
816
+ views = [];
817
+ }
818
+ const catalogDocMap = buildCatalogDocMap(paths.catalogPath);
819
+ const { schedule: epicSchedule } = dashboardEpicPlan(paths);
820
+ const epicScheduleMap = new Map(epicSchedule.map((s) => [s.id, s]));
821
+ lines.push(...renderActionRequiredSection(paths, views, catalogDocMap));
822
+ lines.push(...renderRecommendedRegisterSection(paths, views));
823
+ lines.push(...renderActiveEpicsSection(paths, views, catalogDocMap, epicScheduleMap));
824
+ lines.push(...renderCompletedEpicsSection(paths, views, epicScheduleMap));
491
825
  lines.push(...renderRoutineSection(paths));
492
- lines.push(...renderDailyRoutineSection(paths));
493
- lines.push(...renderRecommendedRegisterSection(paths.projectId));
494
- lines.push(...renderAttentionSection(paths));
495
826
  lines.push(...renderGradeSection(paths));
827
+ lines.push(...renderAggregationSection(paths, views));
496
828
  lines.push(...renderExecRecordsSection(paths));
497
829
  // 各セクションは次のセクションとの区切りとして空行で終わる。最後のセクションの空行を
498
830
  // そのまま残すと、書き出し時に付ける改行と合わさって末尾が空行2行になり markdownlint の
@@ -511,21 +843,37 @@ export function writeDashboard(paths) {
511
843
  const recordsMarkdown = buildExecRecordsMarkdown(paths.projectId, collectExecRecords(execRecordsPath(paths)));
512
844
  writeFileSync(recordsPath, recordsMarkdown + "\n", "utf8");
513
845
  generatedFiles.push(toArtifactPath(recordsPath));
514
- // timeline gantt SVG を並置。tml-index が無い/壊れている場合はスキップ。
846
+ const { schedule: epicSchedule, plannedStartDate: epicStart } = dashboardEpicPlan(paths);
515
847
  const indexPath = join(paths.timelinePath, "tml-index.yaml");
516
- if (existsSync(indexPath)) {
517
- try {
518
- const { index } = loadTimelineIndex(indexPath);
519
- const calendar = resolveDashboardCalendar(paths.schedulePath ?? paths.timelinePath);
520
- const { schedule, plannedStartDate } = computeTimelineTrackSchedules(index, calendar);
521
- const svgPath = join(paths.executionGeneratedPath, "dashboard-timeline-gantt.svg");
522
- writeFileSync(svgPath, buildTimelineGanttSvg(schedule, plannedStartDate) + "\n", "utf8");
523
- generatedFiles.push(toArtifactPath(svgPath));
848
+ if (epicSchedule.length > 0 || existsSync(indexPath)) {
849
+ let svg;
850
+ if (epicSchedule.length > 0) {
851
+ svg = buildTimelineGanttSvg(epicSchedule, epicStart, "全体計画(epic)", "登録簿の予定開始日・着手記録・先行 epic と、完了日時・期限から算出。日付の逆転がある期間は未定。");
524
852
  }
525
- catch {
526
- // SVG 生成失敗は markdown に影響しないため破棄(renderTimelineSection でエラー表示済み)。
853
+ else {
854
+ const { index, errors } = loadTimelineIndex(indexPath);
855
+ if (errors.length)
856
+ throw new Error(errors.join("; "));
857
+ const { schedule, plannedStartDate } = computeTimelineTrackSchedules(index, resolveDashboardCalendar(paths.schedulePath ?? paths.timelinePath));
858
+ svg = buildTimelineGanttSvg(schedule, plannedStartDate);
527
859
  }
860
+ const svgPath = join(paths.executionGeneratedPath, "dashboard-timeline-gantt.svg");
861
+ writeFileSync(svgPath, svg + "\n", "utf8");
862
+ generatedFiles.push(toArtifactPath(svgPath));
528
863
  }
864
+ const catalogPlan = buildTimeline({
865
+ timelinePath: paths.timelinePath,
866
+ catalogPath: paths.catalogPath ?? null,
867
+ registerPath: paths.registerPath ?? join(paths.projectPath, "controls", "project-register"),
868
+ schedulePath: paths.schedulePath,
869
+ projectId: paths.projectId,
870
+ repoRoot: paths.repoRoot ?? specdojoRootDir(),
871
+ });
872
+ if (catalogPlan.errors.length > 0)
873
+ throw new Error(catalogPlan.errors.join("; "));
874
+ const scaffoldPath = join(paths.executionGeneratedPath, "catalog-scaffold.md");
875
+ writeFileSync(scaffoldPath, renderCatalogScaffoldMarkdown(catalogPlan), "utf8");
876
+ generatedFiles.push(toArtifactPath(scaffoldPath));
529
877
  return { markdown, generatedFiles };
530
878
  }
531
879
  export function buildDashboard(opts) {
@@ -535,7 +883,12 @@ export function buildDashboard(opts) {
535
883
  }
536
884
  // build-command ステップで使う出力先の解決を公開する。
537
885
  export function dashboardOutputFiles(paths) {
538
- return ["dashboard.md", EXEC_RECORDS_FILE, "dashboard-timeline-gantt.svg"].map((name) => toArtifactPath(join(paths.executionGeneratedPath, name)));
886
+ return [
887
+ "dashboard.md",
888
+ EXEC_RECORDS_FILE,
889
+ "dashboard-timeline-gantt.svg",
890
+ "catalog-scaffold.md",
891
+ ].map((name) => toArtifactPath(join(paths.executionGeneratedPath, name)));
539
892
  }
540
893
  // ================================
541
894
  // CLI command
@@ -549,7 +902,7 @@ export function registerDashboardCommands(program) {
549
902
  const dash = program.command("dashboard").description("Per-project dashboard build commands");
550
903
  const bcmd = dash
551
904
  .command("build")
552
- .description("Generate per-project dashboard.md and timeline Gantt chart SVG")
905
+ .description("Generate per-project dashboard.md, epic Gantt chart SVG and catalog scaffold targets")
553
906
  .option("--project <id>", "Project id in specdojo.config.json")
554
907
  .option("--dry-run", "Print generated content to stdout without writing", false);
555
908
  bcmd.action((opts) => {
@@ -574,4 +927,4 @@ export function registerDashboardCommands(program) {
574
927
  });
575
928
  }
576
929
  // build-command で使う path 解決ヘルパーを公開する。
577
- export { getProjectExecutionPath, getProjectRoutinesPath, getProjectSchedulePath, getProjectTimelinePath, };
930
+ export { getProjectExecutionPath, getProjectRegisterPath, getProjectRoutinesPath, getProjectSchedulePath, getProjectTimelinePath, };