specdojo 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +82 -38
- 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 +980 -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 +45 -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 +15 -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 +55 -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 +473 -0
- package/docs/ja/specdojo/guides/register-operation-guide.md +418 -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 +120 -24
- 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/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/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/dist/exec-schedule-timeline-render.js +0 -201
- package/dist/exec-schedule-timeline.js +0 -2
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
3
|
+
import yaml from "js-yaml";
|
|
4
|
+
import { readSpecdojoNamespace } from "./frontmatter-namespace.js";
|
|
5
|
+
import { specdojoDirectoryPaths, specdojoReferencePath, } from "./template-resolution.js";
|
|
6
|
+
const SKIP_DIRS = new Set(["node_modules", "dist", ".vitepress", "out"]);
|
|
7
|
+
const FILE_RE = /\.(md|yaml|yml)$/;
|
|
8
|
+
const DOC_ID_RE = /^[a-z][a-z0-9:_-]+$/;
|
|
9
|
+
const KATA_RELATIVE_DIRS = [
|
|
10
|
+
"docs/ja/specdojo/rulebooks",
|
|
11
|
+
"docs/ja/specdojo/standards",
|
|
12
|
+
"docs/ja/specdojo/recipes",
|
|
13
|
+
"docs/ja/specdojo/samples",
|
|
14
|
+
"docs/ja/specdojo/templates",
|
|
15
|
+
];
|
|
16
|
+
class DuplicateDocIdError extends Error {
|
|
17
|
+
}
|
|
18
|
+
// scanRelPath(scan ルート相対)先頭ディレクトリが locales に含まれればそのロケール、
|
|
19
|
+
// そうでなければ言語中立(null)を返す。locales 空なら常に中立(従来動作)。
|
|
20
|
+
function localeOfScanPath(scanRelPath, locales) {
|
|
21
|
+
if (locales.size === 0)
|
|
22
|
+
return null;
|
|
23
|
+
const first = scanRelPath.split("/")[0];
|
|
24
|
+
return locales.has(first) ? first : null;
|
|
25
|
+
}
|
|
26
|
+
function addId(collector, id, path, locale) {
|
|
27
|
+
let record = collector.get(id);
|
|
28
|
+
if (!record) {
|
|
29
|
+
record = { neutral: [], byLocale: new Map() };
|
|
30
|
+
collector.set(id, record);
|
|
31
|
+
}
|
|
32
|
+
if (locale === null) {
|
|
33
|
+
if (!record.neutral.some((source) => source.path === path))
|
|
34
|
+
record.neutral.push({ path });
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const sources = record.byLocale.get(locale) ?? [];
|
|
38
|
+
if (!sources.some((source) => source.path === path))
|
|
39
|
+
sources.push({ path });
|
|
40
|
+
record.byLocale.set(locale, sources);
|
|
41
|
+
}
|
|
42
|
+
function sourcePaths(record) {
|
|
43
|
+
return [
|
|
44
|
+
...record.neutral.map((source) => source.path),
|
|
45
|
+
...[...record.byLocale.values()].flatMap((sources) => sources.map((source) => source.path)),
|
|
46
|
+
].sort();
|
|
47
|
+
}
|
|
48
|
+
// 重複は走査中に即時エラーにせず、スコープ全体を収集してから判定する。
|
|
49
|
+
// これにより 3 件以上衝突した場合もエラーへ全ファイルパスを表示できる。
|
|
50
|
+
function assertNoDuplicateIds(collector) {
|
|
51
|
+
for (const [id, record] of collector) {
|
|
52
|
+
if (record.neutral.length > 0 && record.byLocale.size > 0) {
|
|
53
|
+
throw new DuplicateDocIdError(`Duplicate document ID "${id}": ${sourcePaths(record).join(", ")} (mixed language-neutral and localized)`);
|
|
54
|
+
}
|
|
55
|
+
if (record.neutral.length > 1) {
|
|
56
|
+
throw new DuplicateDocIdError(`Duplicate document ID "${id}": ${sourcePaths(record).join(", ")}`);
|
|
57
|
+
}
|
|
58
|
+
for (const [locale, sources] of record.byLocale) {
|
|
59
|
+
if (sources.length > 1) {
|
|
60
|
+
throw new DuplicateDocIdError(`Duplicate document ID "${id}" in locale "${locale}": ${sources
|
|
61
|
+
.map((source) => source.path)
|
|
62
|
+
.sort()
|
|
63
|
+
.join(", ")}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// 収集器から出力用の { entries(既定言語のフラット map), localized } を構築する。
|
|
69
|
+
function buildIndexMaps(collector, localeOrder) {
|
|
70
|
+
const entries = {};
|
|
71
|
+
const localized = {};
|
|
72
|
+
for (const id of [...collector.keys()].sort()) {
|
|
73
|
+
const record = collector.get(id);
|
|
74
|
+
if (record.neutral.length > 0) {
|
|
75
|
+
entries[id] = record.neutral[0].path;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const localeMap = {};
|
|
79
|
+
for (const locale of [...record.byLocale.keys()].sort()) {
|
|
80
|
+
localeMap[locale] = record.byLocale.get(locale)[0].path;
|
|
81
|
+
}
|
|
82
|
+
localized[id] = localeMap;
|
|
83
|
+
const defaultLocale = localeOrder.find((locale) => record.byLocale.has(locale)) ?? Object.keys(localeMap)[0];
|
|
84
|
+
entries[id] = localeMap[defaultLocale];
|
|
85
|
+
}
|
|
86
|
+
return { entries, localized };
|
|
87
|
+
}
|
|
88
|
+
// ---- Markdown frontmatter ----------------------------------------------
|
|
89
|
+
function extractIdFromMarkdown(content) {
|
|
90
|
+
// Markdown frontmatter の id は `specdojo:` 名前空間配下にある。
|
|
91
|
+
const id = readSpecdojoNamespace(content).id;
|
|
92
|
+
return typeof id === "string" ? id.trim() : undefined;
|
|
93
|
+
}
|
|
94
|
+
// ---- YAML top-level id -------------------------------------------------
|
|
95
|
+
function extractTopLevelId(parsed) {
|
|
96
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
97
|
+
return undefined;
|
|
98
|
+
const record = parsed;
|
|
99
|
+
const id = record["id"];
|
|
100
|
+
if (typeof id === "string" && DOC_ID_RE.test(id))
|
|
101
|
+
return id;
|
|
102
|
+
// OpenAPI / AsyncAPI 形式(ifx-* 等)はトップレベルに独自キーを置けないため、
|
|
103
|
+
// specdojo:document-metadata-standard に従い x-spec-meta.id をメタ情報の正本とする。
|
|
104
|
+
const specMeta = record["x-spec-meta"];
|
|
105
|
+
if (specMeta && typeof specMeta === "object" && !Array.isArray(specMeta)) {
|
|
106
|
+
const nestedId = specMeta["id"];
|
|
107
|
+
if (typeof nestedId === "string" && DOC_ID_RE.test(nestedId))
|
|
108
|
+
return nestedId;
|
|
109
|
+
}
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
// ---- dot-path resolution (arrays auto-expanded) ------------------------
|
|
113
|
+
function resolveItems(obj, fieldPath) {
|
|
114
|
+
if (fieldPath.length === 0) {
|
|
115
|
+
if (Array.isArray(obj))
|
|
116
|
+
return obj;
|
|
117
|
+
return obj !== undefined && obj !== null ? [obj] : [];
|
|
118
|
+
}
|
|
119
|
+
if (Array.isArray(obj)) {
|
|
120
|
+
return obj.flatMap((item) => resolveItems(item, fieldPath));
|
|
121
|
+
}
|
|
122
|
+
if (!obj || typeof obj !== "object")
|
|
123
|
+
return [];
|
|
124
|
+
const [head, ...rest] = fieldPath;
|
|
125
|
+
return resolveItems(obj[head], rest);
|
|
126
|
+
}
|
|
127
|
+
// ---- line number lookup ------------------------------------------------
|
|
128
|
+
function findIdLine(lines, id, idKey = "id") {
|
|
129
|
+
const escaped = idKey.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
130
|
+
const re = new RegExp(`^\\s*(?:-\\s+)?${escaped}:\\s*(.+)$`);
|
|
131
|
+
for (let i = 0; i < lines.length; i++) {
|
|
132
|
+
const m = lines[i].match(re);
|
|
133
|
+
if (m && m[1].trim() === id) {
|
|
134
|
+
return i + 1; // 1-based
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return 1;
|
|
138
|
+
}
|
|
139
|
+
// ---- nested id collection ----------------------------------------------
|
|
140
|
+
function collectFromFields(parsed, specs, fileRelPath, content, collector, locale) {
|
|
141
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
142
|
+
return;
|
|
143
|
+
const lines = content.split("\n");
|
|
144
|
+
for (const spec of specs) {
|
|
145
|
+
const idKey = spec.id_field ?? "id";
|
|
146
|
+
const pathKey = spec.path_field ?? "path";
|
|
147
|
+
const fieldPath = spec.field.split(".");
|
|
148
|
+
const items = resolveItems(parsed, fieldPath);
|
|
149
|
+
for (const item of items) {
|
|
150
|
+
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
151
|
+
continue;
|
|
152
|
+
const itemRec = item;
|
|
153
|
+
const id = itemRec[idKey];
|
|
154
|
+
if (typeof id !== "string" || !DOC_ID_RE.test(id))
|
|
155
|
+
continue;
|
|
156
|
+
const pathVal = itemRec[pathKey];
|
|
157
|
+
if (typeof pathVal === "string" && pathVal.trim()) {
|
|
158
|
+
// item has a path field → use it as the index target (no line number)
|
|
159
|
+
addId(collector, id, pathVal.trim(), locale);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
// no path → use file:line
|
|
163
|
+
const lineNum = findIdLine(lines, id, idKey);
|
|
164
|
+
addId(collector, id, `${fileRelPath}:${lineNum}`, locale);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// ---- file scanning -----------------------------------------------------
|
|
170
|
+
function scanFile(fullPath, rootDir, repoRoot, collector, nestedMap, locales, localeOverride) {
|
|
171
|
+
// nestedMap keys are rootDir-relative; entry values are repoRoot-relative
|
|
172
|
+
const scanRelPath = relative(rootDir, fullPath).replace(/\\/g, "/");
|
|
173
|
+
const entryPath = specdojoReferencePath(fullPath, { repositoryRoot: repoRoot });
|
|
174
|
+
const locale = localeOverride ?? localeOfScanPath(scanRelPath, locales);
|
|
175
|
+
const isYaml = !fullPath.endsWith(".md");
|
|
176
|
+
try {
|
|
177
|
+
const content = readFileSync(fullPath, "utf8");
|
|
178
|
+
if (isYaml) {
|
|
179
|
+
const parsed = yaml.load(content);
|
|
180
|
+
const topId = extractTopLevelId(parsed);
|
|
181
|
+
if (topId)
|
|
182
|
+
addId(collector, topId, entryPath, locale);
|
|
183
|
+
const specs = nestedMap.get(scanRelPath);
|
|
184
|
+
if (specs && specs.length > 0) {
|
|
185
|
+
collectFromFields(parsed, specs, entryPath, content, collector, locale);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
const id = extractIdFromMarkdown(content);
|
|
190
|
+
if (id && DOC_ID_RE.test(id))
|
|
191
|
+
addId(collector, id, entryPath, locale);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
if (error instanceof DuplicateDocIdError)
|
|
196
|
+
throw error;
|
|
197
|
+
// ignore unreadable / unparseable files
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function walkDir(dir, rootDir, repoRoot, collector, nestedMap, locales, localeOverride) {
|
|
201
|
+
let items;
|
|
202
|
+
try {
|
|
203
|
+
items = readdirSync(dir);
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
for (const item of items) {
|
|
209
|
+
if (item.startsWith("."))
|
|
210
|
+
continue;
|
|
211
|
+
const full = join(dir, item);
|
|
212
|
+
if (SKIP_DIRS.has(item))
|
|
213
|
+
continue;
|
|
214
|
+
if (item === "generated" && !isControlsGeneratedDir(full, rootDir))
|
|
215
|
+
continue;
|
|
216
|
+
let st;
|
|
217
|
+
try {
|
|
218
|
+
st = statSync(full);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
if (st.isDirectory()) {
|
|
224
|
+
walkDir(full, rootDir, repoRoot, collector, nestedMap, locales, localeOverride);
|
|
225
|
+
}
|
|
226
|
+
else if (FILE_RE.test(item)) {
|
|
227
|
+
scanFile(full, rootDir, repoRoot, collector, nestedMap, locales, localeOverride);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// generated/ は原則として索引対象外だが、controls 配下の管理ビューは文書 ID の正式な
|
|
232
|
+
// 解決先として扱う。特に project-register/generated/pjr-index.md は個票から生成される
|
|
233
|
+
// プロジェクト登録台帳の本体であり、追跡対象の案内ページを必要としない。
|
|
234
|
+
function isControlsGeneratedDir(dir, rootDir) {
|
|
235
|
+
const rel = relative(rootDir, dir).replace(/\\/g, "/");
|
|
236
|
+
return /(?:^|\/)controls(?:\/[^/]+)*\/generated$/.test(rel);
|
|
237
|
+
}
|
|
238
|
+
// index build 単独実行時に controls の生成物が欠落しても、未解決 ID のまま成功させない。
|
|
239
|
+
// 通常の `specdojo build` は register build → index build の順なので、この検査を満たす。
|
|
240
|
+
export function assertControlGeneratedIndexes(rootDir) {
|
|
241
|
+
const missing = [];
|
|
242
|
+
const visit = (dir) => {
|
|
243
|
+
let items;
|
|
244
|
+
try {
|
|
245
|
+
items = readdirSync(dir);
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const rel = relative(rootDir, dir).replace(/\\/g, "/");
|
|
251
|
+
if (/(?:^|\/)controls\/project-register$/.test(rel)) {
|
|
252
|
+
const generatedIndex = join(dir, "generated", "pjr-index.md");
|
|
253
|
+
let valid = false;
|
|
254
|
+
if (existsSync(generatedIndex)) {
|
|
255
|
+
try {
|
|
256
|
+
const id = readSpecdojoNamespace(readFileSync(generatedIndex, "utf8")).id;
|
|
257
|
+
valid = typeof id === "string" && id.endsWith(":pjr-index");
|
|
258
|
+
}
|
|
259
|
+
catch {
|
|
260
|
+
valid = false;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (!valid)
|
|
264
|
+
missing.push(relative(rootDir, generatedIndex));
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
for (const item of items) {
|
|
268
|
+
if (item.startsWith(".") || SKIP_DIRS.has(item) || item === "generated")
|
|
269
|
+
continue;
|
|
270
|
+
const full = join(dir, item);
|
|
271
|
+
try {
|
|
272
|
+
if (statSync(full).isDirectory())
|
|
273
|
+
visit(full);
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
// unreadable entries are ignored consistently with the main scanner
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
visit(rootDir);
|
|
281
|
+
if (missing.length > 0) {
|
|
282
|
+
throw new Error(`Generated project register index is missing or invalid: ${missing.join(", ")}\n` +
|
|
283
|
+
"Run: specdojo register build before specdojo index build");
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
// ---- config loading ----------------------------------------------------
|
|
287
|
+
const DEFAULT_CONFIG_REL = ".specdojo/index-config.yaml";
|
|
288
|
+
function loadIndexConfig(repoRoot, configPath) {
|
|
289
|
+
const p = join(repoRoot, configPath ?? DEFAULT_CONFIG_REL);
|
|
290
|
+
if (!existsSync(p))
|
|
291
|
+
return {};
|
|
292
|
+
try {
|
|
293
|
+
const parsed = yaml.load(readFileSync(p, "utf8"));
|
|
294
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
295
|
+
return parsed;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
// ignore
|
|
300
|
+
}
|
|
301
|
+
return {};
|
|
302
|
+
}
|
|
303
|
+
// ---- public API --------------------------------------------------------
|
|
304
|
+
// Scans docs and returns { entries, localized } without writing a file.
|
|
305
|
+
// Used both by buildDocIndex and by validators that need a fresh ID universe
|
|
306
|
+
// (avoids depending on a possibly-stale .specdojo/doc-index.json).
|
|
307
|
+
export function collectDocIndex(rootDir, repoRoot, configPath, options = {}) {
|
|
308
|
+
const config = loadIndexConfig(repoRoot, configPath);
|
|
309
|
+
// Build nested map: scan-root-relative path → collect_from specs
|
|
310
|
+
// Config `file` values are repo-root-relative; convert to scan-root-relative
|
|
311
|
+
const nestedMap = new Map();
|
|
312
|
+
for (const entry of config.nested_id_files ?? []) {
|
|
313
|
+
if (entry.file && Array.isArray(entry.collect_from)) {
|
|
314
|
+
const absPath = join(repoRoot, entry.file);
|
|
315
|
+
const scanRelPath = relative(rootDir, absPath).replace(/\\/g, "/");
|
|
316
|
+
nestedMap.set(scanRelPath, entry.collect_from);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
const localeOrder = (config.locales ?? []).filter((locale) => typeof locale === "string" && locale.length > 0);
|
|
320
|
+
const locales = new Set(localeOrder);
|
|
321
|
+
const repositoryCollector = new Map();
|
|
322
|
+
walkDir(rootDir, rootDir, repoRoot, repositoryCollector, nestedMap, locales);
|
|
323
|
+
assertNoDuplicateIds(repositoryCollector);
|
|
324
|
+
// resolver が返す package 側の ejectable kata ディレクトリだけを走査する。
|
|
325
|
+
// 利用リポジトリ側は rootDir の走査に含まれるため除外し、node_modules 全体は辿らない。
|
|
326
|
+
const resourceRoots = options.resourceRoots ?? {};
|
|
327
|
+
const roots = { ...resourceRoots, repositoryRoot: resourceRoots.repositoryRoot ?? repoRoot };
|
|
328
|
+
const packageCollector = new Map();
|
|
329
|
+
if (options.includeBundledKata !== false) {
|
|
330
|
+
for (const relativeDir of KATA_RELATIVE_DIRS) {
|
|
331
|
+
const repositoryDir = resolve(roots.repositoryRoot, relativeDir);
|
|
332
|
+
const packageDirs = specdojoDirectoryPaths(relativeDir, roots).filter((directory) => resolve(directory) !== repositoryDir);
|
|
333
|
+
for (const packageDir of packageDirs) {
|
|
334
|
+
walkDir(packageDir, packageDir, repoRoot, packageCollector, new Map(), locales, locales.has("ja") ? "ja" : undefined);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
assertNoDuplicateIds(packageCollector);
|
|
339
|
+
// 同一 ID が両スコープにある場合は eject 済みの利用リポジトリ側を採用する。
|
|
340
|
+
// 走査順ではなくスコープで優先順位を決めるため、結果は決定的になる。
|
|
341
|
+
const mergedCollector = new Map(packageCollector);
|
|
342
|
+
for (const [id, record] of repositoryCollector)
|
|
343
|
+
mergedCollector.set(id, record);
|
|
344
|
+
return buildIndexMaps(mergedCollector, localeOrder);
|
|
345
|
+
}
|
|
346
|
+
// Scans docs and returns the flat id → path entries (default locale per id).
|
|
347
|
+
export function collectDocIndexEntries(rootDir, repoRoot, configPath, options = {}) {
|
|
348
|
+
return collectDocIndex(rootDir, repoRoot, configPath, options).entries;
|
|
349
|
+
}
|
|
350
|
+
export function buildDocIndex(rootDir, outputPath, repoRoot, configPath, options = {}) {
|
|
351
|
+
const { entries, localized } = collectDocIndex(rootDir, repoRoot, configPath, options);
|
|
352
|
+
const index = {
|
|
353
|
+
version: 1,
|
|
354
|
+
entries,
|
|
355
|
+
...(Object.keys(localized).length > 0 ? { localized } : {}),
|
|
356
|
+
};
|
|
357
|
+
const outDir = dirname(outputPath);
|
|
358
|
+
if (!existsSync(outDir))
|
|
359
|
+
mkdirSync(outDir, { recursive: true });
|
|
360
|
+
writeFileSync(outputPath, JSON.stringify(index, null, 2), "utf8");
|
|
361
|
+
return { count: Object.keys(entries).length };
|
|
362
|
+
}
|
|
363
|
+
export function lookupDocIndex(id, indexPath) {
|
|
364
|
+
if (!existsSync(indexPath))
|
|
365
|
+
return undefined;
|
|
366
|
+
const data = JSON.parse(readFileSync(indexPath, "utf8"));
|
|
367
|
+
return data.entries[id];
|
|
368
|
+
}
|
|
369
|
+
function readDocIndex(indexPath) {
|
|
370
|
+
if (!existsSync(indexPath))
|
|
371
|
+
return null;
|
|
372
|
+
return JSON.parse(readFileSync(indexPath, "utf8"));
|
|
373
|
+
}
|
|
374
|
+
function replacementForResolvedRef(id, title, path, format) {
|
|
375
|
+
// path format: emit the canonical repo-relative path verbatim (tools/agents open it
|
|
376
|
+
// from the run CWD). markdown format: emit a root-relative link (leading slash) so it
|
|
377
|
+
// resolves against the site/repo root from any file depth (VitePress resolves a leading
|
|
378
|
+
// slash against srcDir); a bare relative link would break from nested documents.
|
|
379
|
+
if (format === "path")
|
|
380
|
+
return path;
|
|
381
|
+
const href = path.startsWith("/") ? path : `/${path}`;
|
|
382
|
+
return `[${title ?? id}](${href})`;
|
|
383
|
+
}
|
|
384
|
+
function parseWikiRef(rawRef) {
|
|
385
|
+
const separatorIndex = rawRef.indexOf("|");
|
|
386
|
+
if (separatorIndex === -1)
|
|
387
|
+
return { id: rawRef.trim() };
|
|
388
|
+
const id = rawRef.slice(0, separatorIndex).trim();
|
|
389
|
+
const title = rawRef.slice(separatorIndex + 1).trim();
|
|
390
|
+
return title ? { id, title } : { id };
|
|
391
|
+
}
|
|
392
|
+
// Matches, in priority order: a fenced code block (3+ backticks/tildes), an
|
|
393
|
+
// inline code span (1+ backticks), or a [[id]] wiki reference. Code constructs
|
|
394
|
+
// are captured so [[id]] examples inside them stay literal (a rulebook may show
|
|
395
|
+
// the [[id|title]] syntax in backticks; those are not real references).
|
|
396
|
+
const DOC_REF_OR_CODE = /(?<fence>(?<fenceMarker>`{3,}|~{3,})[\s\S]*?\k<fenceMarker>)|(?<inline>(?<inlineMarker>`+)[\s\S]*?\k<inlineMarker>)|\[\[(?<ref>[^\]\n]+)\]\]/g;
|
|
397
|
+
export function replaceDocIndexRefs(content, indexPath, options = {}) {
|
|
398
|
+
const format = options.format ?? "markdown";
|
|
399
|
+
const missing = options.missing ?? "keep";
|
|
400
|
+
const missingMarker = options.missingMarker ?? "_MISSING_";
|
|
401
|
+
const lang = options.lang;
|
|
402
|
+
const index = readDocIndex(indexPath);
|
|
403
|
+
const missingIds = new Set();
|
|
404
|
+
const replaced = content.replace(DOC_REF_OR_CODE, (match, ...args) => {
|
|
405
|
+
const groups = args[args.length - 1];
|
|
406
|
+
// Code regions: keep verbatim so [[id]] inside them is neither rewritten nor
|
|
407
|
+
// reported as missing.
|
|
408
|
+
if (groups.ref === undefined)
|
|
409
|
+
return match;
|
|
410
|
+
const { id, title } = parseWikiRef(groups.ref);
|
|
411
|
+
// 参照元の言語が指定されていれば同一言語の variant を優先し、
|
|
412
|
+
// 無ければ既定言語(entries)へフォールバックする。
|
|
413
|
+
const localizedPath = lang ? index?.localized?.[id]?.[lang] : undefined;
|
|
414
|
+
const path = localizedPath ?? index?.entries[id];
|
|
415
|
+
if (path)
|
|
416
|
+
return replacementForResolvedRef(id, title, path, format);
|
|
417
|
+
missingIds.add(id);
|
|
418
|
+
return missing === "marker" ? missingMarker : match;
|
|
419
|
+
});
|
|
420
|
+
return {
|
|
421
|
+
content: replaced,
|
|
422
|
+
missingIds: [...missingIds],
|
|
423
|
+
};
|
|
424
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { listFilesRecursive, readYaml } from "./exec-shared.js";
|
|
4
|
+
import { specdojoRootDir, } from "./specdojo-config.js";
|
|
5
|
+
import { resolveParentValidationDefinitions } from "./exec-parent-validation.js";
|
|
6
|
+
const PLACEHOLDER_PATTERN = /\{([a-z][a-z0-9_]*)\}/g;
|
|
7
|
+
const BUILTIN_VARIABLE_NAMES = new Set(["nickname", "mode", "proficiency"]);
|
|
8
|
+
// Mirror of the nickname pattern in docs/specdojo/schemas/v1/pm-members.schema.yaml
|
|
9
|
+
// ($defs.Member.nickname). Defense in depth: a nickname is expanded into a provider's
|
|
10
|
+
// command_template and the result is executed with { shell: true }. loadMemberRoster reads
|
|
11
|
+
// pm-members.yaml without schema validation, so a roster edited to carry shell metacharacters
|
|
12
|
+
// in a nickname could inject an arbitrary command. Re-check the value here, at the point where
|
|
13
|
+
// it enters the command, and refuse to build a command for a nickname that the schema would
|
|
14
|
+
// have rejected. Keep this pattern byte-for-byte in sync with the schema.
|
|
15
|
+
const NICKNAME_PATTERN = /^[a-z0-9][a-z0-9_-]{0,62}$/;
|
|
16
|
+
// True when the member has any command source: an explicit override or a provider
|
|
17
|
+
// command_template. Used to filter selectable agents without expanding the template.
|
|
18
|
+
export function hasMemberCommandSource(config, member) {
|
|
19
|
+
if (member.command?.trim())
|
|
20
|
+
return true;
|
|
21
|
+
if (!member.provider)
|
|
22
|
+
return false;
|
|
23
|
+
return Boolean(config.providers?.[member.provider]?.command_template);
|
|
24
|
+
}
|
|
25
|
+
function buildCommandVariables(provider, member, params) {
|
|
26
|
+
const variables = new Map();
|
|
27
|
+
if (!NICKNAME_PATTERN.test(member.nickname)) {
|
|
28
|
+
throw new Error(`Invalid nickname ${JSON.stringify(member.nickname)} for provider ${provider}: ` +
|
|
29
|
+
`must match ${NICKNAME_PATTERN.source} (pm-members.schema.yaml). ` +
|
|
30
|
+
`nickname is expanded into command_template and executed with shell: true; ` +
|
|
31
|
+
`refusing to build a command.`);
|
|
32
|
+
}
|
|
33
|
+
variables.set("nickname", member.nickname);
|
|
34
|
+
if (member.mode)
|
|
35
|
+
variables.set("mode", member.mode);
|
|
36
|
+
if (member.proficiency)
|
|
37
|
+
variables.set("proficiency", member.proficiency);
|
|
38
|
+
const byMode = member.mode ? params?.by_mode?.[member.mode] : undefined;
|
|
39
|
+
const byProficiency = member.proficiency
|
|
40
|
+
? params?.by_proficiency?.[member.proficiency]
|
|
41
|
+
: undefined;
|
|
42
|
+
const byNickname = params?.by_nickname?.[member.nickname];
|
|
43
|
+
// Built-in collision checks look at the full tables (not just the member's rows) so a
|
|
44
|
+
// broken definition fails for every member of the provider, not only for some attributes.
|
|
45
|
+
const modeKeys = Object.values(params?.by_mode ?? {}).flatMap((set) => Object.keys(set ?? {}));
|
|
46
|
+
const proficiencyKeys = Object.values(params?.by_proficiency ?? {}).flatMap((set) => Object.keys(set ?? {}));
|
|
47
|
+
const nicknameKeys = Object.values(params?.by_nickname ?? {}).flatMap((set) => Object.keys(set ?? {}));
|
|
48
|
+
for (const key of [...modeKeys, ...proficiencyKeys, ...nicknameKeys]) {
|
|
49
|
+
if (BUILTIN_VARIABLE_NAMES.has(key)) {
|
|
50
|
+
throw new Error(`exec-defaults providers.${provider}.command_params must not redefine built-in variable {${key}}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
for (const [key, value] of Object.entries(byMode ?? {}))
|
|
54
|
+
variables.set(key, value);
|
|
55
|
+
for (const [key, value] of Object.entries(byProficiency ?? {}))
|
|
56
|
+
variables.set(key, value);
|
|
57
|
+
for (const [key, value] of Object.entries(byNickname ?? {}))
|
|
58
|
+
variables.set(key, value);
|
|
59
|
+
return variables;
|
|
60
|
+
}
|
|
61
|
+
// Resolve the shell command that launches a member's agent. Returns undefined when the
|
|
62
|
+
// member has neither a command override nor a provider command_template (such a member is
|
|
63
|
+
// not runnable by exec run). Throws when a template exists but cannot be fully expanded,
|
|
64
|
+
// so a broken definition surfaces as an error instead of launching a malformed command.
|
|
65
|
+
export function resolveMemberCommand(config, member) {
|
|
66
|
+
const override = member.command?.trim();
|
|
67
|
+
if (override)
|
|
68
|
+
return override;
|
|
69
|
+
const provider = member.provider;
|
|
70
|
+
const template = provider ? config.providers?.[provider]?.command_template : undefined;
|
|
71
|
+
if (!provider || !template)
|
|
72
|
+
return undefined;
|
|
73
|
+
const variables = buildCommandVariables(provider, member, config.providers?.[provider]?.command_params);
|
|
74
|
+
const expanded = template.replace(PLACEHOLDER_PATTERN, (match, name) => {
|
|
75
|
+
return variables.get(name) ?? match;
|
|
76
|
+
});
|
|
77
|
+
const unresolved = [...expanded.matchAll(PLACEHOLDER_PATTERN)].map((m) => m[0]);
|
|
78
|
+
if (unresolved.length > 0) {
|
|
79
|
+
throw new Error(`Cannot resolve ${[...new Set(unresolved)].join(", ")} in providers.${provider}.command_template for member ${member.nickname} (mode: ${member.mode ?? "-"}, proficiency: ${member.proficiency ?? "-"})`);
|
|
80
|
+
}
|
|
81
|
+
return expanded;
|
|
82
|
+
}
|
|
83
|
+
// ── Provider resolution ─────────────────────────────────────────────────────
|
|
84
|
+
// Detection and policy are resolved independently: a provider override for one
|
|
85
|
+
// key does not drop the global value for the other.
|
|
86
|
+
export function resolveRateLimitDetection(config, provider) {
|
|
87
|
+
const override = provider ? config.providers?.[provider]?.rate_limit_detection : undefined;
|
|
88
|
+
return override ?? config.rate_limit_detection;
|
|
89
|
+
}
|
|
90
|
+
export function resolveRateLimitPolicy(config, provider) {
|
|
91
|
+
const override = provider ? config.providers?.[provider]?.rate_limit_policy : undefined;
|
|
92
|
+
return override ?? config.rate_limit_policy;
|
|
93
|
+
}
|
|
94
|
+
// Resolve a provider's concurrency cap, validating the YAML-sourced value. A missing,
|
|
95
|
+
// non-integer, or non-positive value means "no limit" (returns undefined).
|
|
96
|
+
export function resolveMaxConcurrency(config, provider) {
|
|
97
|
+
if (!provider)
|
|
98
|
+
return undefined;
|
|
99
|
+
const raw = config.providers?.[provider]?.max_concurrency;
|
|
100
|
+
if (typeof raw !== "number" || !Number.isInteger(raw) || raw <= 0)
|
|
101
|
+
return undefined;
|
|
102
|
+
return raw;
|
|
103
|
+
}
|
|
104
|
+
export function createProviderCapacityTracker(config) {
|
|
105
|
+
const counts = new Map();
|
|
106
|
+
return {
|
|
107
|
+
hasCapacity(provider) {
|
|
108
|
+
const cap = resolveMaxConcurrency(config, provider);
|
|
109
|
+
if (cap === undefined || !provider)
|
|
110
|
+
return true;
|
|
111
|
+
return (counts.get(provider) ?? 0) < cap;
|
|
112
|
+
},
|
|
113
|
+
reserve(provider) {
|
|
114
|
+
if (!provider)
|
|
115
|
+
return;
|
|
116
|
+
counts.set(provider, (counts.get(provider) ?? 0) + 1);
|
|
117
|
+
},
|
|
118
|
+
release(provider) {
|
|
119
|
+
if (!provider)
|
|
120
|
+
return;
|
|
121
|
+
const next = (counts.get(provider) ?? 0) - 1;
|
|
122
|
+
if (next > 0)
|
|
123
|
+
counts.set(provider, next);
|
|
124
|
+
else
|
|
125
|
+
counts.delete(provider);
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
// ── Loaders ───────────────────────────────────────────────────────────────────
|
|
130
|
+
export function defaultExecDefaultsPath() {
|
|
131
|
+
return join(specdojoRootDir(), ".specdojo", "exec-defaults.yaml");
|
|
132
|
+
}
|
|
133
|
+
function legacyAgentConfigPath() {
|
|
134
|
+
return join(specdojoRootDir(), ".specdojo", "exec-agent.yaml");
|
|
135
|
+
}
|
|
136
|
+
function loadLegacyRateLimitPolicy(executionPath) {
|
|
137
|
+
if (!executionPath || !existsSync(executionPath))
|
|
138
|
+
return undefined;
|
|
139
|
+
const files = listFilesRecursive(executionPath).filter((f) => /exec-strategy-.*\.(yaml|yml)$/.test(f));
|
|
140
|
+
for (const file of files) {
|
|
141
|
+
let raw;
|
|
142
|
+
try {
|
|
143
|
+
raw = readYaml(file);
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (raw?.rate_limit_policy)
|
|
149
|
+
return raw.rate_limit_policy;
|
|
150
|
+
}
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
export function loadExecDefaultsConfig(configPath, executionPath) {
|
|
154
|
+
const path = configPath ?? defaultExecDefaultsPath();
|
|
155
|
+
let defaults = {};
|
|
156
|
+
if (existsSync(path)) {
|
|
157
|
+
defaults = readYaml(path) ?? {};
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
const legacyPath = legacyAgentConfigPath();
|
|
161
|
+
if (existsSync(legacyPath)) {
|
|
162
|
+
defaults = readYaml(legacyPath) ?? {};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (!defaults.rate_limit_policy) {
|
|
166
|
+
const legacyPolicy = loadLegacyRateLimitPolicy(executionPath);
|
|
167
|
+
if (legacyPolicy)
|
|
168
|
+
defaults.rate_limit_policy = legacyPolicy;
|
|
169
|
+
}
|
|
170
|
+
resolveParentValidationDefinitions(defaults.pipeline?.parent_validations);
|
|
171
|
+
return defaults;
|
|
172
|
+
}
|