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
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { relative, resolve, sep } from "node:path";
|
|
2
|
+
import { enforceExecutorReportContract, executorStageResumeHint, recordExecutorEvidence, recordReporterFailureOutput, writeExecutorEvidence, } from "../evidence.js";
|
|
3
|
+
import { integrationCommitSkipHooks } from "../commit-hook-skips.js";
|
|
4
|
+
import { reviewTaskBlockReason } from "../review-completion.js";
|
|
2
5
|
import { limitEventMeta } from "../limit.js";
|
|
6
|
+
import { createPipelineState, loadPipelineResumeCheckpoint, pipelineStateLocation, updatePipelineStage, writePipelineState, } from "../pipeline-state.js";
|
|
7
|
+
import { commitProductWorktrees, integrateTaskRepositories, PROJECT_REPO_NAME, projectMergeBlockers, RepoIntegrationError, } from "../repo-integration.js";
|
|
8
|
+
import { deriveReporterFacts, evidenceForReporter, runReporterWithFormatRetry, } from "../reporter.js";
|
|
3
9
|
import { readResultFrontmatterSnapshot, renderReporterResult, updateResultStatus, } from "../results.js";
|
|
4
|
-
import {
|
|
10
|
+
import { recordPathForRead, snapshotRunAttempt } from "../run-records.js";
|
|
5
11
|
import { withProductRepoPrompt } from "../task-repos.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { deriveReporterFacts, evidenceForReporter, runReporterWithFormatRetry, } from "../reporter.js";
|
|
10
|
-
import { createPipelineState, loadPipelineResumeCheckpoint, pipelineStateLocation, updatePipelineStage, writePipelineState, } from "../pipeline-state.js";
|
|
11
|
-
import { agentEnvironment, appendParentValidationsToExecutorEvidence, buildExecutorPrompt, extractBlockReason, pathInsideWorktree, resumedTargetCoverageFailure, runWithRetry, } from "./agent.js";
|
|
12
|
+
import { branchOwnedRunRecordPaths } from "../trailing-records.js";
|
|
13
|
+
import { assertCommitScope, commitTargetPaths, commitWorktreeChanges, isExecBranchMergedIntoCurrent, mergeWorktreeIntoCurrent, releaseRootWorkingCopies, removeWorktree, taskTargetsAtHead, WorktreeRemovedBranchDeletionError, worktreeStatusPaths, } from "../worktree-ops.js";
|
|
14
|
+
import { gitOutput } from "../worktree.js";
|
|
12
15
|
import { refreshParentValidationsForReporterResume } from "./agent-pipeline.js";
|
|
13
|
-
import {
|
|
14
|
-
import { commitSubject, integrateLogPath, pipelineRecoveryMeta, recordIntegrateStage, recordRepoIntegration, repoRelativePath, spawnBlock, spawnComplete, } from "./mode-shared.js";
|
|
16
|
+
import { agentEnvironment, appendParentValidationsToExecutorEvidence, buildExecutorPrompt, extractBlockReason, pathInsideWorktree, resumedTargetCoverageFailure, runWithRetry, } from "./agent.js";
|
|
17
|
+
import { commitSubject, integrateLogPath, pipelineRecoveryMeta, recordIntegrateStage, recordRepoIntegration, repoRelativePath, spawnBlock, spawnComplete, stageActorMeta, } from "./mode-shared.js";
|
|
18
|
+
import { downgradeUnfilledResult, enforceScheduleKataReview, readCompletionPreflight, } from "./schedule-prepare.js";
|
|
15
19
|
export async function runPreparedTask(prepared, projectId, repoRoot, schedulePath, executionPath, catalogPath, execDefaults, dryRun, lifecycleLock) {
|
|
16
20
|
if (dryRun)
|
|
17
21
|
return "success";
|
|
@@ -77,7 +81,8 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
77
81
|
}
|
|
78
82
|
else if (prepared.pipelineResumeStage === "reporter" &&
|
|
79
83
|
checkpoint.evidence &&
|
|
80
|
-
checkpoint.state.stages.executor.artifact_ref
|
|
84
|
+
checkpoint.state.stages.executor.artifact_ref &&
|
|
85
|
+
!prepared.reviewGradeRefreshed?.length) {
|
|
81
86
|
executorEvidence = checkpoint.evidence;
|
|
82
87
|
executorEvidenceRef = checkpoint.state.stages.executor.artifact_ref;
|
|
83
88
|
executorEvidencePath = resolve(prepared.worktree.path, executorEvidenceRef);
|
|
@@ -92,7 +97,9 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
92
97
|
});
|
|
93
98
|
}
|
|
94
99
|
else if (prepared.pipelineResumeStage === "reporter") {
|
|
95
|
-
process.stdout.write(
|
|
100
|
+
process.stdout.write(prepared.reviewGradeRefreshed?.length
|
|
101
|
+
? " Grade changed after the persisted review executor ran; starting a new executor run.\n"
|
|
102
|
+
: " Persisted executor evidence is invalid; starting a new executor run.\n");
|
|
96
103
|
pipelineState = undefined;
|
|
97
104
|
pipelineStatePath = undefined;
|
|
98
105
|
pipelineStateRef = undefined;
|
|
@@ -117,6 +124,14 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
117
124
|
updatedAt: now,
|
|
118
125
|
executorActor: prepared.agentCandidates[0]?.actor ?? prepared.actor,
|
|
119
126
|
reporterActor: prepared.reporterCandidates?.[0]?.actor,
|
|
127
|
+
artifacts: {
|
|
128
|
+
plan_ref: relative(repoRoot, recordPathForRead(executionPath, "plan", prepared.task.id))
|
|
129
|
+
.split(sep)
|
|
130
|
+
.join("/"),
|
|
131
|
+
result_ref: worktreeResultPath
|
|
132
|
+
? relative(prepared.worktree.path, worktreeResultPath).split(sep).join("/")
|
|
133
|
+
: "",
|
|
134
|
+
},
|
|
120
135
|
});
|
|
121
136
|
pipelineStatePath = location.path;
|
|
122
137
|
pipelineStateRef = location.ref;
|
|
@@ -127,6 +142,8 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
127
142
|
!resumeIntegration &&
|
|
128
143
|
pipelineState &&
|
|
129
144
|
pipelineStatePath) {
|
|
145
|
+
if (prepared.pipelineResumeStage === "executor")
|
|
146
|
+
snapshotRunAttempt(pipelineStatePath);
|
|
130
147
|
const executorStartedAt = new Date().toISOString();
|
|
131
148
|
pipelineState = updatePipelineStage(pipelineState, "executor", {
|
|
132
149
|
status: "running",
|
|
@@ -140,6 +157,8 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
140
157
|
? buildExecutorPrompt(prepared.plan, execDefaults.pipeline?.parent_validations, {
|
|
141
158
|
resumed: true,
|
|
142
159
|
existingChanges: worktreeStatusPaths(prepared.worktree.path),
|
|
160
|
+
initialChangeTargets: prepared.initialChangeTargets,
|
|
161
|
+
resumeHandoff: prepared.resumeHandoff,
|
|
143
162
|
})
|
|
144
163
|
: prepared.prompt;
|
|
145
164
|
const executorOutcome = await runWithRetry(prepared.agentCandidates, withProductRepoPrompt(executorPrompt, prepared.worktree.repos), execDefaults, prepared.worktree.path, agentEnvironment(repoRoot, prepared.worktree.path, schedulePath, executionPath, prepared.worktree.repos), worktreeResultPath, prepared.executorRateLimitOptions);
|
|
@@ -178,6 +197,7 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
178
197
|
plan: prepared.plan,
|
|
179
198
|
evidence: executorEvidence,
|
|
180
199
|
evidencePath: executorEvidencePath,
|
|
200
|
+
initialChangeTargets: prepared.initialChangeTargets,
|
|
181
201
|
})
|
|
182
202
|
: undefined;
|
|
183
203
|
if (result === "success" && coverageFailure) {
|
|
@@ -214,6 +234,31 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
214
234
|
});
|
|
215
235
|
}
|
|
216
236
|
}
|
|
237
|
+
// PJR-1GCD: a missing approach-required field (e.g. `condense_records`) is an executor failure.
|
|
238
|
+
// Checked before the reporter so fresh runs and reporter resumes both stop at the executor stage.
|
|
239
|
+
if (prepared.pipelineRunId &&
|
|
240
|
+
result === "success" &&
|
|
241
|
+
!resumeIntegration &&
|
|
242
|
+
executorEvidence &&
|
|
243
|
+
executorEvidencePath) {
|
|
244
|
+
const contractFailure = enforceExecutorReportContract({
|
|
245
|
+
evidence: executorEvidence,
|
|
246
|
+
evidencePath: executorEvidencePath,
|
|
247
|
+
contract: { approach: prepared.task.approach, mode: prepared.task.mode ?? "edit" },
|
|
248
|
+
resumeHint: executorStageResumeHint({ kind: "schedule", taskId: prepared.task.id }),
|
|
249
|
+
});
|
|
250
|
+
if (contractFailure) {
|
|
251
|
+
result = "failure";
|
|
252
|
+
stderr = contractFailure;
|
|
253
|
+
pipelineBlockReason = contractFailure;
|
|
254
|
+
if (pipelineState && pipelineStatePath) {
|
|
255
|
+
const blockedAt = new Date().toISOString();
|
|
256
|
+
pipelineState = updatePipelineStage(pipelineState, "executor", { status: "blocked", completed_at: blockedAt }, blockedAt);
|
|
257
|
+
writePipelineState(pipelineStatePath, pipelineState);
|
|
258
|
+
}
|
|
259
|
+
process.stdout.write(` Executor report rejected before the reporter: ${contractFailure}\n`);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
217
262
|
if (prepared.pipelineRunId && result === "success" && !resumeIntegration) {
|
|
218
263
|
pipelineFailureStage = "reporter";
|
|
219
264
|
if (!executorEvidence ||
|
|
@@ -331,7 +376,28 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
331
376
|
}
|
|
332
377
|
}
|
|
333
378
|
}
|
|
379
|
+
const failedStageActor = () => pipelineFailureStage === "reporter" ? (reporterActor ?? prepared.actor) : prepared.actor;
|
|
334
380
|
const finalize = async () => {
|
|
381
|
+
if (result === "success" && worktreeResultPath) {
|
|
382
|
+
enforceScheduleKataReview({
|
|
383
|
+
task: prepared.task,
|
|
384
|
+
catalogPath,
|
|
385
|
+
resultPath: worktreeResultPath,
|
|
386
|
+
projectId,
|
|
387
|
+
rootDir: prepared.worktree.path,
|
|
388
|
+
});
|
|
389
|
+
const reviewBlockReason = reviewTaskBlockReason({
|
|
390
|
+
mode: prepared.task.mode,
|
|
391
|
+
resultPath: worktreeResultPath,
|
|
392
|
+
...(prepared.reviewGradeOutcome ? { gradeOutcome: prepared.reviewGradeOutcome } : {}),
|
|
393
|
+
});
|
|
394
|
+
if (reviewBlockReason) {
|
|
395
|
+
result = "failure";
|
|
396
|
+
pipelineBlockReason = reviewBlockReason;
|
|
397
|
+
stderr = reviewBlockReason;
|
|
398
|
+
process.stdout.write(` Review not completed: ${reviewBlockReason}\n`);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
335
401
|
const completedAt = new Date().toISOString();
|
|
336
402
|
const context = {
|
|
337
403
|
repoRoot,
|
|
@@ -347,7 +413,7 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
347
413
|
// particular, resume --by may run a different agent from the one that owns the claim; if we
|
|
348
414
|
// merged first, the subsequent complete command would reject that actor and leave schedule
|
|
349
415
|
// state at doing even though the deliverables had already landed and the worktree was gone.
|
|
350
|
-
const completionPreflight = readCompletionPreflight(schedulePath, prepared.task.id, prepared.
|
|
416
|
+
const completionPreflight = readCompletionPreflight(schedulePath, prepared.task.id, prepared.claimActor);
|
|
351
417
|
if (!completionPreflight.ok) {
|
|
352
418
|
const reason = `completion preflight failed: ${completionPreflight.reason ?? "unknown reason"}`;
|
|
353
419
|
process.stderr.write(`${reason}\n`);
|
|
@@ -361,6 +427,10 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
361
427
|
const alreadyMerged = resumeIntegration &&
|
|
362
428
|
isExecBranchMergedIntoCurrent({ context, worktree: prepared.worktree });
|
|
363
429
|
try {
|
|
430
|
+
assertCommitScope(context, prepared.worktree, prepared.task.id, {
|
|
431
|
+
scopeLogPath: integrateLogPath(pipelineStatePath),
|
|
432
|
+
allowEditedPlan: prepared.pipelineResumeStage === "executor",
|
|
433
|
+
});
|
|
364
434
|
if (alreadyMerged) {
|
|
365
435
|
const lifecyclePaths = new Set([worktreeResultPath, pipelineStatePath]
|
|
366
436
|
.filter((path) => !!path)
|
|
@@ -419,6 +489,12 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
419
489
|
failureLogPath: integrateLogPath(pipelineStatePath),
|
|
420
490
|
productsIntegratedByCaller: true,
|
|
421
491
|
productRootNewFiles,
|
|
492
|
+
allowEditedPlan: prepared.pipelineResumeStage === "executor",
|
|
493
|
+
skipHooks: integrationCommitSkipHooks({
|
|
494
|
+
pipeline: execDefaults.pipeline,
|
|
495
|
+
worktreePath: prepared.worktree.path,
|
|
496
|
+
pipelineStatePath,
|
|
497
|
+
}),
|
|
422
498
|
});
|
|
423
499
|
}
|
|
424
500
|
catch (error) {
|
|
@@ -458,6 +534,7 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
458
534
|
taskId: prepared.task.id,
|
|
459
535
|
failureLogPath: integrateLogPath(pipelineStatePath),
|
|
460
536
|
productsIntegratedByCaller: true,
|
|
537
|
+
allowEditedPlan: prepared.pipelineResumeStage === "executor",
|
|
461
538
|
});
|
|
462
539
|
},
|
|
463
540
|
mergeProject: () => mergeWorktreeIntoCurrent({
|
|
@@ -466,6 +543,17 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
466
543
|
taskId: prepared.task.id,
|
|
467
544
|
message: mergeMessage,
|
|
468
545
|
releaseRootPaths: prepared.checkpointPaths,
|
|
546
|
+
// 失敗・延期の後の記帳 commit が root の作業コピーを先に統合ブランチへ入れている
|
|
547
|
+
// 場合、同じ run の記録は両側の追加として競合する。exec branch 側を最新とする。
|
|
548
|
+
resolveConflictsWithBranchPaths: [
|
|
549
|
+
...(prepared.checkpointPaths ?? []),
|
|
550
|
+
...branchOwnedRunRecordPaths({
|
|
551
|
+
repoRoot,
|
|
552
|
+
executionPath,
|
|
553
|
+
branch: prepared.worktree.branch,
|
|
554
|
+
taskId: prepared.task.id,
|
|
555
|
+
}),
|
|
556
|
+
],
|
|
469
557
|
failureLogPath: integrateLogPath(pipelineStatePath),
|
|
470
558
|
}),
|
|
471
559
|
record: (repo, patch) => recordRepoIntegration(pipelineStatePath, repo, patch),
|
|
@@ -487,7 +575,7 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
487
575
|
process.stderr.write(`Warning: ${error.message}; run exec worktree prune.\n`);
|
|
488
576
|
}
|
|
489
577
|
else {
|
|
490
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
578
|
+
const reason = integrationBlockReason(prepared.task.id, error instanceof Error ? error.message : String(error), prepared.worktree.path);
|
|
491
579
|
const integrateFailedAt = new Date().toISOString();
|
|
492
580
|
recordIntegrateStage(pipelineStatePath, integrateFailedAt, () => ({
|
|
493
581
|
status: "failed",
|
|
@@ -495,20 +583,23 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
495
583
|
}));
|
|
496
584
|
if (worktreeResultPath)
|
|
497
585
|
await updateResultStatus(worktreeResultPath, "blocked", completedAt, reason);
|
|
498
|
-
spawnBlock(projectId, prepared.task.id, prepared.
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
586
|
+
spawnBlock(projectId, prepared.task.id, prepared.claimActor, reason, {
|
|
587
|
+
...(pipelineStateRef
|
|
588
|
+
? pipelineRecoveryMeta({
|
|
589
|
+
stage: "integrate",
|
|
590
|
+
evidenceRef: executorEvidenceRef,
|
|
591
|
+
stateRef: pipelineStateRef,
|
|
592
|
+
runId: pipelineState?.run_id ?? prepared.pipelineRunId,
|
|
593
|
+
})
|
|
594
|
+
: { limit_deferred: "false" }),
|
|
595
|
+
...stageActorMeta(prepared.claimActor, prepared.actor),
|
|
596
|
+
});
|
|
506
597
|
process.stderr.write(`${reason}\n`);
|
|
507
598
|
process.stdout.write(` Blocked: ${prepared.task.id} (worktree kept: ${prepared.worktree.path})\n`);
|
|
508
599
|
return "failure";
|
|
509
600
|
}
|
|
510
601
|
}
|
|
511
|
-
spawnComplete(projectId, prepared.task.id, prepared.
|
|
602
|
+
spawnComplete(projectId, prepared.task.id, prepared.claimActor);
|
|
512
603
|
process.stdout.write(` Done: ${prepared.task.id}\n`);
|
|
513
604
|
}
|
|
514
605
|
else if (effectiveResult === "rate_limit") {
|
|
@@ -521,12 +612,14 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
521
612
|
: (pipelineBlockReason ?? "rate limit reached");
|
|
522
613
|
if (worktreeResultPath)
|
|
523
614
|
await updateResultStatus(worktreeResultPath, "blocked", completedAt, reason);
|
|
524
|
-
|
|
615
|
+
const rateLimitActorMeta = stageActorMeta(prepared.claimActor, failedStageActor());
|
|
616
|
+
spawnBlock(projectId, prepared.task.id, prepared.claimActor, reason, activeLimit
|
|
525
617
|
? {
|
|
526
618
|
...limitEventMeta(activeLimit, {
|
|
527
619
|
attempts: totalAttempts,
|
|
528
620
|
worktree: prepared.worktree.path,
|
|
529
621
|
}),
|
|
622
|
+
...rateLimitActorMeta,
|
|
530
623
|
...(prepared.pipelineRunId
|
|
531
624
|
? pipelineRecoveryMeta({
|
|
532
625
|
stage: pipelineFailureStage,
|
|
@@ -538,6 +631,7 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
538
631
|
}
|
|
539
632
|
: {
|
|
540
633
|
limit_deferred: "false",
|
|
634
|
+
...rateLimitActorMeta,
|
|
541
635
|
...(prepared.pipelineRunId
|
|
542
636
|
? pipelineRecoveryMeta({
|
|
543
637
|
stage: pipelineFailureStage,
|
|
@@ -557,8 +651,9 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
557
651
|
: (pipelineBlockReason ?? extractBlockReason(stderr));
|
|
558
652
|
if (worktreeResultPath)
|
|
559
653
|
await updateResultStatus(worktreeResultPath, "blocked", completedAt, blockReason);
|
|
560
|
-
spawnBlock(projectId, prepared.task.id, prepared.
|
|
654
|
+
spawnBlock(projectId, prepared.task.id, prepared.claimActor, blockReason, {
|
|
561
655
|
limit_deferred: "false",
|
|
656
|
+
...stageActorMeta(prepared.claimActor, failedStageActor()),
|
|
562
657
|
...(prepared.pipelineRunId
|
|
563
658
|
? pipelineRecoveryMeta({
|
|
564
659
|
stage: pipelineFailureStage,
|
|
@@ -574,6 +669,15 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
574
669
|
};
|
|
575
670
|
return lifecycleLock ? lifecycleLock.runExclusive(finalize) : finalize();
|
|
576
671
|
}
|
|
672
|
+
// 統合の段の失敗の理由(検査の名前・commit の対象外のパス・merge の失敗など、失敗した操作の
|
|
673
|
+
// メッセージ)に、worktree の成果を保ったまま続ける次の操作を足す。block の理由と result の
|
|
674
|
+
// 両方へ同じ文を残す(PJR-ED0K)。
|
|
675
|
+
export function integrationBlockReason(taskId, cause, worktreePath) {
|
|
676
|
+
return (`integration failed: ${cause.trim() || "unknown error"}; worktree kept: ${worktreePath}; ` +
|
|
677
|
+
`next: fix the artifacts with exec resume --task ${taskId} --resume-from executor ` +
|
|
678
|
+
`(syncs the integration target first), or retry only the integration with ` +
|
|
679
|
+
`exec resume --task ${taskId}`);
|
|
680
|
+
}
|
|
577
681
|
export async function runPreparedTaskSafely(prepared, projectId, repoRoot, schedulePath, executionPath, catalogPath, execDefaults, dryRun, lifecycleLock) {
|
|
578
682
|
try {
|
|
579
683
|
const result = await runPreparedTask(prepared, projectId, repoRoot, schedulePath, executionPath, catalogPath, execDefaults, dryRun, lifecycleLock);
|
|
@@ -587,7 +691,10 @@ export async function runPreparedTaskSafely(prepared, projectId, repoRoot, sched
|
|
|
587
691
|
const completedAt = new Date().toISOString();
|
|
588
692
|
if (prepared.resultPath)
|
|
589
693
|
await updateResultStatus(prepared.resultPath, "blocked", completedAt);
|
|
590
|
-
spawnBlock(projectId, prepared.task.id, prepared.
|
|
694
|
+
spawnBlock(projectId, prepared.task.id, prepared.claimActor, `runner error: ${message}`, {
|
|
695
|
+
limit_deferred: "false",
|
|
696
|
+
...stageActorMeta(prepared.claimActor, prepared.actor),
|
|
697
|
+
});
|
|
591
698
|
}
|
|
592
699
|
};
|
|
593
700
|
if (lifecycleLock)
|
package/dist/exec/run/shared.js
CHANGED
|
@@ -7,7 +7,7 @@ import { listFilesRecursive, readYaml } from "../shared.js";
|
|
|
7
7
|
import { getProjectSchedulePath, loadConfig, resolveAgentMember, specdojoRootDir, } from "../../shared/specdojo-config.js";
|
|
8
8
|
import { acquireExecRunLock, EXEC_RUN_LOCK_TOKEN_ENV, execLocksDir, inheritsExecRunLock, releaseExecRunLock, ROUTINE_BUSY_SKIP_EXIT_CODE, ROUTINE_EXEC_ENV, } from "./lock.js";
|
|
9
9
|
import { getActiveExecLocksDir, setActiveExecLocksDir } from "../slot-lock.js";
|
|
10
|
-
import { readAllEventFiles, foldEventsToState } from "../events.js";
|
|
10
|
+
import { claimOwnerOf, readAllEventFiles, foldEventsToState } from "../events.js";
|
|
11
11
|
import { extractPhaseSuffix, normalizePhaseSetSelection, phaseSetNames, } from "../../schedule/phase-sets.js";
|
|
12
12
|
export function rateLimitRecoveryReason(events) {
|
|
13
13
|
return events
|
|
@@ -294,8 +294,9 @@ export function collectBusyActors(schedulePath) {
|
|
|
294
294
|
const initTasks = buildInitialStateFromStrategy(schedulePath, sch);
|
|
295
295
|
const snap = foldEventsToState(evts, sch, schedulePath, initTasks);
|
|
296
296
|
for (const taskState of Object.values(snap.tasks ?? {})) {
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
const owner = taskState?.state === "doing" ? claimOwnerOf(taskState) : undefined;
|
|
298
|
+
if (owner)
|
|
299
|
+
busy.add(owner);
|
|
299
300
|
}
|
|
300
301
|
}
|
|
301
302
|
catch {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { resolveAgentMember, specdojoRootDir } from "../../shared/specdojo-config.js";
|
|
2
|
+
import { resolveProjectPaths } from "../project.js";
|
|
3
|
+
import { commitTrailingRunRecords, reportTrailingRunRecords } from "../trailing-records.js";
|
|
4
|
+
import { loadRosterForExecutionPath } from "./agent.js";
|
|
5
|
+
// Schedule の run(exec run --auto / --task --worktree、exec resume、exec cycle)の終わりに、
|
|
6
|
+
// runner が統合の後に書いたイベントと run の記録を記帳の commit にする(PJR-DVNV)。
|
|
7
|
+
// 前の run で残った runner の記録も同じ commit で拾う。dry-run では何もしない。
|
|
8
|
+
export function recordTrailingRunRecords(opts, label) {
|
|
9
|
+
if (opts.dryRun)
|
|
10
|
+
return;
|
|
11
|
+
try {
|
|
12
|
+
const { schedulePath, executionPath } = resolveProjectPaths({ project: opts.project });
|
|
13
|
+
const roster = loadRosterForExecutionPath(executionPath);
|
|
14
|
+
const report = commitTrailingRunRecords({
|
|
15
|
+
repoRoot: specdojoRootDir(),
|
|
16
|
+
schedulePath,
|
|
17
|
+
executionPath,
|
|
18
|
+
isRunnerActor: (actor) => resolveAgentMember(roster, actor) !== undefined,
|
|
19
|
+
});
|
|
20
|
+
reportTrailingRunRecords(report, label);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
process.stderr.write(`warning: could not record execution records after ${label}: ` +
|
|
24
|
+
`${error instanceof Error ? error.message : String(error)}\n`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// action が失敗・中断しても記帳する。記帳の失敗は run の終了コードを変えず、警告に留める。
|
|
28
|
+
export async function withTrailingRunRecords(opts, label, action) {
|
|
29
|
+
try {
|
|
30
|
+
await action();
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
recordTrailingRunRecords(opts, label);
|
|
34
|
+
}
|
|
35
|
+
}
|
package/dist/exec/strategy.js
CHANGED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { lstatSync, readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { gitOutput, gitResult, repoRelative, stageCommitTargets, summarizeGitHookFailure, unstageCommitTargets, worktreeStatusPaths, } from "../shared/git.js";
|
|
4
|
+
import { acquireSchedulerLock, isExecEventV1, releaseSchedulerLock } from "./events.js";
|
|
5
|
+
import { eventsDirForProject } from "./project.js";
|
|
6
|
+
import { planConventionsDirectory, recordIdentity, runItemDirectory, runRecordLocation, runRecordsDirectory, } from "./run-records.js";
|
|
7
|
+
import { missingRunRecords } from "./validate-records.js";
|
|
8
|
+
import { normalizeResultWhitespace, stabilizeCommitTargets } from "./worktree-ops-commit.js";
|
|
9
|
+
// runner は Schedule タスクの complete・block・release などのイベントを統合の commit の後に書き、
|
|
10
|
+
// 失敗・延期した run の plan / result の作業コピーも root に残す。run の終わりにこれらを
|
|
11
|
+
// 記帳の commit 1 件として統合ブランチへ入れる(PJR-DVNV)。人が書いたイベントは、従来どおり
|
|
12
|
+
// 書いた人が commit するため対象にしない。
|
|
13
|
+
export const TRAILING_RECORDS_COMMIT_SUBJECT = "exec(run): record execution events and run records";
|
|
14
|
+
const SCHEDULER_LOCK_TIMEOUT_MS = 10_000;
|
|
15
|
+
const SCHEDULER_LOCK_STALE_MS = 300_000;
|
|
16
|
+
function prefixOf(repoRoot, directory) {
|
|
17
|
+
return `${repoRelative(repoRoot, directory)}/`;
|
|
18
|
+
}
|
|
19
|
+
function isFile(repoRoot, path) {
|
|
20
|
+
return lstatSync(resolve(repoRoot, path), { throwIfNoEntry: false })?.isFile() === true;
|
|
21
|
+
}
|
|
22
|
+
function readRunnerEventTaskId(context, path) {
|
|
23
|
+
try {
|
|
24
|
+
const raw = JSON.parse(readFileSync(resolve(context.repoRoot, path), "utf8"));
|
|
25
|
+
if (!isExecEventV1(raw, path))
|
|
26
|
+
return undefined;
|
|
27
|
+
return context.isRunnerActor(raw.by) ? raw.task_id : undefined;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// 壊れたイベントは exec validate が報告する。記帳では推測で commit しない。
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// root の未 commit のファイルから、runner が書いた記録だけを選ぶ。
|
|
35
|
+
// - イベント: `exec/events/*.json` のうち、`by` が runner のもの。
|
|
36
|
+
// - run の記録: 上のイベントの task の `runs/schedule/<task>/` 配下(失敗・延期・再開前の試行を含む)。
|
|
37
|
+
// - plan の共通規約: run の記録を 1 件以上選んだ場合の `plan-conventions/` 配下(内容で命名される)。
|
|
38
|
+
// 削除や存在しないパスは選ばない。結果はソート済みで返す。
|
|
39
|
+
export function selectTrailingRunRecords(context, dirtyPaths = worktreeStatusPaths(context.repoRoot)) {
|
|
40
|
+
const { repoRoot } = context;
|
|
41
|
+
const eventsPrefix = prefixOf(repoRoot, eventsDirForProject(context.schedulePath));
|
|
42
|
+
const schedulePrefix = prefixOf(repoRoot, resolve(runRecordsDirectory(context.executionPath), "schedule"));
|
|
43
|
+
const conventionsPrefix = prefixOf(repoRoot, planConventionsDirectory(context.executionPath));
|
|
44
|
+
const files = [...new Set(dirtyPaths.map((path) => path.replaceAll("\\", "/")))]
|
|
45
|
+
.filter((path) => isFile(repoRoot, path))
|
|
46
|
+
.sort();
|
|
47
|
+
const events = [];
|
|
48
|
+
const taskIds = new Set();
|
|
49
|
+
for (const path of files) {
|
|
50
|
+
if (!path.startsWith(eventsPrefix) || !path.endsWith(".json"))
|
|
51
|
+
continue;
|
|
52
|
+
const taskId = readRunnerEventTaskId(context, path);
|
|
53
|
+
if (!taskId)
|
|
54
|
+
continue;
|
|
55
|
+
events.push(path);
|
|
56
|
+
taskIds.add(taskId);
|
|
57
|
+
}
|
|
58
|
+
const itemPrefixes = [...taskIds].map((taskId) => prefixOf(repoRoot, runItemDirectory(context.executionPath, "schedule", recordIdentity(taskId, "schedule").itemId)));
|
|
59
|
+
const candidates = files.filter((path) => path.startsWith(schedulePrefix) && itemPrefixes.some((prefix) => path.startsWith(prefix)));
|
|
60
|
+
const { kept: runRecords, incompleteRuns } = dropIncompleteRuns(context, candidates);
|
|
61
|
+
const conventions = runRecords.length > 0 ? files.filter((path) => path.startsWith(conventionsPrefix)) : [];
|
|
62
|
+
return {
|
|
63
|
+
events,
|
|
64
|
+
runRecords,
|
|
65
|
+
paths: [...events, ...runRecords, ...conventions].sort(),
|
|
66
|
+
incompleteRuns,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
// setup や executor の起動前に止まった run は plan だけを残す。これを commit すると、commit 先の
|
|
70
|
+
// `exec validate --records-only`(CI と pre-push)が missing で落ちる(PJR-1ZQK)。配置の規約は
|
|
71
|
+
// 「記録がそろった revision を対象にする」ため、commit 後の状態で必須の記録が欠ける run は記帳せず、
|
|
72
|
+
// 作業ツリーに残して報告する。`isPresent` を省くと作業ツリーの通常ファイルで判定する。
|
|
73
|
+
function dropIncompleteRuns(context, paths, isPresent) {
|
|
74
|
+
const { repoRoot, executionPath } = context;
|
|
75
|
+
const runOf = (path) => {
|
|
76
|
+
const directory = dirname(resolve(repoRoot, path));
|
|
77
|
+
return runRecordLocation(executionPath, directory) ? directory : undefined;
|
|
78
|
+
};
|
|
79
|
+
const incomplete = new Set();
|
|
80
|
+
const checked = new Set();
|
|
81
|
+
for (const path of paths) {
|
|
82
|
+
const directory = runOf(path);
|
|
83
|
+
if (!directory || checked.has(directory))
|
|
84
|
+
continue;
|
|
85
|
+
checked.add(directory);
|
|
86
|
+
const missing = missingRunRecords(executionPath, directory, isPresent ? { isFile: (absolute) => isPresent(repoRelative(repoRoot, absolute)) } : {});
|
|
87
|
+
if (missing.length > 0)
|
|
88
|
+
incomplete.add(directory);
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
kept: paths.filter((path) => {
|
|
92
|
+
const directory = runOf(path);
|
|
93
|
+
return !directory || !incomplete.has(directory);
|
|
94
|
+
}),
|
|
95
|
+
incompleteRuns: [...incomplete].map((directory) => repoRelative(repoRoot, directory)).sort(),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function isTrackedAtHead(repoRoot, path) {
|
|
99
|
+
return gitResult(repoRoot, ["cat-file", "-e", `HEAD:${path}`]).status === 0;
|
|
100
|
+
}
|
|
101
|
+
function remainingOf(repoRoot, paths) {
|
|
102
|
+
const wanted = new Set(paths);
|
|
103
|
+
return worktreeStatusPaths(repoRoot).filter((path) => wanted.has(path));
|
|
104
|
+
}
|
|
105
|
+
// 指定パスだけを 1 commit にする。hook(整形・markdownlint・認証情報の検査)は通常どおり走らせ、
|
|
106
|
+
// 整形で変わった分は同じ commit へ収束させる。失敗した場合は stage を戻して例外を投げる。
|
|
107
|
+
function commitPaths(repoRoot, paths, message) {
|
|
108
|
+
try {
|
|
109
|
+
stageCommitTargets(repoRoot, paths);
|
|
110
|
+
const staged = gitResult(repoRoot, ["diff", "--cached", "--quiet", "--", ...paths]);
|
|
111
|
+
if (staged.status === 0)
|
|
112
|
+
return;
|
|
113
|
+
const commit = gitResult(repoRoot, ["commit", "-m", message, "--", ...paths]);
|
|
114
|
+
if (commit.status !== 0) {
|
|
115
|
+
const output = [commit.stdout, commit.stderr]
|
|
116
|
+
.filter((part) => typeof part === "string" && part.length > 0)
|
|
117
|
+
.join("\n");
|
|
118
|
+
throw new Error(`git commit failed: ${summarizeGitHookFailure(output)}`);
|
|
119
|
+
}
|
|
120
|
+
stabilizeCommitTargets(repoRoot, () => remainingOf(repoRoot, paths));
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
unstageCommitTargets(repoRoot, paths);
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function headCommit(repoRoot) {
|
|
128
|
+
return gitOutput(repoRoot, ["rev-parse", "--short", "HEAD"]).trim();
|
|
129
|
+
}
|
|
130
|
+
// runner の記録を記帳の commit にする。統合と同じ scheduler lock で直列化し、index.lock の競合は
|
|
131
|
+
// gitResult が再試行する。result.md の記法違反で hook に拒否された場合は result.md を外して
|
|
132
|
+
// もう一度試す。それでも失敗した場合は残ったファイルを返し、commit しないまま終える。
|
|
133
|
+
export function commitTrailingRunRecords(context) {
|
|
134
|
+
const { repoRoot } = context;
|
|
135
|
+
const message = context.message ?? TRAILING_RECORDS_COMMIT_SUBJECT;
|
|
136
|
+
let lockDir = "";
|
|
137
|
+
let selected = [];
|
|
138
|
+
let incompleteRuns = [];
|
|
139
|
+
try {
|
|
140
|
+
lockDir = acquireSchedulerLock(context.schedulePath, {
|
|
141
|
+
actor: "exec-trailing-records",
|
|
142
|
+
lockTimeoutMs: SCHEDULER_LOCK_TIMEOUT_MS,
|
|
143
|
+
lockStaleMs: SCHEDULER_LOCK_STALE_MS,
|
|
144
|
+
});
|
|
145
|
+
const selection = selectTrailingRunRecords(context);
|
|
146
|
+
selected = selection.paths;
|
|
147
|
+
incompleteRuns = selection.incompleteRuns;
|
|
148
|
+
const withIncomplete = incompleteRuns.length > 0 ? { incompleteRuns } : {};
|
|
149
|
+
if (selected.length === 0)
|
|
150
|
+
return { committed: [], remaining: [], ...withIncomplete };
|
|
151
|
+
const results = selected.filter((path) => path.endsWith("/result.md"));
|
|
152
|
+
for (const path of results)
|
|
153
|
+
normalizeResultWhitespace(resolve(repoRoot, path));
|
|
154
|
+
try {
|
|
155
|
+
commitPaths(repoRoot, selected, message);
|
|
156
|
+
return {
|
|
157
|
+
committed: selected,
|
|
158
|
+
remaining: remainingOf(repoRoot, selected),
|
|
159
|
+
commit: headCommit(repoRoot),
|
|
160
|
+
...withIncomplete,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
if (results.length === 0)
|
|
165
|
+
throw error;
|
|
166
|
+
// result.md を外した run は、HEAD に result がなければ記録がそろわないので、その run ごと外す。
|
|
167
|
+
const withoutResultSet = new Set(selected.filter((path) => !results.includes(path)));
|
|
168
|
+
const retry = dropIncompleteRuns(context, [...withoutResultSet], (path) => withoutResultSet.has(path) || isTrackedAtHead(repoRoot, path));
|
|
169
|
+
const withoutResults = retry.kept;
|
|
170
|
+
incompleteRuns = [...new Set([...incompleteRuns, ...retry.incompleteRuns])].sort();
|
|
171
|
+
process.stderr.write(`warning: execution-record commit failed with result.md included; retrying without them: ` +
|
|
172
|
+
`${error instanceof Error ? error.message : String(error)}\n`);
|
|
173
|
+
if (withoutResults.length === 0)
|
|
174
|
+
throw error;
|
|
175
|
+
commitPaths(repoRoot, withoutResults, message);
|
|
176
|
+
return {
|
|
177
|
+
committed: withoutResults,
|
|
178
|
+
remaining: remainingOf(repoRoot, selected),
|
|
179
|
+
commit: headCommit(repoRoot),
|
|
180
|
+
...(incompleteRuns.length > 0 ? { incompleteRuns } : {}),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
const remaining = selected.length > 0 ? remainingOf(repoRoot, selected) : [];
|
|
186
|
+
return {
|
|
187
|
+
committed: [],
|
|
188
|
+
remaining,
|
|
189
|
+
error: error instanceof Error ? error.message : String(error),
|
|
190
|
+
...(incompleteRuns.length > 0 ? { incompleteRuns } : {}),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
finally {
|
|
194
|
+
if (lockDir)
|
|
195
|
+
releaseSchedulerLock(lockDir);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// 記帳の結果を run の出力へ書く。残ったファイルがあれば、ファイルと次の操作を stderr に出す。
|
|
199
|
+
export function reportTrailingRunRecords(report, label) {
|
|
200
|
+
if (report.commit && report.committed.length > 0) {
|
|
201
|
+
process.stdout.write(`[${label}] recorded ${report.committed.length} execution record(s) in ${report.commit}\n`);
|
|
202
|
+
}
|
|
203
|
+
if (report.error) {
|
|
204
|
+
process.stderr.write(`warning: could not commit execution records: ${report.error}\n`);
|
|
205
|
+
}
|
|
206
|
+
if (report.incompleteRuns && report.incompleteRuns.length > 0) {
|
|
207
|
+
process.stderr.write(`warning: ${report.incompleteRuns.length} run(s) lack plan.md, result.md or evidence.json ` +
|
|
208
|
+
`and were left uncommitted so that exec validate --records-only keeps passing:\n` +
|
|
209
|
+
report.incompleteRuns.map((path) => ` ${path}/\n`).join("") +
|
|
210
|
+
` next: resume the run to complete its records, or remove the directory ` +
|
|
211
|
+
`if the run stopped before the executor started\n`);
|
|
212
|
+
}
|
|
213
|
+
if (report.remaining.length > 0) {
|
|
214
|
+
process.stderr.write(`warning: ${report.remaining.length} execution record(s) remain uncommitted:\n` +
|
|
215
|
+
report.remaining.map((path) => ` ${path}\n`).join("") +
|
|
216
|
+
` next: fix the cause above, then commit them with git add/commit, ` +
|
|
217
|
+
`or run the next exec run/resume to retry the bookkeeping commit\n`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// exec branch の先端にある、その task の run の記録のパス(root 側の絶対パス)。記帳の commit が統合
|
|
221
|
+
// ブランチへ先に入れた作業コピーと、exec branch 側で更新された同じファイルは両側の追加として
|
|
222
|
+
// 競合する。統合の merge では、これらの競合を exec branch 側(最新の記録)で解決する。
|
|
223
|
+
export function branchOwnedRunRecordPaths(params) {
|
|
224
|
+
const identity = recordIdentity(params.taskId, "schedule");
|
|
225
|
+
const directory = runItemDirectory(params.executionPath, identity.origin, identity.itemId);
|
|
226
|
+
const listed = gitResult(params.repoRoot, [
|
|
227
|
+
"ls-tree",
|
|
228
|
+
"-r",
|
|
229
|
+
"-z",
|
|
230
|
+
"--name-only",
|
|
231
|
+
params.branch,
|
|
232
|
+
"--",
|
|
233
|
+
repoRelative(params.repoRoot, directory),
|
|
234
|
+
]);
|
|
235
|
+
if (listed.status !== 0 || typeof listed.stdout !== "string")
|
|
236
|
+
return [];
|
|
237
|
+
return listed.stdout
|
|
238
|
+
.split("\0")
|
|
239
|
+
.filter(Boolean)
|
|
240
|
+
.sort()
|
|
241
|
+
.map((path) => resolve(params.repoRoot, path));
|
|
242
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import {
|
|
2
|
+
import { readPlanFile } from "../shared/plan-conventions.js";
|
|
3
|
+
import { copyFileSync, existsSync, writeFileSync } from "node:fs";
|
|
3
4
|
import { basename, dirname, join, resolve } from "node:path";
|
|
4
5
|
import { defaultExecDefaultsPath, loadExecDefaultsConfig, resolveMemberCommand, resolveRateLimitDetection, } from "./agent-config.js";
|
|
5
6
|
import { agentProtectedConfigViolation, isAgentProtectedConfigPath, } from "./agent-protected-config.js";
|
|
@@ -203,7 +204,7 @@ async function runTrials(opts) {
|
|
|
203
204
|
const planPath = resolve(opts.plan);
|
|
204
205
|
if (!existsSync(planPath))
|
|
205
206
|
throw new Error(`Plan not found: ${planPath}`);
|
|
206
|
-
const planContent =
|
|
207
|
+
const planContent = readPlanFile(planPath);
|
|
207
208
|
const identity = parsePlanTaskIdentity(planContent);
|
|
208
209
|
if (!identity)
|
|
209
210
|
throw new Error("Trial plan must have SpecDojo task_id/mode/project_id frontmatter.");
|