specdojo 0.6.0 → 0.8.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 +3 -2
- package/CHANGELOG.md +193 -0
- package/README.md +2 -2
- package/dist/catalog/build.js +24 -1
- package/dist/catalog/plan.js +1 -1
- package/dist/catalog/scaffold.js +4 -1
- package/dist/commands/agent.js +33 -0
- package/dist/commands/init.js +6 -1
- package/dist/commands/night-orchestrator.js +6 -4
- package/dist/commands/orchestrator.js +10 -1
- package/dist/dashboard/dashboard-timeline.js +18 -16
- package/dist/dashboard/dashboard.js +612 -259
- package/dist/dashboard/epic-plan.js +81 -0
- package/dist/dashboard/exec-records.js +16 -20
- package/dist/dashboard/routines.js +8 -6
- package/dist/dashboard/timeline-build.js +5 -9
- package/dist/dashboard/timeline.js +9 -4
- package/dist/devcontainer/command.js +18 -0
- package/dist/devcontainer/host-script.js +21 -0
- package/dist/devcontainer/scaffold.js +22 -3
- package/dist/docs/frontmatter-namespace.js +1 -48
- package/dist/docs/yaml-pages.js +125 -3
- package/dist/exec/agent-config.js +22 -0
- package/dist/exec/agent-plan.js +3 -2
- package/dist/exec/antigravity-session.js +154 -0
- package/dist/exec/commands.js +69 -21
- package/dist/exec/commit-hook-skips.js +78 -0
- package/dist/exec/core.js +19 -7
- package/dist/exec/events.js +159 -8
- package/dist/exec/evidence.js +64 -16
- 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 +160 -12
- package/dist/exec/pipeline-state.js +27 -5
- package/dist/exec/plan-markdownlint.js +89 -0
- package/dist/exec/plans-condense-findings.js +89 -0
- package/dist/exec/plans-core.js +24 -17
- package/dist/exec/plans-generation.js +52 -25
- 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/register-resume.js +69 -42
- package/dist/exec/register.js +26 -22
- package/dist/exec/repo-integration-sync.js +8 -4
- package/dist/exec/repo-integration.js +21 -1
- package/dist/exec/reporter.js +121 -23
- package/dist/exec/results.js +85 -24
- package/dist/exec/review-completion.js +47 -0
- package/dist/exec/review-kata.js +109 -0
- package/dist/exec/run/agent-pipeline.js +75 -6
- package/dist/exec/run/agent.js +20 -7
- package/dist/exec/run/in-place.js +69 -32
- package/dist/exec/run/job.js +81 -24
- package/dist/exec/run/lifecycle-commands.js +264 -43
- package/dist/exec/run/mode-shared.js +11 -3
- package/dist/exec/run/register-command.js +12 -10
- package/dist/exec/run/register-core.js +20 -13
- package/dist/exec/run/register-mode.js +12 -12
- package/dist/exec/run/register-post-review.js +21 -9
- package/dist/exec/run/register-resume.js +28 -18
- package/dist/exec/run/register-state.js +10 -7
- package/dist/exec/run/register-worktree.js +60 -30
- package/dist/exec/run/schedule-mode.js +26 -6
- package/dist/exec/run/schedule-prepare.js +228 -45
- package/dist/exec/run/schedule-task.js +132 -25
- package/dist/exec/run/shared.js +4 -3
- package/dist/exec/run/trailing-records.js +35 -0
- package/dist/exec/run-records.js +2 -0
- package/dist/exec/strategy.js +1 -0
- package/dist/exec/trailing-records.js +242 -0
- package/dist/exec/trial-commands.js +3 -2
- package/dist/exec/validate-records-commit.js +110 -0
- package/dist/exec/validate-records.js +148 -0
- package/dist/exec/worktree-command.js +29 -16
- package/dist/exec/worktree-ops-commit.js +118 -59
- package/dist/exec/worktree-ops-lifecycle.js +77 -44
- package/dist/exec/worktree-ops-merge.js +13 -2
- package/dist/exec/worktree-ops.js +2 -2
- package/dist/exec/worktree.js +19 -2
- package/dist/grade/apply.js +32 -6
- package/dist/grade/command-inspect.js +2 -2
- package/dist/grade/command-run.js +2 -0
- 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 +23 -3
- package/dist/grade/target-discovery.js +17 -4
- package/dist/grade/targets.js +12 -11
- package/dist/job/job.js +31 -17
- package/dist/job/noop.js +104 -0
- 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 +4 -1
- package/dist/register/planning.js +7 -14
- package/dist/register/register.js +74 -32
- 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 +4 -3
- package/dist/routine/failure.js +30 -0
- package/dist/routine/routine.js +56 -32
- package/dist/routine/storage.js +33 -0
- package/dist/schedule/schedule.js +1 -0
- 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 +2 -0
- package/dist/shared/condense-records.js +25 -0
- package/dist/shared/deprecation.js +8 -0
- 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.js +149 -15
- package/dist/shared/grade-result.js +17 -1
- 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/provider-scaffold.js +2 -0
- package/dist/shared/run-records.js +224 -0
- package/dist/shared/specdojo-config.js +39 -21
- package/dist/shared/specdojo-gitignore.js +1 -0
- package/dist/shared/text.js +65 -5
- package/dist/shared/timeline-index.js +2 -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 +48 -0
- package/docs/ja/specdojo/guides/docs-structure-guide.md +48 -15
- package/docs/ja/specdojo/guides/exec-config-guide.md +61 -28
- package/docs/ja/specdojo/guides/exec-operation-guide.md +61 -13
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +20 -11
- package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +4 -2
- 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 +589 -807
- package/docs/ja/specdojo/guides/register-operation-guide.md +26 -4
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +33 -4
- package/docs/ja/specdojo/guides/review-guide.md +22 -19
- package/docs/ja/specdojo/guides/routine-operation-guide.md +14 -8
- package/docs/ja/specdojo/guides/ryu-guide.md +23 -13
- package/docs/ja/specdojo/guides/schedule-design-guide.md +7 -4
- package/docs/ja/specdojo/guides/schedule-operation-guide.md +41 -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 +471 -74
- package/docs/ja/specdojo/recipes/bac-recipe.md +94 -0
- package/docs/ja/specdojo/recipes/bes-recipe.md +105 -0
- package/docs/ja/specdojo/recipes/br-recipe.md +84 -0
- package/docs/ja/specdojo/recipes/cdfd-overview-recipe.md +88 -86
- package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +108 -122
- package/docs/ja/specdojo/recipes/cnd-recipe.md +125 -0
- package/docs/ja/specdojo/recipes/cpd-recipe.md +126 -0
- package/docs/ja/specdojo/recipes/cxd-recipe.md +145 -0
- package/docs/ja/specdojo/recipes/ifd-recipe.md +134 -0
- package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +135 -86
- package/docs/ja/specdojo/recipes/ifx-index-recipe.md +130 -0
- package/docs/ja/specdojo/recipes/pm-organization-recipe.md +29 -26
- package/docs/ja/specdojo/recipes/pm-plan-recipe.md +35 -26
- package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +38 -28
- package/docs/ja/specdojo/recipes/pm-raci-recipe.md +39 -31
- package/docs/ja/specdojo/recipes/pm-roles-recipe.md +26 -28
- package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +10 -8
- package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +18 -17
- package/docs/ja/specdojo/recipes/stsd-recipe.md +100 -62
- package/docs/ja/specdojo/recipes/sysd-critical-flows-recipe.md +106 -0
- package/docs/ja/specdojo/recipes/sysd-cross-cutting-policy-recipe.md +137 -0
- package/docs/ja/specdojo/recipes/sysd-index-recipe.md +122 -0
- package/docs/ja/specdojo/references/command-reference.md +146 -99
- package/docs/ja/specdojo/references/deliverables-reference.md +9 -4
- package/docs/ja/specdojo/references/directory-layout-reference.md +3 -2
- package/docs/ja/specdojo/references/specdojo-config-reference.md +17 -16
- package/docs/ja/specdojo/rulebooks/bac-rulebook.md +72 -290
- package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +212 -79
- package/docs/ja/specdojo/rulebooks/bds-rulebook.md +138 -154
- package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +147 -59
- package/docs/ja/specdojo/rulebooks/bes-rulebook.md +100 -96
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +88 -108
- package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +126 -211
- package/docs/ja/specdojo/rulebooks/cdfd-d2-rulebook.md +367 -0
- package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +6 -5
- package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +96 -100
- package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +38 -47
- package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +132 -106
- package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +102 -68
- package/docs/ja/specdojo/rulebooks/cdt-rulebook.md +152 -0
- package/docs/ja/specdojo/rulebooks/cld-rulebook.md +9 -184
- package/docs/ja/specdojo/rulebooks/clis-rulebook.md +187 -0
- package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +93 -247
- package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +104 -241
- package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +124 -257
- package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +87 -98
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +9 -7
- package/docs/ja/specdojo/rulebooks/dec-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/dss-rulebook.md +193 -0
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +100 -54
- package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +69 -252
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +91 -76
- package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +252 -226
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +118 -40
- package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +11 -11
- package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +9 -9
- package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +4 -4
- package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +11 -11
- package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +11 -11
- package/docs/ja/specdojo/rulebooks/mm-rulebook.md +4 -3
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +34 -29
- package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +8 -8
- package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +2 -2
- package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +50 -56
- package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +46 -55
- package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +57 -54
- package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +50 -65
- package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +2 -2
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +70 -97
- package/docs/ja/specdojo/rulebooks/pr-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +47 -56
- package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +61 -135
- package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +116 -32
- package/docs/ja/specdojo/rulebooks/sf-rulebook.md +118 -61
- package/docs/ja/specdojo/rulebooks/sld-rulebook.md +152 -57
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +51 -39
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +101 -46
- package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +72 -329
- package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +74 -263
- package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +78 -195
- package/docs/ja/specdojo/rulebooks/tml-rulebook.md +4 -9
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +3 -4
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +3 -3
- package/docs/ja/specdojo/rulebooks/uis-rulebook.md +140 -143
- 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 +100 -21
- package/docs/ja/specdojo/samples/bes-index-sample.md +59 -20
- package/docs/ja/specdojo/samples/bes-sample.md +80 -21
- package/docs/ja/specdojo/samples/br-sample.md +68 -14
- package/docs/ja/specdojo/samples/ccd-sample.md +81 -19
- package/docs/ja/specdojo/samples/cdfd-overview-sample.md +248 -140
- package/docs/ja/specdojo/samples/cdfd-sample.md +172 -99
- package/docs/ja/specdojo/samples/cdfd-uc-sample.md +130 -97
- package/docs/ja/specdojo/samples/cdsd-sample.md +89 -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 +132 -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/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-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/pm-members-sample.yaml +37 -13
- package/docs/ja/specdojo/samples/pm-organization-sample.md +52 -20
- package/docs/ja/specdojo/samples/pm-plan-sample.md +84 -26
- package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +55 -22
- package/docs/ja/specdojo/samples/pm-raci-sample.md +69 -28
- package/docs/ja/specdojo/samples/pm-roles-sample.yaml +13 -12
- package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +50 -26
- package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +89 -62
- package/docs/ja/specdojo/samples/sf-index-sample.md +89 -20
- package/docs/ja/specdojo/samples/sf-sample.md +121 -21
- package/docs/ja/specdojo/samples/sld-sample.md +107 -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 +164 -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/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-overview-template.md +161 -83
- package/docs/ja/specdojo/templates/cdfd-template.md +81 -54
- package/docs/ja/specdojo/templates/cdfd-uc-template.md +130 -89
- 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 +3 -0
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +54 -3
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +3 -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/register-events.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +17 -1
- package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +1 -0
- package/package.json +6 -3
- package/templates/antigravity/README.md +19 -46
- package/templates/antigravity/exec-defaults-snippet.yaml +5 -6
- package/templates/antigravity/orchestrator.md +3 -2
- package/templates/antigravity/settings.edit.json +73 -0
- package/templates/antigravity/settings.orchestrator.json +15 -0
- package/templates/antigravity/settings.report.json +7 -0
- package/templates/antigravity/settings.review.json +7 -0
- package/templates/claude/agents/specdojo-orchestrator.md +3 -2
- package/templates/codex/agents/specdojo-orchestrator.toml +3 -2
- package/templates/codex/orchestrator.md +3 -2
- package/templates/devcontainer/remote-host/devcontainer-tmux.sh +217 -0
- package/templates/devcontainer/remote-host/specdojo-tmux.sh.sample +8 -96
- package/templates/devcontainer/remote-host/ssh-config.sample +3 -1
- package/templates/devcontainer/tmux.conf +6 -0
- package/templates/init-agent-members.yaml +1 -0
- package/templates/init-exec-defaults.yaml +1 -1
- package/templates/opencode/agents/specdojo-orchestrator.md +3 -2
|
@@ -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
|
}
|
|
@@ -16,6 +16,8 @@ export const ORCHESTRATOR_NPM_SCRIPTS = {
|
|
|
16
16
|
"orch:luna": 'specdojo orchestrator launch --provider codex -- -m gpt-6-luna "$(cat .specdojo/codex/orchestrator.md)"',
|
|
17
17
|
},
|
|
18
18
|
antigravity: {
|
|
19
|
+
"orch:argon": 'specdojo orchestrator launch --provider antigravity -- --add-dir "$(pwd)" --model gemini-4-argon-medium -i "$(cat .specdojo/antigravity/orchestrator.md)"',
|
|
20
|
+
"orch:argon:work": 'tools/worktree/open-agent-worktree.sh argon-work specdojo orchestrator launch --provider antigravity -- --add-dir . --model gemini-4-argon-medium -i "$(cat .specdojo/antigravity/orchestrator.md)"',
|
|
19
21
|
"orch:flash": 'specdojo orchestrator launch --provider antigravity -- --add-dir "$(pwd)" --model gemini-3.8-flash-high -i "$(cat .specdojo/antigravity/orchestrator.md)"',
|
|
20
22
|
},
|
|
21
23
|
opencode: {
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { copyFileSync, existsSync, readdirSync, readFileSync, renameSync, statSync, writeFileSync, } from "node:fs";
|
|
2
|
+
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
3
|
+
import { readSpecdojoNamespace } from "./frontmatter-namespace.js";
|
|
4
|
+
function pathSegment(value) {
|
|
5
|
+
const segment = value.trim().replace(/[^A-Za-z0-9._-]/g, "_");
|
|
6
|
+
if (!segment || segment === "." || segment === "..")
|
|
7
|
+
throw new Error(`Invalid run record identity: ${value}`);
|
|
8
|
+
return segment;
|
|
9
|
+
}
|
|
10
|
+
export const RUN_ORIGINS = ["register", "schedule", "job"];
|
|
11
|
+
export function runRecordsDirectory(executionPath) {
|
|
12
|
+
return join(executionPath, "runs");
|
|
13
|
+
}
|
|
14
|
+
/** Accept only an exact origin/item/run directory produced by the path policy. */
|
|
15
|
+
export function runRecordLocation(executionPath, directory) {
|
|
16
|
+
const parts = relative(runRecordsDirectory(executionPath), directory).split(/[\\/]/);
|
|
17
|
+
if (parts.length !== 3 || !RUN_ORIGINS.includes(parts[0]))
|
|
18
|
+
return undefined;
|
|
19
|
+
try {
|
|
20
|
+
const paths = runRecordPaths(executionPath, parts[0], parts[1], parts[2]);
|
|
21
|
+
return resolve(paths.directory) === resolve(directory) ? paths : undefined;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function planConventionsDirectory(executionPath) {
|
|
28
|
+
return join(executionPath, "conventions");
|
|
29
|
+
}
|
|
30
|
+
export function planConventionsPath(executionPath, hash) {
|
|
31
|
+
if (!/^[a-f0-9]{64}$/.test(hash))
|
|
32
|
+
throw new Error(`Invalid conventions SHA-256: ${hash}`);
|
|
33
|
+
return join(planConventionsDirectory(executionPath), `${hash}.txt`);
|
|
34
|
+
}
|
|
35
|
+
/** All managed execution record paths. */
|
|
36
|
+
export function runRecordPaths(executionPath, origin, itemId, runId) {
|
|
37
|
+
if (!RUN_ORIGINS.includes(origin))
|
|
38
|
+
throw new Error(`Invalid run origin: ${origin}`);
|
|
39
|
+
const directory = join(runItemDirectory(executionPath, origin, itemId), pathSegment(runId));
|
|
40
|
+
return {
|
|
41
|
+
directory,
|
|
42
|
+
plan: join(directory, "plan.md"),
|
|
43
|
+
result: join(directory, "result.md"),
|
|
44
|
+
evidence: join(directory, "evidence.json"),
|
|
45
|
+
state: join(directory, "pipeline-state.json"),
|
|
46
|
+
log: (name) => join(directory, basename(name)),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export function recordIdentity(taskId, origin) {
|
|
50
|
+
const local = taskId.replace(/^[^:]+:/, "");
|
|
51
|
+
const inferred = origin ?? (/^pjr-/i.test(local) ? "register" : /^JBR-/i.test(local) ? "job" : "schedule");
|
|
52
|
+
const itemId = inferred === "register"
|
|
53
|
+
? (local.match(/^pjr-[a-z0-9]+/i)?.[0] ?? local).toUpperCase()
|
|
54
|
+
: inferred === "job"
|
|
55
|
+
? local.replace(/-review$/, "")
|
|
56
|
+
: local;
|
|
57
|
+
return { origin: inferred, itemId };
|
|
58
|
+
}
|
|
59
|
+
export function runItemDirectory(executionPath, origin, itemId) {
|
|
60
|
+
return join(runRecordsDirectory(executionPath), origin, pathSegment(itemId));
|
|
61
|
+
}
|
|
62
|
+
export function taskRecordPaths(executionPath, taskId, runId = taskId, origin) {
|
|
63
|
+
const identity = recordIdentity(taskId, origin);
|
|
64
|
+
return runRecordPaths(executionPath, identity.origin, identity.itemId, runId);
|
|
65
|
+
}
|
|
66
|
+
export function taskEvidencePaths(executionPath, taskId, runId) {
|
|
67
|
+
const records = taskRecordPaths(executionPath, taskId, runId);
|
|
68
|
+
return { directory: records.directory, evidence: records.evidence, state: records.state };
|
|
69
|
+
}
|
|
70
|
+
export function runRecordPrefixes(executionPath, taskId, runId) {
|
|
71
|
+
return [`${taskRecordPaths(executionPath, taskId, runId).directory.replaceAll("\\", "/")}/`];
|
|
72
|
+
}
|
|
73
|
+
function filesBelow(path) {
|
|
74
|
+
if (!existsSync(path))
|
|
75
|
+
return [];
|
|
76
|
+
return readdirSync(path, { withFileTypes: true })
|
|
77
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
78
|
+
.flatMap((entry) => {
|
|
79
|
+
const child = join(path, entry.name);
|
|
80
|
+
return entry.isDirectory() ? filesBelow(child) : entry.isFile() ? [child] : [];
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
export function listRunRecords(executionPath, kind) {
|
|
84
|
+
return filesBelow(join(executionPath, "runs")).filter((path) => basename(path) === `${kind}.md`);
|
|
85
|
+
}
|
|
86
|
+
/** Find the latest run for an item, or a run with the requested stem. */
|
|
87
|
+
export function findRunRecord(executionPath, kind, taskOrStem) {
|
|
88
|
+
const identity = recordIdentity(taskOrStem);
|
|
89
|
+
const itemDirectory = runItemDirectory(executionPath, identity.origin, identity.itemId);
|
|
90
|
+
const newFiles = filesBelow(existsSync(itemDirectory) ? itemDirectory : join(executionPath, "runs")).filter((path) => basename(path) === `${kind}.md`);
|
|
91
|
+
const matches = newFiles.filter((path) => {
|
|
92
|
+
if (recordStem(path) === taskOrStem)
|
|
93
|
+
return true;
|
|
94
|
+
try {
|
|
95
|
+
return readSpecdojoNamespace(readFileSync(path, "utf8")).task_id === taskOrStem;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const latest = (paths) => paths
|
|
102
|
+
.sort((a, b) => {
|
|
103
|
+
const time = (path) => {
|
|
104
|
+
if (kind === "result") {
|
|
105
|
+
try {
|
|
106
|
+
const started = readSpecdojoNamespace(readFileSync(path, "utf8")).started_at;
|
|
107
|
+
const timestamp = typeof started === "string" ? Date.parse(started) : NaN;
|
|
108
|
+
if (Number.isFinite(timestamp))
|
|
109
|
+
return timestamp;
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
/* Fall back to the file timestamp for malformed historical records. */
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return statSync(path).birthtimeMs || statSync(path).mtimeMs;
|
|
116
|
+
};
|
|
117
|
+
return time(a) - time(b) || a.localeCompare(b);
|
|
118
|
+
})
|
|
119
|
+
.at(-1);
|
|
120
|
+
return latest(matches);
|
|
121
|
+
}
|
|
122
|
+
export function recordPathForRead(executionPath, kind, taskOrStem) {
|
|
123
|
+
return (findRunRecord(executionPath, kind, taskOrStem) ??
|
|
124
|
+
taskRecordPaths(executionPath, taskOrStem)[kind]);
|
|
125
|
+
}
|
|
126
|
+
export function isRunRecordPath(path) {
|
|
127
|
+
return /(?:^|\/)runs\/(?:register|schedule|job)\/[^/]+\/[^/]+\//.test(path.replaceAll("\\", "/"));
|
|
128
|
+
}
|
|
129
|
+
export function recordStem(path) {
|
|
130
|
+
return isRunRecordPath(path)
|
|
131
|
+
? basename(dirname(path))
|
|
132
|
+
: basename(path).replace(/-(plan|result)\.md$/, "");
|
|
133
|
+
}
|
|
134
|
+
export function resultForPlan(planPath) {
|
|
135
|
+
return isRunRecordPath(planPath)
|
|
136
|
+
? join(dirname(planPath), "result.md")
|
|
137
|
+
: planPath.replace(/-plan\.md$/, "-result.md");
|
|
138
|
+
}
|
|
139
|
+
export function recordRef(executionPath, path) {
|
|
140
|
+
return relative(executionPath, path).replaceAll("\\", "/");
|
|
141
|
+
}
|
|
142
|
+
export function runnerRecordPrefixes(executionPath) {
|
|
143
|
+
return [planConventionsDirectory(executionPath), join(executionPath, "runs")].map((path) => `${path.replaceAll("\\", "/")}/`);
|
|
144
|
+
}
|
|
145
|
+
export function taskRecordPrefixes(executionPath, taskId) {
|
|
146
|
+
const identity = recordIdentity(taskId);
|
|
147
|
+
return [
|
|
148
|
+
planConventionsDirectory(executionPath),
|
|
149
|
+
runItemDirectory(executionPath, identity.origin, identity.itemId),
|
|
150
|
+
].map((path) => `${path.replaceAll("\\", "/")}/`);
|
|
151
|
+
}
|
|
152
|
+
export function resumeStatePaths(executionPath, taskId) {
|
|
153
|
+
const identity = recordIdentity(taskId);
|
|
154
|
+
return [runItemDirectory(executionPath, identity.origin, identity.itemId)]
|
|
155
|
+
.flatMap(filesBelow)
|
|
156
|
+
.filter((path) => basename(path) === "pipeline-state.json");
|
|
157
|
+
}
|
|
158
|
+
export function runEvidencePath(statePath) {
|
|
159
|
+
return join(dirname(statePath), "evidence.json");
|
|
160
|
+
}
|
|
161
|
+
export function runLogPath(statePath, name) {
|
|
162
|
+
return join(dirname(statePath), basename(name));
|
|
163
|
+
}
|
|
164
|
+
export function executionRecordLink(file, kind) {
|
|
165
|
+
return join("..", "exec", file.includes("/") ? file : `${kind === "plan" ? "plans" : "results"}/${file}`).replaceAll("\\", "/");
|
|
166
|
+
}
|
|
167
|
+
export function isPlanOrResultRecord(path) {
|
|
168
|
+
// Recognize obsolete names for commit-scope protection without reading that layout.
|
|
169
|
+
return (/(?:^|\/)exec\/(?:plans|results)\//.test(path.replaceAll("\\", "/")) ||
|
|
170
|
+
(isRunRecordPath(path) && /\/(plan|result)\.md$/.test(path.replaceAll("\\", "/"))));
|
|
171
|
+
}
|
|
172
|
+
export function isOtherRunRecord(path, resultPath) {
|
|
173
|
+
return isRunRecordPath(path) && dirname(path) !== dirname(resultPath);
|
|
174
|
+
}
|
|
175
|
+
/** Archive a checkpoint; keep original logs only when the next stage retains their refs. */
|
|
176
|
+
export function snapshotRunAttempt(statePath, retainedLogRefs = []) {
|
|
177
|
+
if (!existsSync(statePath))
|
|
178
|
+
return;
|
|
179
|
+
const directory = dirname(statePath);
|
|
180
|
+
let attempt = 1;
|
|
181
|
+
while (existsSync(join(directory, `pipeline-state.attempt-${attempt}.json`)))
|
|
182
|
+
attempt++;
|
|
183
|
+
const names = readdirSync(directory).filter((file) => !file.includes(".attempt-") &&
|
|
184
|
+
(file === "pipeline-state.json" || file === "evidence.json" || file.endsWith(".log")));
|
|
185
|
+
const retainedLogs = new Set(retainedLogRefs.map((ref) => basename(ref.path.replaceAll("\\", "/"))));
|
|
186
|
+
const archivedLogs = new Map();
|
|
187
|
+
for (const name of names.filter((file) => file.endsWith(".log"))) {
|
|
188
|
+
archivedLogs.set(name, `${name.slice(0, -4)}.attempt-${attempt}.log`);
|
|
189
|
+
}
|
|
190
|
+
for (const name of names) {
|
|
191
|
+
const dot = name.lastIndexOf(".");
|
|
192
|
+
const destination = join(directory, `${name.slice(0, dot)}.attempt-${attempt}${name.slice(dot)}`);
|
|
193
|
+
if (name.endsWith(".log") && !retainedLogs.has(name)) {
|
|
194
|
+
renameSync(join(directory, name), destination);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
copyFileSync(join(directory, name), destination);
|
|
198
|
+
}
|
|
199
|
+
if (name === "evidence.json") {
|
|
200
|
+
try {
|
|
201
|
+
const evidence = JSON.parse(readFileSync(destination, "utf8"));
|
|
202
|
+
if (Array.isArray(evidence.log_refs)) {
|
|
203
|
+
evidence.log_refs = evidence.log_refs.map((ref) => {
|
|
204
|
+
const refName = basename(ref.path.replaceAll("\\", "/"));
|
|
205
|
+
const archivedName = archivedLogs.get(refName);
|
|
206
|
+
return {
|
|
207
|
+
...ref,
|
|
208
|
+
path: archivedName
|
|
209
|
+
? `${ref.path.slice(0, -refName.length)}${archivedName}`
|
|
210
|
+
: ref.path,
|
|
211
|
+
};
|
|
212
|
+
});
|
|
213
|
+
writeFileSync(destination, `${JSON.stringify(evidence, null, 2)}\n`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
/* Preserve malformed evidence verbatim for diagnosis. */
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
export function resolveRunPlanRef(executionPath, ref) {
|
|
223
|
+
return ref.replaceAll("\\", "/").startsWith("runs/") ? resolve(executionPath, ref) : resolve(ref);
|
|
224
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { warnDeprecated } from "./deprecation.js";
|
|
1
2
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
2
4
|
import { basename, dirname, isAbsolute, join, posix, relative, resolve } from "node:path";
|
|
3
5
|
import dotenv from "dotenv";
|
|
4
6
|
import { validateBranchTemplate } from "./branch-template.js";
|
|
@@ -167,26 +169,34 @@ export function isSpecdojoSourceRepository(rootDir = specdojoRootDir()) {
|
|
|
167
169
|
return false;
|
|
168
170
|
}
|
|
169
171
|
}
|
|
170
|
-
function
|
|
171
|
-
|
|
172
|
+
export function specdojoRootDir(startDir = process.cwd()) {
|
|
173
|
+
const current = resolve(startDir);
|
|
174
|
+
const systemTmp = resolve(tmpdir());
|
|
175
|
+
let dir = current;
|
|
176
|
+
let firstGitDir = null;
|
|
172
177
|
while (true) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
178
|
+
// 一時ディレクトリのルートそのもの(/tmp など)にある設定は、テストや検証の
|
|
179
|
+
// 漏洩・干渉を防ぐため親として拾わない。また一時ディレクトリ内から systemTmp を越えて探索しない。
|
|
180
|
+
if (dir === systemTmp) {
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
if (existsSync(join(dir, ".specdojo", "specdojo.config.json"))) {
|
|
184
|
+
return dir;
|
|
185
|
+
}
|
|
186
|
+
if (!firstGitDir && existsSync(join(dir, ".git"))) {
|
|
187
|
+
firstGitDir = dir;
|
|
188
|
+
// リポジトリ境界に到達した。.git より親の .specdojo は拾わない。
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
const parent = dirname(dir);
|
|
192
|
+
if (parent === dir)
|
|
193
|
+
break;
|
|
194
|
+
dir = parent;
|
|
195
|
+
}
|
|
196
|
+
if (firstGitDir) {
|
|
197
|
+
return firstGitDir;
|
|
198
|
+
}
|
|
199
|
+
return current;
|
|
190
200
|
}
|
|
191
201
|
/** Default worktree directory beside the repository, derived from its directory name. */
|
|
192
202
|
export function defaultWorktreeBase(rootDir = specdojoRootDir()) {
|
|
@@ -224,6 +234,8 @@ export function getProjectExecutionPath(project) {
|
|
|
224
234
|
// Timeline lives in a fixed cross-cutting directory under the project root, so an
|
|
225
235
|
// unset timeline_path falls back to "timeline" instead of disabling the command.
|
|
226
236
|
export function getProjectTimelinePath(project) {
|
|
237
|
+
if (project.timeline_path !== undefined)
|
|
238
|
+
warnDeprecated("timeline_path", "Use register epics and dashboard build.");
|
|
227
239
|
return withBasePath(project, project.timeline_path?.trim() || "timeline");
|
|
228
240
|
}
|
|
229
241
|
export function getProjectMembersPath(project) {
|
|
@@ -703,6 +715,8 @@ export function loadConfig(configRootDir = specdojoRootDir()) {
|
|
|
703
715
|
throw new Error(`Invalid .specdojo/specdojo.config.json: kata_authority must match ${KATA_AUTHORITY_PATTERN}`);
|
|
704
716
|
}
|
|
705
717
|
for (const [projectId, project] of Object.entries(parsed.projects)) {
|
|
718
|
+
if (project?.timeline_path !== undefined)
|
|
719
|
+
warnDeprecated("timeline_path", "Use register epics and dashboard build.");
|
|
706
720
|
if (!isValidProjectConfig(project)) {
|
|
707
721
|
throw new Error(`Invalid .specdojo/specdojo.config.json: projects.${projectId} must omit ` +
|
|
708
722
|
`schedule_path/execution_path/integration_branch or set them to non-empty strings, ` +
|
|
@@ -767,9 +781,13 @@ export function registerConfigCommands(program) {
|
|
|
767
781
|
"and initialize .gitignore and markdownlint settings")
|
|
768
782
|
.option("--dry-run", "Show the planned config, .gitignore and markdownlint settings without writing", false)
|
|
769
783
|
.action((opts) => {
|
|
784
|
+
const rootDir = specdojoRootDir();
|
|
785
|
+
if (resolve(rootDir) === resolve(tmpdir())) {
|
|
786
|
+
throw new Error("Refusing to initialize specdojo configuration directly under temporary directory root.");
|
|
787
|
+
}
|
|
770
788
|
const dryRun = !!opts.dryRun;
|
|
771
|
-
const { configPath, config } = loadConfig();
|
|
772
|
-
ensureMarkdownlintConfig(
|
|
789
|
+
const { configPath, config } = loadConfig(rootDir);
|
|
790
|
+
ensureMarkdownlintConfig(rootDir, dryRun);
|
|
773
791
|
if (config) {
|
|
774
792
|
process.stdout.write(`Already exists: ${configPath}\n`);
|
|
775
793
|
writeGitignoreForConfig(config, dryRun);
|