specdojo 0.1.0 → 0.2.1

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 (540) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +142 -35
  3. package/dist/agent-response.js +27 -0
  4. package/dist/agent.js +124 -0
  5. package/dist/build-command.js +149 -0
  6. package/dist/build-if-stale.js +35 -0
  7. package/dist/catalog-build.js +1079 -0
  8. package/dist/catalog-generate.js +226 -0
  9. package/dist/catalog-paths.js +31 -0
  10. package/dist/catalog-plan-generate.js +301 -0
  11. package/dist/catalog-plan-prompt.js +73 -0
  12. package/dist/catalog-plan.js +471 -0
  13. package/dist/catalog-scaffold.js +255 -0
  14. package/dist/catalog-types.js +4 -0
  15. package/dist/catalog.js +606 -0
  16. package/dist/dashboard.js +990 -0
  17. package/dist/deliverable-trash.js +148 -0
  18. package/dist/deliverable.js +97 -0
  19. package/dist/dist-freshness.js +150 -0
  20. package/dist/doc-index.js +424 -0
  21. package/dist/exec-agent-config.js +172 -0
  22. package/dist/exec-agent-git-state.js +136 -0
  23. package/dist/exec-agent-protected-config.js +276 -0
  24. package/dist/exec-events.js +250 -112
  25. package/dist/exec-evidence.js +317 -0
  26. package/dist/exec-format.js +54 -0
  27. package/dist/exec-limit.js +202 -0
  28. package/dist/exec-parent-validation.js +169 -0
  29. package/dist/exec-pipeline-state.js +160 -0
  30. package/dist/exec-plans.js +1016 -0
  31. package/dist/exec-project.js +25 -11
  32. package/dist/exec-protection-handoff.js +169 -0
  33. package/dist/exec-provider-scaffold.js +99 -0
  34. package/dist/exec-register-resume.js +196 -0
  35. package/dist/exec-register.js +281 -0
  36. package/dist/exec-reporter.js +329 -0
  37. package/dist/exec-results.js +510 -0
  38. package/dist/exec-run-lock.js +149 -0
  39. package/dist/exec-run.js +4953 -0
  40. package/dist/exec-schedule-calendar.js +86 -9
  41. package/dist/exec-schedule-cpm.js +30 -12
  42. package/dist/exec-schedule-gantt-chart-render.js +428 -0
  43. package/dist/exec-schedule-gantt-chart-scope.js +111 -0
  44. package/dist/exec-schedule-gantt-chart.js +2 -0
  45. package/dist/exec-schedule-hash.js +34 -25
  46. package/dist/exec-schedule-index.js +200 -67
  47. package/dist/exec-schedule-initial.js +100 -0
  48. package/dist/exec-schedule-progress.js +51 -26
  49. package/dist/exec-schedule-ready.js +71 -27
  50. package/dist/exec-schedule.js +171 -93
  51. package/dist/exec-shared.js +146 -25
  52. package/dist/exec-strategy.js +547 -0
  53. package/dist/exec-task-view.js +64 -0
  54. package/dist/exec-trial.js +895 -0
  55. package/dist/exec-worktree-command.js +426 -0
  56. package/dist/exec-worktree-ops.js +847 -0
  57. package/dist/exec-worktree.js +359 -0
  58. package/dist/exec.js +744 -192
  59. package/dist/frontmatter-namespace.js +48 -0
  60. package/dist/git-environment.js +23 -0
  61. package/dist/grade-result.js +137 -0
  62. package/dist/grade.js +2456 -0
  63. package/dist/index-command.js +103 -0
  64. package/dist/job.js +1081 -0
  65. package/dist/kata-command.js +303 -0
  66. package/dist/kata.js +187 -0
  67. package/dist/package-paths.js +33 -0
  68. package/dist/practice-id.js +24 -0
  69. package/dist/register-date.js +122 -0
  70. package/dist/register-events.js +363 -0
  71. package/dist/register-history.js +323 -0
  72. package/dist/register-item.js +455 -0
  73. package/dist/register-migrate-timestamps.js +176 -0
  74. package/dist/register.js +2199 -0
  75. package/dist/review-plan.js +199 -0
  76. package/dist/review-types.js +1 -0
  77. package/dist/role-types.js +1 -0
  78. package/dist/routine.js +814 -0
  79. package/dist/schedule-approach.js +252 -0
  80. package/dist/schedule-build.js +552 -0
  81. package/dist/schedule-phase-sets.js +73 -0
  82. package/dist/schedule-strategy-generate.js +812 -0
  83. package/dist/schedule-strategy-profiles.js +276 -0
  84. package/dist/schedule.js +420 -0
  85. package/dist/spawn-self.js +28 -0
  86. package/dist/specdojo-config.js +133 -39
  87. package/dist/specdojo.js +56 -7
  88. package/dist/template-frontmatter.js +89 -0
  89. package/dist/template-resolution.js +92 -0
  90. package/dist/timeline-build.js +334 -0
  91. package/dist/timeline.js +107 -0
  92. package/dist/watch.js +313 -0
  93. package/dist/yaml-pages-command.js +28 -0
  94. package/dist/yaml-pages.js +180 -0
  95. package/dist/yaml-schema-modeline.js +49 -0
  96. package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +600 -0
  97. package/docs/ja/specdojo/exec-templates/xep-bootstrap-template.md +120 -0
  98. package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +37 -0
  99. package/docs/ja/specdojo/exec-templates/xep-cross-deliverable-dedup-template.md +51 -0
  100. package/docs/ja/specdojo/exec-templates/xep-freeform-template.md +74 -0
  101. package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +109 -0
  102. package/docs/ja/specdojo/exec-templates/xep-job-template.md +43 -0
  103. package/docs/ja/specdojo/exec-templates/xep-recipe-guided-template.md +82 -0
  104. package/docs/ja/specdojo/exec-templates/xep-recipe-maintenance-template.md +86 -0
  105. package/docs/ja/specdojo/exec-templates/xep-register-investigate-template.md +42 -0
  106. package/docs/ja/specdojo/exec-templates/xep-register-template.md +49 -0
  107. package/docs/ja/specdojo/exec-templates/xep-retrofit-template.md +98 -0
  108. package/docs/ja/specdojo/exec-templates/xep-rulebook-maintenance-template.md +86 -0
  109. package/docs/ja/specdojo/exec-templates/xep-sample-maintenance-template.md +86 -0
  110. package/docs/ja/specdojo/exec-templates/xep-template-maintenance-template.md +86 -0
  111. package/docs/ja/specdojo/exec-templates/xep-template.md +66 -0
  112. package/docs/ja/specdojo/exec-templates/xer-cross-deliverable-dedup-template.md +31 -0
  113. package/docs/ja/specdojo/exec-templates/xer-human-bootstrap-finalize-template.md +40 -0
  114. package/docs/ja/specdojo/exec-templates/xer-human-finalize-template.md +30 -0
  115. package/docs/ja/specdojo/exec-templates/xer-template.md +19 -0
  116. package/docs/ja/specdojo/exec-templates/xrp-freeform-template.md +70 -0
  117. package/docs/ja/specdojo/exec-templates/xrp-fully-guided-template.md +97 -0
  118. package/docs/ja/specdojo/exec-templates/xrp-recipe-guided-template.md +76 -0
  119. package/docs/ja/specdojo/exec-templates/xrp-recipe-maintenance-template.md +73 -0
  120. package/docs/ja/specdojo/exec-templates/xrp-retrofit-template.md +74 -0
  121. package/docs/ja/specdojo/exec-templates/xrp-rulebook-maintenance-template.md +74 -0
  122. package/docs/ja/specdojo/exec-templates/xrp-sample-maintenance-template.md +73 -0
  123. package/docs/ja/specdojo/exec-templates/xrp-template-maintenance-template.md +73 -0
  124. package/docs/ja/specdojo/exec-templates/xrp-template.md +67 -0
  125. package/docs/ja/specdojo/exec-templates/xrp-viewpoint-detail-template.md +7 -0
  126. package/docs/ja/specdojo/exec-templates/xrr-template.md +21 -0
  127. package/docs/ja/specdojo/exec-templates/xrr-viewpoint-detail-template.md +7 -0
  128. package/docs/ja/specdojo/guides/branch-workflow-guide.md +354 -0
  129. package/docs/ja/specdojo/guides/docs-editing-guide.md +327 -0
  130. package/docs/ja/specdojo/guides/docs-structure-guide.md +519 -0
  131. package/docs/ja/specdojo/guides/exec-config-guide.md +589 -0
  132. package/docs/ja/specdojo/guides/exec-operation-guide.md +440 -0
  133. package/docs/ja/specdojo/guides/exec-worktree-guide.md +318 -0
  134. package/docs/ja/specdojo/guides/kata-guide.md +89 -0
  135. package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +127 -0
  136. package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +228 -0
  137. package/docs/ja/specdojo/guides/practice-system-composition-guide.md +111 -0
  138. package/docs/ja/specdojo/guides/quick-start-guide.md +472 -0
  139. package/docs/ja/specdojo/guides/register-operation-guide.md +418 -0
  140. package/docs/ja/specdojo/guides/remote-host-development-guide.md +163 -0
  141. package/docs/ja/specdojo/guides/review-guide.md +428 -0
  142. package/docs/ja/specdojo/guides/routine-operation-guide.md +282 -0
  143. package/docs/ja/specdojo/guides/ryu-guide.md +230 -0
  144. package/docs/ja/specdojo/guides/schedule-design-guide.md +429 -0
  145. package/docs/ja/specdojo/guides/schedule-operation-guide.md +151 -0
  146. package/docs/ja/specdojo/guides/specdojo-overview-guide.md +257 -0
  147. package/docs/ja/specdojo/guides/timeline-design-guide.md +160 -0
  148. package/docs/ja/specdojo/guides/track-design-guide.md +215 -0
  149. package/docs/ja/specdojo/guides/use-case-guide.md +133 -0
  150. package/docs/ja/specdojo/guides/waza-guide.md +224 -0
  151. package/docs/ja/specdojo/index.md +33 -0
  152. package/docs/ja/specdojo/philosophy/needs-to-implementation-philosophy.md +212 -0
  153. package/docs/ja/specdojo/philosophy/specdojo-philosophy.md +242 -0
  154. package/docs/ja/specdojo/recipes/cdfd-overview-recipe.md +198 -0
  155. package/docs/ja/specdojo/recipes/cdfd-recipe.md +218 -0
  156. package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +198 -0
  157. package/docs/ja/specdojo/recipes/exec-human-finalize-recipe.md +100 -0
  158. package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +148 -0
  159. package/docs/ja/specdojo/recipes/pm-communication-plan-recipe.md +97 -0
  160. package/docs/ja/specdojo/recipes/pm-members-recipe.md +149 -0
  161. package/docs/ja/specdojo/recipes/pm-organization-recipe.md +96 -0
  162. package/docs/ja/specdojo/recipes/pm-plan-recipe.md +98 -0
  163. package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +97 -0
  164. package/docs/ja/specdojo/recipes/pm-raci-recipe.md +96 -0
  165. package/docs/ja/specdojo/recipes/pm-roles-recipe.md +136 -0
  166. package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +162 -0
  167. package/docs/ja/specdojo/recipes/prj-charter-recipe.md +187 -0
  168. package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +235 -0
  169. package/docs/ja/specdojo/recipes/prj-issues-and-approach-recipe.md +205 -0
  170. package/docs/ja/specdojo/recipes/prj-overview-recipe.md +289 -0
  171. package/docs/ja/specdojo/recipes/prj-scope-recipe.md +201 -0
  172. package/docs/ja/specdojo/recipes/prj-stakeholder-register-recipe.md +168 -0
  173. package/docs/ja/specdojo/recipes/prj-success-criteria-and-acceptance-criteria-recipe.md +179 -0
  174. package/docs/ja/specdojo/recipes/stsd-recipe.md +138 -0
  175. package/docs/ja/specdojo/references/command-reference.md +718 -0
  176. package/docs/ja/specdojo/references/deliverables-reference.md +407 -0
  177. package/docs/ja/specdojo/references/directory-layout-reference.md +280 -0
  178. package/docs/ja/specdojo/references/specdojo-config-reference.md +133 -0
  179. package/docs/ja/specdojo/rulebooks/atc-index-rulebook.md +372 -0
  180. package/docs/ja/specdojo/rulebooks/atc-rulebook.md +302 -0
  181. package/docs/ja/specdojo/rulebooks/bac-rulebook.md +331 -0
  182. package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +134 -0
  183. package/docs/ja/specdojo/rulebooks/bds-rulebook.md +207 -0
  184. package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +102 -0
  185. package/docs/ja/specdojo/rulebooks/bes-rulebook.md +131 -0
  186. package/docs/ja/specdojo/rulebooks/bps-rulebook.md +269 -0
  187. package/docs/ja/specdojo/rulebooks/br-rulebook.md +187 -0
  188. package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +279 -0
  189. package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +219 -0
  190. package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +233 -0
  191. package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +182 -0
  192. package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +171 -0
  193. package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +105 -0
  194. package/docs/ja/specdojo/rulebooks/cld-rulebook.md +195 -0
  195. package/docs/ja/specdojo/rulebooks/cnd-mermaid-rulebook.md +285 -0
  196. package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +292 -0
  197. package/docs/ja/specdojo/rulebooks/cop-index-rulebook.md +171 -0
  198. package/docs/ja/specdojo/rulebooks/cop-rulebook.md +325 -0
  199. package/docs/ja/specdojo/rulebooks/cpd-mermaid-rulebook.md +266 -0
  200. package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +294 -0
  201. package/docs/ja/specdojo/rulebooks/cstd-rulebook.md +21 -0
  202. package/docs/ja/specdojo/rulebooks/cxd-mermaid-rulebook.md +401 -0
  203. package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +311 -0
  204. package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +158 -0
  205. package/docs/ja/specdojo/rulebooks/dct-rulebook.md +287 -0
  206. package/docs/ja/specdojo/rulebooks/dec-rulebook.md +62 -0
  207. package/docs/ja/specdojo/rulebooks/dmd-index-rulebook.md +100 -0
  208. package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +298 -0
  209. package/docs/ja/specdojo/rulebooks/etc-index-rulebook.md +379 -0
  210. package/docs/ja/specdojo/rulebooks/etc-rulebook.md +310 -0
  211. package/docs/ja/specdojo/rulebooks/gl-rulebook.md +86 -0
  212. package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +297 -0
  213. package/docs/ja/specdojo/rulebooks/ifx-api-rulebook.md +79 -0
  214. package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +213 -0
  215. package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +311 -0
  216. package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +94 -0
  217. package/docs/ja/specdojo/rulebooks/ifx-msg-rulebook.md +81 -0
  218. package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +117 -0
  219. package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +118 -0
  220. package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +116 -0
  221. package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +116 -0
  222. package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +116 -0
  223. package/docs/ja/specdojo/rulebooks/itc-index-rulebook.md +421 -0
  224. package/docs/ja/specdojo/rulebooks/itc-rulebook.md +307 -0
  225. package/docs/ja/specdojo/rulebooks/mip-index-rulebook.md +312 -0
  226. package/docs/ja/specdojo/rulebooks/mm-rulebook.md +63 -0
  227. package/docs/ja/specdojo/rulebooks/mtp-rulebook.md +353 -0
  228. package/docs/ja/specdojo/rulebooks/nfr-availability-rulebook.md +184 -0
  229. package/docs/ja/specdojo/rulebooks/nfr-index-rulebook.md +179 -0
  230. package/docs/ja/specdojo/rulebooks/nfr-integrity-rulebook.md +184 -0
  231. package/docs/ja/specdojo/rulebooks/nfr-maintainability-rulebook.md +183 -0
  232. package/docs/ja/specdojo/rulebooks/nfr-operations-rulebook.md +185 -0
  233. package/docs/ja/specdojo/rulebooks/nfr-performance-rulebook.md +185 -0
  234. package/docs/ja/specdojo/rulebooks/nfr-reliability-rulebook.md +186 -0
  235. package/docs/ja/specdojo/rulebooks/nfr-security-safety-rulebook.md +186 -0
  236. package/docs/ja/specdojo/rulebooks/nfr-usability-rulebook.md +184 -0
  237. package/docs/ja/specdojo/rulebooks/ntp-rulebook.md +61 -0
  238. package/docs/ja/specdojo/rulebooks/opd-index-rulebook.md +84 -0
  239. package/docs/ja/specdojo/rulebooks/opd-rulebook.md +357 -0
  240. package/docs/ja/specdojo/rulebooks/opr-index-rulebook.md +80 -0
  241. package/docs/ja/specdojo/rulebooks/opr-rulebook.md +484 -0
  242. package/docs/ja/specdojo/rulebooks/otp-index-rulebook.md +120 -0
  243. package/docs/ja/specdojo/rulebooks/otp-rulebook.md +293 -0
  244. package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +211 -0
  245. package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +94 -0
  246. package/docs/ja/specdojo/rulebooks/pm-communication-plan-rulebook.md +116 -0
  247. package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +93 -0
  248. package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +190 -0
  249. package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +108 -0
  250. package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +122 -0
  251. package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +117 -0
  252. package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +116 -0
  253. package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +93 -0
  254. package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +146 -0
  255. package/docs/ja/specdojo/rulebooks/pr-rulebook.md +65 -0
  256. package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +178 -0
  257. package/docs/ja/specdojo/rulebooks/prj-charter-rulebook.md +232 -0
  258. package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +235 -0
  259. package/docs/ja/specdojo/rulebooks/prj-issues-and-approach-rulebook.md +242 -0
  260. package/docs/ja/specdojo/rulebooks/prj-overview-rulebook.md +187 -0
  261. package/docs/ja/specdojo/rulebooks/prj-scope-rulebook.md +201 -0
  262. package/docs/ja/specdojo/rulebooks/prj-stakeholder-register-rulebook.md +165 -0
  263. package/docs/ja/specdojo/rulebooks/prj-success-criteria-and-acceptance-criteria-rulebook.md +165 -0
  264. package/docs/ja/specdojo/rulebooks/sac-rulebook.md +202 -0
  265. package/docs/ja/specdojo/rulebooks/sch-rulebook.md +139 -0
  266. package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +63 -0
  267. package/docs/ja/specdojo/rulebooks/sf-rulebook.md +93 -0
  268. package/docs/ja/specdojo/rulebooks/sld-rulebook.md +93 -0
  269. package/docs/ja/specdojo/rulebooks/stc-index-rulebook.md +329 -0
  270. package/docs/ja/specdojo/rulebooks/stc-rulebook.md +297 -0
  271. package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +132 -0
  272. package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +215 -0
  273. package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +376 -0
  274. package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +313 -0
  275. package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +246 -0
  276. package/docs/ja/specdojo/rulebooks/sysd-rulebook.md +119 -0
  277. package/docs/ja/specdojo/rulebooks/tml-rulebook.md +188 -0
  278. package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +114 -0
  279. package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +117 -0
  280. package/docs/ja/specdojo/rulebooks/tsd-index-rulebook.md +101 -0
  281. package/docs/ja/specdojo/rulebooks/tsd-rulebook.md +103 -0
  282. package/docs/ja/specdojo/rulebooks/tsp-index-rulebook.md +396 -0
  283. package/docs/ja/specdojo/rulebooks/uis-rulebook.md +207 -0
  284. package/docs/ja/specdojo/rulebooks/utc-index-rulebook.md +387 -0
  285. package/docs/ja/specdojo/rulebooks/utc-rulebook.md +303 -0
  286. package/docs/ja/specdojo/samples/atc-index-sample.md +38 -0
  287. package/docs/ja/specdojo/samples/atc-sample.md +41 -0
  288. package/docs/ja/specdojo/samples/bac-sample.md +38 -0
  289. package/docs/ja/specdojo/samples/bdd-sample.yaml +71 -0
  290. package/docs/ja/specdojo/samples/bds-sample.md +38 -0
  291. package/docs/ja/specdojo/samples/bes-index-sample.md +38 -0
  292. package/docs/ja/specdojo/samples/bes-sample.md +38 -0
  293. package/docs/ja/specdojo/samples/bps-sample.md +38 -0
  294. package/docs/ja/specdojo/samples/br-sample.md +40 -0
  295. package/docs/ja/specdojo/samples/ccd-sample.md +38 -0
  296. package/docs/ja/specdojo/samples/cdfd-overview-sample.md +284 -0
  297. package/docs/ja/specdojo/samples/cdfd-sample.md +229 -0
  298. package/docs/ja/specdojo/samples/cdfd-uc-sample.md +146 -0
  299. package/docs/ja/specdojo/samples/cdsd-sample.md +38 -0
  300. package/docs/ja/specdojo/samples/cld-sample.md +38 -0
  301. package/docs/ja/specdojo/samples/cnd-sample.md +38 -0
  302. package/docs/ja/specdojo/samples/cop-index-sample.md +38 -0
  303. package/docs/ja/specdojo/samples/cop-sample.md +38 -0
  304. package/docs/ja/specdojo/samples/cpd-sample.md +38 -0
  305. package/docs/ja/specdojo/samples/cstd-sample.md +11 -0
  306. package/docs/ja/specdojo/samples/cxd-sample.md +38 -0
  307. package/docs/ja/specdojo/samples/dct-index-sample.yaml +39 -0
  308. package/docs/ja/specdojo/samples/dct-sample.yaml +91 -0
  309. package/docs/ja/specdojo/samples/dec-sample.md +39 -0
  310. package/docs/ja/specdojo/samples/dmd-index-sample.md +50 -0
  311. package/docs/ja/specdojo/samples/dmd-sample.md +74 -0
  312. package/docs/ja/specdojo/samples/etc-index-sample.md +38 -0
  313. package/docs/ja/specdojo/samples/etc-sample.md +38 -0
  314. package/docs/ja/specdojo/samples/gl-sample.yaml +37 -0
  315. package/docs/ja/specdojo/samples/ifd-sample.md +38 -0
  316. package/docs/ja/specdojo/samples/ifx-api-sample.yaml +102 -0
  317. package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +107 -0
  318. package/docs/ja/specdojo/samples/ifx-file-sample.md +38 -0
  319. package/docs/ja/specdojo/samples/ifx-msg-sample.yaml +89 -0
  320. package/docs/ja/specdojo/samples/imp-business-sample.md +66 -0
  321. package/docs/ja/specdojo/samples/imp-data-sample.md +60 -0
  322. package/docs/ja/specdojo/samples/imp-interface-sample.md +60 -0
  323. package/docs/ja/specdojo/samples/imp-operations-sample.md +60 -0
  324. package/docs/ja/specdojo/samples/imp-test-sample.md +60 -0
  325. package/docs/ja/specdojo/samples/itc-index-sample.md +38 -0
  326. package/docs/ja/specdojo/samples/itc-sample.md +38 -0
  327. package/docs/ja/specdojo/samples/mip-index-sample.md +38 -0
  328. package/docs/ja/specdojo/samples/mm-sample.md +35 -0
  329. package/docs/ja/specdojo/samples/mtp-sample.md +38 -0
  330. package/docs/ja/specdojo/samples/nfr-availability-sample.md +38 -0
  331. package/docs/ja/specdojo/samples/nfr-index-sample.md +38 -0
  332. package/docs/ja/specdojo/samples/nfr-integrity-sample.md +38 -0
  333. package/docs/ja/specdojo/samples/nfr-maintainability-sample.md +38 -0
  334. package/docs/ja/specdojo/samples/nfr-operations-sample.md +38 -0
  335. package/docs/ja/specdojo/samples/nfr-performance-sample.md +38 -0
  336. package/docs/ja/specdojo/samples/nfr-reliability-sample.md +38 -0
  337. package/docs/ja/specdojo/samples/nfr-security-safety-sample.md +38 -0
  338. package/docs/ja/specdojo/samples/nfr-usability-sample.md +38 -0
  339. package/docs/ja/specdojo/samples/ntp-sample.md +38 -0
  340. package/docs/ja/specdojo/samples/opd-access-control-sample.md +29 -0
  341. package/docs/ja/specdojo/samples/opd-incident-management-sample.md +31 -0
  342. package/docs/ja/specdojo/samples/opd-index-sample.md +41 -0
  343. package/docs/ja/specdojo/samples/opd-monitoring-sample.md +32 -0
  344. package/docs/ja/specdojo/samples/opd-sample.md +38 -0
  345. package/docs/ja/specdojo/samples/opr-access-control-sample.md +24 -0
  346. package/docs/ja/specdojo/samples/opr-backup-restore-sample.md +27 -0
  347. package/docs/ja/specdojo/samples/opr-batch-sample.md +23 -0
  348. package/docs/ja/specdojo/samples/opr-change-sample.md +24 -0
  349. package/docs/ja/specdojo/samples/opr-incident-sample.md +38 -0
  350. package/docs/ja/specdojo/samples/opr-index-sample.md +43 -0
  351. package/docs/ja/specdojo/samples/opr-monitoring-sample.md +27 -0
  352. package/docs/ja/specdojo/samples/opr-sample.md +38 -0
  353. package/docs/ja/specdojo/samples/opr-support-sample.md +23 -0
  354. package/docs/ja/specdojo/samples/otp-index-sample.md +66 -0
  355. package/docs/ja/specdojo/samples/otp-sample.md +68 -0
  356. package/docs/ja/specdojo/samples/pm-change-request-log-sample.md +47 -0
  357. package/docs/ja/specdojo/samples/pm-communication-plan-sample.md +46 -0
  358. package/docs/ja/specdojo/samples/pm-issue-log-sample.md +45 -0
  359. package/docs/ja/specdojo/samples/pm-members-sample.yaml +103 -0
  360. package/docs/ja/specdojo/samples/pm-organization-sample.md +46 -0
  361. package/docs/ja/specdojo/samples/pm-plan-sample.md +57 -0
  362. package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +52 -0
  363. package/docs/ja/specdojo/samples/pm-raci-sample.md +57 -0
  364. package/docs/ja/specdojo/samples/pm-risk-register-sample.md +43 -0
  365. package/docs/ja/specdojo/samples/pm-roles-sample.yaml +41 -0
  366. package/docs/ja/specdojo/samples/pr-sample.md +39 -0
  367. package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +57 -0
  368. package/docs/ja/specdojo/samples/prj-charter-sample.md +121 -0
  369. package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +105 -0
  370. package/docs/ja/specdojo/samples/prj-issues-and-approach-sample.md +78 -0
  371. package/docs/ja/specdojo/samples/prj-overview-sample.md +95 -0
  372. package/docs/ja/specdojo/samples/prj-scope-sample.md +71 -0
  373. package/docs/ja/specdojo/samples/prj-stakeholder-register-sample.md +60 -0
  374. package/docs/ja/specdojo/samples/prj-success-criteria-and-acceptance-criteria-sample.md +62 -0
  375. package/docs/ja/specdojo/samples/sac-sample.md +38 -0
  376. package/docs/ja/specdojo/samples/sf-index-sample.md +38 -0
  377. package/docs/ja/specdojo/samples/sf-sample.md +38 -0
  378. package/docs/ja/specdojo/samples/sld-sample.md +38 -0
  379. package/docs/ja/specdojo/samples/stc-index-sample.md +38 -0
  380. package/docs/ja/specdojo/samples/stc-sample.md +38 -0
  381. package/docs/ja/specdojo/samples/stsd-sample.md +58 -0
  382. package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +38 -0
  383. package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +38 -0
  384. package/docs/ja/specdojo/samples/sysd-index-sample.md +38 -0
  385. package/docs/ja/specdojo/samples/trc-requirements-to-specs-sample.md +56 -0
  386. package/docs/ja/specdojo/samples/trc-requirements-to-tests-sample.md +56 -0
  387. package/docs/ja/specdojo/samples/tsd-index-sample.md +29 -0
  388. package/docs/ja/specdojo/samples/tsd-sample.md +38 -0
  389. package/docs/ja/specdojo/samples/tsp-index-sample.md +38 -0
  390. package/docs/ja/specdojo/samples/uis-sample.md +38 -0
  391. package/docs/ja/specdojo/samples/utc-index-sample.md +38 -0
  392. package/docs/ja/specdojo/samples/utc-sample.md +38 -0
  393. package/docs/ja/specdojo/schemas/v1/guide-content.schema.yaml +20 -0
  394. package/docs/ja/specdojo/schemas/v1/philosophy-content.schema.yaml +21 -0
  395. package/docs/ja/specdojo/schemas/v1/reference-content.schema.yaml +21 -0
  396. package/docs/ja/specdojo/standards/document-metadata-standard.md +323 -0
  397. package/docs/ja/specdojo/standards/exec-human-finalize-standard.md +75 -0
  398. package/docs/ja/specdojo/standards/git-branching-standard.md +227 -0
  399. package/docs/ja/specdojo/standards/guide-authoring-standard.md +124 -0
  400. package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +929 -0
  401. package/docs/ja/specdojo/standards/job-definition-standard.md +148 -0
  402. package/docs/ja/specdojo/standards/people-and-organization-definition-standard.md +431 -0
  403. package/docs/ja/specdojo/standards/philosophy-authoring-standard.md +113 -0
  404. package/docs/ja/specdojo/standards/recipe-authoring-standard.md +143 -0
  405. package/docs/ja/specdojo/standards/reference-authoring-standard.md +99 -0
  406. package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +140 -0
  407. package/docs/ja/specdojo/standards/sample-authoring-standard.md +151 -0
  408. package/docs/ja/specdojo/standards/standard-authoring-standard.md +108 -0
  409. package/docs/ja/specdojo/standards/template-authoring-standard.md +101 -0
  410. package/docs/ja/specdojo/standards/test-document-scope-standard.md +176 -0
  411. package/docs/ja/specdojo/templates/cdfd-overview-template.md +199 -0
  412. package/docs/ja/specdojo/templates/cdfd-template.md +173 -0
  413. package/docs/ja/specdojo/templates/cdfd-uc-template.md +148 -0
  414. package/docs/ja/specdojo/templates/dct-architecture-template.yaml +136 -0
  415. package/docs/ja/specdojo/templates/dct-business-acceptance-criteria-template.yaml +34 -0
  416. package/docs/ja/specdojo/templates/dct-business-model-bes-template.yaml +75 -0
  417. package/docs/ja/specdojo/templates/dct-business-model-bps-template.yaml +49 -0
  418. package/docs/ja/specdojo/templates/dct-business-model-br-template.yaml +50 -0
  419. package/docs/ja/specdojo/templates/dct-data-flow-template.yaml +40 -0
  420. package/docs/ja/specdojo/templates/dct-data-model-bdd-template.yaml +46 -0
  421. package/docs/ja/specdojo/templates/dct-data-model-ccd-template.yaml +46 -0
  422. package/docs/ja/specdojo/templates/dct-data-model-cdsd-template.yaml +41 -0
  423. package/docs/ja/specdojo/templates/dct-data-model-cld-template.yaml +38 -0
  424. package/docs/ja/specdojo/templates/dct-data-model-sld-template.yaml +38 -0
  425. package/docs/ja/specdojo/templates/dct-data-model-stsd-template.yaml +46 -0
  426. package/docs/ja/specdojo/templates/dct-external-interface-specs-template.yaml +114 -0
  427. package/docs/ja/specdojo/templates/dct-glossary-template.yaml +35 -0
  428. package/docs/ja/specdojo/templates/dct-impact-analysis-template.yaml +138 -0
  429. package/docs/ja/specdojo/templates/dct-index-template.md +40 -0
  430. package/docs/ja/specdojo/templates/dct-migration-planning-template.yaml +148 -0
  431. package/docs/ja/specdojo/templates/dct-non-functional-requirements-template.yaml +222 -0
  432. package/docs/ja/specdojo/templates/dct-operations-template.yaml +108 -0
  433. package/docs/ja/specdojo/templates/dct-project-definition-template.yaml +210 -0
  434. package/docs/ja/specdojo/templates/dct-project-management-template.yaml +423 -0
  435. package/docs/ja/specdojo/templates/dct-system-acceptance-criteria-template.yaml +37 -0
  436. package/docs/ja/specdojo/templates/dct-system-design-template.yaml +82 -0
  437. package/docs/ja/specdojo/templates/dct-system-functions-template.yaml +58 -0
  438. package/docs/ja/specdojo/templates/dct-test-specs-template.yaml +261 -0
  439. package/docs/ja/specdojo/templates/dct-user-interface-model-template.yaml +60 -0
  440. package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +88 -0
  441. package/docs/ja/specdojo/templates/opr-template.md +85 -0
  442. package/docs/ja/specdojo/templates/pjr-change-request-template.md +60 -0
  443. package/docs/ja/specdojo/templates/pjr-decision-template.md +61 -0
  444. package/docs/ja/specdojo/templates/pjr-index-template.md +49 -0
  445. package/docs/ja/specdojo/templates/pjr-issue-template.md +50 -0
  446. package/docs/ja/specdojo/templates/pjr-note-template.md +35 -0
  447. package/docs/ja/specdojo/templates/pjr-question-template.md +53 -0
  448. package/docs/ja/specdojo/templates/pjr-risk-template.md +49 -0
  449. package/docs/ja/specdojo/templates/pjr-todo-template.md +41 -0
  450. package/docs/ja/specdojo/templates/pjr-views-by-owner-template.md +22 -0
  451. package/docs/ja/specdojo/templates/pjr-views-by-priority-template.md +22 -0
  452. package/docs/ja/specdojo/templates/pjr-views-by-status-template.md +22 -0
  453. package/docs/ja/specdojo/templates/pm-change-request-log-template.md +20 -0
  454. package/docs/ja/specdojo/templates/pm-communication-plan-template.md +46 -0
  455. package/docs/ja/specdojo/templates/pm-decision-log-template.md +20 -0
  456. package/docs/ja/specdojo/templates/pm-issue-log-template.md +20 -0
  457. package/docs/ja/specdojo/templates/pm-members-template.yaml +105 -0
  458. package/docs/ja/specdojo/templates/pm-organization-template.md +44 -0
  459. package/docs/ja/specdojo/templates/pm-plan-template.md +52 -0
  460. package/docs/ja/specdojo/templates/pm-quality-management-plan-template.md +46 -0
  461. package/docs/ja/specdojo/templates/pm-raci-template.md +51 -0
  462. package/docs/ja/specdojo/templates/pm-risk-register-template.md +20 -0
  463. package/docs/ja/specdojo/templates/pm-roles-template.yaml +53 -0
  464. package/docs/ja/specdojo/templates/prj-assumptions-constraints-dependencies-template.md +59 -0
  465. package/docs/ja/specdojo/templates/prj-charter-template.md +116 -0
  466. package/docs/ja/specdojo/templates/prj-comparison-of-alternatives-template.md +116 -0
  467. package/docs/ja/specdojo/templates/prj-issues-and-approach-template.md +89 -0
  468. package/docs/ja/specdojo/templates/prj-overview-template.md +85 -0
  469. package/docs/ja/specdojo/templates/prj-scope-template.md +75 -0
  470. package/docs/ja/specdojo/templates/prj-stakeholder-register-template.md +64 -0
  471. package/docs/ja/specdojo/templates/prj-success-criteria-and-acceptance-criteria-template.md +60 -0
  472. package/docs/ja/specdojo/templates/stsd-template.md +57 -0
  473. package/docs/specdojo/schemas/v1/bdd.schema.yaml +230 -0
  474. package/docs/specdojo/schemas/v1/common-frontmatter.schema.yaml +77 -0
  475. package/docs/specdojo/schemas/v1/dct-index.schema.yaml +85 -0
  476. package/docs/specdojo/schemas/v1/dct-plan.schema.yaml +324 -0
  477. package/docs/specdojo/schemas/v1/dct.schema.yaml +368 -0
  478. package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +91 -0
  479. package/docs/specdojo/schemas/v1/esil.schema.yaml +142 -0
  480. package/docs/specdojo/schemas/v1/exec-common.schema.yaml +101 -0
  481. package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +272 -0
  482. package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +162 -0
  483. package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +126 -0
  484. package/docs/specdojo/schemas/v1/exec-reporter-output.schema.yaml +151 -0
  485. package/docs/specdojo/schemas/v1/exec-result-frontmatter.schema.yaml +144 -0
  486. package/docs/specdojo/schemas/v1/grade-done-criteria.schema.yaml +79 -0
  487. package/docs/specdojo/schemas/v1/grade-pipeline-state.schema.yaml +60 -0
  488. package/docs/specdojo/schemas/v1/grade-result.schema.yaml +118 -0
  489. package/docs/specdojo/schemas/v1/guide-frontmatter.schema.yaml +19 -0
  490. package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +293 -0
  491. package/docs/specdojo/schemas/v1/job-run.schema.yaml +90 -0
  492. package/docs/specdojo/schemas/v1/job.schema.yaml +198 -0
  493. package/docs/specdojo/schemas/v1/philosophy-frontmatter.schema.yaml +19 -0
  494. package/docs/specdojo/schemas/v1/pipeline-state.schema.yaml +56 -0
  495. package/docs/specdojo/schemas/v1/pm-members.schema.yaml +252 -0
  496. package/docs/specdojo/schemas/v1/pm-review-viewpoints.schema.yaml +387 -0
  497. package/docs/specdojo/schemas/v1/pm-roles.schema.yaml +106 -0
  498. package/docs/specdojo/schemas/v1/recipe-frontmatter.schema.yaml +27 -0
  499. package/docs/specdojo/schemas/v1/reference-frontmatter.schema.yaml +18 -0
  500. package/docs/specdojo/schemas/v1/register-events.schema.yaml +106 -0
  501. package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +204 -0
  502. package/docs/specdojo/schemas/v1/routine-run.schema.yaml +36 -0
  503. package/docs/specdojo/schemas/v1/routine.schema.yaml +87 -0
  504. package/docs/specdojo/schemas/v1/rulebook-frontmatter.schema.yaml +61 -0
  505. package/docs/specdojo/schemas/v1/sch-common.schema.yaml +258 -0
  506. package/docs/specdojo/schemas/v1/sch-defaults.schema.yaml +48 -0
  507. package/docs/specdojo/schemas/v1/sch-milestones.schema.yaml +64 -0
  508. package/docs/specdojo/schemas/v1/sch-strategy.schema.yaml +772 -0
  509. package/docs/specdojo/schemas/v1/sch-track.schema.yaml +66 -0
  510. package/docs/specdojo/schemas/v1/standard-frontmatter.schema.yaml +18 -0
  511. package/docs/specdojo/schemas/v1/tml-index.schema.yaml +103 -0
  512. package/package.json +121 -24
  513. package/templates/antigravity/README.md +35 -0
  514. package/templates/antigravity/exec-defaults-snippet.yaml +38 -0
  515. package/templates/antigravity/orchestrator.md +146 -0
  516. package/templates/antigravity/pm-members-snippet.yaml +55 -0
  517. package/templates/claude/README.md +46 -0
  518. package/templates/claude/agents/claude-expert-review-executor.md +14 -0
  519. package/templates/claude/agents/claude-review-executor.md +14 -0
  520. package/templates/claude/agents/specdojo-orchestrator.md +153 -0
  521. package/templates/claude/settings.edit.json +6 -0
  522. package/templates/claude/settings.report.json +6 -0
  523. package/templates/claude/settings.review.json +7 -0
  524. package/templates/codex/README.md +61 -0
  525. package/templates/codex/agents/codex-executor.toml +12 -0
  526. package/templates/codex/agents/codex-expert-executor.toml +12 -0
  527. package/templates/codex/agents/codex-expert-review-executor.toml +10 -0
  528. package/templates/codex/agents/codex-review-executor.toml +10 -0
  529. package/templates/codex/agents/specdojo-orchestrator.toml +154 -0
  530. package/templates/codex/orchestrator.md +146 -0
  531. package/templates/copilot/README.md +41 -0
  532. package/templates/copilot/exec-defaults-snippet.yaml +28 -0
  533. package/templates/copilot/pm-members-snippet.yaml +44 -0
  534. package/templates/opencode/README.md +41 -0
  535. package/templates/opencode/agents/opencode-executor.md +59 -0
  536. package/templates/opencode/agents/opencode-reporter.md +26 -0
  537. package/templates/opencode/agents/opencode-review-executor.md +48 -0
  538. package/templates/opencode/agents/specdojo-orchestrator.md +193 -0
  539. package/dist/exec-schedule-timeline-render.js +0 -201
  540. package/dist/exec-schedule-timeline.js +0 -2
@@ -1,4 +1,4 @@
1
- import { formatDateOnlyUtc } from './exec-shared.js';
1
+ import { formatDateOnlyUtc } from "./exec-shared.js";
2
2
  function scheduleAnchorDateUtc() {
3
3
  return Date.UTC(2000, 0, 1, 0, 0, 0, 0);
4
4
  }
@@ -16,6 +16,7 @@ export function isWorkingDateUtc(dt, calendar) {
16
16
  return calendar.workdays.has(dt.getUTCDay()) && !calendar.holidays.has(dateOnly);
17
17
  }
18
18
  function advanceToNextWorkingInstantUtc(dt, calendar) {
19
+ assertCalendarHasWorkingDay(calendar);
19
20
  while (true) {
20
21
  if (!isWorkingDateUtc(dt, calendar)) {
21
22
  dt.setUTCDate(dt.getUTCDate() + 1);
@@ -32,7 +33,7 @@ function advanceToNextWorkingInstantUtc(dt, calendar) {
32
33
  }
33
34
  }
34
35
  export function addWorkingDayOffset(startDate, dayOffset, calendar) {
35
- const [year, month, day] = startDate.split('-').map(Number);
36
+ const [year, month, day] = startDate.split("-").map(Number);
36
37
  const dt = new Date(Date.UTC(year, month - 1, day, 0, 0, 0, 0));
37
38
  advanceToNextWorkingInstantUtc(dt, calendar);
38
39
  let remainingMinutes = Math.round(dayOffset * workingMinutesPerDay(calendar));
@@ -51,6 +52,25 @@ export function addWorkingDayOffset(startDate, dayOffset, calendar) {
51
52
  advanceToNextWorkingInstantUtc(dt, calendar);
52
53
  return dt;
53
54
  }
55
+ export function workingDayOffsetForDate(startDate, targetDate, calendar) {
56
+ const toMidnightUtc = (dateOnly) => {
57
+ const [year, month, day] = dateOnly.split("-").map(Number);
58
+ return new Date(Date.UTC(year, month - 1, day, 0, 0, 0, 0));
59
+ };
60
+ const cursor = toMidnightUtc(startDate);
61
+ const target = toMidnightUtc(targetDate);
62
+ advanceToNextWorkingInstantUtc(cursor, calendar);
63
+ advanceToNextWorkingInstantUtc(target, calendar);
64
+ if (target.getTime() <= cursor.getTime())
65
+ return 0;
66
+ let count = 0;
67
+ while (cursor.getTime() < target.getTime()) {
68
+ if (isWorkingDateUtc(cursor, calendar))
69
+ count += 1;
70
+ cursor.setUTCDate(cursor.getUTCDate() + 1);
71
+ }
72
+ return count;
73
+ }
54
74
  export function buildWorkingTaskSegments(startDate, startOffset, durationDays, calendar) {
55
75
  const cursor = addWorkingDayOffset(startDate, startOffset, calendar);
56
76
  let remainingMinutes = Math.round(durationDays * workingMinutesPerDay(calendar));
@@ -69,25 +89,82 @@ export function buildWorkingTaskSegments(startDate, startOffset, durationDays, c
69
89
  }
70
90
  return segments;
71
91
  }
72
- function timelineAnchorDate(startDate) {
92
+ function ganttChartAnchorDate(startDate) {
73
93
  if (!startDate)
74
94
  return new Date(scheduleAnchorDateUtc());
75
- const [year, month, day] = startDate.split('-').map(Number);
95
+ const [year, month, day] = startDate.split("-").map(Number);
76
96
  return new Date(Date.UTC(year, month - 1, day, 0, 0, 0, 0));
77
97
  }
78
98
  export function dateForWorkingOffset(dayOffset, startDate, calendar) {
79
99
  return startDate
80
100
  ? addWorkingDayOffset(startDate, dayOffset, calendar)
81
- : new Date(scheduleAnchorDateUtc() + Math.round(dayOffset * workingMinutesPerDay(calendar)) * 60 * 1000);
101
+ : new Date(scheduleAnchorDateUtc() +
102
+ Math.round(dayOffset * workingMinutesPerDay(calendar)) * 60 * 1000);
82
103
  }
83
- export function timelinePositionX(dt, timelineStart, calendar, dayWidth) {
104
+ export function ganttChartPositionX(dt, ganttChartStart, calendar, dayWidth) {
84
105
  const midnight = new Date(dt.getTime());
85
106
  midnight.setUTCHours(0, 0, 0, 0);
86
- const dayIndex = Math.floor((midnight.getTime() - timelineStart.getTime()) / 86400000);
107
+ const dayIndex = Math.floor((midnight.getTime() - ganttChartStart.getTime()) / 86400000);
87
108
  const minutesFromMidnight = dt.getUTCHours() * 60 + dt.getUTCMinutes();
88
109
  const relative = Math.max(0, Math.min(1, minutesFromMidnight / workingMinutesPerDay(calendar)));
89
110
  return (dayIndex + relative) * dayWidth;
90
111
  }
91
- export function timelineStartDate(startDate) {
92
- return timelineAnchorDate(startDate);
112
+ export function ganttChartStartDate(startDate) {
113
+ return ganttChartAnchorDate(startDate);
114
+ }
115
+ function parseDateOnlyUtc(dateOnly) {
116
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(dateOnly)) {
117
+ throw new Error(`invalid date-only value: ${dateOnly}`);
118
+ }
119
+ const [year, month, day] = dateOnly.split("-").map(Number);
120
+ const parsed = new Date(Date.UTC(year, month - 1, day, 0, 0, 0, 0));
121
+ if (formatDateOnlyUtc(parsed) !== dateOnly) {
122
+ throw new Error(`invalid date-only value: ${dateOnly}`);
123
+ }
124
+ return parsed;
125
+ }
126
+ function assertCalendarHasWorkingDay(calendar) {
127
+ if (![...calendar.workdays].some((day) => Number.isInteger(day) && day >= 0 && day <= 6)) {
128
+ throw new Error("calendar.workdays must contain at least one weekday");
129
+ }
130
+ }
131
+ // 計画開始日(yyyy-mm-dd)から推定稼働日数を暦日へ伸ばした予定終了日(yyyy-mm-dd)を返す。
132
+ // 稼働日のみ数え、休日・週末は飛ばす。dayOffset <= 0 の場合 start 当日を返す。
133
+ // 用途: Timeline 用 Gantt chart の各トラックの予定開始日・予定終了日の算出。
134
+ export function addWorkingDaysToDate(startDate, dayOffset, calendar) {
135
+ if (!Number.isFinite(dayOffset) || dayOffset <= 0)
136
+ return startDate;
137
+ assertCalendarHasWorkingDay(calendar);
138
+ const target = parseDateOnlyUtc(startDate);
139
+ let remaining = Math.round(dayOffset);
140
+ while (remaining > 0) {
141
+ const next = new Date(target.getTime() + 86_400_000);
142
+ if (!Number.isFinite(next.getTime())) {
143
+ throw new Error(`working-day calculation exceeded the supported date range: ${startDate}`);
144
+ }
145
+ // 非稼働日でもカーソルは必ず進める。進めないと週末・休日で無限ループになる。
146
+ target.setTime(next.getTime());
147
+ if (isWorkingDateUtc(next, calendar)) {
148
+ remaining -= 1;
149
+ }
150
+ }
151
+ return formatDateOnlyUtc(target);
152
+ }
153
+ // 開始日・終了日を含めず、2 つの日付間にある稼働日数を返す。target <= start なら 0。
154
+ export function countWorkingDaysBetween(startDate, targetDate, calendar) {
155
+ const cursor = parseDateOnlyUtc(startDate);
156
+ const endMs = parseDateOnlyUtc(targetDate).getTime();
157
+ if (endMs <= cursor.getTime())
158
+ return 0;
159
+ assertCalendarHasWorkingDay(calendar);
160
+ let count = 0;
161
+ while (true) {
162
+ const next = new Date(cursor.getTime() + 86_400_000);
163
+ if (next.getTime() >= endMs)
164
+ break;
165
+ if (isWorkingDateUtc(next, calendar))
166
+ count += 1;
167
+ cursor.setTime(next.getTime());
168
+ }
169
+ return count;
93
170
  }
@@ -1,4 +1,5 @@
1
- import { toArtifactPath, toScheduleFilePath } from './exec-shared.js';
1
+ import { toArtifactPath, toScheduleFilePath } from "./exec-shared.js";
2
+ import { workingDayOffsetForDate } from "./exec-schedule-calendar.js";
2
3
  export function topoSort(schedule) {
3
4
  const indeg = new Map();
4
5
  const out = new Map();
@@ -8,7 +9,7 @@ export function topoSort(schedule) {
8
9
  }
9
10
  for (const node of schedule.nodes.values()) {
10
11
  for (const dep of node.depends_on) {
11
- out.get(dep).push(node.id);
12
+ out.get(dep)?.push(node.id);
12
13
  indeg.set(node.id, (indeg.get(node.id) ?? 0) + 1);
13
14
  }
14
15
  }
@@ -40,11 +41,23 @@ export function topoSort(schedule) {
40
41
  export function computeCpm(schedule, projectPath) {
41
42
  const { order, cycle } = topoSort(schedule);
42
43
  if (cycle && cycle.length)
43
- throw new Error(`schedule dependency cycle detected: ${cycle.join(', ')}`);
44
+ throw new Error(`schedule dependency cycle detected: ${cycle.join(", ")}`);
44
45
  const nodes = {};
46
+ // schedule_file(生パス)ごとの start_date を、project_start_date を基準にした
47
+ // 稼働日オフセットへ変換する。track が明示した start_date より前に開始しないための
48
+ // es 下限(床)として使う。project_start_date が無い場合はオフセット 0。
49
+ const fileStartOffsets = new Map();
50
+ if (schedule.start_date) {
51
+ for (const [file, date] of schedule.file_start_dates) {
52
+ fileStartOffsets.set(file, workingDayOffsetForDate(schedule.start_date, date, schedule.calendar));
53
+ }
54
+ }
45
55
  for (const id of order) {
46
56
  const n = schedule.nodes.get(id);
47
- const es = n.depends_on.length === 0 ? 0 : Math.max(...n.depends_on.map(d => nodes[d].ef));
57
+ const startFloor = fileStartOffsets.get(n.schedule_file) ?? 0;
58
+ const es = n.depends_on.length === 0
59
+ ? startFloor
60
+ : Math.max(startFloor, ...n.depends_on.map((d) => nodes[d].ef));
48
61
  const ef = es + n.duration_days;
49
62
  nodes[id] = {
50
63
  id,
@@ -59,9 +72,10 @@ export function computeCpm(schedule, projectPath) {
59
72
  slack: 0,
60
73
  depends_on: n.depends_on,
61
74
  schedule_file: toScheduleFilePath(projectPath, n.schedule_file),
75
+ ...(n.tags ? { tags: n.tags } : {}),
62
76
  };
63
77
  }
64
- const projectDuration = Math.max(...Object.values(nodes).map(n => n.ef), 0);
78
+ const projectDuration = Math.max(...Object.values(nodes).map((n) => n.ef), 0);
65
79
  const succ = new Map();
66
80
  for (const id of schedule.nodes.keys())
67
81
  succ.set(id, []);
@@ -72,17 +86,21 @@ export function computeCpm(schedule, projectPath) {
72
86
  const rev = [...order].reverse();
73
87
  for (const id of rev) {
74
88
  const s = succ.get(id);
75
- const lf = s.length === 0 ? projectDuration : Math.min(...s.map(child => nodes[child].ls));
89
+ const lf = s.length === 0 ? projectDuration : Math.min(...s.map((child) => nodes[child].ls));
76
90
  const ls = lf - nodes[id].duration_days;
77
91
  nodes[id].lf = lf;
78
92
  nodes[id].ls = ls;
79
93
  nodes[id].slack = ls - nodes[id].es;
80
94
  }
81
95
  const critical = new Set(Object.values(nodes)
82
- .filter(n => n.slack === 0)
83
- .map(n => n.id));
84
- const starts = Object.values(nodes)
85
- .filter(n => critical.has(n.id) && n.es === 0)
96
+ .filter((n) => n.slack === 0)
97
+ .map((n) => n.id));
98
+ const criticalNodes = Object.values(nodes).filter((n) => critical.has(n.id));
99
+ // track 床の導入で起点 es は必ずしも 0 にならないため、critical ノードの
100
+ // 最小 es を起点として検出する(単一 track では従来どおり es === 0)。
101
+ const minCriticalEs = criticalNodes.length ? Math.min(...criticalNodes.map((n) => n.es)) : 0;
102
+ const starts = criticalNodes
103
+ .filter((n) => n.es === minCriticalEs)
86
104
  .sort((a, b) => a.id.localeCompare(b.id));
87
105
  const path = [];
88
106
  if (starts.length) {
@@ -90,8 +108,8 @@ export function computeCpm(schedule, projectPath) {
90
108
  path.push(cur);
91
109
  while (true) {
92
110
  const nexts = (succ.get(cur) ?? [])
93
- .filter(x => critical.has(x))
94
- .filter(x => nodes[x].es === nodes[cur].ef)
111
+ .filter((x) => critical.has(x))
112
+ .filter((x) => nodes[x].es === nodes[cur].ef)
95
113
  .sort((a, b) => a.localeCompare(b));
96
114
  if (!nexts.length)
97
115
  break;
@@ -0,0 +1,428 @@
1
+ import { formatDateOnlyUtc, formatDays } from "./exec-shared.js";
2
+ import { buildWorkingTaskSegments, dateForWorkingOffset, ganttChartStartDate, isWorkingDateUtc, workingMinutesPerDay, } from "./exec-schedule-calendar.js";
3
+ function xmlEscape(text) {
4
+ return text
5
+ .replace(/&/g, "&amp;")
6
+ .replace(/</g, "&lt;")
7
+ .replace(/>/g, "&gt;")
8
+ .replace(/"/g, "&quot;");
9
+ }
10
+ function dayLabelUtc(dt) {
11
+ const mm = (dt.getUTCMonth() + 1).toString().padStart(2, "0");
12
+ const dd = dt.getUTCDate().toString().padStart(2, "0");
13
+ return `${mm}/${dd}`;
14
+ }
15
+ function stateColor(state, critical) {
16
+ if (state === "gate")
17
+ return "#7c3aed";
18
+ if (state === "milestone")
19
+ return "#b45309";
20
+ if (state === "done")
21
+ return "#16a34a";
22
+ if (state === "doing")
23
+ return "#2563eb";
24
+ if (state === "blocked")
25
+ return "#f59e0b";
26
+ if (state === "cancelled")
27
+ return "#6b7280";
28
+ if (critical)
29
+ return "#dc2626";
30
+ return "#d1d5db";
31
+ }
32
+ export function buildGanttChartSvg(cpm, schedule, stateSnapshot, options) {
33
+ const title = options?.title ?? "プロジェクトガントチャート";
34
+ const rows = Object.values(cpm.nodes).sort((a, b) => a.es - b.es || a.id.localeCompare(b.id));
35
+ const criticalSet = new Set(cpm.critical_path);
36
+ // コード列(col1)に表示する文字列。タスクは local_id-phase_suffix、
37
+ // ゲート・マイルストーンは row.id をそのまま使う(描画ループと同じ導出規則)。
38
+ const col1LabelFor = (row) => {
39
+ if (row.kind !== "task")
40
+ return row.id;
41
+ const scheduleNode = schedule.nodes.get(row.id);
42
+ const localId = scheduleNode?.local_id ?? "";
43
+ const phaseSuffix = scheduleNode?.phase_suffix ?? "";
44
+ return localId && phaseSuffix ? `${localId}-${phaseSuffix}` : localId || phaseSuffix || row.id;
45
+ };
46
+ // フェーズセット列(col3)に表示する文字列。strategy.yaml の phase_sets
47
+ // キー(例: retrofit-pass-2)で、同じフェーズの1回目・2回目などを区別する。
48
+ // ゲート・マイルストーンには対応する phase_set がないため空文字にする。
49
+ const col3LabelFor = (row) => {
50
+ if (row.kind !== "task")
51
+ return "";
52
+ return schedule.nodes.get(row.id)?.phase_set ?? "";
53
+ };
54
+ // Left panel column boundaries — col1(コード列)・col3(フェーズセット列)は、
55
+ // このチャートに登場する最長の文字列がクリップされずに収まる幅へ動的に広げる。
56
+ // col2(成果物名・168px)・col4(フェーズ名・142px)の幅は従来値を維持する。
57
+ const monospaceCharWidthPx = 6.5;
58
+ const col1MinWidth = 114;
59
+ const col3MinWidth = 90;
60
+ const colTextPadding = 6;
61
+ const maxCol1Chars = rows.reduce((max, row) => Math.max(max, col1LabelFor(row).length), 0);
62
+ const col1Width = Math.max(col1MinWidth, Math.ceil(maxCol1Chars * monospaceCharWidthPx) + colTextPadding);
63
+ const maxCol3Chars = rows.reduce((max, row) => Math.max(max, col3LabelFor(row).length), 0);
64
+ const col3Width = Math.max(col3MinWidth, Math.ceil(maxCol3Chars * monospaceCharWidthPx) + colTextPadding);
65
+ const col2Width = 168;
66
+ const col4Width = 142;
67
+ const col1X = 8;
68
+ const col1DivX = col1X + col1Width;
69
+ const col2X = col1DivX + 4;
70
+ const col2DivX = col2X + col2Width;
71
+ const col3X = col2DivX + 4;
72
+ const col3DivX = col3X + col3Width;
73
+ const col4X = col3DivX + 4;
74
+ const leftPad = col4X + col4Width;
75
+ const topPad = 108;
76
+ const bottomPad = 32;
77
+ const rowHeight = 24;
78
+ const sectionHeight = 30;
79
+ const sectionGap = 8;
80
+ const dayWidth = 56;
81
+ const ganttChartStart = ganttChartStartDate(cpm.project_start_date);
82
+ const isInitialComplete = (r) => r.tags?.includes("initial-complete") ?? false;
83
+ const milestoneRows = rows.filter((r) => r.kind === "milestone");
84
+ const taskRowsByFile = new Map();
85
+ let firstTaskFile = null;
86
+ for (const row of rows) {
87
+ if (row.kind !== "task")
88
+ continue;
89
+ if (isInitialComplete(row))
90
+ continue; // handled separately
91
+ if (!firstTaskFile)
92
+ firstTaskFile = row.schedule_file;
93
+ const group = taskRowsByFile.get(row.schedule_file);
94
+ if (group)
95
+ group.push(row);
96
+ else
97
+ taskRowsByFile.set(row.schedule_file, [row]);
98
+ }
99
+ // Insert each gate row immediately after its last dependency task in the first task file section
100
+ const gateRows = rows.filter((r) => r.kind === "gate");
101
+ const insertedGateIds = new Set();
102
+ if (firstTaskFile && gateRows.length > 0) {
103
+ const fileRows = taskRowsByFile.get(firstTaskFile) ?? [];
104
+ const rowIndexById = new Map(fileRows.map((r, i) => [r.id, i]));
105
+ // Sort gates by their insertion position descending so back-to-front splicing keeps indices stable
106
+ const insertions = gateRows
107
+ .map((gate) => {
108
+ const depIndices = gate.depends_on
109
+ .map((depId) => rowIndexById.get(depId) ?? -1)
110
+ .filter((idx) => idx >= 0);
111
+ return {
112
+ gate,
113
+ insertAfter: depIndices.length > 0 ? Math.max(...depIndices) : fileRows.length - 1,
114
+ };
115
+ })
116
+ .sort((a, b) => b.insertAfter - a.insertAfter);
117
+ for (const { gate, insertAfter } of insertions) {
118
+ fileRows.splice(insertAfter + 1, 0, gate);
119
+ insertedGateIds.add(gate.id);
120
+ }
121
+ taskRowsByFile.set(firstTaskFile, fileRows);
122
+ }
123
+ // Gates with no task section to attach to (e.g. milestones-only scope) are rendered
124
+ // alongside milestones so the節目 stays visible.
125
+ const orphanGateRows = gateRows.filter((r) => !insertedGateIds.has(r.id));
126
+ const dayIndexOf = (dt) => Math.floor((dt.getTime() - ganttChartStart.getTime()) / 86400000);
127
+ // タスクバー・マイルストーン・ゲートが載る日(ganttChartStart からの日インデックス)。
128
+ // アクティブでない日の連続区間は時間軸で圧縮表示する。
129
+ const activeDays = new Set();
130
+ const taskSegments = new Map();
131
+ let ganttChartEnd = new Date(ganttChartStart.getTime());
132
+ for (const row of rows) {
133
+ if (row.kind === "task") {
134
+ const segments = cpm.project_start_date
135
+ ? buildWorkingTaskSegments(cpm.project_start_date, row.es, row.duration_days, schedule.calendar)
136
+ : [
137
+ {
138
+ start: dateForWorkingOffset(row.es, cpm.project_start_date, schedule.calendar),
139
+ end: dateForWorkingOffset(row.ef, cpm.project_start_date, schedule.calendar),
140
+ },
141
+ ];
142
+ taskSegments.set(row.id, segments);
143
+ const end = segments[segments.length - 1]?.end;
144
+ if (end && end > ganttChartEnd)
145
+ ganttChartEnd = end;
146
+ if (isInitialComplete(row))
147
+ continue; // no bar → does not activate days
148
+ for (const segment of segments) {
149
+ const from = dayIndexOf(segment.start);
150
+ // end が翌日 00:00 のとき翌日を誤って含めないよう 1ms 戻す
151
+ const to = dayIndexOf(new Date(segment.end.getTime() - 1));
152
+ for (let k = from; k <= to; k += 1)
153
+ activeDays.add(k);
154
+ }
155
+ continue;
156
+ }
157
+ const milestoneAt = dateForWorkingOffset(row.es, cpm.project_start_date, schedule.calendar);
158
+ if (milestoneAt > ganttChartEnd)
159
+ ganttChartEnd = milestoneAt;
160
+ activeDays.add(dayIndexOf(milestoneAt));
161
+ }
162
+ const totalDays = Math.max(1, Math.ceil((ganttChartEnd.getTime() - ganttChartStart.getTime()) / 86400000) + 1);
163
+ // 圧縮軸レイアウト: 非アクティブ日が minCompressRun 日以上連続する区間を
164
+ // 1 本の gap カラムに畳む。それ以外は従来どおり dayWidth の day カラム。
165
+ const minCompressRun = 3;
166
+ const gapWidth = 48;
167
+ const columns = [];
168
+ const dayX = new Map();
169
+ let cursorX = 0;
170
+ let dayCursor = 0;
171
+ while (dayCursor < totalDays) {
172
+ if (!activeDays.has(dayCursor)) {
173
+ let runEnd = dayCursor;
174
+ while (runEnd < totalDays && !activeDays.has(runEnd))
175
+ runEnd += 1;
176
+ const runLength = runEnd - dayCursor;
177
+ if (runLength >= minCompressRun) {
178
+ columns.push({ kind: "gap", fromDay: dayCursor, days: runLength, x: cursorX });
179
+ for (let k = dayCursor; k < runEnd; k += 1)
180
+ dayX.set(k, cursorX);
181
+ cursorX += gapWidth;
182
+ dayCursor = runEnd;
183
+ continue;
184
+ }
185
+ }
186
+ columns.push({ kind: "day", dayIndex: dayCursor, x: cursorX });
187
+ dayX.set(dayCursor, cursorX);
188
+ cursorX += dayWidth;
189
+ dayCursor += 1;
190
+ }
191
+ const chartWidth = cursorX;
192
+ const width = leftPad + chartWidth + 40;
193
+ const xForDate = (dt) => {
194
+ const midnight = new Date(dt.getTime());
195
+ midnight.setUTCHours(0, 0, 0, 0);
196
+ const dayIndex = dayIndexOf(midnight);
197
+ const baseX = dayX.get(dayIndex) ?? 0;
198
+ const minutesFromMidnight = dt.getUTCHours() * 60 + dt.getUTCMinutes();
199
+ const relative = Math.max(0, Math.min(1, minutesFromMidnight / workingMinutesPerDay(schedule.calendar)));
200
+ return leftPad + baseX + relative * dayWidth;
201
+ };
202
+ const layoutRows = [];
203
+ // Milestones at the top (with orphan gates that had no task section to attach to)
204
+ if (milestoneRows.length > 0 || orphanGateRows.length > 0) {
205
+ layoutRows.push({ type: "section", label: "マイルストーン" });
206
+ for (const row of milestoneRows)
207
+ layoutRows.push({ type: "node", row });
208
+ for (const row of orphanGateRows)
209
+ layoutRows.push({ type: "node", row });
210
+ }
211
+ // Tasks (+ gates merged in) grouped by file
212
+ // initial-complete rows appear first in the first task file section (no bar)
213
+ const initialCompleteRows = rows.filter((r) => r.kind === "task" && isInitialComplete(r));
214
+ let initialCompleteInserted = false;
215
+ for (const [scheduleFile, fileRows] of taskRowsByFile.entries()) {
216
+ layoutRows.push({
217
+ type: "section",
218
+ label: schedule.section_labels[scheduleFile] ?? scheduleFile,
219
+ });
220
+ if (!initialCompleteInserted && initialCompleteRows.length > 0) {
221
+ for (const row of initialCompleteRows)
222
+ layoutRows.push({ type: "node", row });
223
+ initialCompleteInserted = true;
224
+ }
225
+ for (const row of fileRows)
226
+ layoutRows.push({ type: "node", row });
227
+ }
228
+ const height = topPad +
229
+ layoutRows.reduce((sum, entry) => sum + (entry.type === "section" ? sectionHeight + sectionGap : rowHeight), 0) +
230
+ bottomPad;
231
+ const parts = [];
232
+ parts.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" role="img" aria-label="${xmlEscape(title)}">`);
233
+ parts.push(`<style>
234
+ text { font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; fill: #1f2937; }
235
+ .title { font-size: 18px; font-weight: 700; fill: #0f172a; }
236
+ .caption { font-size: 11px; fill: #64748b; }
237
+ .section { font-size: 13px; font-weight: 700; fill: #0f172a; }
238
+ .label { font-size: 12px; font-weight: 600; fill: #1f2937; }
239
+ .label-artifact { font-size: 11px; font-weight: 400; fill: #6b7280; }
240
+ .label-id { font-size: 10px; font-family: ui-monospace, 'Courier New', monospace; fill: #9ca3af; }
241
+ .label-phase-set { font-size: 10px; font-family: ui-monospace, 'Courier New', monospace; fill: #6b7280; }
242
+ .axis { font-size: 11px; fill: #475569; }
243
+ .col-div { stroke: #d7dee7; stroke-width: 1; }
244
+ .grid { stroke: #d7dee7; stroke-width: 1; }
245
+ .row-grid { stroke: #edf2f7; stroke-width: 1; }
246
+ .shade { fill: #f8fafc; }
247
+ .holiday { fill: #eff6ff; }
248
+ .legend-label { font-size: 11px; fill: #475569; }
249
+ .month-grid { stroke: #94a3b8; stroke-width: 2; }
250
+ .gap { fill: #f1f5f9; }
251
+ .gap-div { stroke: #94a3b8; stroke-width: 1; stroke-dasharray: 3 3; }
252
+ .gap-label { font-size: 10px; fill: #64748b; }
253
+ </style>`);
254
+ parts.push(`<defs>
255
+ <clipPath id="clip-col1"><rect x="${col1X}" y="0" width="${col1DivX - col1X}" height="${height}" /></clipPath>
256
+ <clipPath id="clip-col2"><rect x="${col2X}" y="0" width="${col2DivX - col2X}" height="${height}" /></clipPath>
257
+ <clipPath id="clip-col3"><rect x="${col3X}" y="0" width="${col3DivX - col3X}" height="${height}" /></clipPath>
258
+ <clipPath id="clip-col4"><rect x="${col4X}" y="0" width="${leftPad - col4X}" height="${height}" /></clipPath>
259
+ </defs>`);
260
+ parts.push(`<rect x="0" y="0" width="${width}" height="${height}" fill="#fffdf8" />`);
261
+ parts.push(`<rect x="0" y="0" width="${leftPad}" height="${height}" fill="#fffaf0" />`);
262
+ parts.push(`<rect x="${leftPad}" y="0" width="${chartWidth + 40}" height="${height}" fill="#ffffff" />`);
263
+ parts.push(`<text class="title" x="16" y="28">${xmlEscape(title)}</text>`);
264
+ parts.push(`<text class="caption" x="16" y="48">1 タスク 1 行で表示します。1 日の長さは ${schedule.calendar.work_hours_per_day} 時間で、休日と週末は空白のままとし、次の稼働日に作業を再開します。タスクが無い期間は ⋯ で圧縮表示します。</text>`);
265
+ parts.push(`<rect x="0" y="${topPad - 36}" width="${width}" height="28" fill="#fff7ed" />`);
266
+ const legendY = 74;
267
+ const legend = [
268
+ { label: "todo", color: "#d1d5db" },
269
+ { label: "doing", color: "#2563eb" },
270
+ { label: "done", color: "#16a34a" },
271
+ { label: "blocked", color: "#f59e0b" },
272
+ { label: "critical", color: "#dc2626" },
273
+ { label: "gate", color: "#7c3aed" },
274
+ ];
275
+ let legendX = 16;
276
+ for (const item of legend) {
277
+ parts.push(`<rect x="${legendX}" y="${legendY - 10}" width="14" height="14" rx="3" fill="${item.color}" />`);
278
+ parts.push(`<text class="legend-label" x="${legendX + 20}" y="${legendY + 4}">${xmlEscape(item.label)}</text>`);
279
+ legendX += 76;
280
+ }
281
+ parts.push(`<rect x="${legendX}" y="${legendY - 10}" width="14" height="14" fill="#eff6ff" />`);
282
+ parts.push(`<text class="legend-label" x="${legendX + 20}" y="${legendY + 4}">holiday</text>`);
283
+ legendX += 90;
284
+ parts.push(`<rect x="${legendX}" y="${legendY - 10}" width="14" height="14" fill="#f8fafc" stroke="#d7dee7" />`);
285
+ parts.push(`<text class="legend-label" x="${legendX + 20}" y="${legendY + 4}">weekend</text>`);
286
+ // Column header labels
287
+ parts.push(`<text class="axis" x="${col1X}" y="${topPad - 18}">コード</text>`);
288
+ parts.push(`<text class="axis" x="${col2X}" y="${topPad - 18}">成果物名</text>`);
289
+ parts.push(`<text class="axis" x="${col3X}" y="${topPad - 18}">フェーズセット</text>`);
290
+ parts.push(`<text class="axis" x="${col4X}" y="${topPad - 18}">フェーズ</text>`);
291
+ for (const column of columns) {
292
+ if (column.kind === "gap") {
293
+ const x = leftPad + column.x;
294
+ // 圧縮区間: 薄い塗り + 破線の区切り + 「⋯ N日」ラベル
295
+ parts.push(`<rect class="gap" x="${x}" y="${topPad - 20}" width="${gapWidth}" height="${height - topPad}" />`);
296
+ parts.push(`<line class="gap-div" x1="${x}" y1="${topPad - 20}" x2="${x}" y2="${height - bottomPad}" />`);
297
+ parts.push(`<line class="gap-div" x1="${x + gapWidth}" y1="${topPad - 20}" x2="${x + gapWidth}" y2="${height - bottomPad}" />`);
298
+ parts.push(`<text class="gap-label" x="${x + gapWidth / 2}" y="${topPad - 18}" text-anchor="middle">⋯${column.days}日</text>`);
299
+ continue;
300
+ }
301
+ const dayStart = new Date(ganttChartStart.getTime() + column.dayIndex * 86400000);
302
+ const x = leftPad + column.x;
303
+ const isWorking = isWorkingDateUtc(dayStart, schedule.calendar);
304
+ const dayOfWeek = dayStart.getUTCDay();
305
+ const isWeekend = dayOfWeek === 0 || dayOfWeek === 6;
306
+ const isMonthStart = dayStart.getUTCDate() === 1;
307
+ const isHoliday = schedule.calendar.holidays.has(formatDateOnlyUtc(dayStart));
308
+ if (isHoliday) {
309
+ parts.push(`<rect class="holiday" x="${x}" y="${topPad - 20}" width="${dayWidth}" height="${height - topPad}" />`);
310
+ }
311
+ else if (!isWorking || isWeekend) {
312
+ parts.push(`<rect class="shade" x="${x}" y="${topPad - 20}" width="${dayWidth}" height="${height - topPad}" />`);
313
+ }
314
+ parts.push(`<line class="${isMonthStart ? "month-grid" : "grid"}" x1="${x}" y1="${topPad - 20}" x2="${x}" y2="${height - bottomPad}" />`);
315
+ parts.push(`<text class="axis" x="${x + 6}" y="${topPad - 18}">${xmlEscape(dayLabelUtc(dayStart))}</text>`);
316
+ }
317
+ parts.push(`<line class="grid" x1="${leftPad + chartWidth}" y1="${topPad - 20}" x2="${leftPad + chartWidth}" y2="${height - bottomPad}" />`);
318
+ // Vertical column dividers in left panel
319
+ parts.push(`<line class="col-div" x1="${col1DivX}" y1="${topPad - 22}" x2="${col1DivX}" y2="${height - bottomPad}" />`);
320
+ parts.push(`<line class="col-div" x1="${col2DivX}" y1="${topPad - 22}" x2="${col2DivX}" y2="${height - bottomPad}" />`);
321
+ parts.push(`<line class="col-div" x1="${col3DivX}" y1="${topPad - 22}" x2="${col3DivX}" y2="${height - bottomPad}" />`);
322
+ let currentY = topPad;
323
+ for (const entry of layoutRows) {
324
+ if (entry.type === "section") {
325
+ parts.push(`<rect x="0" y="${currentY - 18}" width="${width}" height="${sectionHeight}" fill="#f1f5f9" />`);
326
+ parts.push(`<text class="section" x="16" y="${currentY}">${xmlEscape(entry.label)}</text>`);
327
+ parts.push(`<line class="grid" x1="0" y1="${currentY + 8}" x2="${width}" y2="${currentY + 8}" />`);
328
+ currentY += sectionHeight + sectionGap;
329
+ continue;
330
+ }
331
+ const row = entry.row;
332
+ const rowTop = currentY - 14;
333
+ const rowMid = currentY - 2;
334
+ const taskState = row.kind === "task"
335
+ ? (stateSnapshot?.tasks[row.id]?.state ?? "todo")
336
+ : row.kind === "gate"
337
+ ? "gate"
338
+ : "milestone";
339
+ const fill = stateColor(taskState, criticalSet.has(row.id));
340
+ const scheduleNode = schedule.nodes.get(row.id);
341
+ if (row.kind === "gate") {
342
+ parts.push(`<rect x="0" y="${currentY - 14}" width="${width}" height="${rowHeight}" fill="#f3e8ff" />`);
343
+ }
344
+ if (row.kind === "task" && isInitialComplete(row)) {
345
+ parts.push(`<rect x="0" y="${currentY - 14}" width="${width}" height="${rowHeight}" fill="#f8fafc" />`);
346
+ }
347
+ if (row.kind === "task") {
348
+ const shortId = col1LabelFor(row);
349
+ const artifactName = scheduleNode?.artifact_name ?? "";
350
+ const phaseSet = col3LabelFor(row);
351
+ const taskName = row.name ?? "";
352
+ parts.push(`<text class="label-id" x="${col1X}" y="${currentY}" clip-path="url(#clip-col1)">${xmlEscape(shortId)}</text>`);
353
+ if (artifactName)
354
+ parts.push(`<text class="label-artifact" x="${col2X}" y="${currentY}" clip-path="url(#clip-col2)">${xmlEscape(artifactName)}</text>`);
355
+ if (phaseSet)
356
+ parts.push(`<text class="label-phase-set" x="${col3X}" y="${currentY}" clip-path="url(#clip-col3)">${xmlEscape(phaseSet)}</text>`);
357
+ if (taskName)
358
+ parts.push(`<text class="label" x="${col4X}" y="${currentY}" clip-path="url(#clip-col4)">${xmlEscape(taskName)}</text>`);
359
+ }
360
+ else {
361
+ const domainName = scheduleNode?.artifact_name ?? "";
362
+ const milestoneName = row.name ?? "";
363
+ parts.push(`<text class="label-id" x="${col1X}" y="${currentY}" clip-path="url(#clip-col1)">${xmlEscape(row.id)}</text>`);
364
+ if (domainName)
365
+ parts.push(`<text class="label-artifact" x="${col2X}" y="${currentY}" clip-path="url(#clip-col2)">${xmlEscape(domainName)}</text>`);
366
+ if (milestoneName)
367
+ parts.push(`<text class="label" x="${col4X}" y="${currentY}" clip-path="url(#clip-col4)">${xmlEscape(milestoneName)}</text>`);
368
+ }
369
+ parts.push(`<line class="row-grid" x1="0" y1="${currentY + 8}" x2="${width}" y2="${currentY + 8}" />`);
370
+ if (row.kind === "task" && isInitialComplete(row)) {
371
+ // No Gantt bar for completed deliverables — row label only
372
+ }
373
+ else if (row.kind === "task") {
374
+ const segments = taskSegments.get(row.id) ?? [];
375
+ for (const segment of segments) {
376
+ const startX = xForDate(segment.start);
377
+ const endX = xForDate(segment.end);
378
+ const widthPx = Math.max(2, endX - startX);
379
+ const stroke = criticalSet.has(row.id)
380
+ ? "#991b1b"
381
+ : taskState === "todo"
382
+ ? "#9ca3af"
383
+ : taskState === "blocked"
384
+ ? "#b45309"
385
+ : "#334155";
386
+ parts.push(`<rect x="${startX}" y="${rowTop}" width="${widthPx}" height="12" rx="4" fill="${fill}" stroke="${stroke}" stroke-width="${criticalSet.has(row.id) ? 1.25 : 0.75}" opacity="0.94" />`);
387
+ }
388
+ }
389
+ else if (row.kind === "gate") {
390
+ const at = dateForWorkingOffset(row.es, cpm.project_start_date, schedule.calendar);
391
+ const cx = xForDate(at);
392
+ // Vertical bar with top/bottom caps (gate/barrier symbol)
393
+ parts.push(`<rect x="${cx - 2}" y="${rowTop}" width="4" height="12" fill="${fill}" opacity="0.9" />`);
394
+ parts.push(`<rect x="${cx - 7}" y="${rowTop}" width="14" height="3" rx="1" fill="${fill}" opacity="0.9" />`);
395
+ parts.push(`<rect x="${cx - 7}" y="${rowTop + 9}" width="14" height="3" rx="1" fill="${fill}" opacity="0.9" />`);
396
+ }
397
+ else {
398
+ const at = dateForWorkingOffset(row.es, cpm.project_start_date, schedule.calendar);
399
+ const cx = xForDate(at);
400
+ parts.push(`<polygon points="${cx},${rowMid - 7} ${cx + 7},${rowMid} ${cx},${rowMid + 7} ${cx - 7},${rowMid}" fill="${fill}" />`);
401
+ }
402
+ currentY += rowHeight;
403
+ }
404
+ parts.push(`</svg>`);
405
+ return parts.join("\n");
406
+ }
407
+ export function buildGanttChartMarkdown(cpm, summary, options) {
408
+ const title = options?.title ?? "ガントチャート";
409
+ const svgFileName = options?.svgFileName ?? "gantt-chart.svg";
410
+ const scopeLabel = options?.scopeLabel ?? "full_schedule";
411
+ const lines = [];
412
+ lines.push(`# ${title}`);
413
+ lines.push("");
414
+ lines.push(...summary.progressSummaryLines);
415
+ lines.push(`- schedule_path: \`${cpm.schedule_path}\``);
416
+ if (cpm.project_start_date)
417
+ lines.push(`- project_start_date: \`${cpm.project_start_date}\``);
418
+ lines.push(`- project_duration_days: \`${formatDays(cpm.project_duration_days)}\``);
419
+ lines.push(`- scope: \`${scopeLabel}\``);
420
+ lines.push(`- critical_path_task_count: \`${summary.criticalPathTaskCount}\``);
421
+ lines.push(`- progress_percent: \`${summary.progressPercent}%\``);
422
+ lines.push(`- done_tasks: \`${summary.doneTasks}\``);
423
+ lines.push(`- task_state_counts: \`${summary.taskStateCounts}\``);
424
+ lines.push("");
425
+ lines.push(`![${title}](./${svgFileName})`);
426
+ lines.push("");
427
+ return lines.join("\n");
428
+ }