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.
- package/LICENSE +22 -0
- package/README.md +142 -35
- package/dist/agent-response.js +27 -0
- package/dist/agent.js +124 -0
- package/dist/build-command.js +149 -0
- package/dist/build-if-stale.js +35 -0
- package/dist/catalog-build.js +1079 -0
- package/dist/catalog-generate.js +226 -0
- package/dist/catalog-paths.js +31 -0
- package/dist/catalog-plan-generate.js +301 -0
- package/dist/catalog-plan-prompt.js +73 -0
- package/dist/catalog-plan.js +471 -0
- package/dist/catalog-scaffold.js +255 -0
- package/dist/catalog-types.js +4 -0
- package/dist/catalog.js +606 -0
- package/dist/dashboard.js +990 -0
- package/dist/deliverable-trash.js +148 -0
- package/dist/deliverable.js +97 -0
- package/dist/dist-freshness.js +150 -0
- package/dist/doc-index.js +424 -0
- package/dist/exec-agent-config.js +172 -0
- package/dist/exec-agent-git-state.js +136 -0
- package/dist/exec-agent-protected-config.js +276 -0
- package/dist/exec-events.js +250 -112
- package/dist/exec-evidence.js +317 -0
- package/dist/exec-format.js +54 -0
- package/dist/exec-limit.js +202 -0
- package/dist/exec-parent-validation.js +169 -0
- package/dist/exec-pipeline-state.js +160 -0
- package/dist/exec-plans.js +1016 -0
- package/dist/exec-project.js +25 -11
- package/dist/exec-protection-handoff.js +169 -0
- package/dist/exec-provider-scaffold.js +99 -0
- package/dist/exec-register-resume.js +196 -0
- package/dist/exec-register.js +281 -0
- package/dist/exec-reporter.js +329 -0
- package/dist/exec-results.js +510 -0
- package/dist/exec-run-lock.js +149 -0
- package/dist/exec-run.js +4953 -0
- package/dist/exec-schedule-calendar.js +86 -9
- package/dist/exec-schedule-cpm.js +30 -12
- package/dist/exec-schedule-gantt-chart-render.js +428 -0
- package/dist/exec-schedule-gantt-chart-scope.js +111 -0
- package/dist/exec-schedule-gantt-chart.js +2 -0
- package/dist/exec-schedule-hash.js +34 -25
- package/dist/exec-schedule-index.js +200 -67
- package/dist/exec-schedule-initial.js +100 -0
- package/dist/exec-schedule-progress.js +51 -26
- package/dist/exec-schedule-ready.js +71 -27
- package/dist/exec-schedule.js +171 -93
- package/dist/exec-shared.js +146 -25
- package/dist/exec-strategy.js +547 -0
- package/dist/exec-task-view.js +64 -0
- package/dist/exec-trial.js +895 -0
- package/dist/exec-worktree-command.js +426 -0
- package/dist/exec-worktree-ops.js +847 -0
- package/dist/exec-worktree.js +359 -0
- package/dist/exec.js +744 -192
- package/dist/frontmatter-namespace.js +48 -0
- package/dist/git-environment.js +23 -0
- package/dist/grade-result.js +137 -0
- package/dist/grade.js +2456 -0
- package/dist/index-command.js +103 -0
- package/dist/job.js +1081 -0
- package/dist/kata-command.js +303 -0
- package/dist/kata.js +187 -0
- package/dist/package-paths.js +33 -0
- package/dist/practice-id.js +24 -0
- package/dist/register-date.js +122 -0
- package/dist/register-events.js +363 -0
- package/dist/register-history.js +323 -0
- package/dist/register-item.js +455 -0
- package/dist/register-migrate-timestamps.js +176 -0
- package/dist/register.js +2199 -0
- package/dist/review-plan.js +199 -0
- package/dist/review-types.js +1 -0
- package/dist/role-types.js +1 -0
- package/dist/routine.js +814 -0
- package/dist/schedule-approach.js +252 -0
- package/dist/schedule-build.js +552 -0
- package/dist/schedule-phase-sets.js +73 -0
- package/dist/schedule-strategy-generate.js +812 -0
- package/dist/schedule-strategy-profiles.js +276 -0
- package/dist/schedule.js +420 -0
- package/dist/spawn-self.js +28 -0
- package/dist/specdojo-config.js +133 -39
- package/dist/specdojo.js +56 -7
- package/dist/template-frontmatter.js +89 -0
- package/dist/template-resolution.js +92 -0
- package/dist/timeline-build.js +334 -0
- package/dist/timeline.js +107 -0
- package/dist/watch.js +313 -0
- package/dist/yaml-pages-command.js +28 -0
- package/dist/yaml-pages.js +180 -0
- package/dist/yaml-schema-modeline.js +49 -0
- package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +600 -0
- package/docs/ja/specdojo/exec-templates/xep-bootstrap-template.md +120 -0
- package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +37 -0
- package/docs/ja/specdojo/exec-templates/xep-cross-deliverable-dedup-template.md +51 -0
- package/docs/ja/specdojo/exec-templates/xep-freeform-template.md +74 -0
- package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +109 -0
- package/docs/ja/specdojo/exec-templates/xep-job-template.md +43 -0
- package/docs/ja/specdojo/exec-templates/xep-recipe-guided-template.md +82 -0
- package/docs/ja/specdojo/exec-templates/xep-recipe-maintenance-template.md +86 -0
- package/docs/ja/specdojo/exec-templates/xep-register-investigate-template.md +42 -0
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +49 -0
- package/docs/ja/specdojo/exec-templates/xep-retrofit-template.md +98 -0
- package/docs/ja/specdojo/exec-templates/xep-rulebook-maintenance-template.md +86 -0
- package/docs/ja/specdojo/exec-templates/xep-sample-maintenance-template.md +86 -0
- package/docs/ja/specdojo/exec-templates/xep-template-maintenance-template.md +86 -0
- package/docs/ja/specdojo/exec-templates/xep-template.md +66 -0
- package/docs/ja/specdojo/exec-templates/xer-cross-deliverable-dedup-template.md +31 -0
- package/docs/ja/specdojo/exec-templates/xer-human-bootstrap-finalize-template.md +40 -0
- package/docs/ja/specdojo/exec-templates/xer-human-finalize-template.md +30 -0
- package/docs/ja/specdojo/exec-templates/xer-template.md +19 -0
- package/docs/ja/specdojo/exec-templates/xrp-freeform-template.md +70 -0
- package/docs/ja/specdojo/exec-templates/xrp-fully-guided-template.md +97 -0
- package/docs/ja/specdojo/exec-templates/xrp-recipe-guided-template.md +76 -0
- package/docs/ja/specdojo/exec-templates/xrp-recipe-maintenance-template.md +73 -0
- package/docs/ja/specdojo/exec-templates/xrp-retrofit-template.md +74 -0
- package/docs/ja/specdojo/exec-templates/xrp-rulebook-maintenance-template.md +74 -0
- package/docs/ja/specdojo/exec-templates/xrp-sample-maintenance-template.md +73 -0
- package/docs/ja/specdojo/exec-templates/xrp-template-maintenance-template.md +73 -0
- package/docs/ja/specdojo/exec-templates/xrp-template.md +67 -0
- package/docs/ja/specdojo/exec-templates/xrp-viewpoint-detail-template.md +7 -0
- package/docs/ja/specdojo/exec-templates/xrr-template.md +21 -0
- package/docs/ja/specdojo/exec-templates/xrr-viewpoint-detail-template.md +7 -0
- package/docs/ja/specdojo/guides/branch-workflow-guide.md +354 -0
- package/docs/ja/specdojo/guides/docs-editing-guide.md +327 -0
- package/docs/ja/specdojo/guides/docs-structure-guide.md +519 -0
- package/docs/ja/specdojo/guides/exec-config-guide.md +589 -0
- package/docs/ja/specdojo/guides/exec-operation-guide.md +440 -0
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +318 -0
- package/docs/ja/specdojo/guides/kata-guide.md +89 -0
- package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +127 -0
- package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +228 -0
- package/docs/ja/specdojo/guides/practice-system-composition-guide.md +111 -0
- package/docs/ja/specdojo/guides/quick-start-guide.md +472 -0
- package/docs/ja/specdojo/guides/register-operation-guide.md +418 -0
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +163 -0
- package/docs/ja/specdojo/guides/review-guide.md +428 -0
- package/docs/ja/specdojo/guides/routine-operation-guide.md +282 -0
- package/docs/ja/specdojo/guides/ryu-guide.md +230 -0
- package/docs/ja/specdojo/guides/schedule-design-guide.md +429 -0
- package/docs/ja/specdojo/guides/schedule-operation-guide.md +151 -0
- package/docs/ja/specdojo/guides/specdojo-overview-guide.md +257 -0
- package/docs/ja/specdojo/guides/timeline-design-guide.md +160 -0
- package/docs/ja/specdojo/guides/track-design-guide.md +215 -0
- package/docs/ja/specdojo/guides/use-case-guide.md +133 -0
- package/docs/ja/specdojo/guides/waza-guide.md +224 -0
- package/docs/ja/specdojo/index.md +33 -0
- package/docs/ja/specdojo/philosophy/needs-to-implementation-philosophy.md +212 -0
- package/docs/ja/specdojo/philosophy/specdojo-philosophy.md +242 -0
- package/docs/ja/specdojo/recipes/cdfd-overview-recipe.md +198 -0
- package/docs/ja/specdojo/recipes/cdfd-recipe.md +218 -0
- package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +198 -0
- package/docs/ja/specdojo/recipes/exec-human-finalize-recipe.md +100 -0
- package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +148 -0
- package/docs/ja/specdojo/recipes/pm-communication-plan-recipe.md +97 -0
- package/docs/ja/specdojo/recipes/pm-members-recipe.md +149 -0
- package/docs/ja/specdojo/recipes/pm-organization-recipe.md +96 -0
- package/docs/ja/specdojo/recipes/pm-plan-recipe.md +98 -0
- package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +97 -0
- package/docs/ja/specdojo/recipes/pm-raci-recipe.md +96 -0
- package/docs/ja/specdojo/recipes/pm-roles-recipe.md +136 -0
- package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +162 -0
- package/docs/ja/specdojo/recipes/prj-charter-recipe.md +187 -0
- package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +235 -0
- package/docs/ja/specdojo/recipes/prj-issues-and-approach-recipe.md +205 -0
- package/docs/ja/specdojo/recipes/prj-overview-recipe.md +289 -0
- package/docs/ja/specdojo/recipes/prj-scope-recipe.md +201 -0
- package/docs/ja/specdojo/recipes/prj-stakeholder-register-recipe.md +168 -0
- package/docs/ja/specdojo/recipes/prj-success-criteria-and-acceptance-criteria-recipe.md +179 -0
- package/docs/ja/specdojo/recipes/stsd-recipe.md +138 -0
- package/docs/ja/specdojo/references/command-reference.md +718 -0
- package/docs/ja/specdojo/references/deliverables-reference.md +407 -0
- package/docs/ja/specdojo/references/directory-layout-reference.md +280 -0
- package/docs/ja/specdojo/references/specdojo-config-reference.md +133 -0
- package/docs/ja/specdojo/rulebooks/atc-index-rulebook.md +372 -0
- package/docs/ja/specdojo/rulebooks/atc-rulebook.md +302 -0
- package/docs/ja/specdojo/rulebooks/bac-rulebook.md +331 -0
- package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +134 -0
- package/docs/ja/specdojo/rulebooks/bds-rulebook.md +207 -0
- package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +102 -0
- package/docs/ja/specdojo/rulebooks/bes-rulebook.md +131 -0
- package/docs/ja/specdojo/rulebooks/bps-rulebook.md +269 -0
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +187 -0
- package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +279 -0
- package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +219 -0
- package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +233 -0
- package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +182 -0
- package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +171 -0
- package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +105 -0
- package/docs/ja/specdojo/rulebooks/cld-rulebook.md +195 -0
- package/docs/ja/specdojo/rulebooks/cnd-mermaid-rulebook.md +285 -0
- package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +292 -0
- package/docs/ja/specdojo/rulebooks/cop-index-rulebook.md +171 -0
- package/docs/ja/specdojo/rulebooks/cop-rulebook.md +325 -0
- package/docs/ja/specdojo/rulebooks/cpd-mermaid-rulebook.md +266 -0
- package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +294 -0
- package/docs/ja/specdojo/rulebooks/cstd-rulebook.md +21 -0
- package/docs/ja/specdojo/rulebooks/cxd-mermaid-rulebook.md +401 -0
- package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +311 -0
- package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +158 -0
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +287 -0
- package/docs/ja/specdojo/rulebooks/dec-rulebook.md +62 -0
- package/docs/ja/specdojo/rulebooks/dmd-index-rulebook.md +100 -0
- package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +298 -0
- package/docs/ja/specdojo/rulebooks/etc-index-rulebook.md +379 -0
- package/docs/ja/specdojo/rulebooks/etc-rulebook.md +310 -0
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +86 -0
- package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +297 -0
- package/docs/ja/specdojo/rulebooks/ifx-api-rulebook.md +79 -0
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +213 -0
- package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +311 -0
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +94 -0
- package/docs/ja/specdojo/rulebooks/ifx-msg-rulebook.md +81 -0
- package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +117 -0
- package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +118 -0
- package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +116 -0
- package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +116 -0
- package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +116 -0
- package/docs/ja/specdojo/rulebooks/itc-index-rulebook.md +421 -0
- package/docs/ja/specdojo/rulebooks/itc-rulebook.md +307 -0
- package/docs/ja/specdojo/rulebooks/mip-index-rulebook.md +312 -0
- package/docs/ja/specdojo/rulebooks/mm-rulebook.md +63 -0
- package/docs/ja/specdojo/rulebooks/mtp-rulebook.md +353 -0
- package/docs/ja/specdojo/rulebooks/nfr-availability-rulebook.md +184 -0
- package/docs/ja/specdojo/rulebooks/nfr-index-rulebook.md +179 -0
- package/docs/ja/specdojo/rulebooks/nfr-integrity-rulebook.md +184 -0
- package/docs/ja/specdojo/rulebooks/nfr-maintainability-rulebook.md +183 -0
- package/docs/ja/specdojo/rulebooks/nfr-operations-rulebook.md +185 -0
- package/docs/ja/specdojo/rulebooks/nfr-performance-rulebook.md +185 -0
- package/docs/ja/specdojo/rulebooks/nfr-reliability-rulebook.md +186 -0
- package/docs/ja/specdojo/rulebooks/nfr-security-safety-rulebook.md +186 -0
- package/docs/ja/specdojo/rulebooks/nfr-usability-rulebook.md +184 -0
- package/docs/ja/specdojo/rulebooks/ntp-rulebook.md +61 -0
- package/docs/ja/specdojo/rulebooks/opd-index-rulebook.md +84 -0
- package/docs/ja/specdojo/rulebooks/opd-rulebook.md +357 -0
- package/docs/ja/specdojo/rulebooks/opr-index-rulebook.md +80 -0
- package/docs/ja/specdojo/rulebooks/opr-rulebook.md +484 -0
- package/docs/ja/specdojo/rulebooks/otp-index-rulebook.md +120 -0
- package/docs/ja/specdojo/rulebooks/otp-rulebook.md +293 -0
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +211 -0
- package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +94 -0
- package/docs/ja/specdojo/rulebooks/pm-communication-plan-rulebook.md +116 -0
- package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +93 -0
- package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +190 -0
- package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +108 -0
- package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +122 -0
- package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +117 -0
- package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +116 -0
- package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +93 -0
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +146 -0
- package/docs/ja/specdojo/rulebooks/pr-rulebook.md +65 -0
- package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +178 -0
- package/docs/ja/specdojo/rulebooks/prj-charter-rulebook.md +232 -0
- package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +235 -0
- package/docs/ja/specdojo/rulebooks/prj-issues-and-approach-rulebook.md +242 -0
- package/docs/ja/specdojo/rulebooks/prj-overview-rulebook.md +187 -0
- package/docs/ja/specdojo/rulebooks/prj-scope-rulebook.md +201 -0
- package/docs/ja/specdojo/rulebooks/prj-stakeholder-register-rulebook.md +165 -0
- package/docs/ja/specdojo/rulebooks/prj-success-criteria-and-acceptance-criteria-rulebook.md +165 -0
- package/docs/ja/specdojo/rulebooks/sac-rulebook.md +202 -0
- package/docs/ja/specdojo/rulebooks/sch-rulebook.md +139 -0
- package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +63 -0
- package/docs/ja/specdojo/rulebooks/sf-rulebook.md +93 -0
- package/docs/ja/specdojo/rulebooks/sld-rulebook.md +93 -0
- package/docs/ja/specdojo/rulebooks/stc-index-rulebook.md +329 -0
- package/docs/ja/specdojo/rulebooks/stc-rulebook.md +297 -0
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +132 -0
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +215 -0
- package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +376 -0
- package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +313 -0
- package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +246 -0
- package/docs/ja/specdojo/rulebooks/sysd-rulebook.md +119 -0
- package/docs/ja/specdojo/rulebooks/tml-rulebook.md +188 -0
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +114 -0
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +117 -0
- package/docs/ja/specdojo/rulebooks/tsd-index-rulebook.md +101 -0
- package/docs/ja/specdojo/rulebooks/tsd-rulebook.md +103 -0
- package/docs/ja/specdojo/rulebooks/tsp-index-rulebook.md +396 -0
- package/docs/ja/specdojo/rulebooks/uis-rulebook.md +207 -0
- package/docs/ja/specdojo/rulebooks/utc-index-rulebook.md +387 -0
- package/docs/ja/specdojo/rulebooks/utc-rulebook.md +303 -0
- package/docs/ja/specdojo/samples/atc-index-sample.md +38 -0
- package/docs/ja/specdojo/samples/atc-sample.md +41 -0
- package/docs/ja/specdojo/samples/bac-sample.md +38 -0
- package/docs/ja/specdojo/samples/bdd-sample.yaml +71 -0
- package/docs/ja/specdojo/samples/bds-sample.md +38 -0
- package/docs/ja/specdojo/samples/bes-index-sample.md +38 -0
- package/docs/ja/specdojo/samples/bes-sample.md +38 -0
- package/docs/ja/specdojo/samples/bps-sample.md +38 -0
- package/docs/ja/specdojo/samples/br-sample.md +40 -0
- package/docs/ja/specdojo/samples/ccd-sample.md +38 -0
- package/docs/ja/specdojo/samples/cdfd-overview-sample.md +284 -0
- package/docs/ja/specdojo/samples/cdfd-sample.md +229 -0
- package/docs/ja/specdojo/samples/cdfd-uc-sample.md +146 -0
- package/docs/ja/specdojo/samples/cdsd-sample.md +38 -0
- package/docs/ja/specdojo/samples/cld-sample.md +38 -0
- package/docs/ja/specdojo/samples/cnd-sample.md +38 -0
- package/docs/ja/specdojo/samples/cop-index-sample.md +38 -0
- package/docs/ja/specdojo/samples/cop-sample.md +38 -0
- package/docs/ja/specdojo/samples/cpd-sample.md +38 -0
- package/docs/ja/specdojo/samples/cstd-sample.md +11 -0
- package/docs/ja/specdojo/samples/cxd-sample.md +38 -0
- package/docs/ja/specdojo/samples/dct-index-sample.yaml +39 -0
- package/docs/ja/specdojo/samples/dct-sample.yaml +91 -0
- package/docs/ja/specdojo/samples/dec-sample.md +39 -0
- package/docs/ja/specdojo/samples/dmd-index-sample.md +50 -0
- package/docs/ja/specdojo/samples/dmd-sample.md +74 -0
- package/docs/ja/specdojo/samples/etc-index-sample.md +38 -0
- package/docs/ja/specdojo/samples/etc-sample.md +38 -0
- package/docs/ja/specdojo/samples/gl-sample.yaml +37 -0
- package/docs/ja/specdojo/samples/ifd-sample.md +38 -0
- package/docs/ja/specdojo/samples/ifx-api-sample.yaml +102 -0
- package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +107 -0
- package/docs/ja/specdojo/samples/ifx-file-sample.md +38 -0
- package/docs/ja/specdojo/samples/ifx-msg-sample.yaml +89 -0
- package/docs/ja/specdojo/samples/imp-business-sample.md +66 -0
- package/docs/ja/specdojo/samples/imp-data-sample.md +60 -0
- package/docs/ja/specdojo/samples/imp-interface-sample.md +60 -0
- package/docs/ja/specdojo/samples/imp-operations-sample.md +60 -0
- package/docs/ja/specdojo/samples/imp-test-sample.md +60 -0
- package/docs/ja/specdojo/samples/itc-index-sample.md +38 -0
- package/docs/ja/specdojo/samples/itc-sample.md +38 -0
- package/docs/ja/specdojo/samples/mip-index-sample.md +38 -0
- package/docs/ja/specdojo/samples/mm-sample.md +35 -0
- package/docs/ja/specdojo/samples/mtp-sample.md +38 -0
- package/docs/ja/specdojo/samples/nfr-availability-sample.md +38 -0
- package/docs/ja/specdojo/samples/nfr-index-sample.md +38 -0
- package/docs/ja/specdojo/samples/nfr-integrity-sample.md +38 -0
- package/docs/ja/specdojo/samples/nfr-maintainability-sample.md +38 -0
- package/docs/ja/specdojo/samples/nfr-operations-sample.md +38 -0
- package/docs/ja/specdojo/samples/nfr-performance-sample.md +38 -0
- package/docs/ja/specdojo/samples/nfr-reliability-sample.md +38 -0
- package/docs/ja/specdojo/samples/nfr-security-safety-sample.md +38 -0
- package/docs/ja/specdojo/samples/nfr-usability-sample.md +38 -0
- package/docs/ja/specdojo/samples/ntp-sample.md +38 -0
- package/docs/ja/specdojo/samples/opd-access-control-sample.md +29 -0
- package/docs/ja/specdojo/samples/opd-incident-management-sample.md +31 -0
- package/docs/ja/specdojo/samples/opd-index-sample.md +41 -0
- package/docs/ja/specdojo/samples/opd-monitoring-sample.md +32 -0
- package/docs/ja/specdojo/samples/opd-sample.md +38 -0
- package/docs/ja/specdojo/samples/opr-access-control-sample.md +24 -0
- package/docs/ja/specdojo/samples/opr-backup-restore-sample.md +27 -0
- package/docs/ja/specdojo/samples/opr-batch-sample.md +23 -0
- package/docs/ja/specdojo/samples/opr-change-sample.md +24 -0
- package/docs/ja/specdojo/samples/opr-incident-sample.md +38 -0
- package/docs/ja/specdojo/samples/opr-index-sample.md +43 -0
- package/docs/ja/specdojo/samples/opr-monitoring-sample.md +27 -0
- package/docs/ja/specdojo/samples/opr-sample.md +38 -0
- package/docs/ja/specdojo/samples/opr-support-sample.md +23 -0
- package/docs/ja/specdojo/samples/otp-index-sample.md +66 -0
- package/docs/ja/specdojo/samples/otp-sample.md +68 -0
- package/docs/ja/specdojo/samples/pm-change-request-log-sample.md +47 -0
- package/docs/ja/specdojo/samples/pm-communication-plan-sample.md +46 -0
- package/docs/ja/specdojo/samples/pm-issue-log-sample.md +45 -0
- package/docs/ja/specdojo/samples/pm-members-sample.yaml +103 -0
- package/docs/ja/specdojo/samples/pm-organization-sample.md +46 -0
- package/docs/ja/specdojo/samples/pm-plan-sample.md +57 -0
- package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +52 -0
- package/docs/ja/specdojo/samples/pm-raci-sample.md +57 -0
- package/docs/ja/specdojo/samples/pm-risk-register-sample.md +43 -0
- package/docs/ja/specdojo/samples/pm-roles-sample.yaml +41 -0
- package/docs/ja/specdojo/samples/pr-sample.md +39 -0
- package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +57 -0
- package/docs/ja/specdojo/samples/prj-charter-sample.md +121 -0
- package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +105 -0
- package/docs/ja/specdojo/samples/prj-issues-and-approach-sample.md +78 -0
- package/docs/ja/specdojo/samples/prj-overview-sample.md +95 -0
- package/docs/ja/specdojo/samples/prj-scope-sample.md +71 -0
- package/docs/ja/specdojo/samples/prj-stakeholder-register-sample.md +60 -0
- package/docs/ja/specdojo/samples/prj-success-criteria-and-acceptance-criteria-sample.md +62 -0
- package/docs/ja/specdojo/samples/sac-sample.md +38 -0
- package/docs/ja/specdojo/samples/sf-index-sample.md +38 -0
- package/docs/ja/specdojo/samples/sf-sample.md +38 -0
- package/docs/ja/specdojo/samples/sld-sample.md +38 -0
- package/docs/ja/specdojo/samples/stc-index-sample.md +38 -0
- package/docs/ja/specdojo/samples/stc-sample.md +38 -0
- package/docs/ja/specdojo/samples/stsd-sample.md +58 -0
- package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +38 -0
- package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +38 -0
- package/docs/ja/specdojo/samples/sysd-index-sample.md +38 -0
- package/docs/ja/specdojo/samples/trc-requirements-to-specs-sample.md +56 -0
- package/docs/ja/specdojo/samples/trc-requirements-to-tests-sample.md +56 -0
- package/docs/ja/specdojo/samples/tsd-index-sample.md +29 -0
- package/docs/ja/specdojo/samples/tsd-sample.md +38 -0
- package/docs/ja/specdojo/samples/tsp-index-sample.md +38 -0
- package/docs/ja/specdojo/samples/uis-sample.md +38 -0
- package/docs/ja/specdojo/samples/utc-index-sample.md +38 -0
- package/docs/ja/specdojo/samples/utc-sample.md +38 -0
- package/docs/ja/specdojo/schemas/v1/guide-content.schema.yaml +20 -0
- package/docs/ja/specdojo/schemas/v1/philosophy-content.schema.yaml +21 -0
- package/docs/ja/specdojo/schemas/v1/reference-content.schema.yaml +21 -0
- package/docs/ja/specdojo/standards/document-metadata-standard.md +323 -0
- package/docs/ja/specdojo/standards/exec-human-finalize-standard.md +75 -0
- package/docs/ja/specdojo/standards/git-branching-standard.md +227 -0
- package/docs/ja/specdojo/standards/guide-authoring-standard.md +124 -0
- package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +929 -0
- package/docs/ja/specdojo/standards/job-definition-standard.md +148 -0
- package/docs/ja/specdojo/standards/people-and-organization-definition-standard.md +431 -0
- package/docs/ja/specdojo/standards/philosophy-authoring-standard.md +113 -0
- package/docs/ja/specdojo/standards/recipe-authoring-standard.md +143 -0
- package/docs/ja/specdojo/standards/reference-authoring-standard.md +99 -0
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +140 -0
- package/docs/ja/specdojo/standards/sample-authoring-standard.md +151 -0
- package/docs/ja/specdojo/standards/standard-authoring-standard.md +108 -0
- package/docs/ja/specdojo/standards/template-authoring-standard.md +101 -0
- package/docs/ja/specdojo/standards/test-document-scope-standard.md +176 -0
- package/docs/ja/specdojo/templates/cdfd-overview-template.md +199 -0
- package/docs/ja/specdojo/templates/cdfd-template.md +173 -0
- package/docs/ja/specdojo/templates/cdfd-uc-template.md +148 -0
- package/docs/ja/specdojo/templates/dct-architecture-template.yaml +136 -0
- package/docs/ja/specdojo/templates/dct-business-acceptance-criteria-template.yaml +34 -0
- package/docs/ja/specdojo/templates/dct-business-model-bes-template.yaml +75 -0
- package/docs/ja/specdojo/templates/dct-business-model-bps-template.yaml +49 -0
- package/docs/ja/specdojo/templates/dct-business-model-br-template.yaml +50 -0
- package/docs/ja/specdojo/templates/dct-data-flow-template.yaml +40 -0
- package/docs/ja/specdojo/templates/dct-data-model-bdd-template.yaml +46 -0
- package/docs/ja/specdojo/templates/dct-data-model-ccd-template.yaml +46 -0
- package/docs/ja/specdojo/templates/dct-data-model-cdsd-template.yaml +41 -0
- package/docs/ja/specdojo/templates/dct-data-model-cld-template.yaml +38 -0
- package/docs/ja/specdojo/templates/dct-data-model-sld-template.yaml +38 -0
- package/docs/ja/specdojo/templates/dct-data-model-stsd-template.yaml +46 -0
- package/docs/ja/specdojo/templates/dct-external-interface-specs-template.yaml +114 -0
- package/docs/ja/specdojo/templates/dct-glossary-template.yaml +35 -0
- package/docs/ja/specdojo/templates/dct-impact-analysis-template.yaml +138 -0
- package/docs/ja/specdojo/templates/dct-index-template.md +40 -0
- package/docs/ja/specdojo/templates/dct-migration-planning-template.yaml +148 -0
- package/docs/ja/specdojo/templates/dct-non-functional-requirements-template.yaml +222 -0
- package/docs/ja/specdojo/templates/dct-operations-template.yaml +108 -0
- package/docs/ja/specdojo/templates/dct-project-definition-template.yaml +210 -0
- package/docs/ja/specdojo/templates/dct-project-management-template.yaml +423 -0
- package/docs/ja/specdojo/templates/dct-system-acceptance-criteria-template.yaml +37 -0
- package/docs/ja/specdojo/templates/dct-system-design-template.yaml +82 -0
- package/docs/ja/specdojo/templates/dct-system-functions-template.yaml +58 -0
- package/docs/ja/specdojo/templates/dct-test-specs-template.yaml +261 -0
- package/docs/ja/specdojo/templates/dct-user-interface-model-template.yaml +60 -0
- package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +88 -0
- package/docs/ja/specdojo/templates/opr-template.md +85 -0
- package/docs/ja/specdojo/templates/pjr-change-request-template.md +60 -0
- package/docs/ja/specdojo/templates/pjr-decision-template.md +61 -0
- package/docs/ja/specdojo/templates/pjr-index-template.md +49 -0
- package/docs/ja/specdojo/templates/pjr-issue-template.md +50 -0
- package/docs/ja/specdojo/templates/pjr-note-template.md +35 -0
- package/docs/ja/specdojo/templates/pjr-question-template.md +53 -0
- package/docs/ja/specdojo/templates/pjr-risk-template.md +49 -0
- package/docs/ja/specdojo/templates/pjr-todo-template.md +41 -0
- package/docs/ja/specdojo/templates/pjr-views-by-owner-template.md +22 -0
- package/docs/ja/specdojo/templates/pjr-views-by-priority-template.md +22 -0
- package/docs/ja/specdojo/templates/pjr-views-by-status-template.md +22 -0
- package/docs/ja/specdojo/templates/pm-change-request-log-template.md +20 -0
- package/docs/ja/specdojo/templates/pm-communication-plan-template.md +46 -0
- package/docs/ja/specdojo/templates/pm-decision-log-template.md +20 -0
- package/docs/ja/specdojo/templates/pm-issue-log-template.md +20 -0
- package/docs/ja/specdojo/templates/pm-members-template.yaml +105 -0
- package/docs/ja/specdojo/templates/pm-organization-template.md +44 -0
- package/docs/ja/specdojo/templates/pm-plan-template.md +52 -0
- package/docs/ja/specdojo/templates/pm-quality-management-plan-template.md +46 -0
- package/docs/ja/specdojo/templates/pm-raci-template.md +51 -0
- package/docs/ja/specdojo/templates/pm-risk-register-template.md +20 -0
- package/docs/ja/specdojo/templates/pm-roles-template.yaml +53 -0
- package/docs/ja/specdojo/templates/prj-assumptions-constraints-dependencies-template.md +59 -0
- package/docs/ja/specdojo/templates/prj-charter-template.md +116 -0
- package/docs/ja/specdojo/templates/prj-comparison-of-alternatives-template.md +116 -0
- package/docs/ja/specdojo/templates/prj-issues-and-approach-template.md +89 -0
- package/docs/ja/specdojo/templates/prj-overview-template.md +85 -0
- package/docs/ja/specdojo/templates/prj-scope-template.md +75 -0
- package/docs/ja/specdojo/templates/prj-stakeholder-register-template.md +64 -0
- package/docs/ja/specdojo/templates/prj-success-criteria-and-acceptance-criteria-template.md +60 -0
- package/docs/ja/specdojo/templates/stsd-template.md +57 -0
- package/docs/specdojo/schemas/v1/bdd.schema.yaml +230 -0
- package/docs/specdojo/schemas/v1/common-frontmatter.schema.yaml +77 -0
- package/docs/specdojo/schemas/v1/dct-index.schema.yaml +85 -0
- package/docs/specdojo/schemas/v1/dct-plan.schema.yaml +324 -0
- package/docs/specdojo/schemas/v1/dct.schema.yaml +368 -0
- package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +91 -0
- package/docs/specdojo/schemas/v1/esil.schema.yaml +142 -0
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +101 -0
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +272 -0
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +162 -0
- package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +126 -0
- package/docs/specdojo/schemas/v1/exec-reporter-output.schema.yaml +151 -0
- package/docs/specdojo/schemas/v1/exec-result-frontmatter.schema.yaml +144 -0
- package/docs/specdojo/schemas/v1/grade-done-criteria.schema.yaml +79 -0
- package/docs/specdojo/schemas/v1/grade-pipeline-state.schema.yaml +60 -0
- package/docs/specdojo/schemas/v1/grade-result.schema.yaml +118 -0
- package/docs/specdojo/schemas/v1/guide-frontmatter.schema.yaml +19 -0
- package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +293 -0
- package/docs/specdojo/schemas/v1/job-run.schema.yaml +90 -0
- package/docs/specdojo/schemas/v1/job.schema.yaml +198 -0
- package/docs/specdojo/schemas/v1/philosophy-frontmatter.schema.yaml +19 -0
- package/docs/specdojo/schemas/v1/pipeline-state.schema.yaml +56 -0
- package/docs/specdojo/schemas/v1/pm-members.schema.yaml +252 -0
- package/docs/specdojo/schemas/v1/pm-review-viewpoints.schema.yaml +387 -0
- package/docs/specdojo/schemas/v1/pm-roles.schema.yaml +106 -0
- package/docs/specdojo/schemas/v1/recipe-frontmatter.schema.yaml +27 -0
- package/docs/specdojo/schemas/v1/reference-frontmatter.schema.yaml +18 -0
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +106 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +204 -0
- package/docs/specdojo/schemas/v1/routine-run.schema.yaml +36 -0
- package/docs/specdojo/schemas/v1/routine.schema.yaml +87 -0
- package/docs/specdojo/schemas/v1/rulebook-frontmatter.schema.yaml +61 -0
- package/docs/specdojo/schemas/v1/sch-common.schema.yaml +258 -0
- package/docs/specdojo/schemas/v1/sch-defaults.schema.yaml +48 -0
- package/docs/specdojo/schemas/v1/sch-milestones.schema.yaml +64 -0
- package/docs/specdojo/schemas/v1/sch-strategy.schema.yaml +772 -0
- package/docs/specdojo/schemas/v1/sch-track.schema.yaml +66 -0
- package/docs/specdojo/schemas/v1/standard-frontmatter.schema.yaml +18 -0
- package/docs/specdojo/schemas/v1/tml-index.schema.yaml +103 -0
- package/package.json +121 -24
- package/templates/antigravity/README.md +35 -0
- package/templates/antigravity/exec-defaults-snippet.yaml +38 -0
- package/templates/antigravity/orchestrator.md +146 -0
- package/templates/antigravity/pm-members-snippet.yaml +55 -0
- package/templates/claude/README.md +46 -0
- package/templates/claude/agents/claude-expert-review-executor.md +14 -0
- package/templates/claude/agents/claude-review-executor.md +14 -0
- package/templates/claude/agents/specdojo-orchestrator.md +153 -0
- package/templates/claude/settings.edit.json +6 -0
- package/templates/claude/settings.report.json +6 -0
- package/templates/claude/settings.review.json +7 -0
- package/templates/codex/README.md +61 -0
- package/templates/codex/agents/codex-executor.toml +12 -0
- package/templates/codex/agents/codex-expert-executor.toml +12 -0
- package/templates/codex/agents/codex-expert-review-executor.toml +10 -0
- package/templates/codex/agents/codex-review-executor.toml +10 -0
- package/templates/codex/agents/specdojo-orchestrator.toml +154 -0
- package/templates/codex/orchestrator.md +146 -0
- package/templates/copilot/README.md +41 -0
- package/templates/copilot/exec-defaults-snippet.yaml +28 -0
- package/templates/copilot/pm-members-snippet.yaml +44 -0
- package/templates/opencode/README.md +41 -0
- package/templates/opencode/agents/opencode-executor.md +59 -0
- package/templates/opencode/agents/opencode-reporter.md +26 -0
- package/templates/opencode/agents/opencode-review-executor.md +48 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +193 -0
- package/dist/exec-schedule-timeline-render.js +0 -201
- package/dist/exec-schedule-timeline.js +0 -2
|
@@ -0,0 +1,990 @@
|
|
|
1
|
+
import { mkdirSync, existsSync, readFileSync, writeFileSync, readdirSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import yaml from "js-yaml";
|
|
4
|
+
import { defaultScheduleCalendar, buildScheduleIndex } from "./exec-schedule-index.js";
|
|
5
|
+
import { addWorkingDaysToDate } from "./exec-schedule-calendar.js";
|
|
6
|
+
import { readJson, stripTerminalControlSequences, toArtifactPath } from "./exec-shared.js";
|
|
7
|
+
import { readAllEventFiles } from "./exec-events.js";
|
|
8
|
+
import { getProjectExecutionPath, getProjectRoutinesPath, getProjectSchedulePath, getProjectTimelinePath, loadConfig, loadEnv, specdojoRootDir, } from "./specdojo-config.js";
|
|
9
|
+
import { resolveRegisterPaths, loadRegisterItems, } from "./register.js";
|
|
10
|
+
import { readRegisterEventsFromContent, registerEventFilePath, } from "./register-events.js";
|
|
11
|
+
import { buildTimelineWaves, loadTimelineIndex, } from "./timeline-build.js";
|
|
12
|
+
// routine の due 判定は機械可読な正本(interval / trigger + last_scheduled_for / last_run)から同じ
|
|
13
|
+
// 関数で算出する。CLI 出力の転記ではなく、routine.ts の実装へ流用して文言解析に依存しない。
|
|
14
|
+
import { cronMatches, cronOccurrences, isRoutineDue, routineActionKindLabel, } from "./routine.js";
|
|
15
|
+
import { gradeFindingCount, parseGradeResult } from "./grade-result.js";
|
|
16
|
+
// ================================
|
|
17
|
+
// Types
|
|
18
|
+
// ================================
|
|
19
|
+
function generatedBanner(command) {
|
|
20
|
+
return `> このページは \`${command}\` が生成した派生ビューです。正本は Schedule / Timeline(tml-index.yaml)/ 登録簿個票・event / exec event / routine(rtn-*.yaml・generated/routine-state.json・generated/routine-runs.jsonl)の機械可読な成果物であり、このページを手編集しても次回のビルドで失われます。`;
|
|
21
|
+
}
|
|
22
|
+
// ================================
|
|
23
|
+
// Path resolution
|
|
24
|
+
// ================================
|
|
25
|
+
function resolveProjectConfig(opts) {
|
|
26
|
+
loadEnv();
|
|
27
|
+
const { config, configPath } = loadConfig();
|
|
28
|
+
const resolvedId = opts.project?.trim() ||
|
|
29
|
+
process.env.SPECDOJO_PROJECT?.trim() ||
|
|
30
|
+
(config ? Object.keys(config.projects)[0] : "");
|
|
31
|
+
if (!config) {
|
|
32
|
+
throw new Error(`dashboard commands require specdojo.config.json.\nRun: specdojo config init`);
|
|
33
|
+
}
|
|
34
|
+
if (!resolvedId) {
|
|
35
|
+
throw new Error("No project specified. Use --project <id> or SPECDOJO_PROJECT.");
|
|
36
|
+
}
|
|
37
|
+
const project = config.projects[resolvedId];
|
|
38
|
+
if (!project) {
|
|
39
|
+
throw new Error(`Unknown project: ${resolvedId} (check ${configPath})`);
|
|
40
|
+
}
|
|
41
|
+
return { projectId: resolvedId, project };
|
|
42
|
+
}
|
|
43
|
+
export function resolveDashboardPaths(opts) {
|
|
44
|
+
const { projectId, project } = resolveProjectConfig(opts);
|
|
45
|
+
const baseDir = specdojoRootDir();
|
|
46
|
+
return {
|
|
47
|
+
projectId,
|
|
48
|
+
projectPath: join(baseDir, getProjectTimelinePath(project), ".."),
|
|
49
|
+
schedulePath: join(baseDir, getProjectSchedulePath(project)),
|
|
50
|
+
executionGeneratedPath: join(join(baseDir, getProjectExecutionPath(project)), "generated"),
|
|
51
|
+
timelinePath: join(baseDir, getProjectTimelinePath(project)),
|
|
52
|
+
routinesPath: (() => {
|
|
53
|
+
const p = getProjectRoutinesPath(project);
|
|
54
|
+
return p ? join(baseDir, p) : undefined;
|
|
55
|
+
})(),
|
|
56
|
+
gradeResultsPath: join(baseDir, getProjectExecutionPath(project), "grade", "results"),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// tml-index の tracks を order → wave に集約し、planned_start_date と稼働日カレンダーで各トラックの
|
|
60
|
+
// 予定開始日・終了日を算出する。横軸は日付であり、wave 番号ではない。
|
|
61
|
+
export function computeTimelineTrackSchedules(index, calendar) {
|
|
62
|
+
const waves = buildTimelineWaves(index.tracks);
|
|
63
|
+
const waveNumberByOrder = new Map();
|
|
64
|
+
for (const wave of waves) {
|
|
65
|
+
for (const tk of wave.tracks)
|
|
66
|
+
waveNumberByOrder.set(tk.order, wave.wave);
|
|
67
|
+
}
|
|
68
|
+
const startByTrack = new Map();
|
|
69
|
+
const endByTrack = new Map();
|
|
70
|
+
let cursor = index.planned_start_date;
|
|
71
|
+
for (const wave of waves) {
|
|
72
|
+
const waveStart = cursor;
|
|
73
|
+
let waveEnd;
|
|
74
|
+
for (const tk of wave.tracks) {
|
|
75
|
+
startByTrack.set(tk.track, waveStart);
|
|
76
|
+
if (tk.catalog_duration_estimate_days && waveStart) {
|
|
77
|
+
const end = addWorkingDaysToDate(waveStart, tk.catalog_duration_estimate_days, calendar);
|
|
78
|
+
endByTrack.set(tk.track, end);
|
|
79
|
+
if (!waveEnd || end > waveEnd)
|
|
80
|
+
waveEnd = end;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
endByTrack.set(tk.track, undefined);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// 次 wave の手始め。本 wave に推定日数のあるトラックがあれば最遅完了日の翌稼働日で、
|
|
87
|
+
// 未定のトラックだけなら直前の手始め日をそのまま受け継ぐ(後続波まで日付が伝播する)。
|
|
88
|
+
cursor = waveEnd ? addWorkingDaysToDate(waveEnd, 1, calendar) : cursor;
|
|
89
|
+
}
|
|
90
|
+
const schedule = index.tracks.map((tk) => ({
|
|
91
|
+
track: tk.track,
|
|
92
|
+
order: tk.order,
|
|
93
|
+
domains: tk.domains,
|
|
94
|
+
status: tk.catalog_status,
|
|
95
|
+
estimateDays: tk.catalog_duration_estimate_days,
|
|
96
|
+
parallel_group: tk.parallel_group,
|
|
97
|
+
depends_on: tk.depends_on,
|
|
98
|
+
startDate: startByTrack.get(tk.track),
|
|
99
|
+
endDate: endByTrack.get(tk.track),
|
|
100
|
+
wave: waveNumberByOrder.get(tk.order) ?? 0,
|
|
101
|
+
}));
|
|
102
|
+
return { schedule, plannedStartDate: index.planned_start_date };
|
|
103
|
+
}
|
|
104
|
+
// 稼働日カレンダーの機械可読正本:tml-index.planned_start_date を起点にし、Schedule 側
|
|
105
|
+
// (sch-defaults.yaml と各 sch-*.yaml)の calendar を buildScheduleIndex から復用する。
|
|
106
|
+
// 両方とも YAML 正本から機械的に読み取り、表示文言の解析に依存しない。
|
|
107
|
+
export function resolveDashboardCalendar(schedulePath) {
|
|
108
|
+
try {
|
|
109
|
+
return buildScheduleIndex(schedulePath).calendar;
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return defaultScheduleCalendar();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// ================================
|
|
116
|
+
// Timeline Gantt SVG (x-axis = date)
|
|
117
|
+
// ================================
|
|
118
|
+
function xmlEscape(text) {
|
|
119
|
+
return text
|
|
120
|
+
.replace(/&/g, "&")
|
|
121
|
+
.replace(/</g, "<")
|
|
122
|
+
.replace(/>/g, ">")
|
|
123
|
+
.replace(/"/g, """);
|
|
124
|
+
}
|
|
125
|
+
function statusColor(status) {
|
|
126
|
+
if (status === "primary")
|
|
127
|
+
return "#16a34a";
|
|
128
|
+
if (status === "draft")
|
|
129
|
+
return "#2563eb";
|
|
130
|
+
return "#d1d5db";
|
|
131
|
+
}
|
|
132
|
+
// 予定日付の無いトラックはバーを持たずラベルのみ表示する(手始め日 or 推定稼働日が未設定)。
|
|
133
|
+
export function buildTimelineGanttSvg(schedule, plannedStartDate, title = "トラック計画ガントチャート") {
|
|
134
|
+
const dayWidth = 30;
|
|
135
|
+
const rowHeight = 26;
|
|
136
|
+
const leftPad = 240;
|
|
137
|
+
const topPad = 56;
|
|
138
|
+
const bottomPad = 20;
|
|
139
|
+
// バーは startDate かつ endDate 両方を持つトラックへ。開始日のみのトラックは着手順の着手点として
|
|
140
|
+
// 四角(diamond)で表示する。軸の範囲は endDate が無いトラックも startDate を含めて算出する。
|
|
141
|
+
const fullRows = schedule.filter((row) => row.startDate);
|
|
142
|
+
if (fullRows.length === 0 || !plannedStartDate) {
|
|
143
|
+
return noDataTimelineSvg(title, plannedStartDate
|
|
144
|
+
? "トラックの予定開始日・終了日を算出できませんでした。"
|
|
145
|
+
: "計画開始日(tml-index.yaml の planned_start_date)が未設定です。");
|
|
146
|
+
}
|
|
147
|
+
const parseMs = (dateOnly) => {
|
|
148
|
+
const [year, month, day] = dateOnly.split("-").map(Number);
|
|
149
|
+
return Date.UTC(year, month - 1, day, 0, 0, 0, 0);
|
|
150
|
+
};
|
|
151
|
+
const startMs = parseMs(plannedStartDate);
|
|
152
|
+
let endMs = startMs;
|
|
153
|
+
for (const row of fullRows) {
|
|
154
|
+
const last = row.endDate ?? row.startDate;
|
|
155
|
+
if (parseMs(last) > endMs)
|
|
156
|
+
endMs = parseMs(last);
|
|
157
|
+
}
|
|
158
|
+
const totalDays = Math.max(1, Math.ceil((endMs - startMs) / 86_400_000) + 1);
|
|
159
|
+
const width = leftPad + totalDays * dayWidth + 24;
|
|
160
|
+
const height = topPad + schedule.length * rowHeight + bottomPad;
|
|
161
|
+
const xForDate = (dateOnly) => {
|
|
162
|
+
const daysDiff = Math.floor((parseMs(dateOnly) - startMs) / 86_400_000);
|
|
163
|
+
return leftPad + daysDiff * dayWidth;
|
|
164
|
+
};
|
|
165
|
+
const parts = [];
|
|
166
|
+
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)}">`);
|
|
167
|
+
parts.push(`<style>
|
|
168
|
+
text { font-family: ui-sans-serif, system-ui, -apple-system, sans-serif; fill: #1f2937; }
|
|
169
|
+
.tl-title { font-size: 16px; font-weight: 700; fill: #0f172a; }
|
|
170
|
+
.tl-caption { font-size: 11px; fill: #64748b; }
|
|
171
|
+
.tl-label { font-size: 11px; font-weight: 600; fill: #1f2937; }
|
|
172
|
+
.tl-axis { font-size: 10px; fill: #475569; }
|
|
173
|
+
.tl-grid { stroke: #e2e8f0; stroke-width: 1; }
|
|
174
|
+
.tl-month-grid { stroke: #94a3b8; stroke-width: 1.5; }
|
|
175
|
+
.tl-note { font-size: 10px; fill: #9ca3af; }
|
|
176
|
+
</style>`);
|
|
177
|
+
parts.push(`<rect x="0" y="0" width="${width}" height="${height}" fill="#fffdf8" />`);
|
|
178
|
+
parts.push(`<text class="tl-title" x="16" y="24">${xmlEscape(title)}</text>`);
|
|
179
|
+
parts.push(`<text class="tl-caption" x="16" y="42">横軸は日付。予定開始日・予定終了日は tml-index.yaml の planned_start_date と catalog_duration_estimate_days(推定稼働日数)から算出。</text>`);
|
|
180
|
+
for (let offset = 0; offset < totalDays; offset++) {
|
|
181
|
+
const dayMs = startMs + offset * 86_400_000;
|
|
182
|
+
if (new Date(dayMs).getUTCDate() !== 1)
|
|
183
|
+
continue;
|
|
184
|
+
const x = leftPad + offset * dayWidth;
|
|
185
|
+
parts.push(`<line class="tl-month-grid" x1="${x}" y1="${topPad - 22}" x2="${x}" y2="${height - bottomPad}" />`);
|
|
186
|
+
parts.push(`<text class="tl-axis" x="${x + 4}" y="${topPad - 8}">${xmlEscape(new Date(dayMs).toISOString().slice(0, 7))}</text>`);
|
|
187
|
+
}
|
|
188
|
+
parts.push(`<line class="tl-grid" x1="${leftPad}" y1="${topPad - 22}" x2="${leftPad}" y2="${height - bottomPad}" />`);
|
|
189
|
+
let currentY = topPad;
|
|
190
|
+
for (const row of schedule) {
|
|
191
|
+
parts.push(`<text class="tl-label" x="8" y="${currentY + 14}">${xmlEscape(row.track)}</text>`);
|
|
192
|
+
if (row.startDate && row.endDate) {
|
|
193
|
+
const x1 = xForDate(row.startDate);
|
|
194
|
+
const x2 = xForDate(row.endDate);
|
|
195
|
+
const barWidth = Math.max(4, x2 - x1);
|
|
196
|
+
parts.push(`<rect x="${x1}" y="${currentY + 6}" width="${barWidth}" height="12" rx="3" fill="${statusColor(row.status)}" opacity="0.9" />`);
|
|
197
|
+
}
|
|
198
|
+
else if (row.startDate) {
|
|
199
|
+
// 開始日のみ(推定稼働日数未定): 着手点の diamond マーカーで表示。
|
|
200
|
+
const cx = xForDate(row.startDate);
|
|
201
|
+
parts.push(`<polygon points="${cx},${currentY + 2} ${cx + 6},${currentY + 8} ${cx},${currentY + 14} ${cx - 6},${currentY + 8}" fill="${statusColor(row.status)}" opacity="0.85" />`);
|
|
202
|
+
parts.push(`<text class="tl-note" x="${xForDate(row.startDate) + 8}" y="${currentY + 14}">${xmlEscape(datePlanNote(row))}</text>`);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
parts.push(`<text class="tl-note" x="${leftPad + 4}" y="${currentY + 14}">${xmlEscape(datePlanNote(row))}</text>`);
|
|
206
|
+
}
|
|
207
|
+
parts.push(`<line class="tl-grid" x1="0" y1="${currentY + rowHeight}" x2="${width}" y2="${currentY + rowHeight}" />`);
|
|
208
|
+
currentY += rowHeight;
|
|
209
|
+
}
|
|
210
|
+
parts.push(`</svg>`);
|
|
211
|
+
return parts.join("\n");
|
|
212
|
+
}
|
|
213
|
+
function datePlanNote(row) {
|
|
214
|
+
if (!row.startDate)
|
|
215
|
+
return "手始め日未定";
|
|
216
|
+
if (row.endDate === undefined || !row.estimateDays)
|
|
217
|
+
return `着手順 ${row.order}(推定稼働日数未定)`;
|
|
218
|
+
return `${row.startDate} ~ ${row.endDate}`;
|
|
219
|
+
}
|
|
220
|
+
function noDataTimelineSvg(title, message) {
|
|
221
|
+
const width = 560;
|
|
222
|
+
const height = 120;
|
|
223
|
+
return [
|
|
224
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" role="img" aria-label="${xmlEscape(title)}">`,
|
|
225
|
+
`<rect x="0" y="0" width="${width}" height="${height}" fill="#fffdf8" />`,
|
|
226
|
+
`<text class="tl-title" x="16" y="24">${xmlEscape(title)}</text>`,
|
|
227
|
+
`<text x="16" y="72" font-size="13" fill="#64748b">${xmlEscape(message)}</text>`,
|
|
228
|
+
`</svg>`,
|
|
229
|
+
].join("\n");
|
|
230
|
+
}
|
|
231
|
+
function aggregateRegister(projectId) {
|
|
232
|
+
const result = {
|
|
233
|
+
statusCounts: {},
|
|
234
|
+
priorityCounts: {},
|
|
235
|
+
total: 0,
|
|
236
|
+
};
|
|
237
|
+
try {
|
|
238
|
+
const paths = resolveRegisterPaths({ project: projectId });
|
|
239
|
+
const items = loadRegisterItems(paths);
|
|
240
|
+
for (const view of items) {
|
|
241
|
+
const item = view.item;
|
|
242
|
+
result.statusCounts[item.status] = (result.statusCounts[item.status] ?? 0) + 1;
|
|
243
|
+
result.priorityCounts[item.priority] = (result.priorityCounts[item.priority] ?? 0) + 1;
|
|
244
|
+
}
|
|
245
|
+
result.total = items.length;
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
result.error = error instanceof Error ? error.message : String(error);
|
|
249
|
+
}
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
252
|
+
const EXECUTABLE_REGISTER_TYPES = new Set(["todo", "issue", "change-request", "question", "risk"]);
|
|
253
|
+
const PRIORITY_RANK = { high: 0, medium: 1, low: 2 };
|
|
254
|
+
function dateOnlyMs(value) {
|
|
255
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value))
|
|
256
|
+
return undefined;
|
|
257
|
+
const time = Date.parse(`${value}T00:00:00Z`);
|
|
258
|
+
return Number.isNaN(time) ? undefined : time;
|
|
259
|
+
}
|
|
260
|
+
export function rankRegisterCandidates(candidates, today) {
|
|
261
|
+
const todayMs = dateOnlyMs(today) ?? 0;
|
|
262
|
+
const dueRank = (item) => dateOnlyMs(item.due) ?? Infinity;
|
|
263
|
+
const registeredRank = (item) => Date.parse(item.registeredAt) || Infinity;
|
|
264
|
+
return [...candidates].sort((a, b) => {
|
|
265
|
+
const aDue = dueRank(a);
|
|
266
|
+
const bDue = dueRank(b);
|
|
267
|
+
const aOverdue = aDue < todayMs ? 0 : 1;
|
|
268
|
+
const bOverdue = bDue < todayMs ? 0 : 1;
|
|
269
|
+
return (aOverdue - bOverdue ||
|
|
270
|
+
aDue - bDue ||
|
|
271
|
+
(PRIORITY_RANK[a.priority] ?? 99) - (PRIORITY_RANK[b.priority] ?? 99) ||
|
|
272
|
+
Number(a.relatedOpenPjrCount > 0) - Number(b.relatedOpenPjrCount > 0) ||
|
|
273
|
+
registeredRank(a) - registeredRank(b) ||
|
|
274
|
+
a.id.localeCompare(b.id));
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
function pjrLinks(content) {
|
|
278
|
+
return [
|
|
279
|
+
...content.matchAll(/\[\[[^\]\n|]*:pjr-([0-9a-z]{4})(?:-[^\]\n|]*)?(?:\|[^\]\n]*)?\]\]/gi),
|
|
280
|
+
].map((match) => `PJR-${match[1].toUpperCase()}`);
|
|
281
|
+
}
|
|
282
|
+
function buildRegisterCandidates(paths) {
|
|
283
|
+
const views = loadRegisterItems(paths);
|
|
284
|
+
const openIds = new Set(views.filter((view) => view.item.status === "open").map((view) => view.id));
|
|
285
|
+
return views
|
|
286
|
+
.filter((view) => view.item.status === "open" && EXECUTABLE_REGISTER_TYPES.has(view.item.type))
|
|
287
|
+
.map((view) => {
|
|
288
|
+
const links = view.ticketPath
|
|
289
|
+
? pjrLinks(readFileSync(view.ticketPath, "utf8")).filter((id) => id !== view.id && openIds.has(id))
|
|
290
|
+
: [];
|
|
291
|
+
return {
|
|
292
|
+
id: view.id,
|
|
293
|
+
title: view.item.title,
|
|
294
|
+
type: view.item.type,
|
|
295
|
+
priority: view.item.priority,
|
|
296
|
+
due: view.item.due,
|
|
297
|
+
registeredAt: view.item.registeredAt,
|
|
298
|
+
relatedOpenPjrCount: new Set(links).size,
|
|
299
|
+
};
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
export function latestRegisterWaitReason(events) {
|
|
303
|
+
return [...events].reverse().find((event) => event.action === "wait")?.reason;
|
|
304
|
+
}
|
|
305
|
+
export function latestExecBlockReasons(blockedIds, events) {
|
|
306
|
+
const blocked = new Set(blockedIds);
|
|
307
|
+
const reasons = new Map();
|
|
308
|
+
for (const event of events) {
|
|
309
|
+
if (blocked.has(event.task_id) && event.type === "block")
|
|
310
|
+
reasons.set(event.task_id, event.msg);
|
|
311
|
+
}
|
|
312
|
+
return reasons;
|
|
313
|
+
}
|
|
314
|
+
function readRegisterEvents(view, registerPath) {
|
|
315
|
+
const path = registerEventFilePath(registerPath, view.id);
|
|
316
|
+
if (!existsSync(path))
|
|
317
|
+
return [];
|
|
318
|
+
return readRegisterEventsFromContent(readFileSync(path, "utf8"), path);
|
|
319
|
+
}
|
|
320
|
+
function aggregateAttention(paths) {
|
|
321
|
+
const rows = [];
|
|
322
|
+
const registerPaths = resolveRegisterPaths({ project: paths.projectId });
|
|
323
|
+
const views = loadRegisterItems(registerPaths);
|
|
324
|
+
for (const view of views.filter((item) => item.item.status === "waiting")) {
|
|
325
|
+
rows.push({
|
|
326
|
+
source: "register",
|
|
327
|
+
id: view.id,
|
|
328
|
+
reason: latestRegisterWaitReason(readRegisterEvents(view, registerPaths.projectRegisterPath)) ??
|
|
329
|
+
"-",
|
|
330
|
+
nextAction: `待機理由を解消し \`specdojo register start --project ${paths.projectId} --id ${view.id}\``,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
if (!paths.schedulePath)
|
|
334
|
+
return rows;
|
|
335
|
+
const statePath = join(paths.executionGeneratedPath, "state.json");
|
|
336
|
+
if (!existsSync(statePath))
|
|
337
|
+
return rows;
|
|
338
|
+
const state = readJson(statePath);
|
|
339
|
+
const blockedIds = Object.entries(state.tasks)
|
|
340
|
+
.filter(([, task]) => task.state === "blocked")
|
|
341
|
+
.map(([id]) => id);
|
|
342
|
+
const reasons = latestExecBlockReasons(blockedIds, readAllEventFiles(paths.schedulePath).map(({ event }) => event));
|
|
343
|
+
for (const id of blockedIds.sort()) {
|
|
344
|
+
rows.push({
|
|
345
|
+
source: "exec",
|
|
346
|
+
id,
|
|
347
|
+
reason: reasons.get(id) ?? state.tasks[id].last_msg ?? "-",
|
|
348
|
+
nextAction: `原因を解消し \`specdojo exec unblock --project ${paths.projectId} --task ${id} --by <actor> --msg <reason>\``,
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
return rows;
|
|
352
|
+
}
|
|
353
|
+
// routine ファイル(rtn-*.yaml)を読み、状態ファイル generated/routine-state.json と突き合わせて
|
|
354
|
+
// 最終実行・実行結果・due 状況を得る。CLI 出力(routine list)の転記に依存しない。
|
|
355
|
+
function aggregateRoutines(routinesPath) {
|
|
356
|
+
if (!routinesPath || !existsSync(routinesPath))
|
|
357
|
+
return { rows: [], docs: [], history: [] };
|
|
358
|
+
const result = {
|
|
359
|
+
rows: [],
|
|
360
|
+
docs: [],
|
|
361
|
+
history: readRoutineRunHistory(join(routinesPath, "generated", "routine-runs.jsonl")),
|
|
362
|
+
error: undefined,
|
|
363
|
+
};
|
|
364
|
+
const stateEntries = readRoutineStateEntries(join(routinesPath, "generated", "routine-state.json"));
|
|
365
|
+
const now = new Date();
|
|
366
|
+
const files = readdirSync(routinesPath)
|
|
367
|
+
.filter((name) => /^rtn-.*\.(ya?ml)$/.test(name))
|
|
368
|
+
.sort();
|
|
369
|
+
for (const file of files) {
|
|
370
|
+
try {
|
|
371
|
+
const doc = parseRoutineFileSafe(join(routinesPath, file));
|
|
372
|
+
if (!doc?.id || typeof doc.id !== "string")
|
|
373
|
+
continue;
|
|
374
|
+
result.docs.push(doc);
|
|
375
|
+
buildRoutineRow(result, doc, stateEntries, now);
|
|
376
|
+
}
|
|
377
|
+
catch {
|
|
378
|
+
result.error = `routine file parse failed: ${file}`;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
result.rows.sort((a, b) => a.id.localeCompare(b.id));
|
|
382
|
+
return result;
|
|
383
|
+
}
|
|
384
|
+
export function readRoutineRunHistory(historyPath) {
|
|
385
|
+
if (!existsSync(historyPath))
|
|
386
|
+
return [];
|
|
387
|
+
const entries = [];
|
|
388
|
+
for (const [index, line] of readFileSync(historyPath, "utf8").split(/\r?\n/).entries()) {
|
|
389
|
+
if (!line.trim())
|
|
390
|
+
continue;
|
|
391
|
+
try {
|
|
392
|
+
const value = JSON.parse(line);
|
|
393
|
+
if (value.version === 1 &&
|
|
394
|
+
typeof value.routine_id === "string" &&
|
|
395
|
+
typeof value.scheduled_for === "string" &&
|
|
396
|
+
typeof value.started_at === "string" &&
|
|
397
|
+
typeof value.completed_at === "string" &&
|
|
398
|
+
["success", "failure", "skipped"].includes(value.result) &&
|
|
399
|
+
Array.isArray(value.job_run_ids)) {
|
|
400
|
+
entries.push(value);
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
throw new Error("invalid routine history entry");
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
catch {
|
|
407
|
+
throw new Error(`routine history parse failed at line ${index + 1}`);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return entries;
|
|
411
|
+
}
|
|
412
|
+
// 毎時の dashboard 更新のように 1 日に何度も動く routine は、日ごとに 1 行へまとめる。
|
|
413
|
+
const ROUTINE_ROW_COLLAPSE_THRESHOLD = 3;
|
|
414
|
+
export function formatZonedDateTime(iso, timeZone) {
|
|
415
|
+
const date = new Date(iso);
|
|
416
|
+
if (Number.isNaN(date.getTime()))
|
|
417
|
+
return iso;
|
|
418
|
+
const parts = new Intl.DateTimeFormat("en-CA", {
|
|
419
|
+
timeZone,
|
|
420
|
+
month: "2-digit",
|
|
421
|
+
day: "2-digit",
|
|
422
|
+
hour: "2-digit",
|
|
423
|
+
minute: "2-digit",
|
|
424
|
+
hour12: false,
|
|
425
|
+
}).formatToParts(date);
|
|
426
|
+
const get = (type) => parts.find((part) => part.type === type)?.value ?? "";
|
|
427
|
+
return `${get("month")}-${get("day")} ${get("hour")}:${get("minute")}`;
|
|
428
|
+
}
|
|
429
|
+
function zonedDateKey(date, timeZone) {
|
|
430
|
+
return new Intl.DateTimeFormat("en-CA", {
|
|
431
|
+
timeZone,
|
|
432
|
+
year: "numeric",
|
|
433
|
+
month: "2-digit",
|
|
434
|
+
day: "2-digit",
|
|
435
|
+
}).format(date);
|
|
436
|
+
}
|
|
437
|
+
function previousDateKey(dateKey) {
|
|
438
|
+
const [year, month, day] = dateKey.split("-").map(Number);
|
|
439
|
+
const previous = new Date(Date.UTC(year, month - 1, day - 1));
|
|
440
|
+
return previous.toISOString().slice(0, 10);
|
|
441
|
+
}
|
|
442
|
+
function scheduledToday(doc, today, now, timeZone) {
|
|
443
|
+
if (!doc.trigger || doc.enabled === false)
|
|
444
|
+
return [];
|
|
445
|
+
const start = Math.floor((now.getTime() - 36 * 60 * 60 * 1000) / 60_000) * 60_000;
|
|
446
|
+
const end = Math.floor((now.getTime() + 36 * 60 * 60 * 1000) / 60_000) * 60_000;
|
|
447
|
+
const matches = [];
|
|
448
|
+
for (let cursor = start; cursor <= end; cursor += 60_000) {
|
|
449
|
+
const candidate = new Date(cursor);
|
|
450
|
+
if (zonedDateKey(candidate, timeZone) === today &&
|
|
451
|
+
cronMatches(doc.trigger.cron, doc.trigger.timezone, candidate)) {
|
|
452
|
+
matches.push(candidate);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
return matches;
|
|
456
|
+
}
|
|
457
|
+
export function buildDailyRoutineRows(docs, history, now, timeZone = "Asia/Tokyo") {
|
|
458
|
+
const today = zonedDateKey(now, timeZone);
|
|
459
|
+
const yesterday = previousDateKey(today);
|
|
460
|
+
const rows = history
|
|
461
|
+
.filter((entry) => {
|
|
462
|
+
const key = zonedDateKey(new Date(entry.scheduled_for), timeZone);
|
|
463
|
+
return key === yesterday || key === today;
|
|
464
|
+
})
|
|
465
|
+
.map((entry) => ({
|
|
466
|
+
day: zonedDateKey(new Date(entry.scheduled_for), timeZone) === yesterday ? "昨日" : "本日",
|
|
467
|
+
routineId: entry.routine_id,
|
|
468
|
+
scheduledFor: entry.scheduled_for,
|
|
469
|
+
startedAt: entry.started_at,
|
|
470
|
+
completedAt: entry.completed_at,
|
|
471
|
+
result: entry.result,
|
|
472
|
+
jobRunIds: entry.job_run_ids,
|
|
473
|
+
runCount: 1,
|
|
474
|
+
}));
|
|
475
|
+
const completedKeys = new Set(history.map((entry) => `${entry.routine_id}:${new Date(entry.scheduled_for).toISOString().slice(0, 16)}`));
|
|
476
|
+
for (const doc of docs) {
|
|
477
|
+
for (const scheduledFor of scheduledToday(doc, today, now, timeZone)) {
|
|
478
|
+
const key = `${doc.id}:${scheduledFor.toISOString().slice(0, 16)}`;
|
|
479
|
+
if (completedKeys.has(key))
|
|
480
|
+
continue;
|
|
481
|
+
rows.push({
|
|
482
|
+
day: "本日",
|
|
483
|
+
routineId: doc.id,
|
|
484
|
+
scheduledFor: scheduledFor.toISOString(),
|
|
485
|
+
startedAt: "-",
|
|
486
|
+
completedAt: "-",
|
|
487
|
+
// 予定時刻を過ぎても履歴がなければ、skip や cron 停止で動かなかったことを示す。
|
|
488
|
+
result: scheduledFor.getTime() <= now.getTime() ? "未実行" : "予定",
|
|
489
|
+
jobRunIds: [],
|
|
490
|
+
runCount: 1,
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return collapseFrequentRoutineRows(rows).sort((a, b) => a.scheduledFor.localeCompare(b.scheduledFor) || a.routineId.localeCompare(b.routineId));
|
|
495
|
+
}
|
|
496
|
+
// 同じ routine・同じ日の行が閾値以上あれば、最新の実行 1 行に件数をまとめる。
|
|
497
|
+
export function collapseFrequentRoutineRows(rows) {
|
|
498
|
+
const groups = new Map();
|
|
499
|
+
for (const row of rows) {
|
|
500
|
+
const key = `${row.day}:${row.routineId}`;
|
|
501
|
+
groups.set(key, [...(groups.get(key) ?? []), row]);
|
|
502
|
+
}
|
|
503
|
+
const collapsed = [];
|
|
504
|
+
for (const group of groups.values()) {
|
|
505
|
+
if (group.length < ROUTINE_ROW_COLLAPSE_THRESHOLD) {
|
|
506
|
+
collapsed.push(...group);
|
|
507
|
+
continue;
|
|
508
|
+
}
|
|
509
|
+
const executed = group.filter((row) => row.result !== "予定" && row.result !== "未実行");
|
|
510
|
+
const latest = [...(executed.length > 0 ? executed : group)].sort((a, b) => b.scheduledFor.localeCompare(a.scheduledFor))[0];
|
|
511
|
+
const failures = executed.filter((row) => row.result === "failure").length;
|
|
512
|
+
collapsed.push({
|
|
513
|
+
...latest,
|
|
514
|
+
runCount: executed.length > 0 ? executed.length : group.length,
|
|
515
|
+
jobRunIds: [],
|
|
516
|
+
result: failures > 0 ? "failure" : latest.result,
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
return collapsed;
|
|
520
|
+
}
|
|
521
|
+
// generated/routine-state.json の routines.<id> が状態の正本。破損時は空。
|
|
522
|
+
function readRoutineStateEntries(statePath) {
|
|
523
|
+
const entries = {};
|
|
524
|
+
if (!existsSync(statePath))
|
|
525
|
+
return entries;
|
|
526
|
+
try {
|
|
527
|
+
const parsed = readJson(statePath);
|
|
528
|
+
const routines = parsed?.routines;
|
|
529
|
+
if (routines && typeof routines === "object") {
|
|
530
|
+
for (const [id, value] of Object.entries(routines)) {
|
|
531
|
+
if (value && typeof value === "object") {
|
|
532
|
+
const entry = value;
|
|
533
|
+
entries[id] = {
|
|
534
|
+
last_run: typeof entry.last_run === "string" ? entry.last_run : undefined,
|
|
535
|
+
last_result: typeof entry.last_result === "string" ? entry.last_result : undefined,
|
|
536
|
+
last_scheduled_for: typeof entry.last_scheduled_for === "string" ? entry.last_scheduled_for : undefined,
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
catch {
|
|
543
|
+
return {};
|
|
544
|
+
}
|
|
545
|
+
return entries;
|
|
546
|
+
}
|
|
547
|
+
function parseRoutineFileSafe(filePath) {
|
|
548
|
+
let parsed;
|
|
549
|
+
try {
|
|
550
|
+
parsed = yaml.load(readFileSync(filePath, "utf8"));
|
|
551
|
+
}
|
|
552
|
+
catch {
|
|
553
|
+
return undefined;
|
|
554
|
+
}
|
|
555
|
+
if (!parsed || typeof parsed !== "object")
|
|
556
|
+
return undefined;
|
|
557
|
+
return parsed;
|
|
558
|
+
}
|
|
559
|
+
// routine 1 行を機械可読な正本から集計し、due は now と状態から判定する。
|
|
560
|
+
function buildRoutineRow(result, doc, stateEntries, now) {
|
|
561
|
+
const id = String(doc.id);
|
|
562
|
+
const enabled = doc.enabled === undefined ? true : doc.enabled;
|
|
563
|
+
const kind = doc.action ? routineActionKindLabel(doc.action) : "-";
|
|
564
|
+
const stateEntry = stateEntries[id];
|
|
565
|
+
let lastRun = "-";
|
|
566
|
+
if (stateEntry?.last_run) {
|
|
567
|
+
lastRun = stateEntry.last_result
|
|
568
|
+
? `${stateEntry.last_run} (${stateEntry.last_result})`
|
|
569
|
+
: stateEntry.last_run;
|
|
570
|
+
}
|
|
571
|
+
result.rows.push({
|
|
572
|
+
id,
|
|
573
|
+
name: typeof doc.name === "string" ? doc.name : undefined,
|
|
574
|
+
enabled,
|
|
575
|
+
schedule: routineScheduleLabel(doc),
|
|
576
|
+
kind,
|
|
577
|
+
lastRun,
|
|
578
|
+
due: computeRoutineDue(doc, stateEntry, enabled, now),
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
// interval / trigger + 現在時刻 + 状態(last_run / last_scheduled_for)から due を機械的に判定する。
|
|
582
|
+
export function computeRoutineDue(doc, stateEntry, enabled, now) {
|
|
583
|
+
if (!enabled)
|
|
584
|
+
return "disabled";
|
|
585
|
+
if (doc.trigger) {
|
|
586
|
+
const occurrences = cronOccurrences(doc, stateEntry?.last_scheduled_for, now);
|
|
587
|
+
return occurrences.length > 0 ? "due" : "-";
|
|
588
|
+
}
|
|
589
|
+
if (doc.interval) {
|
|
590
|
+
return isRoutineDue(doc, stateEntry?.last_run, now) ? "due" : "-";
|
|
591
|
+
}
|
|
592
|
+
return "-";
|
|
593
|
+
}
|
|
594
|
+
// interval / trigger を表すラベル。interval 優先、なければ trigger.cron。
|
|
595
|
+
function routineScheduleLabel(doc) {
|
|
596
|
+
if (typeof doc.interval === "string")
|
|
597
|
+
return doc.interval;
|
|
598
|
+
const trigger = doc.trigger;
|
|
599
|
+
if (trigger && typeof trigger.cron === "string")
|
|
600
|
+
return `cron: ${trigger.cron}`;
|
|
601
|
+
return "-";
|
|
602
|
+
}
|
|
603
|
+
// ================================
|
|
604
|
+
// Markdown rendering
|
|
605
|
+
// ================================
|
|
606
|
+
const MAX_DASHBOARD_CELL_LENGTH = 200;
|
|
607
|
+
// dashboard の表へは event や subprocess 由来の文字列も入る。表へ埋める直前に
|
|
608
|
+
// ターミナル制御シーケンスと改行類を除き、列区切りをエスケープして長さを制限する。
|
|
609
|
+
export function sanitizeDashboardCell(text) {
|
|
610
|
+
const singleLine = stripTerminalControlSequences(text)
|
|
611
|
+
.replace(/[\t\r\n]+/g, " ")
|
|
612
|
+
.replace(/ +/g, " ")
|
|
613
|
+
.trim();
|
|
614
|
+
const truncated = singleLine.length <= MAX_DASHBOARD_CELL_LENGTH
|
|
615
|
+
? singleLine
|
|
616
|
+
: `${singleLine.slice(0, MAX_DASHBOARD_CELL_LENGTH)}…`;
|
|
617
|
+
return truncated.replace(/\|/g, "\\|");
|
|
618
|
+
}
|
|
619
|
+
const STATUS_ORDER = [
|
|
620
|
+
"open",
|
|
621
|
+
"in-progress",
|
|
622
|
+
"waiting",
|
|
623
|
+
"review",
|
|
624
|
+
"decided",
|
|
625
|
+
"done",
|
|
626
|
+
"deferred",
|
|
627
|
+
"rejected",
|
|
628
|
+
];
|
|
629
|
+
const PRIORITY_ORDER = ["high", "medium", "low"];
|
|
630
|
+
function countTable(keyLabel, counts, order) {
|
|
631
|
+
const orderedKeys = Object.keys(counts)
|
|
632
|
+
.sort((a, b) => {
|
|
633
|
+
const ai = order.indexOf(a);
|
|
634
|
+
const bi = order.indexOf(b);
|
|
635
|
+
const rankA = ai === -1 ? order.length : ai;
|
|
636
|
+
const rankB = bi === -1 ? order.length : bi;
|
|
637
|
+
return rankA !== rankB ? rankA - rankB : a.localeCompare(b);
|
|
638
|
+
})
|
|
639
|
+
.filter((key) => counts[key] > 0);
|
|
640
|
+
if (orderedKeys.length === 0)
|
|
641
|
+
return "(該当項目なし)";
|
|
642
|
+
const lines = [];
|
|
643
|
+
lines.push(`| ${keyLabel} | 件数 |`);
|
|
644
|
+
lines.push("| --- | ---: |");
|
|
645
|
+
for (const key of orderedKeys)
|
|
646
|
+
lines.push(`| \`${key}\` | ${counts[key]} |`);
|
|
647
|
+
return lines.join("\n");
|
|
648
|
+
}
|
|
649
|
+
// ================================
|
|
650
|
+
// Section renderers
|
|
651
|
+
// ================================
|
|
652
|
+
function renderScheduleSection(paths) {
|
|
653
|
+
const lines = ["## 1. Schedule進捗", ""];
|
|
654
|
+
if (!existsSync(paths.executionGeneratedPath)) {
|
|
655
|
+
lines.push("- Schedule はまだ生成されていません(`specdojo exec refresh` を実行してください)。");
|
|
656
|
+
lines.push("");
|
|
657
|
+
return lines;
|
|
658
|
+
}
|
|
659
|
+
try {
|
|
660
|
+
const state = existsSync(join(paths.executionGeneratedPath, "state.json"))
|
|
661
|
+
? readJson(join(paths.executionGeneratedPath, "state.json"))
|
|
662
|
+
: undefined;
|
|
663
|
+
const ready = existsSync(join(paths.executionGeneratedPath, "ready.json"))
|
|
664
|
+
? readJson(join(paths.executionGeneratedPath, "ready.json"))
|
|
665
|
+
: undefined;
|
|
666
|
+
if (state) {
|
|
667
|
+
const counts = {
|
|
668
|
+
todo: 0,
|
|
669
|
+
doing: 0,
|
|
670
|
+
blocked: 0,
|
|
671
|
+
done: 0,
|
|
672
|
+
cancelled: 0,
|
|
673
|
+
};
|
|
674
|
+
for (const taskState of Object.values(state.tasks)) {
|
|
675
|
+
const s = taskState.state;
|
|
676
|
+
if (s in counts)
|
|
677
|
+
counts[s] += 1;
|
|
678
|
+
}
|
|
679
|
+
const total = Object.values(counts).reduce((sum, n) => sum + n, 0);
|
|
680
|
+
const doneEquivalent = counts.done + counts.doing * 0.5;
|
|
681
|
+
const percent = total > 0 ? ((doneEquivalent / total) * 100).toFixed(1) : "0.0";
|
|
682
|
+
lines.push(`- 進捗率(done+doing×0.5): \`${percent}%\``);
|
|
683
|
+
lines.push(`- 状態別: \`todo=${counts.todo}, doing=${counts.doing}, blocked=${counts.blocked}, done=${counts.done}, cancelled=${counts.cancelled}\``);
|
|
684
|
+
lines.push("");
|
|
685
|
+
}
|
|
686
|
+
if (ready && typeof ready === "object") {
|
|
687
|
+
const r = ready;
|
|
688
|
+
lines.push(`- 着手可能タスク(ready): \`${r.ready_count ?? 0}\`件`);
|
|
689
|
+
if (r.strategies?.["critical-first"]?.next_task_id) {
|
|
690
|
+
lines.push(`- 次の着手候補(critical-first): \`${r.strategies["critical-first"].next_task_id}\``);
|
|
691
|
+
}
|
|
692
|
+
lines.push("");
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
catch {
|
|
696
|
+
lines.push("- Schedule の集計に失敗しました(state.json / ready.json が不正)。");
|
|
697
|
+
lines.push("");
|
|
698
|
+
}
|
|
699
|
+
lines.push("- 詳細ガントチャート: [`execution/generated/gantt-chart.md`](./gantt-chart.md)");
|
|
700
|
+
lines.push("");
|
|
701
|
+
lines.push("");
|
|
702
|
+
return lines;
|
|
703
|
+
}
|
|
704
|
+
function renderTimelineSection(paths) {
|
|
705
|
+
const lines = ["## 2. タイムライン(トラック着手順序)", ""];
|
|
706
|
+
const indexPath = join(paths.timelinePath, "tml-index.yaml");
|
|
707
|
+
if (!existsSync(indexPath)) {
|
|
708
|
+
lines.push("- タイムラインデータを読み込めませんでした(tml-index.yaml が存在しません)。");
|
|
709
|
+
lines.push("");
|
|
710
|
+
return lines;
|
|
711
|
+
}
|
|
712
|
+
try {
|
|
713
|
+
const { index } = loadTimelineIndex(indexPath);
|
|
714
|
+
const scheduleReadyTracks = index.tracks
|
|
715
|
+
.filter((t) => t.catalog_status === "primary")
|
|
716
|
+
.map((t) => t.track)
|
|
717
|
+
.sort();
|
|
718
|
+
const waves = buildTimelineWaves(index.tracks);
|
|
719
|
+
const calendar = resolveDashboardCalendar(paths.schedulePath ?? paths.timelinePath);
|
|
720
|
+
const { schedule, plannedStartDate } = computeTimelineTrackSchedules(index, calendar);
|
|
721
|
+
lines.push(`- 計画開始日(planned_start_date): \`${plannedStartDate ?? "-"}\``);
|
|
722
|
+
lines.push(`- wave数: \`${waves.length}\``);
|
|
723
|
+
lines.push(`- Schedule展開準備状況(catalog_status=primary): \`${scheduleReadyTracks.join(", ") || "-"}\``);
|
|
724
|
+
lines.push("");
|
|
725
|
+
lines.push("### Wave・トラック一覧");
|
|
726
|
+
lines.push("");
|
|
727
|
+
lines.push("| wave | track | catalog_status | 推定稼働日数 | 予定開始日 | 予定終了日 | parallel_group | depends_on |");
|
|
728
|
+
lines.push("| ---: | --- | --- | ---: | --- | --- | --- | --- |");
|
|
729
|
+
for (const wave of waves) {
|
|
730
|
+
for (const tk of wave.tracks) {
|
|
731
|
+
const row = schedule.find((s) => s.track === tk.track);
|
|
732
|
+
if (!row)
|
|
733
|
+
continue;
|
|
734
|
+
lines.push(`| ${wave.wave} | \`${tk.track}\` | \`${tk.catalog_status}\` | ${formatEstimate(tk)} | ${row.startDate ?? "-"} | ${row.endDate ?? "-"} | ${sanitizeDashboardCell(row.parallel_group ?? "-")} | ${sanitizeDashboardCell(row.depends_on.join(", ") || "-")} |`);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
lines.push("");
|
|
738
|
+
lines.push("### トラック計画ガントチャート");
|
|
739
|
+
lines.push("");
|
|
740
|
+
lines.push("");
|
|
741
|
+
lines.push("");
|
|
742
|
+
return lines;
|
|
743
|
+
}
|
|
744
|
+
catch (error) {
|
|
745
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
746
|
+
lines.push(`- タイムラインの集計に失敗しました: ${message}`);
|
|
747
|
+
lines.push("");
|
|
748
|
+
return lines;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
function formatEstimate(track) {
|
|
752
|
+
return track.catalog_duration_estimate_days === undefined
|
|
753
|
+
? "-"
|
|
754
|
+
: String(track.catalog_duration_estimate_days);
|
|
755
|
+
}
|
|
756
|
+
function renderRegisterSection(projectId) {
|
|
757
|
+
const agg = aggregateRegister(projectId);
|
|
758
|
+
const lines = ["## 3. 登録簿状況", ""];
|
|
759
|
+
if (agg.error) {
|
|
760
|
+
lines.push(`- 登録簿の集計に失敗しました: ${agg.error}`);
|
|
761
|
+
lines.push("");
|
|
762
|
+
return lines;
|
|
763
|
+
}
|
|
764
|
+
lines.push(`- 総件数: \`${agg.total}\``);
|
|
765
|
+
lines.push("");
|
|
766
|
+
lines.push("### 状態別");
|
|
767
|
+
lines.push("");
|
|
768
|
+
lines.push(countTable("状態", agg.statusCounts, STATUS_ORDER));
|
|
769
|
+
lines.push("");
|
|
770
|
+
lines.push("### 優先度別");
|
|
771
|
+
lines.push("");
|
|
772
|
+
lines.push(countTable("優先度", agg.priorityCounts, PRIORITY_ORDER));
|
|
773
|
+
lines.push("");
|
|
774
|
+
return lines;
|
|
775
|
+
}
|
|
776
|
+
function renderRoutineSection(paths) {
|
|
777
|
+
const agg = aggregateRoutines(paths.routinesPath);
|
|
778
|
+
const lines = ["## 4. routine定義・最終実行", ""];
|
|
779
|
+
if (agg.error)
|
|
780
|
+
lines.push(`- routine 集計に失敗しました: ${agg.error}`);
|
|
781
|
+
if (agg.rows.length === 0) {
|
|
782
|
+
lines.push("- (定義された routine がありません)");
|
|
783
|
+
lines.push("");
|
|
784
|
+
return lines;
|
|
785
|
+
}
|
|
786
|
+
lines.push("| id | name | enabled | 間隔 / cron | kind | 最終実行 / 結果 | due |");
|
|
787
|
+
lines.push("| --- | --- | --- | --- | --- | --- | :---: |");
|
|
788
|
+
for (const row of agg.rows) {
|
|
789
|
+
lines.push(`| \`${row.id}\` | ${sanitizeDashboardCell(row.name ?? "-")} | ${row.enabled ? "enabled" : "disabled"} | \`${sanitizeDashboardCell(row.schedule)}\` | \`${row.kind}\` | ${sanitizeDashboardCell(row.lastRun)} | ${row.due} |`);
|
|
790
|
+
}
|
|
791
|
+
lines.push("");
|
|
792
|
+
return lines;
|
|
793
|
+
}
|
|
794
|
+
function renderDailyRoutineSection(paths) {
|
|
795
|
+
const lines = ["## 5. routine 実行状況(昨日・本日)", ""];
|
|
796
|
+
const agg = aggregateRoutines(paths.routinesPath);
|
|
797
|
+
const rows = buildDailyRoutineRows(agg.docs, agg.history, new Date());
|
|
798
|
+
if (rows.length === 0) {
|
|
799
|
+
lines.push("- (昨日の実行履歴・本日の予定はありません)", "");
|
|
800
|
+
return lines;
|
|
801
|
+
}
|
|
802
|
+
const timeZone = "Asia/Tokyo";
|
|
803
|
+
lines.push(`- 時刻は ${timeZone}。1 日に ${ROUTINE_ROW_COLLAPSE_THRESHOLD} 回以上動く routine は最新の実行 1 行に件数をまとめる。`);
|
|
804
|
+
lines.push("");
|
|
805
|
+
lines.push("| 日 | routine | 予定 | 開始 | 完了 | 結果 | 回数 | Job Run |");
|
|
806
|
+
lines.push("| --- | --- | --- | --- | --- | --- | ---: | --- |");
|
|
807
|
+
for (const row of rows) {
|
|
808
|
+
const fmt = (value) => value === "-" ? "-" : formatZonedDateTime(value, timeZone);
|
|
809
|
+
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(", ") || "-"} |`);
|
|
810
|
+
}
|
|
811
|
+
lines.push("");
|
|
812
|
+
return lines;
|
|
813
|
+
}
|
|
814
|
+
export function readDashboardGradeResults(resultsPath) {
|
|
815
|
+
if (!existsSync(resultsPath))
|
|
816
|
+
return [];
|
|
817
|
+
return readdirSync(resultsPath)
|
|
818
|
+
.filter((name) => name.endsWith(".yaml") || name.endsWith(".yml"))
|
|
819
|
+
.sort()
|
|
820
|
+
.flatMap((name) => {
|
|
821
|
+
const path = join(resultsPath, name);
|
|
822
|
+
try {
|
|
823
|
+
return [parseGradeResult(readFileSync(path, "utf8"), path)];
|
|
824
|
+
}
|
|
825
|
+
catch {
|
|
826
|
+
return [];
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
function renderGradeSection(paths) {
|
|
831
|
+
const lines = ["## 8. Grade", ""];
|
|
832
|
+
const results = paths.gradeResultsPath ? readDashboardGradeResults(paths.gradeResultsPath) : [];
|
|
833
|
+
if (results.length === 0) {
|
|
834
|
+
lines.push("- grade result はまだありません。", "");
|
|
835
|
+
return lines;
|
|
836
|
+
}
|
|
837
|
+
lines.push("| 成果物 | 対象 | verdict | score | findings |", "| --- | --- | --- | ---: | ---: |");
|
|
838
|
+
for (const result of results) {
|
|
839
|
+
lines.push(`| \`${sanitizeDashboardCell(result.document)}\` | \`${result.target}\` | \`${result.verdict}\` | ${result.score} | ${gradeFindingCount(result)} |`);
|
|
840
|
+
}
|
|
841
|
+
lines.push("");
|
|
842
|
+
return lines;
|
|
843
|
+
}
|
|
844
|
+
function renderRecommendedRegisterSection(projectId) {
|
|
845
|
+
const lines = ["## 6. 着手可能な登録項目(おすすめ順)", ""];
|
|
846
|
+
let rows;
|
|
847
|
+
let today;
|
|
848
|
+
try {
|
|
849
|
+
const paths = resolveRegisterPaths({ project: projectId });
|
|
850
|
+
today = zonedDateKey(new Date(), paths.registerDateTimeZone);
|
|
851
|
+
rows = rankRegisterCandidates(buildRegisterCandidates(paths), today).slice(0, 10);
|
|
852
|
+
}
|
|
853
|
+
catch (error) {
|
|
854
|
+
lines.push(`- 登録簿の集計に失敗しました: ${error instanceof Error ? error.message : String(error)}`, "");
|
|
855
|
+
return lines;
|
|
856
|
+
}
|
|
857
|
+
if (rows.length === 0) {
|
|
858
|
+
lines.push("- (着手可能な登録項目はありません)", "");
|
|
859
|
+
return lines;
|
|
860
|
+
}
|
|
861
|
+
lines.push("| 順位 | id | type | title | 期日 | 優先度 | 関連 open PJR | 登録日時 | 根拠 |");
|
|
862
|
+
lines.push("| ---: | --- | --- | --- | --- | --- | ---: | --- | --- |");
|
|
863
|
+
const todayMs = dateOnlyMs(today) ?? 0;
|
|
864
|
+
rows.forEach((row, index) => {
|
|
865
|
+
const dueMs = dateOnlyMs(row.due);
|
|
866
|
+
const dueReason = dueMs === undefined
|
|
867
|
+
? "期日なし"
|
|
868
|
+
: dueMs < todayMs
|
|
869
|
+
? `期日超過 ${Math.ceil((todayMs - dueMs) / 86_400_000)}日`
|
|
870
|
+
: `期日まで ${Math.ceil((dueMs - todayMs) / 86_400_000)}日`;
|
|
871
|
+
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}件 |`);
|
|
872
|
+
});
|
|
873
|
+
lines.push("");
|
|
874
|
+
return lines;
|
|
875
|
+
}
|
|
876
|
+
function renderAttentionSection(paths) {
|
|
877
|
+
const lines = ["## 7. 要対応(解除待ち)", ""];
|
|
878
|
+
try {
|
|
879
|
+
const rows = aggregateAttention(paths);
|
|
880
|
+
if (rows.length === 0) {
|
|
881
|
+
lines.push("- (解除待ちの登録項目・exec タスクはありません)", "");
|
|
882
|
+
return lines;
|
|
883
|
+
}
|
|
884
|
+
lines.push("| 種別 | id | 理由 | 次の行動 |");
|
|
885
|
+
lines.push("| --- | --- | --- | --- |");
|
|
886
|
+
for (const row of rows) {
|
|
887
|
+
lines.push(`| ${row.source} | \`${row.id}\` | ${sanitizeDashboardCell(row.reason)} | ${sanitizeDashboardCell(row.nextAction)} |`);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
catch (error) {
|
|
891
|
+
lines.push(`- 要対応一覧の集計に失敗しました: ${error instanceof Error ? error.message : String(error)}`);
|
|
892
|
+
}
|
|
893
|
+
lines.push("");
|
|
894
|
+
return lines;
|
|
895
|
+
}
|
|
896
|
+
export function buildDashboardMarkdown(paths) {
|
|
897
|
+
const lines = [];
|
|
898
|
+
const nowLabel = new Date().toISOString().replace(/\.\d{3}Z$/, "");
|
|
899
|
+
lines.push("# プロジェクトダッシュボード");
|
|
900
|
+
lines.push("");
|
|
901
|
+
lines.push(`- project_id: \`${paths.projectId}\``);
|
|
902
|
+
lines.push(`- generated_at: \`${nowLabel}\``);
|
|
903
|
+
lines.push(`- 再生成: \`specdojo dashboard build --project ${paths.projectId}\``);
|
|
904
|
+
lines.push("");
|
|
905
|
+
lines.push(generatedBanner("specdojo dashboard build"));
|
|
906
|
+
lines.push("");
|
|
907
|
+
lines.push(...renderScheduleSection(paths));
|
|
908
|
+
lines.push(...renderTimelineSection(paths));
|
|
909
|
+
lines.push(...renderRegisterSection(paths.projectId));
|
|
910
|
+
lines.push(...renderRoutineSection(paths));
|
|
911
|
+
lines.push(...renderDailyRoutineSection(paths));
|
|
912
|
+
lines.push(...renderRecommendedRegisterSection(paths.projectId));
|
|
913
|
+
lines.push(...renderAttentionSection(paths));
|
|
914
|
+
lines.push(...renderGradeSection(paths));
|
|
915
|
+
// 各セクションは次のセクションとの区切りとして空行で終わる。最後のセクションの空行を
|
|
916
|
+
// そのまま残すと、書き出し時に付ける改行と合わさって末尾が空行2行になり markdownlint の
|
|
917
|
+
// MD012 に触れるため、ここで末尾の空行を落とす。
|
|
918
|
+
return lines.join("\n").replace(/\n+$/, "");
|
|
919
|
+
}
|
|
920
|
+
export function writeDashboard(paths) {
|
|
921
|
+
mkdirSync(paths.executionGeneratedPath, { recursive: true });
|
|
922
|
+
const markdown = buildDashboardMarkdown(paths);
|
|
923
|
+
const generatedFiles = [];
|
|
924
|
+
const mdPath = join(paths.executionGeneratedPath, "dashboard.md");
|
|
925
|
+
writeFileSync(mdPath, markdown + "\n", "utf8");
|
|
926
|
+
generatedFiles.push(toArtifactPath(mdPath));
|
|
927
|
+
// timeline gantt SVG を並置。tml-index が無い/壊れている場合はスキップ。
|
|
928
|
+
const indexPath = join(paths.timelinePath, "tml-index.yaml");
|
|
929
|
+
if (existsSync(indexPath)) {
|
|
930
|
+
try {
|
|
931
|
+
const { index } = loadTimelineIndex(indexPath);
|
|
932
|
+
const calendar = resolveDashboardCalendar(paths.schedulePath ?? paths.timelinePath);
|
|
933
|
+
const { schedule, plannedStartDate } = computeTimelineTrackSchedules(index, calendar);
|
|
934
|
+
const svgPath = join(paths.executionGeneratedPath, "dashboard-timeline-gantt.svg");
|
|
935
|
+
writeFileSync(svgPath, buildTimelineGanttSvg(schedule, plannedStartDate) + "\n", "utf8");
|
|
936
|
+
generatedFiles.push(toArtifactPath(svgPath));
|
|
937
|
+
}
|
|
938
|
+
catch {
|
|
939
|
+
// SVG 生成失敗は markdown に影響しないため破棄(renderTimelineSection でエラー表示済み)。
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
return { markdown, generatedFiles };
|
|
943
|
+
}
|
|
944
|
+
export function buildDashboard(opts) {
|
|
945
|
+
const paths = resolveDashboardPaths(opts);
|
|
946
|
+
const { generatedFiles } = writeDashboard(paths);
|
|
947
|
+
return { projectId: paths.projectId, generatedFiles, errors: [], warnings: [] };
|
|
948
|
+
}
|
|
949
|
+
// build-command ステップで使う出力先の解決を公開する。
|
|
950
|
+
export function dashboardOutputFiles(paths) {
|
|
951
|
+
return ["dashboard.md", "dashboard-timeline-gantt.svg"].map((name) => toArtifactPath(join(paths.executionGeneratedPath, name)));
|
|
952
|
+
}
|
|
953
|
+
// ================================
|
|
954
|
+
// CLI command
|
|
955
|
+
// ================================
|
|
956
|
+
function printCommandError(error) {
|
|
957
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
958
|
+
process.stdout.write(message + "\n");
|
|
959
|
+
process.exitCode = 1;
|
|
960
|
+
}
|
|
961
|
+
export function registerDashboardCommands(program) {
|
|
962
|
+
const dash = program.command("dashboard").description("Per-project dashboard build commands");
|
|
963
|
+
const bcmd = dash
|
|
964
|
+
.command("build")
|
|
965
|
+
.description("Generate per-project dashboard.md and timeline Gantt chart SVG")
|
|
966
|
+
.option("--project <id>", "Project id in specdojo.config.json")
|
|
967
|
+
.option("--dry-run", "Print generated content to stdout without writing", false);
|
|
968
|
+
bcmd.action((opts) => {
|
|
969
|
+
try {
|
|
970
|
+
if (opts.dryRun) {
|
|
971
|
+
const paths = resolveDashboardPaths(opts);
|
|
972
|
+
process.stdout.write(`\n# --- (dry-run) dashboard.md ---\n\n`);
|
|
973
|
+
process.stdout.write(buildDashboardMarkdown(paths) + "\n");
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
const result = buildDashboard(opts);
|
|
977
|
+
if (result.errors.length > 0) {
|
|
978
|
+
for (const error of result.errors)
|
|
979
|
+
printCommandError(new Error(error));
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
process.stdout.write(`Generated dashboard: ${result.generatedFiles.map((f) => `\n ${f}`).join("")}\n`);
|
|
983
|
+
}
|
|
984
|
+
catch (error) {
|
|
985
|
+
printCommandError(error);
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
// build-command で使う path 解決ヘルパーを公開する。
|
|
990
|
+
export { getProjectExecutionPath, getProjectRoutinesPath, getProjectSchedulePath, getProjectTimelinePath, };
|