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,812 @@
|
|
|
1
|
+
// Deterministic strategy generator: turns the deliverable catalogs (DCT), the track plan
|
|
2
|
+
// (Timeline), intent declarations, current facts/grades and the standard strategy profiles into
|
|
3
|
+
// sch-strategy-<track>.yaml. Approach selection and all generated schedule structures are decided
|
|
4
|
+
// by code so `schedule build` and `exec refresh` stay deterministic.
|
|
5
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync, } from "node:fs";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
|
+
import { basename, join, relative, resolve } from "node:path";
|
|
8
|
+
import yaml from "js-yaml";
|
|
9
|
+
import { resolveSpecdojoPath } from "./template-resolution.js";
|
|
10
|
+
import Ajv2020Module from "ajv/dist/2020.js";
|
|
11
|
+
import { collectResolvedDeliverables } from "./catalog-build.js";
|
|
12
|
+
import { resolveBasePath } from "./catalog-paths.js";
|
|
13
|
+
import { diffPlanText } from "./catalog-plan.js";
|
|
14
|
+
import { readYaml } from "./exec-shared.js";
|
|
15
|
+
import { buildScheduleTrack } from "./schedule-build.js";
|
|
16
|
+
import { collectCatalogFilesByDomain, loadTimelineIndex } from "./timeline-build.js";
|
|
17
|
+
import { collectApproachFacts, deriveApproaches, } from "./schedule-approach.js";
|
|
18
|
+
import { AUTHOR_PHASE_SETS, PHASE_SET_ORDER, profileFor, renderPhase, STRATEGY_PHASE_SETS, } from "./schedule-strategy-profiles.js";
|
|
19
|
+
export const SCH_STRATEGY_SCHEMA_PATH = "docs/specdojo/schemas/v1/sch-strategy.schema.yaml";
|
|
20
|
+
function isRecord(value) {
|
|
21
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22
|
+
}
|
|
23
|
+
function toRepoAbsolute(absolutePath, repoRoot) {
|
|
24
|
+
return `/${relative(repoRoot, absolutePath).replace(/\\/g, "/")}`;
|
|
25
|
+
}
|
|
26
|
+
// ---- scope resolution ---------------------------------------------------------
|
|
27
|
+
// Artifact label shown in the timeline for gates and milestones. Catalog titles follow
|
|
28
|
+
// `成果物カタログ(<name>)`; anything else is left unset rather than guessed.
|
|
29
|
+
export function artifactNameFromCatalogTitle(title) {
|
|
30
|
+
const match = title?.match(/^成果物カタログ((.+))$/);
|
|
31
|
+
return match ? match[1] : undefined;
|
|
32
|
+
}
|
|
33
|
+
// Resolves the catalogs a track covers. An existing strategy is authoritative (a human may have
|
|
34
|
+
// narrowed the scope on purpose); otherwise the Timeline track plan decides which domains belong
|
|
35
|
+
// to the track, and every catalog file of those domains (including physical splits) is included.
|
|
36
|
+
export function resolveTrackScopeCatalogs(opts) {
|
|
37
|
+
const { repoRoot, catalogPath, timelinePath, track } = opts;
|
|
38
|
+
const warnings = [];
|
|
39
|
+
const errors = [];
|
|
40
|
+
const byDomain = collectCatalogFilesByDomain(catalogPath);
|
|
41
|
+
const refFor = (filePath, localIds) => {
|
|
42
|
+
const doc = readYaml(filePath);
|
|
43
|
+
if (!doc?.id || !doc.domain) {
|
|
44
|
+
errors.push(`${filePath}: id / domain が読み取れないため scope に含められない。`);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
id: doc.id,
|
|
49
|
+
path: toRepoAbsolute(filePath, repoRoot),
|
|
50
|
+
...(localIds ? { local_ids: localIds } : {}),
|
|
51
|
+
domain: doc.domain,
|
|
52
|
+
...(doc.title ? { title: doc.title } : {}),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const timelineCatalogs = [];
|
|
56
|
+
const indexFile = join(timelinePath, "tml-index.yaml");
|
|
57
|
+
if (existsSync(indexFile)) {
|
|
58
|
+
const { index, errors: loadErrors } = loadTimelineIndex(indexFile);
|
|
59
|
+
if (loadErrors.length > 0) {
|
|
60
|
+
warnings.push(`${basename(indexFile)}: ${loadErrors.join(" / ")}`);
|
|
61
|
+
}
|
|
62
|
+
const plan = index.tracks.find((entry) => entry.track === track);
|
|
63
|
+
if (plan) {
|
|
64
|
+
for (const domain of plan.domains) {
|
|
65
|
+
const files = byDomain.get(domain) ?? [];
|
|
66
|
+
if (files.length === 0) {
|
|
67
|
+
warnings.push(`timeline: track '${track}' の domain '${domain}' に対応する dct-*.yaml が無い(scope から除外)。`);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
for (const filePath of files) {
|
|
71
|
+
const ref = refFor(filePath);
|
|
72
|
+
if (ref)
|
|
73
|
+
timelineCatalogs.push(ref);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (plan.catalog_status !== "primary") {
|
|
77
|
+
warnings.push(`timeline: track '${track}' の catalog_status は '${plan.catalog_status}'。` +
|
|
78
|
+
`strategy 生成では昇格させないため、確認後に人間が primary へ更新する。`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
warnings.push(`timeline: track '${track}' が tml-index.yaml に無い。`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const existingScope = isRecord(opts.existingStrategy?.scope)
|
|
86
|
+
? opts.existingStrategy.scope
|
|
87
|
+
: undefined;
|
|
88
|
+
const existingCatalogs = Array.isArray(existingScope?.catalogs) ? existingScope.catalogs : [];
|
|
89
|
+
if (existingCatalogs.length > 0) {
|
|
90
|
+
const catalogs = [];
|
|
91
|
+
for (const entry of existingCatalogs) {
|
|
92
|
+
if (!isRecord(entry) || typeof entry.path !== "string")
|
|
93
|
+
continue;
|
|
94
|
+
let localIds;
|
|
95
|
+
if (entry.local_ids !== undefined) {
|
|
96
|
+
if (!Array.isArray(entry.local_ids) ||
|
|
97
|
+
entry.local_ids.length === 0 ||
|
|
98
|
+
entry.local_ids.some((localId) => typeof localId !== "string" || localId.length === 0)) {
|
|
99
|
+
errors.push(`scope.catalogs: ${entry.path} の local_ids は空でない文字列配列にする。`);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
localIds = entry.local_ids;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const filePath = resolve(repoRoot, entry.path.replace(/^\//, ""));
|
|
106
|
+
if (!existsSync(filePath)) {
|
|
107
|
+
errors.push(`scope.catalogs: カタログが見つからない: ${entry.path}`);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const ref = refFor(filePath, localIds);
|
|
111
|
+
if (ref)
|
|
112
|
+
catalogs.push(ref);
|
|
113
|
+
}
|
|
114
|
+
const known = new Set(catalogs.map((catalog) => catalog.id));
|
|
115
|
+
for (const catalog of timelineCatalogs) {
|
|
116
|
+
if (known.has(catalog.id))
|
|
117
|
+
continue;
|
|
118
|
+
warnings.push(`timeline の domain から解決した ${catalog.id} が既存 scope に無い。scope を広げる場合は ` +
|
|
119
|
+
`sch-strategy-${track}.yaml の scope.catalogs を先に更新する。`);
|
|
120
|
+
}
|
|
121
|
+
return { catalogs, source: "strategy", warnings, errors };
|
|
122
|
+
}
|
|
123
|
+
if (timelineCatalogs.length === 0) {
|
|
124
|
+
errors.push(`track '${track}' の scope を解決できない。tml-index.yaml の domains と ` +
|
|
125
|
+
`dct-<domain>.yaml を用意するか、既存 strategy の scope.catalogs を先に定義する。`);
|
|
126
|
+
}
|
|
127
|
+
return { catalogs: timelineCatalogs, source: "timeline", warnings, errors };
|
|
128
|
+
}
|
|
129
|
+
// Deliverables of the scoped catalogs, in catalog order. `include_kinds` mirrors the strategy
|
|
130
|
+
// scope (work by default).
|
|
131
|
+
export function collectScopeDeliverables(opts) {
|
|
132
|
+
const errors = [];
|
|
133
|
+
const deliverables = [];
|
|
134
|
+
for (const catalog of opts.catalogs) {
|
|
135
|
+
const filePath = resolve(opts.repoRoot, catalog.path.replace(/^\//, ""));
|
|
136
|
+
const doc = readYaml(filePath);
|
|
137
|
+
if (!doc?.groups) {
|
|
138
|
+
errors.push(`${catalog.path}: groups が無い。`);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const collected = [];
|
|
142
|
+
collectResolvedDeliverables(doc.groups, resolveBasePath("", doc.base_path), collected);
|
|
143
|
+
const catalogLocalIds = new Set(collected.map(({ item }) => item.local_id));
|
|
144
|
+
for (const localId of catalog.local_ids ?? []) {
|
|
145
|
+
if (!catalogLocalIds.has(localId)) {
|
|
146
|
+
errors.push(`${catalog.id}: scope.local_ids の '${localId}' がカタログに存在しない。`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const selectedLocalIds = catalog.local_ids ? new Set(catalog.local_ids) : null;
|
|
150
|
+
for (const { item } of collected) {
|
|
151
|
+
if (!opts.includeKinds.includes(item.kind))
|
|
152
|
+
continue;
|
|
153
|
+
if (selectedLocalIds && !selectedLocalIds.has(item.local_id))
|
|
154
|
+
continue;
|
|
155
|
+
deliverables.push({
|
|
156
|
+
local_id: item.local_id,
|
|
157
|
+
catalog_id: catalog.id,
|
|
158
|
+
depends_on: item.depends_on ?? [],
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return { deliverables, errors };
|
|
163
|
+
}
|
|
164
|
+
// Owner derivation rule, in priority order:
|
|
165
|
+
// 1. explicit --owner <local_id>=<ROLE>
|
|
166
|
+
// 2. the owner already recorded in the existing strategy's owner_rules
|
|
167
|
+
// 3. --default-owner <ROLE>
|
|
168
|
+
// `done_criteria.roles` is deliberately not consulted: those are review viewpoints, not the
|
|
169
|
+
// role that performs the work. When no rule applies, generation stops instead of guessing.
|
|
170
|
+
export function resolveDeliverableOwners(opts) {
|
|
171
|
+
const owners = new Map();
|
|
172
|
+
const errors = [];
|
|
173
|
+
const warnings = [];
|
|
174
|
+
const unresolved = [];
|
|
175
|
+
for (const localId of opts.localIds) {
|
|
176
|
+
const owner = opts.overrides.get(localId) ?? opts.previous.get(localId) ?? opts.defaultOwner;
|
|
177
|
+
if (!owner) {
|
|
178
|
+
unresolved.push(localId);
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (opts.knownRoles && opts.knownRoles.size > 0 && !opts.knownRoles.has(owner)) {
|
|
182
|
+
errors.push(`owner '${owner}' は pm-roles.yaml に存在しない (${localId})。`);
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
owners.set(localId, owner);
|
|
186
|
+
}
|
|
187
|
+
for (const localId of opts.overrides.keys()) {
|
|
188
|
+
if (opts.localIds.includes(localId))
|
|
189
|
+
continue;
|
|
190
|
+
warnings.push(`--owner ${localId} は scope に含まれない成果物を指している(無視する)。`);
|
|
191
|
+
}
|
|
192
|
+
if (unresolved.length > 0) {
|
|
193
|
+
errors.push(`主担当ロールを決定できない成果物がある: ${unresolved.join(", ")}。` +
|
|
194
|
+
`--owner <local_id>=<ROLE> または --default-owner <ROLE> で明示する` +
|
|
195
|
+
`(done_criteria.roles はレビュー観点であり主担当ではない)。`);
|
|
196
|
+
}
|
|
197
|
+
return { owners, errors, warnings };
|
|
198
|
+
}
|
|
199
|
+
export function loadKnownRoles(repoRoot, rolesPath) {
|
|
200
|
+
if (!rolesPath)
|
|
201
|
+
return new Set();
|
|
202
|
+
const filePath = resolve(repoRoot, rolesPath);
|
|
203
|
+
if (!existsSync(filePath))
|
|
204
|
+
return new Set();
|
|
205
|
+
const doc = readYaml(filePath);
|
|
206
|
+
if (!isRecord(doc) || !Array.isArray(doc.roles))
|
|
207
|
+
return new Set();
|
|
208
|
+
const codes = doc.roles
|
|
209
|
+
.map((role) => (isRecord(role) && typeof role.code === "string" ? role.code : ""))
|
|
210
|
+
.filter(Boolean);
|
|
211
|
+
return new Set(codes);
|
|
212
|
+
}
|
|
213
|
+
function phaseSetsOf(approach) {
|
|
214
|
+
return profileFor(approach).phase_sets;
|
|
215
|
+
}
|
|
216
|
+
function orderPhaseSets(names) {
|
|
217
|
+
const unique = [...new Set(names)];
|
|
218
|
+
return unique.sort((left, right) => PHASE_SET_ORDER.indexOf(left) - PHASE_SET_ORDER.indexOf(right));
|
|
219
|
+
}
|
|
220
|
+
// Transitive catalog dependency check used to keep generated bootstrap ordering acyclic.
|
|
221
|
+
function dependsTransitively(from, target, dependsOn) {
|
|
222
|
+
const seen = new Set();
|
|
223
|
+
const stack = [...(dependsOn.get(from) ?? [])];
|
|
224
|
+
while (stack.length > 0) {
|
|
225
|
+
const current = stack.pop();
|
|
226
|
+
if (current === target)
|
|
227
|
+
return true;
|
|
228
|
+
if (seen.has(current))
|
|
229
|
+
continue;
|
|
230
|
+
seen.add(current);
|
|
231
|
+
stack.push(...(dependsOn.get(current) ?? []));
|
|
232
|
+
}
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
export function buildStrategyDocument(input) {
|
|
236
|
+
const warnings = [];
|
|
237
|
+
const errors = [];
|
|
238
|
+
const trackUpper = input.track.toUpperCase();
|
|
239
|
+
const maintenanceKind = (approach) => {
|
|
240
|
+
const match = approach.match(/^(rulebook|recipe|sample|template)-maintenance$/);
|
|
241
|
+
return match?.[1];
|
|
242
|
+
};
|
|
243
|
+
const eligibleDeliverables = input.deliverables.filter((deliverable) => {
|
|
244
|
+
const kind = maintenanceKind(deliverable.approach);
|
|
245
|
+
if (!kind || !deliverable.not_needed_kata?.includes(kind))
|
|
246
|
+
return true;
|
|
247
|
+
errors.push(`${deliverable.local_id}: ${kind} は not-needed と宣言されているため ${kind}-maintenance を生成しない。`);
|
|
248
|
+
return false;
|
|
249
|
+
});
|
|
250
|
+
const sorted = [...eligibleDeliverables].sort((left, right) => left.local_id.localeCompare(right.local_id));
|
|
251
|
+
// --- owner_rules: one rule per (owner, approach) pair -------------------------
|
|
252
|
+
const groups = new Map();
|
|
253
|
+
for (const deliverable of sorted) {
|
|
254
|
+
const owner = input.owners.get(deliverable.local_id);
|
|
255
|
+
if (!owner) {
|
|
256
|
+
errors.push(`${deliverable.local_id}: owner が解決できていない。`);
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
const key = JSON.stringify([owner, deliverable.approach]);
|
|
260
|
+
const group = groups.get(key) ?? { owner, approach: deliverable.approach, localIds: [] };
|
|
261
|
+
group.localIds.push(deliverable.local_id);
|
|
262
|
+
groups.set(key, group);
|
|
263
|
+
}
|
|
264
|
+
const orderedGroups = [...groups.values()].sort((left, right) => left.owner === right.owner
|
|
265
|
+
? left.approach.localeCompare(right.approach)
|
|
266
|
+
: left.owner.localeCompare(right.owner));
|
|
267
|
+
// The most common profile becomes default_phase_sets so rules that follow it stay compact.
|
|
268
|
+
const byApproach = new Map();
|
|
269
|
+
for (const deliverable of sorted) {
|
|
270
|
+
byApproach.set(deliverable.approach, (byApproach.get(deliverable.approach) ?? 0) + 1);
|
|
271
|
+
}
|
|
272
|
+
const defaultApproach = [...byApproach.entries()].sort((left, right) => right[1] === left[1] ? left[0].localeCompare(right[0]) : right[1] - left[1])[0]?.[0];
|
|
273
|
+
const defaultSequence = defaultApproach ? phaseSetsOf(defaultApproach) : [];
|
|
274
|
+
const usedPhaseSets = orderPhaseSets(sorted.flatMap((d) => phaseSetsOf(d.approach)));
|
|
275
|
+
const phaseSets = {};
|
|
276
|
+
for (const name of usedPhaseSets) {
|
|
277
|
+
const definition = STRATEGY_PHASE_SETS[name];
|
|
278
|
+
if (!definition) {
|
|
279
|
+
errors.push(`未定義の phase_set '${name}' が profile から参照された。`);
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
phaseSets[name] = definition.map(renderPhase);
|
|
283
|
+
}
|
|
284
|
+
const ownerRules = orderedGroups.map((group) => {
|
|
285
|
+
const sequence = phaseSetsOf(group.approach);
|
|
286
|
+
const sameAsDefault = sequence.length === defaultSequence.length &&
|
|
287
|
+
sequence.every((name, index) => name === defaultSequence[index]);
|
|
288
|
+
const finalizeApproach = profileFor(group.approach).finalize_approach;
|
|
289
|
+
return {
|
|
290
|
+
local_ids: [...group.localIds].sort(),
|
|
291
|
+
owner: group.owner,
|
|
292
|
+
...(sameAsDefault ? {} : { phase_sets: sequence.map((name) => ({ phase_set: name })) }),
|
|
293
|
+
...(finalizeApproach === "bootstrap-finalize"
|
|
294
|
+
? { phase_overrides: [{ phase: "finalize", approach: "bootstrap-finalize" }] }
|
|
295
|
+
: {}),
|
|
296
|
+
};
|
|
297
|
+
});
|
|
298
|
+
// --- phase gates -------------------------------------------------------------
|
|
299
|
+
const countUsing = (phaseSetName) => sorted.filter((d) => phaseSetsOf(d.approach).includes(phaseSetName)).length;
|
|
300
|
+
const authorPhaseSets = orderPhaseSets(usedPhaseSets.filter((name) => AUTHOR_PHASE_SETS.includes(name)));
|
|
301
|
+
const catalogScope = { catalogs: input.catalogs.map((catalog) => catalog.id) };
|
|
302
|
+
const artifactName = input.catalogs.length === 1 ? artifactNameFromCatalogTitle(input.catalogs[0].title) : undefined;
|
|
303
|
+
const withArtifact = artifactName ? { artifact_name: artifactName } : {};
|
|
304
|
+
const dedupLocalIds = sorted
|
|
305
|
+
.filter((d) => d.approach === "cross-deliverable-dedup")
|
|
306
|
+
.map((d) => d.local_id);
|
|
307
|
+
const authorPassDeliverables = sorted.filter((d) => phaseSetsOf(d.approach).some((name) => AUTHOR_PHASE_SETS.includes(name))).length;
|
|
308
|
+
const firstPassGateId = `G-${trackUpper}-first-pass`;
|
|
309
|
+
const gates = [];
|
|
310
|
+
const needsFirstPassGate = authorPhaseSets.length > 0 && (authorPassDeliverables >= 2 || dedupLocalIds.length >= 2);
|
|
311
|
+
if (needsFirstPassGate) {
|
|
312
|
+
gates.push({
|
|
313
|
+
id: firstPassGateId,
|
|
314
|
+
name: "初回パス完了",
|
|
315
|
+
...withArtifact,
|
|
316
|
+
after_phase_sets: authorPhaseSets,
|
|
317
|
+
owner: input.gateOwner,
|
|
318
|
+
scope: catalogScope,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
if (countUsing("refine-pass") >= 2) {
|
|
322
|
+
gates.push({
|
|
323
|
+
id: `G-${trackUpper}-refine-pass`,
|
|
324
|
+
name: "磨き込み完了",
|
|
325
|
+
...withArtifact,
|
|
326
|
+
after_phase_sets: ["refine-pass"],
|
|
327
|
+
owner: input.gateOwner,
|
|
328
|
+
scope: catalogScope,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
const reviewPhaseSets = orderPhaseSets(usedPhaseSets.filter((name) => name === "review-pass" || name === "retrofit-review-pass"));
|
|
332
|
+
if (reviewPhaseSets.length > 0 && sorted.length >= 2) {
|
|
333
|
+
gates.push({
|
|
334
|
+
id: `G-${trackUpper}-review-pass`,
|
|
335
|
+
name: "レビュー完了",
|
|
336
|
+
...withArtifact,
|
|
337
|
+
after_phase_sets: reviewPhaseSets,
|
|
338
|
+
owner: input.gateOwner,
|
|
339
|
+
scope: catalogScope,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
if (gates.length > 0 && !input.gateOwner) {
|
|
343
|
+
errors.push("phase gate の owner を決定できない。--gate-owner <ROLE> または --default-owner <ROLE> で明示する。");
|
|
344
|
+
}
|
|
345
|
+
// --- cross-deliverable pass --------------------------------------------------
|
|
346
|
+
const crossPasses = [];
|
|
347
|
+
if (dedupLocalIds.length === 1) {
|
|
348
|
+
errors.push(`cross-deliverable-dedup と判定された成果物が 1 件しかない (${dedupLocalIds[0]})。` +
|
|
349
|
+
`横断タスクは 2 件以上の成果物を対象にする。判定を見直す。`);
|
|
350
|
+
}
|
|
351
|
+
else if (dedupLocalIds.length >= 2) {
|
|
352
|
+
if (!needsFirstPassGate) {
|
|
353
|
+
errors.push(`cross-deliverable-dedup を配置する前段フェーズが無い。` +
|
|
354
|
+
`対象 track に author フェーズ(bootstrap / retrofit / draft)を持つ成果物が必要。`);
|
|
355
|
+
}
|
|
356
|
+
const passOwners = new Set(dedupLocalIds.map((localId) => input.owners.get(localId) ?? "").filter(Boolean));
|
|
357
|
+
const passOwner = input.passOwnerOverride ?? (passOwners.size === 1 ? [...passOwners][0] : undefined);
|
|
358
|
+
if (!passOwner) {
|
|
359
|
+
errors.push(`横断タスクの主担当を決定できない(対象成果物の owner が ${[...passOwners].join(", ")})。` +
|
|
360
|
+
`--owner ${input.track}-dedup=<ROLE> で明示する。`);
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
crossPasses.push({
|
|
364
|
+
id: `${input.track}-dedup`,
|
|
365
|
+
name: "成果物間の正本選択・重複整理",
|
|
366
|
+
...withArtifact,
|
|
367
|
+
task_suffix: "060",
|
|
368
|
+
duration_days: 0.5,
|
|
369
|
+
owner: passOwner,
|
|
370
|
+
after_gate: firstPassGateId,
|
|
371
|
+
before_phase_set: "refine-pass",
|
|
372
|
+
execution: "agent",
|
|
373
|
+
mode: "edit",
|
|
374
|
+
approach: "cross-deliverable-dedup",
|
|
375
|
+
agent_pipeline: {
|
|
376
|
+
stages: [
|
|
377
|
+
{ stage_role: "executor", proficiency: "expert" },
|
|
378
|
+
{ stage_role: "reporter", proficiency: "normal" },
|
|
379
|
+
],
|
|
380
|
+
},
|
|
381
|
+
description: "対象成果物を横断し、同じ事実・手順・定義が複数文書へ重複していないか確認する。" +
|
|
382
|
+
"各情報の正本を選び、他の文書は必要な要約と参照へ整理する。各成果物の固有責務と " +
|
|
383
|
+
"done_criteria は維持し、用語と受け渡しを統一する。\n",
|
|
384
|
+
scope: { local_ids: [...dedupLocalIds].sort() },
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
// --- cross domain dependencies ----------------------------------------------
|
|
389
|
+
const crossDeps = [
|
|
390
|
+
...(input.preserved.cross_domain_dependencies ?? []),
|
|
391
|
+
];
|
|
392
|
+
const declared = new Set(crossDeps.map((dep) => JSON.stringify([dep.dependent, dep.requires])));
|
|
393
|
+
if (input.bootstrapOrdering) {
|
|
394
|
+
const bootstrapIds = sorted
|
|
395
|
+
.filter((d) => d.approach === "bootstrap")
|
|
396
|
+
.map((d) => d.local_id)
|
|
397
|
+
.sort();
|
|
398
|
+
for (const deliverable of sorted) {
|
|
399
|
+
if (deliverable.approach === "bootstrap")
|
|
400
|
+
continue;
|
|
401
|
+
if (deliverable.approach === "finalize" || deliverable.approach === "bootstrap-finalize") {
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
for (const bootstrapId of bootstrapIds) {
|
|
405
|
+
const catalogOf = sorted.find((d) => d.local_id === bootstrapId)?.catalog_id;
|
|
406
|
+
if (catalogOf !== deliverable.catalog_id)
|
|
407
|
+
continue;
|
|
408
|
+
if ((input.dependsOn.get(deliverable.local_id) ?? []).includes(bootstrapId))
|
|
409
|
+
continue;
|
|
410
|
+
if (dependsTransitively(bootstrapId, deliverable.local_id, input.dependsOn)) {
|
|
411
|
+
warnings.push(`bootstrap 順序: ${bootstrapId} が ${deliverable.local_id} に依存しているため、` +
|
|
412
|
+
`逆向きの待ち合わせは生成しない。`);
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
const key = JSON.stringify([deliverable.local_id, bootstrapId]);
|
|
416
|
+
if (declared.has(key))
|
|
417
|
+
continue;
|
|
418
|
+
declared.add(key);
|
|
419
|
+
crossDeps.push({
|
|
420
|
+
dependent: deliverable.local_id,
|
|
421
|
+
requires: bootstrapId,
|
|
422
|
+
note: "代表成果物の初期整備(bootstrap)で整った実践の型を前提にする",
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
// --- group milestones --------------------------------------------------------
|
|
428
|
+
const groupMilestones = input.catalogs.map((catalog) => {
|
|
429
|
+
const label = artifactNameFromCatalogTitle(catalog.title);
|
|
430
|
+
const sameDomainCount = input.catalogs.filter((item) => item.domain === catalog.domain).length;
|
|
431
|
+
const catalogLocalId = catalog.id.includes(":")
|
|
432
|
+
? catalog.id.split(":").slice(1).join(":")
|
|
433
|
+
: catalog.id;
|
|
434
|
+
const milestoneSuffix = sameDomainCount > 1 ? catalogLocalId.replace(/^dct-/, "") : catalog.domain;
|
|
435
|
+
return {
|
|
436
|
+
catalog_id: catalog.id,
|
|
437
|
+
milestone: {
|
|
438
|
+
id: `M-${trackUpper}-${milestoneSuffix}`,
|
|
439
|
+
name: "ドメイン完了",
|
|
440
|
+
...(label ? { artifact_name: label } : {}),
|
|
441
|
+
owner: input.milestoneOwner,
|
|
442
|
+
},
|
|
443
|
+
};
|
|
444
|
+
});
|
|
445
|
+
if (groupMilestones.length > 0 && !input.milestoneOwner) {
|
|
446
|
+
errors.push("group milestone の owner を決定できない。--milestone-owner <ROLE> または --default-owner <ROLE> で明示する。");
|
|
447
|
+
}
|
|
448
|
+
const doc = {
|
|
449
|
+
kind: "strategy",
|
|
450
|
+
id: `${input.projectId}:sch-strategy-${input.track}`,
|
|
451
|
+
type: "project",
|
|
452
|
+
status: input.preserved.status ?? "draft",
|
|
453
|
+
title: input.preserved.title ?? `スケジュール戦略(${input.track})`,
|
|
454
|
+
rulebook: "specdojo:sch-rulebook",
|
|
455
|
+
track: input.track,
|
|
456
|
+
...(input.preserved.settings && Object.keys(input.preserved.settings).length > 0
|
|
457
|
+
? { settings: input.preserved.settings }
|
|
458
|
+
: {}),
|
|
459
|
+
scope: {
|
|
460
|
+
catalogs: input.catalogs.map((catalog) => ({
|
|
461
|
+
id: catalog.id,
|
|
462
|
+
path: catalog.path,
|
|
463
|
+
...(catalog.local_ids ? { local_ids: catalog.local_ids } : {}),
|
|
464
|
+
})),
|
|
465
|
+
include_kinds: input.includeKinds,
|
|
466
|
+
},
|
|
467
|
+
approach_rules: input.preserved.approachRules,
|
|
468
|
+
phase_sets: phaseSets,
|
|
469
|
+
...(defaultSequence.length > 0
|
|
470
|
+
? { default_phase_sets: defaultSequence.map((name) => ({ phase_set: name })) }
|
|
471
|
+
: {}),
|
|
472
|
+
owner_rules: ownerRules,
|
|
473
|
+
...(crossPasses.length > 0 ? { cross_deliverable_passes: crossPasses } : {}),
|
|
474
|
+
...(gates.length > 0 ? { phase_gates: gates } : {}),
|
|
475
|
+
...(crossDeps.length > 0 ? { cross_domain_dependencies: crossDeps } : {}),
|
|
476
|
+
...(groupMilestones.length > 0 ? { group_milestones: groupMilestones } : {}),
|
|
477
|
+
...(input.preserved.initial_state ? { initial_state: input.preserved.initial_state } : {}),
|
|
478
|
+
};
|
|
479
|
+
if (ownerRules.length === 0) {
|
|
480
|
+
errors.push("owner_rules が空になる。判定済みの成果物が 1 件も無い。");
|
|
481
|
+
}
|
|
482
|
+
return { doc, warnings, errors };
|
|
483
|
+
}
|
|
484
|
+
// ---- serialization & validation ------------------------------------------------
|
|
485
|
+
export function dumpStrategy(doc) {
|
|
486
|
+
return yaml.dump(doc, {
|
|
487
|
+
lineWidth: 120,
|
|
488
|
+
noRefs: true,
|
|
489
|
+
quotingType: '"',
|
|
490
|
+
forceQuotes: false,
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
const Ajv2020 = Ajv2020Module.default;
|
|
494
|
+
let compiledSchemaCache = null;
|
|
495
|
+
function compileStrategySchema(repoRoot) {
|
|
496
|
+
const schemaPath = resolveSpecdojoPath(SCH_STRATEGY_SCHEMA_PATH, {
|
|
497
|
+
repositoryRoot: repoRoot,
|
|
498
|
+
});
|
|
499
|
+
if (compiledSchemaCache && compiledSchemaCache.schemaPath === schemaPath) {
|
|
500
|
+
return compiledSchemaCache.validate;
|
|
501
|
+
}
|
|
502
|
+
const ajv = new Ajv2020({ allErrors: true, strict: false });
|
|
503
|
+
const load = (fileName) => {
|
|
504
|
+
const filePath = resolveSpecdojoPath(`docs/specdojo/schemas/v1/${fileName}`, {
|
|
505
|
+
repositoryRoot: repoRoot,
|
|
506
|
+
});
|
|
507
|
+
try {
|
|
508
|
+
return yaml.load(readFileSync(filePath, "utf8"));
|
|
509
|
+
}
|
|
510
|
+
catch (error) {
|
|
511
|
+
throw new Error(`Failed to read strategy schema: ${filePath} (${error instanceof Error ? error.message : String(error)})`);
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
// Relative $refs resolve against the empty base URI, so the referenced files are registered
|
|
515
|
+
// under their bare file names first.
|
|
516
|
+
ajv.addSchema(load("sch-common.schema.yaml"), "sch-common.schema.yaml");
|
|
517
|
+
ajv.addSchema(load("exec-common.schema.yaml"), "exec-common.schema.yaml");
|
|
518
|
+
const validate = ajv.compile(load(basename(SCH_STRATEGY_SCHEMA_PATH)));
|
|
519
|
+
compiledSchemaCache = { schemaPath, validate };
|
|
520
|
+
return validate;
|
|
521
|
+
}
|
|
522
|
+
export function validateStrategySchema(doc, repoRoot) {
|
|
523
|
+
const validate = compileStrategySchema(repoRoot);
|
|
524
|
+
if (validate(doc))
|
|
525
|
+
return [];
|
|
526
|
+
return (validate.errors ?? []).map((error) => {
|
|
527
|
+
const at = error.instancePath || "/";
|
|
528
|
+
const params = isRecord(error.params) ? error.params : {};
|
|
529
|
+
const detail = typeof params.additionalProperty === "string"
|
|
530
|
+
? ` (${params.additionalProperty})`
|
|
531
|
+
: typeof params.missingProperty === "string"
|
|
532
|
+
? ` (${params.missingProperty})`
|
|
533
|
+
: Array.isArray(params.allowedValues)
|
|
534
|
+
? ` (allowed: ${params.allowedValues.join(", ")})`
|
|
535
|
+
: "";
|
|
536
|
+
return `${at}: ${error.message ?? "schema violation"}${detail}`;
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
// `schedule build --dry-run` equivalent for a candidate strategy that is not on disk yet. The
|
|
540
|
+
// candidate is evaluated from a temporary file whose name does not match sch-strategy-*.yaml,
|
|
541
|
+
// so no other command can pick it up while it exists.
|
|
542
|
+
export function dryRunStrategy(opts) {
|
|
543
|
+
const { repoRoot, schedulePath, track, projectId, content } = opts;
|
|
544
|
+
const errors = [];
|
|
545
|
+
const warnings = [];
|
|
546
|
+
const candidateDir = mkdtempSync(join(tmpdir(), "specdojo-strategy-candidate-"));
|
|
547
|
+
const candidatePath = join(candidateDir, `sch-strategy-${track}.yaml`);
|
|
548
|
+
const targetFileName = `sch-strategy-${track}.yaml`;
|
|
549
|
+
writeFileSync(candidatePath, content, "utf8");
|
|
550
|
+
try {
|
|
551
|
+
const result = buildScheduleTrack(candidatePath, repoRoot);
|
|
552
|
+
errors.push(...result.errors);
|
|
553
|
+
warnings.push(...result.warnings);
|
|
554
|
+
if (result.projectId !== projectId) {
|
|
555
|
+
errors.push(`生成した strategy の project id '${result.projectId}' が '${projectId}' と一致しない。`);
|
|
556
|
+
}
|
|
557
|
+
const milestoneIds = result.milestones.map((milestone) => milestone.id);
|
|
558
|
+
const owners = new Map();
|
|
559
|
+
for (const id of milestoneIds)
|
|
560
|
+
owners.set(id, targetFileName);
|
|
561
|
+
const otherFiles = (existsSync(schedulePath) ? readdirSync(schedulePath) : [])
|
|
562
|
+
.filter((file) => /^sch-strategy-.+\.yaml$/.test(file))
|
|
563
|
+
.filter((file) => file !== targetFileName)
|
|
564
|
+
.sort();
|
|
565
|
+
for (const file of otherFiles) {
|
|
566
|
+
try {
|
|
567
|
+
const other = buildScheduleTrack(join(schedulePath, file), repoRoot);
|
|
568
|
+
for (const milestone of other.milestones) {
|
|
569
|
+
const previous = owners.get(milestone.id);
|
|
570
|
+
if (previous) {
|
|
571
|
+
errors.push(`Milestone ID '${milestone.id}' が ${previous} と ${file} で重複している。`);
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
574
|
+
owners.set(milestone.id, file);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
catch (error) {
|
|
578
|
+
warnings.push(`${file}: ${error instanceof Error ? error.message : String(error)}`);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
return { taskCount: result.tasks.length, milestoneIds, errors, warnings };
|
|
582
|
+
}
|
|
583
|
+
catch (error) {
|
|
584
|
+
errors.push(error instanceof Error ? error.message : String(error));
|
|
585
|
+
return { taskCount: 0, milestoneIds: [], errors, warnings };
|
|
586
|
+
}
|
|
587
|
+
finally {
|
|
588
|
+
rmSync(candidateDir, { recursive: true, force: true });
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
export function strategyPathFor(schedulePath, track) {
|
|
592
|
+
return join(schedulePath, `sch-strategy-${track}.yaml`);
|
|
593
|
+
}
|
|
594
|
+
// Writes the strategy to its canonical path with the same overwrite protection the other
|
|
595
|
+
// generators use: an existing file is never replaced without --force, and the diff is returned
|
|
596
|
+
// so the operator can review the change first.
|
|
597
|
+
export function writeStrategyFile(opts) {
|
|
598
|
+
const path = strategyPathFor(opts.schedulePath, opts.track);
|
|
599
|
+
const exists = existsSync(path);
|
|
600
|
+
const current = exists ? readFileSync(path, "utf8") : "";
|
|
601
|
+
const diff = diffPlanText(current, opts.content);
|
|
602
|
+
if (exists && diff.length === 0) {
|
|
603
|
+
return { path, written: false, skippedReason: "unchanged", diff };
|
|
604
|
+
}
|
|
605
|
+
if (exists && !opts.force) {
|
|
606
|
+
return { path, written: false, skippedReason: "exists", diff };
|
|
607
|
+
}
|
|
608
|
+
if (opts.dryRun) {
|
|
609
|
+
return { path, written: false, skippedReason: "dry-run", diff };
|
|
610
|
+
}
|
|
611
|
+
mkdirSync(opts.schedulePath, { recursive: true });
|
|
612
|
+
const temporaryPath = join(opts.schedulePath, `.sch-strategy-${opts.track}.${process.pid}.tmp`);
|
|
613
|
+
try {
|
|
614
|
+
writeFileSync(temporaryPath, opts.content, "utf8");
|
|
615
|
+
renameSync(temporaryPath, path);
|
|
616
|
+
}
|
|
617
|
+
finally {
|
|
618
|
+
rmSync(temporaryPath, { force: true });
|
|
619
|
+
}
|
|
620
|
+
return { path, written: true, diff };
|
|
621
|
+
}
|
|
622
|
+
// Fields a regenerated strategy keeps from the existing file. They record human decisions
|
|
623
|
+
// (intent, start date, completed deliverables, extra ordering, owner assignments) that cannot be
|
|
624
|
+
// derived from the catalogs or the timeline.
|
|
625
|
+
export function readPreservedFields(strategyPath) {
|
|
626
|
+
const ownerByLocalId = new Map();
|
|
627
|
+
if (!existsSync(strategyPath))
|
|
628
|
+
return { ownerByLocalId, approachRules: [] };
|
|
629
|
+
const doc = readYaml(strategyPath);
|
|
630
|
+
if (!isRecord(doc))
|
|
631
|
+
return { ownerByLocalId, approachRules: [] };
|
|
632
|
+
const approachRules = (Array.isArray(doc.approach_rules) ? doc.approach_rules : []).filter((rule) => isRecord(rule) && Array.isArray(rule.local_ids) && typeof rule.intent === "string");
|
|
633
|
+
for (const rule of Array.isArray(doc.owner_rules) ? doc.owner_rules : []) {
|
|
634
|
+
if (!isRecord(rule) || typeof rule.owner !== "string")
|
|
635
|
+
continue;
|
|
636
|
+
for (const localId of Array.isArray(rule.local_ids) ? rule.local_ids : []) {
|
|
637
|
+
if (typeof localId === "string")
|
|
638
|
+
ownerByLocalId.set(localId, rule.owner);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
const crossDeps = [];
|
|
642
|
+
for (const dep of Array.isArray(doc.cross_domain_dependencies)
|
|
643
|
+
? doc.cross_domain_dependencies
|
|
644
|
+
: []) {
|
|
645
|
+
if (!isRecord(dep))
|
|
646
|
+
continue;
|
|
647
|
+
if (typeof dep.dependent !== "string" || typeof dep.requires !== "string")
|
|
648
|
+
continue;
|
|
649
|
+
crossDeps.push({
|
|
650
|
+
dependent: dep.dependent,
|
|
651
|
+
requires: dep.requires,
|
|
652
|
+
...(typeof dep.note === "string" ? { note: dep.note } : {}),
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
const firstOwner = (field) => {
|
|
656
|
+
if (!Array.isArray(field))
|
|
657
|
+
return undefined;
|
|
658
|
+
const entry = field.find((item) => isRecord(item) && typeof item.owner === "string");
|
|
659
|
+
return isRecord(entry) && typeof entry.owner === "string" ? entry.owner : undefined;
|
|
660
|
+
};
|
|
661
|
+
const milestoneEntries = Array.isArray(doc.group_milestones)
|
|
662
|
+
? doc.group_milestones.map((item) => (isRecord(item) ? item.milestone : undefined))
|
|
663
|
+
: [];
|
|
664
|
+
const gateOwner = firstOwner(doc.phase_gates);
|
|
665
|
+
const milestoneOwner = firstOwner(milestoneEntries);
|
|
666
|
+
const passOwner = firstOwner(doc.cross_deliverable_passes);
|
|
667
|
+
return {
|
|
668
|
+
...(typeof doc.status === "string" ? { status: doc.status } : {}),
|
|
669
|
+
...(typeof doc.title === "string" ? { title: doc.title } : {}),
|
|
670
|
+
...(isRecord(doc.settings) ? { settings: doc.settings } : {}),
|
|
671
|
+
...(isRecord(doc.initial_state) ? { initial_state: doc.initial_state } : {}),
|
|
672
|
+
...(crossDeps.length > 0 ? { cross_domain_dependencies: crossDeps } : {}),
|
|
673
|
+
...(gateOwner ? { gateOwner } : {}),
|
|
674
|
+
...(milestoneOwner ? { milestoneOwner } : {}),
|
|
675
|
+
...(passOwner ? { passOwner } : {}),
|
|
676
|
+
ownerByLocalId,
|
|
677
|
+
approachRules,
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
export function loadStrategyDocument(strategyPath) {
|
|
681
|
+
if (!existsSync(strategyPath))
|
|
682
|
+
return null;
|
|
683
|
+
const doc = readYaml(strategyPath);
|
|
684
|
+
return isRecord(doc) ? doc : null;
|
|
685
|
+
}
|
|
686
|
+
// Complete generation pipeline used by the CLI and tests. Every input is re-read and validated
|
|
687
|
+
// before a candidate is returned; missing intent, grade, scope coverage, owners or references stop
|
|
688
|
+
// generation instead of producing a guessed strategy.
|
|
689
|
+
export function generateStrategy(opts) {
|
|
690
|
+
const errors = [];
|
|
691
|
+
const warnings = [];
|
|
692
|
+
const targetPath = strategyPathFor(opts.schedulePath, opts.track);
|
|
693
|
+
const existing = loadStrategyDocument(targetPath);
|
|
694
|
+
const preserved = readPreservedFields(targetPath);
|
|
695
|
+
const scope = resolveTrackScopeCatalogs({
|
|
696
|
+
repoRoot: opts.repoRoot,
|
|
697
|
+
catalogPath: opts.catalogPath,
|
|
698
|
+
timelinePath: opts.timelinePath,
|
|
699
|
+
track: opts.track,
|
|
700
|
+
existingStrategy: existing,
|
|
701
|
+
});
|
|
702
|
+
errors.push(...scope.errors);
|
|
703
|
+
warnings.push(...scope.warnings);
|
|
704
|
+
const strategyScope = {
|
|
705
|
+
strategyId: `${opts.projectId}:sch-strategy-${opts.track}`,
|
|
706
|
+
track: opts.track,
|
|
707
|
+
projectId: opts.projectId,
|
|
708
|
+
catalogs: scope.catalogs.map((catalog) => ({
|
|
709
|
+
id: catalog.id,
|
|
710
|
+
path: catalog.path,
|
|
711
|
+
...(catalog.local_ids ? { local_ids: catalog.local_ids } : {}),
|
|
712
|
+
})),
|
|
713
|
+
includeKinds: ["work"],
|
|
714
|
+
};
|
|
715
|
+
const current = collectApproachFacts({ repoRoot: opts.repoRoot, scope: strategyScope });
|
|
716
|
+
errors.push(...current.errors);
|
|
717
|
+
warnings.push(...current.warnings);
|
|
718
|
+
const catalogDeliverables = collectScopeDeliverables({
|
|
719
|
+
repoRoot: opts.repoRoot,
|
|
720
|
+
catalogs: scope.catalogs,
|
|
721
|
+
includeKinds: ["work"],
|
|
722
|
+
});
|
|
723
|
+
errors.push(...catalogDeliverables.errors);
|
|
724
|
+
const catalogByLocalId = new Map();
|
|
725
|
+
for (const deliverable of catalogDeliverables.deliverables) {
|
|
726
|
+
const previous = catalogByLocalId.get(deliverable.local_id);
|
|
727
|
+
if (previous) {
|
|
728
|
+
errors.push(`local_id '${deliverable.local_id}' が ${previous.catalog_id} と ${deliverable.catalog_id} で重複している。`);
|
|
729
|
+
continue;
|
|
730
|
+
}
|
|
731
|
+
catalogByLocalId.set(deliverable.local_id, deliverable);
|
|
732
|
+
}
|
|
733
|
+
const approaches = deriveApproaches({
|
|
734
|
+
facts: current.deliverables,
|
|
735
|
+
rules: preserved.approachRules,
|
|
736
|
+
});
|
|
737
|
+
errors.push(...approaches.errors);
|
|
738
|
+
warnings.push(...approaches.warnings);
|
|
739
|
+
const approachIds = new Set(approaches.deliverables.map((deliverable) => deliverable.local_id));
|
|
740
|
+
for (const localId of catalogByLocalId.keys()) {
|
|
741
|
+
if (!approachIds.has(localId))
|
|
742
|
+
errors.push(`${localId}: strategy profile の選択結果が無い。`);
|
|
743
|
+
}
|
|
744
|
+
if (opts.rolesPath && !existsSync(resolve(opts.repoRoot, opts.rolesPath))) {
|
|
745
|
+
errors.push(`roles_path が見つからない: ${opts.rolesPath}`);
|
|
746
|
+
}
|
|
747
|
+
const knownRoles = loadKnownRoles(opts.repoRoot, opts.rolesPath);
|
|
748
|
+
const owners = resolveDeliverableOwners({
|
|
749
|
+
localIds: [...catalogByLocalId.keys()],
|
|
750
|
+
overrides: opts.ownerOverrides ?? new Map(),
|
|
751
|
+
previous: preserved.ownerByLocalId,
|
|
752
|
+
...(opts.defaultOwner ? { defaultOwner: opts.defaultOwner } : {}),
|
|
753
|
+
...(knownRoles.size > 0 ? { knownRoles } : {}),
|
|
754
|
+
});
|
|
755
|
+
errors.push(...owners.errors);
|
|
756
|
+
warnings.push(...owners.warnings);
|
|
757
|
+
const gateOwner = opts.gateOwner ?? preserved.gateOwner ?? opts.defaultOwner ?? "";
|
|
758
|
+
const milestoneOwner = opts.milestoneOwner ?? preserved.milestoneOwner ?? opts.defaultOwner ?? gateOwner;
|
|
759
|
+
const passOwnerOverride = opts.passOwnerOverride ?? preserved.passOwner;
|
|
760
|
+
for (const [label, owner] of [
|
|
761
|
+
["gate", gateOwner],
|
|
762
|
+
["milestone", milestoneOwner],
|
|
763
|
+
["cross-deliverable pass", passOwnerOverride],
|
|
764
|
+
]) {
|
|
765
|
+
if (owner && knownRoles.size > 0 && !knownRoles.has(owner)) {
|
|
766
|
+
errors.push(`${label} owner '${owner}' は pm-roles.yaml に存在しない。`);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
const dependsOn = new Map(catalogDeliverables.deliverables.map((deliverable) => [
|
|
770
|
+
deliverable.local_id,
|
|
771
|
+
deliverable.depends_on,
|
|
772
|
+
]));
|
|
773
|
+
const built = buildStrategyDocument({
|
|
774
|
+
projectId: opts.projectId,
|
|
775
|
+
track: opts.track,
|
|
776
|
+
catalogs: scope.catalogs,
|
|
777
|
+
deliverables: approaches.deliverables,
|
|
778
|
+
dependsOn,
|
|
779
|
+
owners: owners.owners,
|
|
780
|
+
gateOwner,
|
|
781
|
+
milestoneOwner,
|
|
782
|
+
...(passOwnerOverride ? { passOwnerOverride } : {}),
|
|
783
|
+
bootstrapOrdering: opts.bootstrapOrdering ?? true,
|
|
784
|
+
includeKinds: ["work"],
|
|
785
|
+
preserved,
|
|
786
|
+
});
|
|
787
|
+
errors.push(...built.errors);
|
|
788
|
+
warnings.push(...built.warnings);
|
|
789
|
+
const strategySchemaErrors = validateStrategySchema(built.doc, opts.repoRoot);
|
|
790
|
+
errors.push(...strategySchemaErrors.map((error) => `sch-strategy-${opts.track}.yaml${error}`));
|
|
791
|
+
const content = dumpStrategy(built.doc);
|
|
792
|
+
if (errors.length > 0) {
|
|
793
|
+
return { doc: null, content, taskCount: 0, milestoneIds: [], errors, warnings };
|
|
794
|
+
}
|
|
795
|
+
const dryRun = dryRunStrategy({
|
|
796
|
+
repoRoot: opts.repoRoot,
|
|
797
|
+
schedulePath: opts.schedulePath,
|
|
798
|
+
track: opts.track,
|
|
799
|
+
projectId: opts.projectId,
|
|
800
|
+
content,
|
|
801
|
+
});
|
|
802
|
+
errors.push(...dryRun.errors);
|
|
803
|
+
warnings.push(...dryRun.warnings);
|
|
804
|
+
return {
|
|
805
|
+
doc: errors.length === 0 ? built.doc : null,
|
|
806
|
+
content,
|
|
807
|
+
taskCount: dryRun.taskCount,
|
|
808
|
+
milestoneIds: dryRun.milestoneIds,
|
|
809
|
+
errors,
|
|
810
|
+
warnings,
|
|
811
|
+
};
|
|
812
|
+
}
|