specdojo 0.7.0 → 0.9.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/.github/agents/specdojo-orchestrator.md +7 -3
- package/CHANGELOG.md +217 -0
- package/dist/catalog/build.js +24 -1
- package/dist/catalog/catalog.js +16 -14
- package/dist/catalog/plan.js +1 -1
- package/dist/catalog/scaffold.js +4 -1
- package/dist/commands/agent.js +5 -3
- package/dist/commands/build.js +69 -10
- package/dist/commands/git.js +206 -0
- package/dist/commands/init.js +9 -3
- package/dist/commands/night-orchestrator.js +6 -4
- package/dist/commands/where.js +25 -0
- package/dist/dashboard/dashboard-timeline.js +18 -16
- package/dist/dashboard/dashboard.js +616 -261
- package/dist/dashboard/epic-plan.js +81 -0
- package/dist/dashboard/exec-records.js +16 -20
- package/dist/dashboard/routines.js +11 -12
- package/dist/dashboard/timeline-build.js +5 -9
- package/dist/dashboard/timeline.js +23 -18
- package/dist/devcontainer/scaffold.js +18 -0
- package/dist/docs/frontmatter-namespace.js +1 -48
- package/dist/docs/index-command.js +2 -2
- package/dist/docs/yaml-business-tables.js +243 -0
- package/dist/docs/yaml-interface-tables.js +106 -0
- package/dist/docs/yaml-pages-command.js +5 -3
- package/dist/docs/yaml-pages.js +268 -3
- package/dist/docs/yaml-table-shared.js +70 -0
- package/dist/docs/yaml-tables.js +39 -0
- package/dist/exec/agent-config.js +31 -0
- package/dist/exec/agent-plan.js +3 -2
- package/dist/exec/agent-protected-config.js +2 -0
- package/dist/exec/commands.js +100 -39
- package/dist/exec/commit-hook-skips.js +78 -0
- package/dist/exec/core.js +19 -7
- package/dist/exec/events.js +179 -8
- package/dist/exec/evidence.js +77 -19
- package/dist/exec/handoff.js +9 -13
- package/dist/exec/limit.js +1 -1
- package/dist/exec/mechanical-result.js +45 -0
- package/dist/exec/migrate-records.js +249 -0
- package/dist/exec/parent-validation.js +209 -15
- package/dist/exec/pipeline-state.js +27 -5
- package/dist/exec/plans-condense-findings.js +89 -0
- package/dist/exec/plans-core.js +45 -19
- package/dist/exec/plans-generation.js +52 -30
- package/dist/exec/plans-grade-findings.js +8 -3
- package/dist/exec/plans-kata-findings.js +61 -0
- package/dist/exec/plans-planning.js +3 -3
- package/dist/exec/plans-storage.js +12 -24
- package/dist/exec/post-integration.js +162 -0
- package/dist/exec/queue-command.js +166 -0
- package/dist/exec/queue.js +285 -0
- package/dist/exec/register-foreign-wait.js +84 -0
- package/dist/exec/register-resume.js +55 -56
- package/dist/exec/register.js +26 -22
- package/dist/exec/repo-integration-sync.js +21 -5
- package/dist/exec/repo-integration.js +21 -1
- package/dist/exec/reporter.js +121 -23
- package/dist/exec/results.js +106 -25
- package/dist/exec/review-completion.js +47 -0
- package/dist/exec/review-kata.js +112 -0
- package/dist/exec/run/agent-pipeline.js +78 -8
- package/dist/exec/run/agent.js +32 -13
- package/dist/exec/run/change-scope.js +365 -0
- package/dist/exec/run/deferred-cleanup.js +31 -0
- package/dist/exec/run/in-place.js +73 -33
- package/dist/exec/run/job-lock.js +66 -0
- package/dist/exec/run/job-sequence.js +137 -0
- package/dist/exec/run/job.js +135 -41
- package/dist/exec/run/lifecycle-commands.js +189 -37
- package/dist/exec/run/lock.js +22 -1
- package/dist/exec/run/mode-shared.js +11 -3
- package/dist/exec/run/register-command.js +14 -15
- package/dist/exec/run/register-core.js +20 -13
- package/dist/exec/run/register-mode.js +77 -17
- package/dist/exec/run/register-post-review.js +21 -9
- package/dist/exec/run/register-resume.js +95 -31
- package/dist/exec/run/register-state.js +23 -15
- package/dist/exec/run/register-worktree.js +184 -139
- package/dist/exec/run/schedule-mode.js +79 -18
- package/dist/exec/run/schedule-prepare.js +204 -59
- package/dist/exec/run/schedule-task.js +203 -49
- package/dist/exec/run/shared.js +9 -3
- package/dist/exec/run/trailing-records.js +35 -0
- package/dist/exec/run-records.js +2 -0
- package/dist/exec/schedule/schedule.js +116 -4
- package/dist/exec/shared.js +1 -1
- package/dist/exec/smoke.js +190 -0
- package/dist/exec/strategy.js +14 -3
- package/dist/exec/task-view.js +6 -4
- package/dist/exec/trailing-records.js +242 -0
- package/dist/exec/trial-commands.js +8 -4
- package/dist/exec/trial-core.js +6 -1
- package/dist/exec/validate-records-commit.js +110 -0
- package/dist/exec/validate-records.js +148 -0
- package/dist/exec/validation-metrics.js +181 -0
- package/dist/exec/worktree-cleanup-lock.js +26 -0
- package/dist/exec/worktree-command.js +38 -17
- package/dist/exec/worktree-ops-commit.js +119 -48
- package/dist/exec/worktree-ops-lifecycle.js +77 -48
- package/dist/exec/worktree-ops-merge.js +13 -2
- package/dist/exec/worktree-ops.js +2 -2
- package/dist/exec/worktree.js +32 -4
- package/dist/grade/apply.js +32 -6
- package/dist/grade/command-apply.js +3 -3
- package/dist/grade/command-inspect.js +7 -5
- package/dist/grade/command-plan.js +1 -1
- package/dist/grade/command-run.js +7 -1
- package/dist/grade/command-shared.js +1 -1
- package/dist/grade/core.js +18 -5
- package/dist/grade/markdown.js +3 -3
- package/dist/grade/pipeline-state.js +15 -11
- package/dist/grade/plan.js +37 -17
- package/dist/grade/result.js +3 -3
- package/dist/grade/run.js +87 -11
- package/dist/grade/target-discovery.js +17 -4
- package/dist/grade/targets.js +12 -11
- package/dist/job/definition.js +84 -8
- package/dist/job/job.js +109 -39
- package/dist/job/noop.js +104 -0
- package/dist/register/authoring-sources.js +22 -16
- package/dist/register/core.js +2 -0
- package/dist/register/create-commands.js +28 -3
- package/dist/register/deliverable-target.js +9 -1
- package/dist/register/epic.js +104 -26
- package/dist/register/event-merge.js +3 -0
- package/dist/register/events.js +4 -0
- package/dist/register/external-project.js +3 -0
- package/dist/register/item.js +6 -0
- package/dist/register/maintenance-commands.js +6 -3
- package/dist/register/planning.js +7 -14
- package/dist/register/register.js +74 -16
- package/dist/register/track-domains.js +34 -0
- package/dist/register/track-plan.js +78 -0
- package/dist/register/transition-commands.js +8 -0
- package/dist/register/work-table.js +64 -0
- package/dist/review/grade.js +35 -13
- package/dist/routine/definition.js +13 -3
- package/dist/routine/failure.js +30 -0
- package/dist/routine/routine.js +189 -71
- package/dist/routine/status.js +62 -0
- package/dist/routine/storage.js +33 -0
- package/dist/schedule/schedule.js +39 -39
- package/dist/schedule/strategy-generate-document.js +26 -14
- package/dist/schedule/strategy-generate-scope.js +17 -45
- package/dist/schedule/strategy-generate.js +33 -3
- package/dist/schedule/strategy-profiles.js +86 -12
- package/dist/shared/agent-types.js +7 -0
- package/dist/shared/condense-records.js +25 -0
- package/dist/shared/cross-process-lock.js +9 -1
- package/dist/shared/deprecation.js +8 -0
- package/dist/shared/dist-freshness.js +8 -2
- package/dist/shared/document-metadata.js +20 -0
- package/dist/shared/finding-cause.js +20 -0
- package/dist/shared/frontmatter-namespace.js +48 -0
- package/dist/shared/git-environment.js +2 -1
- package/dist/shared/git.js +186 -16
- package/dist/shared/grade-result.js +17 -1
- package/dist/shared/lefthook-scaffold.js +3 -0
- package/dist/shared/local-config.js +244 -0
- package/dist/shared/local-state.js +20 -0
- package/dist/shared/markdownlint-config.js +8 -3
- package/dist/shared/plan-conventions.js +129 -0
- package/dist/shared/plan-templates.js +57 -41
- package/dist/shared/run-records.js +224 -0
- package/dist/shared/specdojo-config.js +73 -41
- package/dist/shared/specdojo-gitignore.js +1 -0
- package/dist/shared/text.js +74 -6
- package/dist/shared/timeline-index.js +2 -0
- package/dist/shared/where-alias.js +13 -0
- package/dist/specdojo.js +4 -0
- package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +11 -2
- package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +4 -74
- package/docs/ja/specdojo/exec-templates/xep-condense-template.md +50 -0
- package/docs/ja/specdojo/exec-templates/xep-draft-template.md +17 -5
- package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +16 -3
- package/docs/ja/specdojo/exec-templates/xep-recipe-guided-template.md +15 -5
- package/docs/ja/specdojo/exec-templates/xep-recipe-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +1 -1
- package/docs/ja/specdojo/exec-templates/xep-rulebook-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-sample-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-template-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xer-condense-template.md +25 -0
- package/docs/ja/specdojo/exec-templates/xp-common-conventions-template.md +50 -0
- package/docs/ja/specdojo/exec-templates/xrp-common-conventions-template.md +30 -0
- package/docs/ja/specdojo/guides/branch-workflow-guide.md +1 -1
- package/docs/ja/specdojo/guides/docs-editing-guide.md +12 -0
- package/docs/ja/specdojo/guides/docs-structure-guide.md +48 -15
- package/docs/ja/specdojo/guides/exec-config-guide.md +69 -19
- package/docs/ja/specdojo/guides/exec-operation-guide.md +97 -18
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +20 -11
- package/docs/ja/specdojo/guides/job-sequence-guide.md +77 -0
- package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +92 -55
- package/docs/ja/specdojo/guides/project-move-guide.md +381 -0
- package/docs/ja/specdojo/guides/quick-start-guide.md +73 -17
- package/docs/ja/specdojo/guides/register-operation-guide.md +26 -6
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +2 -0
- package/docs/ja/specdojo/guides/review-guide.md +22 -19
- package/docs/ja/specdojo/guides/routine-operation-guide.md +23 -12
- package/docs/ja/specdojo/guides/ryu-guide.md +23 -13
- package/docs/ja/specdojo/guides/schedule-design-guide.md +27 -21
- package/docs/ja/specdojo/guides/schedule-operation-guide.md +27 -3
- package/docs/ja/specdojo/guides/specdojo-overview-guide.md +5 -4
- package/docs/ja/specdojo/guides/timeline-design-guide.md +27 -144
- package/docs/ja/specdojo/guides/use-case-guide.md +92 -155
- package/docs/ja/specdojo/guides/waza-guide.md +12 -8
- package/docs/ja/specdojo/recipes/bac-recipe.md +111 -0
- package/docs/ja/specdojo/recipes/bes-recipe.md +141 -0
- package/docs/ja/specdojo/recipes/bps-recipe.md +88 -139
- package/docs/ja/specdojo/recipes/br-recipe.md +77 -0
- package/docs/ja/specdojo/recipes/cdfd-overview-recipe.md +97 -109
- package/docs/ja/specdojo/recipes/cdfd-recipe.md +85 -146
- package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +92 -99
- package/docs/ja/specdojo/recipes/cnd-recipe.md +135 -0
- package/docs/ja/specdojo/recipes/cpd-recipe.md +140 -0
- package/docs/ja/specdojo/recipes/cxd-recipe.md +162 -0
- package/docs/ja/specdojo/recipes/ifd-recipe.md +145 -0
- package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +112 -90
- package/docs/ja/specdojo/recipes/ifx-index-recipe.md +164 -0
- package/docs/ja/specdojo/recipes/pm-communication-plan-recipe.md +60 -49
- package/docs/ja/specdojo/recipes/pm-members-recipe.md +50 -51
- package/docs/ja/specdojo/recipes/pm-organization-recipe.md +59 -48
- package/docs/ja/specdojo/recipes/pm-plan-recipe.md +72 -50
- package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +40 -49
- package/docs/ja/specdojo/recipes/pm-raci-recipe.md +42 -48
- package/docs/ja/specdojo/recipes/pm-roles-recipe.md +52 -81
- package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +64 -91
- package/docs/ja/specdojo/recipes/prj-charter-recipe.md +71 -106
- package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +78 -156
- package/docs/ja/specdojo/recipes/prj-issues-and-approach-recipe.md +62 -111
- package/docs/ja/specdojo/recipes/prj-scope-recipe.md +67 -123
- package/docs/ja/specdojo/recipes/prj-stakeholder-register-recipe.md +60 -96
- package/docs/ja/specdojo/recipes/prj-success-criteria-and-acceptance-criteria-recipe.md +61 -105
- package/docs/ja/specdojo/recipes/stsd-recipe.md +88 -80
- package/docs/ja/specdojo/recipes/sysd-critical-flows-recipe.md +129 -0
- package/docs/ja/specdojo/recipes/sysd-cross-cutting-policy-recipe.md +146 -0
- package/docs/ja/specdojo/recipes/sysd-index-recipe.md +141 -0
- package/docs/ja/specdojo/recipes/tsd-recipe.md +149 -129
- package/docs/ja/specdojo/references/command-reference.md +303 -148
- package/docs/ja/specdojo/references/deliverables-reference.md +30 -16
- package/docs/ja/specdojo/references/directory-layout-reference.md +3 -2
- package/docs/ja/specdojo/references/specdojo-config-reference.md +54 -18
- package/docs/ja/specdojo/rulebooks/atc-index-rulebook.md +101 -257
- package/docs/ja/specdojo/rulebooks/atc-rulebook.md +102 -228
- package/docs/ja/specdojo/rulebooks/bac-rulebook.md +63 -290
- package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +162 -80
- package/docs/ja/specdojo/rulebooks/bds-rulebook.md +118 -155
- package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +128 -60
- package/docs/ja/specdojo/rulebooks/bes-rulebook.md +70 -94
- package/docs/ja/specdojo/rulebooks/bps-rulebook.md +24 -56
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +58 -103
- package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +103 -223
- package/docs/ja/specdojo/rulebooks/cdfd-d2-rulebook.md +18 -93
- package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +18 -52
- package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +109 -147
- package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +80 -108
- package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +51 -55
- package/docs/ja/specdojo/rulebooks/cdr-rulebook.md +144 -0
- package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +81 -68
- package/docs/ja/specdojo/rulebooks/cdt-rulebook.md +139 -0
- package/docs/ja/specdojo/rulebooks/cld-rulebook.md +9 -184
- package/docs/ja/specdojo/rulebooks/clis-rulebook.md +170 -0
- package/docs/ja/specdojo/rulebooks/cnd-mermaid-rulebook.md +33 -86
- package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +79 -249
- package/docs/ja/specdojo/rulebooks/cop-index-rulebook.md +45 -131
- package/docs/ja/specdojo/rulebooks/cop-rulebook.md +69 -275
- package/docs/ja/specdojo/rulebooks/cpd-mermaid-rulebook.md +20 -112
- package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +79 -249
- package/docs/ja/specdojo/rulebooks/cxd-mermaid-rulebook.md +12 -145
- package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +115 -256
- package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +79 -109
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +119 -174
- package/docs/ja/specdojo/rulebooks/dec-rulebook.md +6 -14
- package/docs/ja/specdojo/rulebooks/dmd-index-rulebook.md +22 -66
- package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +36 -94
- package/docs/ja/specdojo/rulebooks/dss-rulebook.md +171 -0
- package/docs/ja/specdojo/rulebooks/etc-index-rulebook.md +31 -131
- package/docs/ja/specdojo/rulebooks/etc-rulebook.md +50 -104
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +93 -57
- package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +63 -253
- package/docs/ja/specdojo/rulebooks/ifx-api-rulebook.md +14 -20
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +79 -76
- package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +182 -237
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +111 -40
- package/docs/ja/specdojo/rulebooks/ifx-msg-rulebook.md +14 -22
- package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +23 -46
- package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +41 -64
- package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +16 -40
- package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +34 -61
- package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +27 -50
- package/docs/ja/specdojo/rulebooks/itc-index-rulebook.md +70 -199
- package/docs/ja/specdojo/rulebooks/itc-rulebook.md +65 -153
- package/docs/ja/specdojo/rulebooks/mip-index-rulebook.md +74 -150
- package/docs/ja/specdojo/rulebooks/mm-rulebook.md +12 -23
- package/docs/ja/specdojo/rulebooks/mtp-rulebook.md +99 -176
- package/docs/ja/specdojo/rulebooks/nfr-availability-rulebook.md +35 -61
- package/docs/ja/specdojo/rulebooks/nfr-index-rulebook.md +75 -117
- package/docs/ja/specdojo/rulebooks/nfr-integrity-rulebook.md +31 -60
- package/docs/ja/specdojo/rulebooks/nfr-maintainability-rulebook.md +26 -81
- package/docs/ja/specdojo/rulebooks/nfr-operations-rulebook.md +32 -70
- package/docs/ja/specdojo/rulebooks/nfr-performance-rulebook.md +45 -87
- package/docs/ja/specdojo/rulebooks/nfr-reliability-rulebook.md +48 -101
- package/docs/ja/specdojo/rulebooks/nfr-security-safety-rulebook.md +44 -80
- package/docs/ja/specdojo/rulebooks/nfr-usability-rulebook.md +59 -127
- package/docs/ja/specdojo/rulebooks/opd-index-rulebook.md +31 -50
- package/docs/ja/specdojo/rulebooks/opd-rulebook.md +42 -109
- package/docs/ja/specdojo/rulebooks/opr-index-rulebook.md +29 -42
- package/docs/ja/specdojo/rulebooks/opr-rulebook.md +29 -87
- package/docs/ja/specdojo/rulebooks/otp-index-rulebook.md +62 -84
- package/docs/ja/specdojo/rulebooks/otp-rulebook.md +11 -61
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +92 -102
- package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +25 -34
- package/docs/ja/specdojo/rulebooks/pm-communication-plan-rulebook.md +30 -53
- package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +23 -35
- package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +27 -45
- package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +45 -59
- package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +56 -66
- package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +54 -62
- package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +46 -65
- package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +28 -35
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +65 -97
- package/docs/ja/specdojo/rulebooks/pr-rulebook.md +6 -18
- package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +48 -78
- package/docs/ja/specdojo/rulebooks/prj-charter-rulebook.md +23 -97
- package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +61 -153
- package/docs/ja/specdojo/rulebooks/prj-issues-and-approach-rulebook.md +43 -116
- package/docs/ja/specdojo/rulebooks/prj-scope-rulebook.md +16 -51
- package/docs/ja/specdojo/rulebooks/prj-stakeholder-register-rulebook.md +47 -92
- package/docs/ja/specdojo/rulebooks/prj-success-criteria-and-acceptance-criteria-rulebook.md +25 -84
- package/docs/ja/specdojo/rulebooks/sac-rulebook.md +44 -107
- package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +106 -32
- package/docs/ja/specdojo/rulebooks/sf-rulebook.md +111 -61
- package/docs/ja/specdojo/rulebooks/sld-rulebook.md +129 -59
- package/docs/ja/specdojo/rulebooks/stc-index-rulebook.md +90 -189
- package/docs/ja/specdojo/rulebooks/stc-rulebook.md +45 -105
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +46 -40
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +104 -68
- package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +64 -330
- package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +70 -263
- package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +58 -200
- package/docs/ja/specdojo/rulebooks/sysd-rulebook.md +47 -60
- package/docs/ja/specdojo/rulebooks/tml-rulebook.md +4 -9
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +69 -71
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +65 -72
- package/docs/ja/specdojo/rulebooks/tsd-index-rulebook.md +35 -46
- package/docs/ja/specdojo/rulebooks/tsd-rulebook.md +49 -66
- package/docs/ja/specdojo/rulebooks/tsp-index-rulebook.md +64 -139
- package/docs/ja/specdojo/rulebooks/uis-rulebook.md +91 -161
- package/docs/ja/specdojo/rulebooks/utc-index-rulebook.md +49 -144
- package/docs/ja/specdojo/rulebooks/utc-rulebook.md +67 -155
- package/docs/ja/specdojo/samples/bac-sample.md +106 -21
- package/docs/ja/specdojo/samples/bdd-sample.yaml +143 -35
- package/docs/ja/specdojo/samples/bds-sample.md +87 -21
- package/docs/ja/specdojo/samples/bes-index-sample.md +42 -20
- package/docs/ja/specdojo/samples/bes-sample.md +70 -21
- package/docs/ja/specdojo/samples/bps-sample.md +42 -54
- package/docs/ja/specdojo/samples/br-sample.md +57 -15
- package/docs/ja/specdojo/samples/ccd-sample.md +80 -19
- package/docs/ja/specdojo/samples/cdfd-sample.md +172 -99
- package/docs/ja/specdojo/samples/cdfd-uc-sample.md +9 -7
- package/docs/ja/specdojo/samples/cdr-sample.md +78 -0
- package/docs/ja/specdojo/samples/cdsd-sample.md +73 -20
- package/docs/ja/specdojo/samples/cdt-sample.md +116 -0
- package/docs/ja/specdojo/samples/cld-sample.md +3 -30
- package/docs/ja/specdojo/samples/clis-sample.md +125 -0
- package/docs/ja/specdojo/samples/cnd-sample.md +127 -21
- package/docs/ja/specdojo/samples/cpd-sample.md +136 -22
- package/docs/ja/specdojo/samples/cxd-sample.md +108 -22
- package/docs/ja/specdojo/samples/dct-index-sample.yaml +63 -17
- package/docs/ja/specdojo/samples/dec-sample.md +2 -3
- package/docs/ja/specdojo/samples/dss-sample.md +175 -0
- package/docs/ja/specdojo/samples/gl-sample.yaml +50 -14
- package/docs/ja/specdojo/samples/ifd-sample.md +105 -21
- package/docs/ja/specdojo/samples/ifx-api-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +91 -60
- package/docs/ja/specdojo/samples/ifx-file-sample.md +462 -21
- package/docs/ja/specdojo/samples/ifx-index-sample.yaml +87 -19
- package/docs/ja/specdojo/samples/ifx-msg-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/job-sequence.yaml +67 -0
- package/docs/ja/specdojo/samples/mip-index-sample.md +98 -20
- package/docs/ja/specdojo/samples/pm-communication-plan-sample.md +26 -19
- package/docs/ja/specdojo/samples/pm-members-sample.yaml +37 -13
- package/docs/ja/specdojo/samples/pm-organization-sample.md +42 -21
- package/docs/ja/specdojo/samples/pm-plan-sample.md +78 -26
- package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +41 -22
- package/docs/ja/specdojo/samples/pm-raci-sample.md +63 -28
- package/docs/ja/specdojo/samples/pm-roles-sample.yaml +13 -12
- package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +33 -25
- package/docs/ja/specdojo/samples/prj-charter-sample.md +42 -59
- package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +83 -62
- package/docs/ja/specdojo/samples/prj-success-criteria-and-acceptance-criteria-sample.md +30 -33
- package/docs/ja/specdojo/samples/sf-index-sample.md +47 -20
- package/docs/ja/specdojo/samples/sf-sample.md +109 -21
- package/docs/ja/specdojo/samples/sld-sample.md +88 -21
- package/docs/ja/specdojo/samples/stsd-sample.md +54 -26
- package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +166 -21
- package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +178 -21
- package/docs/ja/specdojo/samples/sysd-index-sample.md +82 -21
- package/docs/ja/specdojo/samples/tml-sample.yaml +4 -1
- package/docs/ja/specdojo/samples/uis-sample.md +141 -20
- package/docs/ja/specdojo/standards/document-metadata-standard.md +33 -4
- package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +3 -1
- package/docs/ja/specdojo/standards/job-definition-standard.md +24 -9
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +1 -0
- package/docs/ja/specdojo/templates/bac-template.md +76 -0
- package/docs/ja/specdojo/templates/bes-template.md +56 -0
- package/docs/ja/specdojo/templates/br-template.md +64 -0
- package/docs/ja/specdojo/templates/cdfd-template.md +81 -54
- package/docs/ja/specdojo/templates/cdfd-uc-template.md +9 -5
- package/docs/ja/specdojo/templates/cdr-template.md +58 -0
- package/docs/ja/specdojo/templates/cnd-template.md +137 -0
- package/docs/ja/specdojo/templates/cpd-template.md +129 -0
- package/docs/ja/specdojo/templates/cxd-template.md +105 -0
- package/docs/ja/specdojo/templates/dct-data-model-cdt-template.yaml +40 -0
- package/docs/ja/specdojo/templates/dct-data-model-cld-template.yaml +7 -14
- package/docs/ja/specdojo/templates/dct-index-template.md +9 -20
- package/docs/ja/specdojo/templates/dct-project-management-template.yaml +5 -1
- package/docs/ja/specdojo/templates/ifd-template.md +86 -0
- package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +44 -28
- package/docs/ja/specdojo/templates/ifx-index-template.yaml +40 -0
- package/docs/ja/specdojo/templates/opr-template.md +2 -4
- package/docs/ja/specdojo/templates/pm-organization-template.md +9 -3
- package/docs/ja/specdojo/templates/pm-plan-template.md +4 -4
- package/docs/ja/specdojo/templates/pm-quality-management-plan-template.md +17 -9
- package/docs/ja/specdojo/templates/pm-raci-template.md +24 -13
- package/docs/ja/specdojo/templates/pm-roles-template.yaml +3 -2
- package/docs/ja/specdojo/templates/prj-assumptions-constraints-dependencies-template.md +6 -3
- package/docs/ja/specdojo/templates/prj-comparison-of-alternatives-template.md +22 -19
- package/docs/ja/specdojo/templates/stsd-template.md +46 -21
- package/docs/ja/specdojo/templates/sysd-critical-flows-template.md +94 -0
- package/docs/ja/specdojo/templates/sysd-cross-cutting-policy-template.md +122 -0
- package/docs/ja/specdojo/templates/sysd-index-template.md +89 -0
- package/docs/specdojo/lib/yaml-metadata.cjs +7 -0
- package/docs/specdojo/schemas/v1/bdd.schema.yaml +25 -57
- package/docs/specdojo/schemas/v1/condense-records.schema.yaml +26 -0
- package/docs/specdojo/schemas/v1/dct.schema.yaml +10 -0
- package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +3 -0
- package/docs/specdojo/schemas/v1/esil.schema.yaml +7 -141
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +5 -1
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +95 -8
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +38 -0
- package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +14 -0
- package/docs/specdojo/schemas/v1/exec-result-frontmatter.schema.yaml +18 -0
- package/docs/specdojo/schemas/v1/finding-cause.schema.yaml +22 -0
- package/docs/specdojo/schemas/v1/grade-pipeline-state.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/grade-result.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +65 -5
- package/docs/specdojo/schemas/v1/ifx-index.schema.yaml +142 -0
- package/docs/specdojo/schemas/v1/job-run.schema.yaml +23 -0
- package/docs/specdojo/schemas/v1/job.schema.yaml +63 -2
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +17 -1
- package/docs/specdojo/schemas/v1/sch-strategy.schema.yaml +2 -2
- package/package.json +10 -7
- package/templates/antigravity/orchestrator.md +7 -3
- package/templates/claude/agents/specdojo-orchestrator.md +7 -3
- package/templates/codex/agents/specdojo-orchestrator.toml +7 -3
- package/templates/codex/orchestrator.md +7 -3
- package/templates/devcontainer/tmux.conf +6 -0
- package/templates/init-exec-defaults.yaml +13 -0
- package/templates/lefthook/tools/specdojo-pre-commit.mjs +8 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +8 -4
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { basename, isAbsolute, join, resolve } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Untracked per-machine overrides of `.specdojo/specdojo.config.json` (PJR-NC9R). Only the keys
|
|
5
|
+
* allowed below are accepted; the shared config stays the single source for everything else.
|
|
6
|
+
*/
|
|
7
|
+
export const LOCAL_CONFIG_RELATIVE_PATH = ".specdojo/specdojo.local.config.json";
|
|
8
|
+
/** Absolute path of the main working tree's local config, passed to processes in worktrees. */
|
|
9
|
+
export const LOCAL_CONFIG_ENV = "SPECDOJO_LOCAL_CONFIG";
|
|
10
|
+
/** Keys a local entry may set on a repository already declared in the shared config. */
|
|
11
|
+
const OVERRIDE_REPO_KEYS = ["name", "path"];
|
|
12
|
+
function readTextFileOrNull(path) {
|
|
13
|
+
try {
|
|
14
|
+
return readFileSync(path, "utf8");
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function isRecord(value) {
|
|
21
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22
|
+
}
|
|
23
|
+
/** True when `rootDir` is a linked worktree (its `.git` is a file, not a directory). */
|
|
24
|
+
function isLinkedWorktree(rootDir) {
|
|
25
|
+
const dotGit = join(resolve(rootDir), ".git");
|
|
26
|
+
return existsSync(dotGit) && !statSync(dotGit).isDirectory();
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Root of the main working tree. A linked worktree resolves to the checkout that owns its
|
|
30
|
+
* `.git/worktrees/<name>` directory; any other directory resolves to itself.
|
|
31
|
+
*/
|
|
32
|
+
export function repositoryIdentityRoot(rootDir) {
|
|
33
|
+
const root = resolve(rootDir);
|
|
34
|
+
if (!isLinkedWorktree(root))
|
|
35
|
+
return root;
|
|
36
|
+
const gitdirLine = readTextFileOrNull(join(root, ".git"))
|
|
37
|
+
?.split(/\r?\n/)
|
|
38
|
+
.find((line) => line.startsWith("gitdir:"));
|
|
39
|
+
if (!gitdirLine)
|
|
40
|
+
return root;
|
|
41
|
+
const gitdir = resolve(root, gitdirLine.slice("gitdir:".length).trim()).replaceAll("\\", "/");
|
|
42
|
+
const marker = "/.git/worktrees/";
|
|
43
|
+
const markerIndex = gitdir.lastIndexOf(marker);
|
|
44
|
+
return markerIndex >= 0 ? gitdir.slice(0, markerIndex) : root;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Local config path for `rootDir`. The main working tree reads its own file. A linked worktree
|
|
48
|
+
* never trusts a file of the same name inside itself: it uses the path the parent passed in
|
|
49
|
+
* `SPECDOJO_LOCAL_CONFIG`, or else the main working tree's file. The variable is ignored outside
|
|
50
|
+
* linked worktrees so that it cannot leak into another repository's main checkout.
|
|
51
|
+
*/
|
|
52
|
+
export function resolveLocalConfigPath(rootDir, env = process.env) {
|
|
53
|
+
const root = resolve(rootDir);
|
|
54
|
+
if (!isLinkedWorktree(root))
|
|
55
|
+
return join(root, LOCAL_CONFIG_RELATIVE_PATH);
|
|
56
|
+
const fromEnv = env[LOCAL_CONFIG_ENV]?.trim();
|
|
57
|
+
if (fromEnv) {
|
|
58
|
+
if (!isAbsolute(fromEnv) || basename(fromEnv) !== basename(LOCAL_CONFIG_RELATIVE_PATH)) {
|
|
59
|
+
throw new Error(`Invalid ${LOCAL_CONFIG_ENV}="${fromEnv}": expected an absolute path to ` +
|
|
60
|
+
basename(LOCAL_CONFIG_RELATIVE_PATH));
|
|
61
|
+
}
|
|
62
|
+
return fromEnv;
|
|
63
|
+
}
|
|
64
|
+
return join(repositoryIdentityRoot(root), LOCAL_CONFIG_RELATIVE_PATH);
|
|
65
|
+
}
|
|
66
|
+
/** Environment that hands the local config of `rootDir` to a child process in a worktree. */
|
|
67
|
+
export function localConfigEnvironment(rootDir, env = process.env) {
|
|
68
|
+
const path = resolveLocalConfigPath(rootDir, env);
|
|
69
|
+
return existsSync(path) ? { [LOCAL_CONFIG_ENV]: path } : {};
|
|
70
|
+
}
|
|
71
|
+
function validateRepoEntry(entry, at, sharedRepo, addedRepoKeys) {
|
|
72
|
+
if (!isRecord(entry))
|
|
73
|
+
return [`${at} must be an object with name and path`];
|
|
74
|
+
const errors = [];
|
|
75
|
+
const allowed = sharedRepo ? OVERRIDE_REPO_KEYS : [...addedRepoKeys];
|
|
76
|
+
for (const key of Object.keys(entry).sort()) {
|
|
77
|
+
if (!allowed.includes(key)) {
|
|
78
|
+
errors.push(sharedRepo
|
|
79
|
+
? `${at}: key "${key}" cannot override shared repository "${sharedRepo.name}" ` +
|
|
80
|
+
`(allowed: ${OVERRIDE_REPO_KEYS.join(", ")})`
|
|
81
|
+
: `${at}: unknown key "${key}"`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (typeof entry.path !== "string" || entry.path.trim().length === 0) {
|
|
85
|
+
errors.push(`${at}.path must be a non-empty string`);
|
|
86
|
+
}
|
|
87
|
+
return errors;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Apply a parsed local config to the shared config. Shared `repos[]` entries keep their order and
|
|
91
|
+
* get the local `path` when a local entry has the same `name`; other local entries are appended
|
|
92
|
+
* as local repositories. Every disallowed key or type error is reported with `localPath`.
|
|
93
|
+
* Semantic checks (name pattern, path existence, ...) are left to the shared validator, which
|
|
94
|
+
* runs on the merged result.
|
|
95
|
+
*/
|
|
96
|
+
export function applyLocalConfig(shared, local, localPath, addedRepoKeys) {
|
|
97
|
+
const errors = [];
|
|
98
|
+
const overrides = [];
|
|
99
|
+
const projects = { ...shared.projects };
|
|
100
|
+
const fail = () => {
|
|
101
|
+
throw new Error(`Invalid ${LOCAL_CONFIG_RELATIVE_PATH} (${localPath}):\n` +
|
|
102
|
+
errors.map((message) => ` - ${message}`).join("\n"));
|
|
103
|
+
};
|
|
104
|
+
if (!isRecord(local)) {
|
|
105
|
+
errors.push("expected { version: 1, projects: { ... } }");
|
|
106
|
+
return fail();
|
|
107
|
+
}
|
|
108
|
+
for (const key of Object.keys(local).sort()) {
|
|
109
|
+
if (key !== "version" && key !== "projects") {
|
|
110
|
+
errors.push(`unknown key "${key}" (allowed: version, projects)`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (local.version !== 1)
|
|
114
|
+
errors.push("version must be 1");
|
|
115
|
+
const localProjects = local.projects ?? {};
|
|
116
|
+
if (!isRecord(localProjects))
|
|
117
|
+
errors.push("projects must be an object");
|
|
118
|
+
for (const [projectId, value] of Object.entries(isRecord(localProjects) ? localProjects : {})) {
|
|
119
|
+
const at = `projects.${projectId}`;
|
|
120
|
+
const sharedProject = shared.projects[projectId];
|
|
121
|
+
if (!sharedProject) {
|
|
122
|
+
errors.push(`${at}: project is not declared in .specdojo/specdojo.config.json`);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (!isRecord(value)) {
|
|
126
|
+
errors.push(`${at} must be an object`);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
for (const key of Object.keys(value).sort()) {
|
|
130
|
+
if (key !== "repos")
|
|
131
|
+
errors.push(`${at}: key "${key}" cannot be overridden (allowed: repos)`);
|
|
132
|
+
}
|
|
133
|
+
if (value.repos === undefined)
|
|
134
|
+
continue;
|
|
135
|
+
if (!Array.isArray(value.repos)) {
|
|
136
|
+
errors.push(`${at}.repos must be an array`);
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
const sharedRepos = sharedProject.repos ?? [];
|
|
140
|
+
const merged = sharedRepos.map((repo) => ({ ...repo }));
|
|
141
|
+
const seen = new Set();
|
|
142
|
+
value.repos.forEach((entry, index) => {
|
|
143
|
+
const entryAt = `${at}.repos[${index}]`;
|
|
144
|
+
const name = isRecord(entry) ? entry.name : undefined;
|
|
145
|
+
if (typeof name !== "string" || name.trim().length === 0) {
|
|
146
|
+
errors.push(`${entryAt}.name must be a non-empty string`);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (seen.has(name)) {
|
|
150
|
+
errors.push(`${entryAt}.name "${name}" is declared more than once`);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
seen.add(name);
|
|
154
|
+
const sharedRepo = sharedRepos.find((repo) => repo.name === name);
|
|
155
|
+
const entryErrors = validateRepoEntry(entry, entryAt, sharedRepo, addedRepoKeys);
|
|
156
|
+
errors.push(...entryErrors);
|
|
157
|
+
if (entryErrors.length > 0 || !isRecord(entry))
|
|
158
|
+
return;
|
|
159
|
+
const path = String(entry.path);
|
|
160
|
+
if (sharedRepo) {
|
|
161
|
+
const target = merged.find((repo) => repo.name === name);
|
|
162
|
+
if (target)
|
|
163
|
+
target.path = path;
|
|
164
|
+
overrides.push({
|
|
165
|
+
project: projectId,
|
|
166
|
+
repo: name,
|
|
167
|
+
kind: "path",
|
|
168
|
+
path,
|
|
169
|
+
shared_path: sharedRepo.path,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
// validateRepoEntry checked the keys; the shared validator checks values after the merge.
|
|
174
|
+
merged.push({ ...entry });
|
|
175
|
+
overrides.push({ project: projectId, repo: name, kind: "added", path });
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
projects[projectId] = { ...sharedProject, repos: merged };
|
|
179
|
+
}
|
|
180
|
+
if (errors.length > 0)
|
|
181
|
+
return fail();
|
|
182
|
+
return { config: { ...shared, projects }, overrides };
|
|
183
|
+
}
|
|
184
|
+
/** Read the local config for `rootDir`, or null when the file does not exist. */
|
|
185
|
+
export function readLocalConfig(rootDir, env = process.env) {
|
|
186
|
+
const path = resolveLocalConfigPath(rootDir, env);
|
|
187
|
+
if (!existsSync(path)) {
|
|
188
|
+
if (env[LOCAL_CONFIG_ENV]?.trim() && isLinkedWorktree(rootDir)) {
|
|
189
|
+
throw new Error(`${LOCAL_CONFIG_ENV} points to a missing file: ${path}`);
|
|
190
|
+
}
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const raw = readFileSync(path, "utf8");
|
|
194
|
+
try {
|
|
195
|
+
return { path, value: JSON.parse(raw) };
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
throw new Error(`Invalid ${LOCAL_CONFIG_RELATIVE_PATH} (${path}): ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/** One line per local override, for `config show` and `where exec`. */
|
|
202
|
+
export function formatLocalOverride(override) {
|
|
203
|
+
return override.kind === "path"
|
|
204
|
+
? `projects.${override.project}.repos[${override.repo}].path = ${override.path} ` +
|
|
205
|
+
`(local; shared: ${override.shared_path})`
|
|
206
|
+
: `projects.${override.project}.repos[${override.repo}] = ${override.path} (local; added)`;
|
|
207
|
+
}
|
|
208
|
+
/** Lines describing the local config and its overrides, for `config show` and `where`. */
|
|
209
|
+
export function formatLocalConfigLines(result, projectId) {
|
|
210
|
+
if (!result.localConfigPath)
|
|
211
|
+
return ["local-config: none"];
|
|
212
|
+
const overrides = (result.localOverrides ?? []).filter((override) => projectId === undefined || override.project === projectId);
|
|
213
|
+
return [
|
|
214
|
+
`local-config: ${result.localConfigPath}`,
|
|
215
|
+
...overrides.map((override) => `local-override: ${formatLocalOverride(override)}`),
|
|
216
|
+
];
|
|
217
|
+
}
|
|
218
|
+
/** `config show` output: config files, then each project's repos with their source. */
|
|
219
|
+
export function formatConfigShow(result, projectId) {
|
|
220
|
+
if (!result.config)
|
|
221
|
+
return `No config found: ${result.configPath}\n`;
|
|
222
|
+
const config = result.config;
|
|
223
|
+
if (projectId !== undefined && !config.projects[projectId]) {
|
|
224
|
+
throw new Error(`Unknown project: ${projectId} (${result.configPath})`);
|
|
225
|
+
}
|
|
226
|
+
const lines = [`config: ${result.configPath}`, ...formatLocalConfigLines(result, projectId)];
|
|
227
|
+
const projectIds = projectId === undefined ? Object.keys(config.projects).sort() : [projectId];
|
|
228
|
+
for (const id of projectIds) {
|
|
229
|
+
lines.push(`project: ${id}`);
|
|
230
|
+
const repos = config.projects[id].repos ?? [];
|
|
231
|
+
if (repos.length === 0)
|
|
232
|
+
lines.push(" repos: none");
|
|
233
|
+
for (const repo of repos) {
|
|
234
|
+
const override = result.localOverrides?.find((candidate) => candidate.project === id && candidate.repo === repo.name);
|
|
235
|
+
const source = !override
|
|
236
|
+
? "shared"
|
|
237
|
+
: override.kind === "added"
|
|
238
|
+
? "local; added"
|
|
239
|
+
: `local; shared: ${override.shared_path}`;
|
|
240
|
+
lines.push(` repo ${repo.name}: ${repo.path} (${source})`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return `${lines.join("\n")}\n`;
|
|
244
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { realpathSync } from "node:fs";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
6
|
+
import { gitEnvironment } from "./git-environment.js";
|
|
7
|
+
/** Machine-local state, shared by linked worktrees, never part of the repository tree. */
|
|
8
|
+
export function localStateDirectory(repoRoot) {
|
|
9
|
+
const common = spawnSync("git", ["rev-parse", "--git-common-dir"], {
|
|
10
|
+
cwd: repoRoot,
|
|
11
|
+
encoding: "utf8",
|
|
12
|
+
env: gitEnvironment(),
|
|
13
|
+
});
|
|
14
|
+
const identity = common.status === 0 ? resolve(repoRoot, common.stdout.trim()) : resolve(repoRoot);
|
|
15
|
+
const canonical = realpathSync(identity);
|
|
16
|
+
const key = createHash("sha256").update(canonical).digest("hex");
|
|
17
|
+
const configured = process.env.XDG_STATE_HOME;
|
|
18
|
+
const base = configured && isAbsolute(configured) ? configured : join(homedir(), ".local", "state");
|
|
19
|
+
return join(base, "specdojo", key);
|
|
20
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, readdirSync, writeFileSync } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
4
|
import { dump } from "js-yaml";
|
|
4
5
|
// Keep the fallback result check and every scaffold on the same document rules.
|
|
5
6
|
export const DEFAULT_MARKDOWNLINT_CONFIG = {
|
|
@@ -15,10 +16,14 @@ export function hasMarkdownlintConfig(repoRoot) {
|
|
|
15
16
|
if (["jsonc", "json", "yaml", "yml"].some((ext) => existsSync(join(repoRoot, `.markdownlint.${ext}`))))
|
|
16
17
|
return true;
|
|
17
18
|
// markdownlint-cli also discovers .markdownlintrc in parent directories.
|
|
18
|
-
|
|
19
|
+
// ただし一時ディレクトリのルート(/tmp など)や Git リポジトリ境界を越えて親を辿らない。
|
|
20
|
+
const systemTmp = resolve(tmpdir());
|
|
21
|
+
for (let dir = resolve(repoRoot);; dir = dirname(dir)) {
|
|
19
22
|
if (existsSync(join(dir, ".markdownlintrc")))
|
|
20
23
|
return true;
|
|
21
|
-
if (dirname(dir) === dir)
|
|
24
|
+
if (dirname(dir) === dir || dir === systemTmp)
|
|
25
|
+
return false;
|
|
26
|
+
if (existsSync(join(dir, ".git")))
|
|
22
27
|
return false;
|
|
23
28
|
}
|
|
24
29
|
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { existsSync, linkSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
import remarkParse from "remark-parse";
|
|
5
|
+
import { unified } from "unified";
|
|
6
|
+
import { planConventionsPath } from "./run-records.js";
|
|
7
|
+
import { specdojoRootDir } from "./specdojo-config.js";
|
|
8
|
+
const legacyReferencePattern = /^\[共通規約 sha256:([a-f0-9]{64})\]\(([^\s)]+)\)$/;
|
|
9
|
+
const referencePattern = /^`共通規約 sha256:([a-f0-9]{64})` `([^`\r\n]+)`$/;
|
|
10
|
+
const sha256 = (text) => createHash("sha256").update(text).digest("hex");
|
|
11
|
+
function repositoryRoot(baseDirectory) {
|
|
12
|
+
let directory = resolve(baseDirectory);
|
|
13
|
+
while (true) {
|
|
14
|
+
if (existsSync(join(directory, ".specdojo/specdojo.config.json")) ||
|
|
15
|
+
existsSync(join(directory, ".git")))
|
|
16
|
+
return directory;
|
|
17
|
+
const parent = dirname(directory);
|
|
18
|
+
if (parent === directory)
|
|
19
|
+
return specdojoRootDir();
|
|
20
|
+
directory = parent;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// Only the final, standalone paragraph belongs to the runner. Examples in the body,
|
|
24
|
+
// inline code, blockquotes and fenced code blocks must never be resolved as resources.
|
|
25
|
+
function conventionsReference(plan) {
|
|
26
|
+
const tail = unified().use(remarkParse).parse(plan).children.at(-1);
|
|
27
|
+
if (tail?.type !== "paragraph")
|
|
28
|
+
return undefined;
|
|
29
|
+
const start = tail.position?.start.offset;
|
|
30
|
+
const end = tail.position?.end.offset;
|
|
31
|
+
if (start === undefined || end === undefined)
|
|
32
|
+
return undefined;
|
|
33
|
+
const text = plan.slice(start, end);
|
|
34
|
+
const match = referencePattern.exec(text) ?? legacyReferencePattern.exec(text);
|
|
35
|
+
if (!match) {
|
|
36
|
+
if (text.startsWith("[共通規約 sha256:") || text.startsWith("`共通規約 sha256:")) {
|
|
37
|
+
throw new Error("Invalid plan conventions reference: expected a SHA-256 hash and snapshot path");
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return { start, end, hash: match[1], ref: match[2], legacy: text.startsWith("[") };
|
|
42
|
+
}
|
|
43
|
+
function referencePath(from, to) {
|
|
44
|
+
return relative(dirname(from), to)
|
|
45
|
+
.split(sep)
|
|
46
|
+
.map((segment) => encodeURIComponent(segment).replace(/[()]/g, (char) => `%${char.charCodeAt(0).toString(16)}`))
|
|
47
|
+
.join("/");
|
|
48
|
+
}
|
|
49
|
+
/** Store the resolved fragment once; prompts restore it without consulting current templates. */
|
|
50
|
+
export function storePlanConventions(conventions, executionPath, planPath) {
|
|
51
|
+
const content = `${conventions.trimEnd()}\n`;
|
|
52
|
+
const hash = sha256(content);
|
|
53
|
+
const path = planConventionsPath(executionPath, hash);
|
|
54
|
+
const ref = relative(repositoryRoot(dirname(planPath)), path)
|
|
55
|
+
.split(sep)
|
|
56
|
+
.join("/");
|
|
57
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
58
|
+
// Publish a complete file atomically, so concurrent runs never read a partial snapshot.
|
|
59
|
+
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
60
|
+
writeFileSync(temporary, content, { encoding: "utf8", flag: "wx" });
|
|
61
|
+
try {
|
|
62
|
+
linkSync(temporary, path);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (error.code !== "EEXIST")
|
|
66
|
+
throw error;
|
|
67
|
+
if (readFileSync(path, "utf8") !== content) {
|
|
68
|
+
throw new Error(`Plan conventions SHA-256 mismatch: ${path} (expected ${hash})`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
unlinkSync(temporary);
|
|
73
|
+
}
|
|
74
|
+
return `\`共通規約 sha256:${hash}\` \`${ref}\``;
|
|
75
|
+
}
|
|
76
|
+
/** Also used by checkpointing, so a referenced version travels with its plan. */
|
|
77
|
+
export function planConventionsFiles(plan, baseDirectory = specdojoRootDir()) {
|
|
78
|
+
const reference = conventionsReference(plan);
|
|
79
|
+
if (!reference)
|
|
80
|
+
return [];
|
|
81
|
+
const { hash, ref, legacy } = reference;
|
|
82
|
+
const decoded = legacy ? decodeURIComponent(ref) : ref;
|
|
83
|
+
if (isAbsolute(decoded) ||
|
|
84
|
+
decoded.includes("\\") ||
|
|
85
|
+
!(decoded === `conventions/${hash}.txt` || decoded.endsWith(`/conventions/${hash}.txt`))) {
|
|
86
|
+
throw new Error(`Invalid plan conventions reference: ${ref}`);
|
|
87
|
+
}
|
|
88
|
+
const path = resolve(legacy ? baseDirectory : repositoryRoot(baseDirectory), decoded);
|
|
89
|
+
if (!existsSync(path)) {
|
|
90
|
+
throw new Error(`Plan conventions version not found: sha256:${hash}; path=${path}`);
|
|
91
|
+
}
|
|
92
|
+
if (sha256(readFileSync(path, "utf8")) !== hash) {
|
|
93
|
+
throw new Error(`Plan conventions SHA-256 mismatch: ${path} (expected ${hash})`);
|
|
94
|
+
}
|
|
95
|
+
return [path];
|
|
96
|
+
}
|
|
97
|
+
export function expandPlanConventions(plan, baseDirectory = specdojoRootDir()) {
|
|
98
|
+
const [path] = planConventionsFiles(plan, baseDirectory);
|
|
99
|
+
if (!path)
|
|
100
|
+
return plan;
|
|
101
|
+
const reference = conventionsReference(plan);
|
|
102
|
+
return (plan.slice(0, reference.start) +
|
|
103
|
+
readFileSync(path, "utf8").slice(0, -1) +
|
|
104
|
+
plan.slice(reference.end));
|
|
105
|
+
}
|
|
106
|
+
export function readPlanFile(planPath) {
|
|
107
|
+
return expandPlanConventions(readFileSync(planPath, "utf8"), dirname(planPath));
|
|
108
|
+
}
|
|
109
|
+
/** Include referenced snapshots wherever plan checkpoints are copied, committed or released. */
|
|
110
|
+
export function withPlanConventionsFiles(paths) {
|
|
111
|
+
return [
|
|
112
|
+
...new Set(paths.flatMap((path) => [
|
|
113
|
+
path,
|
|
114
|
+
...(path.endsWith(".md") && existsSync(path)
|
|
115
|
+
? planConventionsFiles(readFileSync(path, "utf8"), dirname(path))
|
|
116
|
+
: []),
|
|
117
|
+
])),
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
export function rebasePlanConventions(plan, from, to) {
|
|
121
|
+
const [path] = planConventionsFiles(plan, dirname(from));
|
|
122
|
+
const reference = conventionsReference(plan);
|
|
123
|
+
if (!path || !reference?.legacy)
|
|
124
|
+
return plan;
|
|
125
|
+
const ref = referencePath(to, path);
|
|
126
|
+
return (plan.slice(0, reference.start) +
|
|
127
|
+
`[共通規約 sha256:${reference.hash}](${ref})` +
|
|
128
|
+
plan.slice(reference.end));
|
|
129
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { isAbsolute, relative } from "node:path";
|
|
3
|
+
import { storePlanConventions } from "./plan-conventions.js";
|
|
4
|
+
import { specdojoPackageRootDir } from "./package-paths.js";
|
|
5
|
+
import { specdojoRootDir } from "./specdojo-config.js";
|
|
6
|
+
import { resolveSpecdojoPath, resolveSpecdojoPathIfExists } from "./template-resolution.js";
|
|
3
7
|
export const MISSING = "_MISSING_";
|
|
4
|
-
const COMMON_CONVENTIONS_TEMPLATE = "
|
|
8
|
+
const COMMON_CONVENTIONS_TEMPLATE = "xp-common-conventions-template.md";
|
|
5
9
|
const COMMON_CONVENTIONS_PLACEHOLDER = "_COMMON_CONVENTIONS_";
|
|
6
|
-
const REVIEW_ONLY_START = "<!-- review-only:start -->";
|
|
7
|
-
const REVIEW_ONLY_END = "<!-- review-only:end -->";
|
|
8
10
|
const PLAN_ESSENTIALS_START = "<!-- plan-essentials:start -->";
|
|
9
11
|
const PLAN_ESSENTIALS_END = "<!-- plan-essentials:end -->";
|
|
10
12
|
const DEFAULT_CONVENTIONS_HEADING = "## 共通: 記法・成果物規約";
|
|
@@ -59,54 +61,68 @@ function extractMarkedBlock(text, start, end) {
|
|
|
59
61
|
.join("\n")
|
|
60
62
|
.trim();
|
|
61
63
|
}
|
|
62
|
-
function conventionsReferenceSentence(
|
|
63
|
-
|
|
64
|
+
function conventionsReferenceSentence(referencePaths) {
|
|
65
|
+
const references = referencePaths.map((path) => `\`${path}\``).join("、");
|
|
66
|
+
return (`作業を始める前に、共通の規約の詳細 ${references} を読み、その内容に従う。` +
|
|
64
67
|
"次の箇条書きは、そのうち守らないと失敗に直結する要点である。");
|
|
65
68
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (marker === REVIEW_ONLY_END) {
|
|
76
|
-
inside = false;
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
if (!inside || isReview)
|
|
80
|
-
kept.push(line);
|
|
81
|
-
}
|
|
82
|
-
return kept
|
|
83
|
-
.join("\n")
|
|
84
|
-
.replace(/\n{3,}/g, "\n\n")
|
|
85
|
-
.trimEnd();
|
|
69
|
+
// Snapshots must not depend on the checkout supplying bundled resources. Keep local
|
|
70
|
+
// paths repository-relative and external bundled paths relative to the package root.
|
|
71
|
+
function conventionsResourceReference(path) {
|
|
72
|
+
if (!isAbsolute(path))
|
|
73
|
+
return path.replaceAll("\\", "/");
|
|
74
|
+
const local = relative(specdojoRootDir(), path).replaceAll("\\", "/");
|
|
75
|
+
return local.startsWith("../") || local === ".."
|
|
76
|
+
? relative(specdojoPackageRootDir(), path).replaceAll("\\", "/")
|
|
77
|
+
: local;
|
|
86
78
|
}
|
|
87
|
-
function planConventionsText(
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
sections.push(reviewOnly);
|
|
79
|
+
function planConventionsText(fragmentPaths, cache) {
|
|
80
|
+
const fragments = fragmentPaths.map((path) => readTemplate(path, cache));
|
|
81
|
+
const essentials = fragments.map((fragment) => extractMarkedBlock(fragment, PLAN_ESSENTIALS_START, PLAN_ESSENTIALS_END));
|
|
82
|
+
// マーカーのないローカル断片は全文を載せる従来の契約を維持する。
|
|
83
|
+
if (essentials.every((block) => block === null)) {
|
|
84
|
+
return fragments
|
|
85
|
+
.map((fragment) => fragment.trim())
|
|
86
|
+
.filter(Boolean)
|
|
87
|
+
.join("\n\n");
|
|
97
88
|
}
|
|
98
|
-
|
|
89
|
+
const heading = fragments[0].split("\n").find((line) => line.startsWith("## ")) ?? DEFAULT_CONVENTIONS_HEADING;
|
|
90
|
+
const content = fragments
|
|
91
|
+
.map((fragment, index) => {
|
|
92
|
+
const essential = essentials[index];
|
|
93
|
+
if (essential !== null && essential !== undefined)
|
|
94
|
+
return essential;
|
|
95
|
+
// 共通断片の見出しは上で案内とともに配置するため、全文との重複を避ける。
|
|
96
|
+
return (index === 0 ? fragment.replace(/^## .+$/m, "") : fragment).trim();
|
|
97
|
+
})
|
|
98
|
+
.filter(Boolean)
|
|
99
|
+
.reduce((previous, next) => {
|
|
100
|
+
const continuesList = previous.split("\n").at(-1)?.startsWith("- ") && next.startsWith("- ");
|
|
101
|
+
return previous ? `${previous}${continuesList ? "\n" : "\n\n"}${next}` : next;
|
|
102
|
+
}, "");
|
|
103
|
+
return [
|
|
104
|
+
heading,
|
|
105
|
+
conventionsReferenceSentence(fragmentPaths.map(conventionsResourceReference)),
|
|
106
|
+
content,
|
|
107
|
+
]
|
|
108
|
+
.filter(Boolean)
|
|
109
|
+
.join("\n\n");
|
|
99
110
|
}
|
|
100
|
-
export function injectCommonConventions(body, schemaRef, cache, mode = "edit") {
|
|
101
|
-
const
|
|
102
|
-
|
|
111
|
+
export function injectCommonConventions(body, schemaRef, cache, mode = "edit", storage) {
|
|
112
|
+
const fragmentPaths = [
|
|
113
|
+
execTemplatePath(COMMON_CONVENTIONS_TEMPLATE),
|
|
114
|
+
execTemplatePath(`${templatePrefix(mode)}-common-conventions-template.md`),
|
|
115
|
+
];
|
|
116
|
+
let conventions = planConventionsText(fragmentPaths, cache);
|
|
103
117
|
conventions =
|
|
104
118
|
schemaRef === MISSING
|
|
105
119
|
? conventions
|
|
106
120
|
.split("\n")
|
|
107
121
|
.filter((line) => !line.includes(SCHEMA_REF_PLACEHOLDER))
|
|
108
122
|
.join("\n")
|
|
109
|
-
: conventions.split(SCHEMA_REF_PLACEHOLDER).join(schemaRef);
|
|
123
|
+
: conventions.split(SCHEMA_REF_PLACEHOLDER).join(conventionsResourceReference(schemaRef));
|
|
124
|
+
if (storage)
|
|
125
|
+
conventions = storePlanConventions(conventions, storage.executionPath, storage.planPath);
|
|
110
126
|
if (body.includes(COMMON_CONVENTIONS_PLACEHOLDER)) {
|
|
111
127
|
return body.split(COMMON_CONVENTIONS_PLACEHOLDER).join(conventions);
|
|
112
128
|
}
|