specdojo 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/agents/specdojo-orchestrator.md +7 -3
- package/CHANGELOG.md +217 -0
- package/dist/catalog/build.js +24 -1
- package/dist/catalog/catalog.js +16 -14
- package/dist/catalog/plan.js +1 -1
- package/dist/catalog/scaffold.js +4 -1
- package/dist/commands/agent.js +5 -3
- package/dist/commands/build.js +69 -10
- package/dist/commands/git.js +206 -0
- package/dist/commands/init.js +9 -3
- package/dist/commands/night-orchestrator.js +6 -4
- package/dist/commands/where.js +25 -0
- package/dist/dashboard/dashboard-timeline.js +18 -16
- package/dist/dashboard/dashboard.js +616 -261
- package/dist/dashboard/epic-plan.js +81 -0
- package/dist/dashboard/exec-records.js +16 -20
- package/dist/dashboard/routines.js +11 -12
- package/dist/dashboard/timeline-build.js +5 -9
- package/dist/dashboard/timeline.js +23 -18
- package/dist/devcontainer/scaffold.js +18 -0
- package/dist/docs/frontmatter-namespace.js +1 -48
- package/dist/docs/index-command.js +2 -2
- package/dist/docs/yaml-business-tables.js +243 -0
- package/dist/docs/yaml-interface-tables.js +106 -0
- package/dist/docs/yaml-pages-command.js +5 -3
- package/dist/docs/yaml-pages.js +268 -3
- package/dist/docs/yaml-table-shared.js +70 -0
- package/dist/docs/yaml-tables.js +39 -0
- package/dist/exec/agent-config.js +31 -0
- package/dist/exec/agent-plan.js +3 -2
- package/dist/exec/agent-protected-config.js +2 -0
- package/dist/exec/commands.js +100 -39
- package/dist/exec/commit-hook-skips.js +78 -0
- package/dist/exec/core.js +19 -7
- package/dist/exec/events.js +179 -8
- package/dist/exec/evidence.js +77 -19
- package/dist/exec/handoff.js +9 -13
- package/dist/exec/limit.js +1 -1
- package/dist/exec/mechanical-result.js +45 -0
- package/dist/exec/migrate-records.js +249 -0
- package/dist/exec/parent-validation.js +209 -15
- package/dist/exec/pipeline-state.js +27 -5
- package/dist/exec/plans-condense-findings.js +89 -0
- package/dist/exec/plans-core.js +45 -19
- package/dist/exec/plans-generation.js +52 -30
- package/dist/exec/plans-grade-findings.js +8 -3
- package/dist/exec/plans-kata-findings.js +61 -0
- package/dist/exec/plans-planning.js +3 -3
- package/dist/exec/plans-storage.js +12 -24
- package/dist/exec/post-integration.js +162 -0
- package/dist/exec/queue-command.js +166 -0
- package/dist/exec/queue.js +285 -0
- package/dist/exec/register-foreign-wait.js +84 -0
- package/dist/exec/register-resume.js +55 -56
- package/dist/exec/register.js +26 -22
- package/dist/exec/repo-integration-sync.js +21 -5
- package/dist/exec/repo-integration.js +21 -1
- package/dist/exec/reporter.js +121 -23
- package/dist/exec/results.js +106 -25
- package/dist/exec/review-completion.js +47 -0
- package/dist/exec/review-kata.js +112 -0
- package/dist/exec/run/agent-pipeline.js +78 -8
- package/dist/exec/run/agent.js +32 -13
- package/dist/exec/run/change-scope.js +365 -0
- package/dist/exec/run/deferred-cleanup.js +31 -0
- package/dist/exec/run/in-place.js +73 -33
- package/dist/exec/run/job-lock.js +66 -0
- package/dist/exec/run/job-sequence.js +137 -0
- package/dist/exec/run/job.js +135 -41
- package/dist/exec/run/lifecycle-commands.js +189 -37
- package/dist/exec/run/lock.js +22 -1
- package/dist/exec/run/mode-shared.js +11 -3
- package/dist/exec/run/register-command.js +14 -15
- package/dist/exec/run/register-core.js +20 -13
- package/dist/exec/run/register-mode.js +77 -17
- package/dist/exec/run/register-post-review.js +21 -9
- package/dist/exec/run/register-resume.js +95 -31
- package/dist/exec/run/register-state.js +23 -15
- package/dist/exec/run/register-worktree.js +184 -139
- package/dist/exec/run/schedule-mode.js +79 -18
- package/dist/exec/run/schedule-prepare.js +204 -59
- package/dist/exec/run/schedule-task.js +203 -49
- package/dist/exec/run/shared.js +9 -3
- package/dist/exec/run/trailing-records.js +35 -0
- package/dist/exec/run-records.js +2 -0
- package/dist/exec/schedule/schedule.js +116 -4
- package/dist/exec/shared.js +1 -1
- package/dist/exec/smoke.js +190 -0
- package/dist/exec/strategy.js +14 -3
- package/dist/exec/task-view.js +6 -4
- package/dist/exec/trailing-records.js +242 -0
- package/dist/exec/trial-commands.js +8 -4
- package/dist/exec/trial-core.js +6 -1
- package/dist/exec/validate-records-commit.js +110 -0
- package/dist/exec/validate-records.js +148 -0
- package/dist/exec/validation-metrics.js +181 -0
- package/dist/exec/worktree-cleanup-lock.js +26 -0
- package/dist/exec/worktree-command.js +38 -17
- package/dist/exec/worktree-ops-commit.js +119 -48
- package/dist/exec/worktree-ops-lifecycle.js +77 -48
- package/dist/exec/worktree-ops-merge.js +13 -2
- package/dist/exec/worktree-ops.js +2 -2
- package/dist/exec/worktree.js +32 -4
- package/dist/grade/apply.js +32 -6
- package/dist/grade/command-apply.js +3 -3
- package/dist/grade/command-inspect.js +7 -5
- package/dist/grade/command-plan.js +1 -1
- package/dist/grade/command-run.js +7 -1
- package/dist/grade/command-shared.js +1 -1
- package/dist/grade/core.js +18 -5
- package/dist/grade/markdown.js +3 -3
- package/dist/grade/pipeline-state.js +15 -11
- package/dist/grade/plan.js +37 -17
- package/dist/grade/result.js +3 -3
- package/dist/grade/run.js +87 -11
- package/dist/grade/target-discovery.js +17 -4
- package/dist/grade/targets.js +12 -11
- package/dist/job/definition.js +84 -8
- package/dist/job/job.js +109 -39
- package/dist/job/noop.js +104 -0
- package/dist/register/authoring-sources.js +22 -16
- package/dist/register/core.js +2 -0
- package/dist/register/create-commands.js +28 -3
- package/dist/register/deliverable-target.js +9 -1
- package/dist/register/epic.js +104 -26
- package/dist/register/event-merge.js +3 -0
- package/dist/register/events.js +4 -0
- package/dist/register/external-project.js +3 -0
- package/dist/register/item.js +6 -0
- package/dist/register/maintenance-commands.js +6 -3
- package/dist/register/planning.js +7 -14
- package/dist/register/register.js +74 -16
- package/dist/register/track-domains.js +34 -0
- package/dist/register/track-plan.js +78 -0
- package/dist/register/transition-commands.js +8 -0
- package/dist/register/work-table.js +64 -0
- package/dist/review/grade.js +35 -13
- package/dist/routine/definition.js +13 -3
- package/dist/routine/failure.js +30 -0
- package/dist/routine/routine.js +189 -71
- package/dist/routine/status.js +62 -0
- package/dist/routine/storage.js +33 -0
- package/dist/schedule/schedule.js +39 -39
- package/dist/schedule/strategy-generate-document.js +26 -14
- package/dist/schedule/strategy-generate-scope.js +17 -45
- package/dist/schedule/strategy-generate.js +33 -3
- package/dist/schedule/strategy-profiles.js +86 -12
- package/dist/shared/agent-types.js +7 -0
- package/dist/shared/condense-records.js +25 -0
- package/dist/shared/cross-process-lock.js +9 -1
- package/dist/shared/deprecation.js +8 -0
- package/dist/shared/dist-freshness.js +8 -2
- package/dist/shared/document-metadata.js +20 -0
- package/dist/shared/finding-cause.js +20 -0
- package/dist/shared/frontmatter-namespace.js +48 -0
- package/dist/shared/git-environment.js +2 -1
- package/dist/shared/git.js +186 -16
- package/dist/shared/grade-result.js +17 -1
- package/dist/shared/lefthook-scaffold.js +3 -0
- package/dist/shared/local-config.js +244 -0
- package/dist/shared/local-state.js +20 -0
- package/dist/shared/markdownlint-config.js +8 -3
- package/dist/shared/plan-conventions.js +129 -0
- package/dist/shared/plan-templates.js +57 -41
- package/dist/shared/run-records.js +224 -0
- package/dist/shared/specdojo-config.js +73 -41
- package/dist/shared/specdojo-gitignore.js +1 -0
- package/dist/shared/text.js +74 -6
- package/dist/shared/timeline-index.js +2 -0
- package/dist/shared/where-alias.js +13 -0
- package/dist/specdojo.js +4 -0
- package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +11 -2
- package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +4 -74
- package/docs/ja/specdojo/exec-templates/xep-condense-template.md +50 -0
- package/docs/ja/specdojo/exec-templates/xep-draft-template.md +17 -5
- package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +16 -3
- package/docs/ja/specdojo/exec-templates/xep-recipe-guided-template.md +15 -5
- package/docs/ja/specdojo/exec-templates/xep-recipe-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +1 -1
- package/docs/ja/specdojo/exec-templates/xep-rulebook-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-sample-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-template-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xer-condense-template.md +25 -0
- package/docs/ja/specdojo/exec-templates/xp-common-conventions-template.md +50 -0
- package/docs/ja/specdojo/exec-templates/xrp-common-conventions-template.md +30 -0
- package/docs/ja/specdojo/guides/branch-workflow-guide.md +1 -1
- package/docs/ja/specdojo/guides/docs-editing-guide.md +12 -0
- package/docs/ja/specdojo/guides/docs-structure-guide.md +48 -15
- package/docs/ja/specdojo/guides/exec-config-guide.md +69 -19
- package/docs/ja/specdojo/guides/exec-operation-guide.md +97 -18
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +20 -11
- package/docs/ja/specdojo/guides/job-sequence-guide.md +77 -0
- package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +92 -55
- package/docs/ja/specdojo/guides/project-move-guide.md +381 -0
- package/docs/ja/specdojo/guides/quick-start-guide.md +73 -17
- package/docs/ja/specdojo/guides/register-operation-guide.md +26 -6
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +2 -0
- package/docs/ja/specdojo/guides/review-guide.md +22 -19
- package/docs/ja/specdojo/guides/routine-operation-guide.md +23 -12
- package/docs/ja/specdojo/guides/ryu-guide.md +23 -13
- package/docs/ja/specdojo/guides/schedule-design-guide.md +27 -21
- package/docs/ja/specdojo/guides/schedule-operation-guide.md +27 -3
- package/docs/ja/specdojo/guides/specdojo-overview-guide.md +5 -4
- package/docs/ja/specdojo/guides/timeline-design-guide.md +27 -144
- package/docs/ja/specdojo/guides/use-case-guide.md +92 -155
- package/docs/ja/specdojo/guides/waza-guide.md +12 -8
- package/docs/ja/specdojo/recipes/bac-recipe.md +111 -0
- package/docs/ja/specdojo/recipes/bes-recipe.md +141 -0
- package/docs/ja/specdojo/recipes/bps-recipe.md +88 -139
- package/docs/ja/specdojo/recipes/br-recipe.md +77 -0
- package/docs/ja/specdojo/recipes/cdfd-overview-recipe.md +97 -109
- package/docs/ja/specdojo/recipes/cdfd-recipe.md +85 -146
- package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +92 -99
- package/docs/ja/specdojo/recipes/cnd-recipe.md +135 -0
- package/docs/ja/specdojo/recipes/cpd-recipe.md +140 -0
- package/docs/ja/specdojo/recipes/cxd-recipe.md +162 -0
- package/docs/ja/specdojo/recipes/ifd-recipe.md +145 -0
- package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +112 -90
- package/docs/ja/specdojo/recipes/ifx-index-recipe.md +164 -0
- package/docs/ja/specdojo/recipes/pm-communication-plan-recipe.md +60 -49
- package/docs/ja/specdojo/recipes/pm-members-recipe.md +50 -51
- package/docs/ja/specdojo/recipes/pm-organization-recipe.md +59 -48
- package/docs/ja/specdojo/recipes/pm-plan-recipe.md +72 -50
- package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +40 -49
- package/docs/ja/specdojo/recipes/pm-raci-recipe.md +42 -48
- package/docs/ja/specdojo/recipes/pm-roles-recipe.md +52 -81
- package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +64 -91
- package/docs/ja/specdojo/recipes/prj-charter-recipe.md +71 -106
- package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +78 -156
- package/docs/ja/specdojo/recipes/prj-issues-and-approach-recipe.md +62 -111
- package/docs/ja/specdojo/recipes/prj-scope-recipe.md +67 -123
- package/docs/ja/specdojo/recipes/prj-stakeholder-register-recipe.md +60 -96
- package/docs/ja/specdojo/recipes/prj-success-criteria-and-acceptance-criteria-recipe.md +61 -105
- package/docs/ja/specdojo/recipes/stsd-recipe.md +88 -80
- package/docs/ja/specdojo/recipes/sysd-critical-flows-recipe.md +129 -0
- package/docs/ja/specdojo/recipes/sysd-cross-cutting-policy-recipe.md +146 -0
- package/docs/ja/specdojo/recipes/sysd-index-recipe.md +141 -0
- package/docs/ja/specdojo/recipes/tsd-recipe.md +149 -129
- package/docs/ja/specdojo/references/command-reference.md +303 -148
- package/docs/ja/specdojo/references/deliverables-reference.md +30 -16
- package/docs/ja/specdojo/references/directory-layout-reference.md +3 -2
- package/docs/ja/specdojo/references/specdojo-config-reference.md +54 -18
- package/docs/ja/specdojo/rulebooks/atc-index-rulebook.md +101 -257
- package/docs/ja/specdojo/rulebooks/atc-rulebook.md +102 -228
- package/docs/ja/specdojo/rulebooks/bac-rulebook.md +63 -290
- package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +162 -80
- package/docs/ja/specdojo/rulebooks/bds-rulebook.md +118 -155
- package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +128 -60
- package/docs/ja/specdojo/rulebooks/bes-rulebook.md +70 -94
- package/docs/ja/specdojo/rulebooks/bps-rulebook.md +24 -56
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +58 -103
- package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +103 -223
- package/docs/ja/specdojo/rulebooks/cdfd-d2-rulebook.md +18 -93
- package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +18 -52
- package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +109 -147
- package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +80 -108
- package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +51 -55
- package/docs/ja/specdojo/rulebooks/cdr-rulebook.md +144 -0
- package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +81 -68
- package/docs/ja/specdojo/rulebooks/cdt-rulebook.md +139 -0
- package/docs/ja/specdojo/rulebooks/cld-rulebook.md +9 -184
- package/docs/ja/specdojo/rulebooks/clis-rulebook.md +170 -0
- package/docs/ja/specdojo/rulebooks/cnd-mermaid-rulebook.md +33 -86
- package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +79 -249
- package/docs/ja/specdojo/rulebooks/cop-index-rulebook.md +45 -131
- package/docs/ja/specdojo/rulebooks/cop-rulebook.md +69 -275
- package/docs/ja/specdojo/rulebooks/cpd-mermaid-rulebook.md +20 -112
- package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +79 -249
- package/docs/ja/specdojo/rulebooks/cxd-mermaid-rulebook.md +12 -145
- package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +115 -256
- package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +79 -109
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +119 -174
- package/docs/ja/specdojo/rulebooks/dec-rulebook.md +6 -14
- package/docs/ja/specdojo/rulebooks/dmd-index-rulebook.md +22 -66
- package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +36 -94
- package/docs/ja/specdojo/rulebooks/dss-rulebook.md +171 -0
- package/docs/ja/specdojo/rulebooks/etc-index-rulebook.md +31 -131
- package/docs/ja/specdojo/rulebooks/etc-rulebook.md +50 -104
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +93 -57
- package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +63 -253
- package/docs/ja/specdojo/rulebooks/ifx-api-rulebook.md +14 -20
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +79 -76
- package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +182 -237
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +111 -40
- package/docs/ja/specdojo/rulebooks/ifx-msg-rulebook.md +14 -22
- package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +23 -46
- package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +41 -64
- package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +16 -40
- package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +34 -61
- package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +27 -50
- package/docs/ja/specdojo/rulebooks/itc-index-rulebook.md +70 -199
- package/docs/ja/specdojo/rulebooks/itc-rulebook.md +65 -153
- package/docs/ja/specdojo/rulebooks/mip-index-rulebook.md +74 -150
- package/docs/ja/specdojo/rulebooks/mm-rulebook.md +12 -23
- package/docs/ja/specdojo/rulebooks/mtp-rulebook.md +99 -176
- package/docs/ja/specdojo/rulebooks/nfr-availability-rulebook.md +35 -61
- package/docs/ja/specdojo/rulebooks/nfr-index-rulebook.md +75 -117
- package/docs/ja/specdojo/rulebooks/nfr-integrity-rulebook.md +31 -60
- package/docs/ja/specdojo/rulebooks/nfr-maintainability-rulebook.md +26 -81
- package/docs/ja/specdojo/rulebooks/nfr-operations-rulebook.md +32 -70
- package/docs/ja/specdojo/rulebooks/nfr-performance-rulebook.md +45 -87
- package/docs/ja/specdojo/rulebooks/nfr-reliability-rulebook.md +48 -101
- package/docs/ja/specdojo/rulebooks/nfr-security-safety-rulebook.md +44 -80
- package/docs/ja/specdojo/rulebooks/nfr-usability-rulebook.md +59 -127
- package/docs/ja/specdojo/rulebooks/opd-index-rulebook.md +31 -50
- package/docs/ja/specdojo/rulebooks/opd-rulebook.md +42 -109
- package/docs/ja/specdojo/rulebooks/opr-index-rulebook.md +29 -42
- package/docs/ja/specdojo/rulebooks/opr-rulebook.md +29 -87
- package/docs/ja/specdojo/rulebooks/otp-index-rulebook.md +62 -84
- package/docs/ja/specdojo/rulebooks/otp-rulebook.md +11 -61
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +92 -102
- package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +25 -34
- package/docs/ja/specdojo/rulebooks/pm-communication-plan-rulebook.md +30 -53
- package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +23 -35
- package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +27 -45
- package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +45 -59
- package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +56 -66
- package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +54 -62
- package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +46 -65
- package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +28 -35
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +65 -97
- package/docs/ja/specdojo/rulebooks/pr-rulebook.md +6 -18
- package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +48 -78
- package/docs/ja/specdojo/rulebooks/prj-charter-rulebook.md +23 -97
- package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +61 -153
- package/docs/ja/specdojo/rulebooks/prj-issues-and-approach-rulebook.md +43 -116
- package/docs/ja/specdojo/rulebooks/prj-scope-rulebook.md +16 -51
- package/docs/ja/specdojo/rulebooks/prj-stakeholder-register-rulebook.md +47 -92
- package/docs/ja/specdojo/rulebooks/prj-success-criteria-and-acceptance-criteria-rulebook.md +25 -84
- package/docs/ja/specdojo/rulebooks/sac-rulebook.md +44 -107
- package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +106 -32
- package/docs/ja/specdojo/rulebooks/sf-rulebook.md +111 -61
- package/docs/ja/specdojo/rulebooks/sld-rulebook.md +129 -59
- package/docs/ja/specdojo/rulebooks/stc-index-rulebook.md +90 -189
- package/docs/ja/specdojo/rulebooks/stc-rulebook.md +45 -105
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +46 -40
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +104 -68
- package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +64 -330
- package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +70 -263
- package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +58 -200
- package/docs/ja/specdojo/rulebooks/sysd-rulebook.md +47 -60
- package/docs/ja/specdojo/rulebooks/tml-rulebook.md +4 -9
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +69 -71
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +65 -72
- package/docs/ja/specdojo/rulebooks/tsd-index-rulebook.md +35 -46
- package/docs/ja/specdojo/rulebooks/tsd-rulebook.md +49 -66
- package/docs/ja/specdojo/rulebooks/tsp-index-rulebook.md +64 -139
- package/docs/ja/specdojo/rulebooks/uis-rulebook.md +91 -161
- package/docs/ja/specdojo/rulebooks/utc-index-rulebook.md +49 -144
- package/docs/ja/specdojo/rulebooks/utc-rulebook.md +67 -155
- package/docs/ja/specdojo/samples/bac-sample.md +106 -21
- package/docs/ja/specdojo/samples/bdd-sample.yaml +143 -35
- package/docs/ja/specdojo/samples/bds-sample.md +87 -21
- package/docs/ja/specdojo/samples/bes-index-sample.md +42 -20
- package/docs/ja/specdojo/samples/bes-sample.md +70 -21
- package/docs/ja/specdojo/samples/bps-sample.md +42 -54
- package/docs/ja/specdojo/samples/br-sample.md +57 -15
- package/docs/ja/specdojo/samples/ccd-sample.md +80 -19
- package/docs/ja/specdojo/samples/cdfd-sample.md +172 -99
- package/docs/ja/specdojo/samples/cdfd-uc-sample.md +9 -7
- package/docs/ja/specdojo/samples/cdr-sample.md +78 -0
- package/docs/ja/specdojo/samples/cdsd-sample.md +73 -20
- package/docs/ja/specdojo/samples/cdt-sample.md +116 -0
- package/docs/ja/specdojo/samples/cld-sample.md +3 -30
- package/docs/ja/specdojo/samples/clis-sample.md +125 -0
- package/docs/ja/specdojo/samples/cnd-sample.md +127 -21
- package/docs/ja/specdojo/samples/cpd-sample.md +136 -22
- package/docs/ja/specdojo/samples/cxd-sample.md +108 -22
- package/docs/ja/specdojo/samples/dct-index-sample.yaml +63 -17
- package/docs/ja/specdojo/samples/dec-sample.md +2 -3
- package/docs/ja/specdojo/samples/dss-sample.md +175 -0
- package/docs/ja/specdojo/samples/gl-sample.yaml +50 -14
- package/docs/ja/specdojo/samples/ifd-sample.md +105 -21
- package/docs/ja/specdojo/samples/ifx-api-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +91 -60
- package/docs/ja/specdojo/samples/ifx-file-sample.md +462 -21
- package/docs/ja/specdojo/samples/ifx-index-sample.yaml +87 -19
- package/docs/ja/specdojo/samples/ifx-msg-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/job-sequence.yaml +67 -0
- package/docs/ja/specdojo/samples/mip-index-sample.md +98 -20
- package/docs/ja/specdojo/samples/pm-communication-plan-sample.md +26 -19
- package/docs/ja/specdojo/samples/pm-members-sample.yaml +37 -13
- package/docs/ja/specdojo/samples/pm-organization-sample.md +42 -21
- package/docs/ja/specdojo/samples/pm-plan-sample.md +78 -26
- package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +41 -22
- package/docs/ja/specdojo/samples/pm-raci-sample.md +63 -28
- package/docs/ja/specdojo/samples/pm-roles-sample.yaml +13 -12
- package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +33 -25
- package/docs/ja/specdojo/samples/prj-charter-sample.md +42 -59
- package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +83 -62
- package/docs/ja/specdojo/samples/prj-success-criteria-and-acceptance-criteria-sample.md +30 -33
- package/docs/ja/specdojo/samples/sf-index-sample.md +47 -20
- package/docs/ja/specdojo/samples/sf-sample.md +109 -21
- package/docs/ja/specdojo/samples/sld-sample.md +88 -21
- package/docs/ja/specdojo/samples/stsd-sample.md +54 -26
- package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +166 -21
- package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +178 -21
- package/docs/ja/specdojo/samples/sysd-index-sample.md +82 -21
- package/docs/ja/specdojo/samples/tml-sample.yaml +4 -1
- package/docs/ja/specdojo/samples/uis-sample.md +141 -20
- package/docs/ja/specdojo/standards/document-metadata-standard.md +33 -4
- package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +3 -1
- package/docs/ja/specdojo/standards/job-definition-standard.md +24 -9
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +1 -0
- package/docs/ja/specdojo/templates/bac-template.md +76 -0
- package/docs/ja/specdojo/templates/bes-template.md +56 -0
- package/docs/ja/specdojo/templates/br-template.md +64 -0
- package/docs/ja/specdojo/templates/cdfd-template.md +81 -54
- package/docs/ja/specdojo/templates/cdfd-uc-template.md +9 -5
- package/docs/ja/specdojo/templates/cdr-template.md +58 -0
- package/docs/ja/specdojo/templates/cnd-template.md +137 -0
- package/docs/ja/specdojo/templates/cpd-template.md +129 -0
- package/docs/ja/specdojo/templates/cxd-template.md +105 -0
- package/docs/ja/specdojo/templates/dct-data-model-cdt-template.yaml +40 -0
- package/docs/ja/specdojo/templates/dct-data-model-cld-template.yaml +7 -14
- package/docs/ja/specdojo/templates/dct-index-template.md +9 -20
- package/docs/ja/specdojo/templates/dct-project-management-template.yaml +5 -1
- package/docs/ja/specdojo/templates/ifd-template.md +86 -0
- package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +44 -28
- package/docs/ja/specdojo/templates/ifx-index-template.yaml +40 -0
- package/docs/ja/specdojo/templates/opr-template.md +2 -4
- package/docs/ja/specdojo/templates/pm-organization-template.md +9 -3
- package/docs/ja/specdojo/templates/pm-plan-template.md +4 -4
- package/docs/ja/specdojo/templates/pm-quality-management-plan-template.md +17 -9
- package/docs/ja/specdojo/templates/pm-raci-template.md +24 -13
- package/docs/ja/specdojo/templates/pm-roles-template.yaml +3 -2
- package/docs/ja/specdojo/templates/prj-assumptions-constraints-dependencies-template.md +6 -3
- package/docs/ja/specdojo/templates/prj-comparison-of-alternatives-template.md +22 -19
- package/docs/ja/specdojo/templates/stsd-template.md +46 -21
- package/docs/ja/specdojo/templates/sysd-critical-flows-template.md +94 -0
- package/docs/ja/specdojo/templates/sysd-cross-cutting-policy-template.md +122 -0
- package/docs/ja/specdojo/templates/sysd-index-template.md +89 -0
- package/docs/specdojo/lib/yaml-metadata.cjs +7 -0
- package/docs/specdojo/schemas/v1/bdd.schema.yaml +25 -57
- package/docs/specdojo/schemas/v1/condense-records.schema.yaml +26 -0
- package/docs/specdojo/schemas/v1/dct.schema.yaml +10 -0
- package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +3 -0
- package/docs/specdojo/schemas/v1/esil.schema.yaml +7 -141
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +5 -1
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +95 -8
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +38 -0
- package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +14 -0
- package/docs/specdojo/schemas/v1/exec-result-frontmatter.schema.yaml +18 -0
- package/docs/specdojo/schemas/v1/finding-cause.schema.yaml +22 -0
- package/docs/specdojo/schemas/v1/grade-pipeline-state.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/grade-result.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +65 -5
- package/docs/specdojo/schemas/v1/ifx-index.schema.yaml +142 -0
- package/docs/specdojo/schemas/v1/job-run.schema.yaml +23 -0
- package/docs/specdojo/schemas/v1/job.schema.yaml +63 -2
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +17 -1
- package/docs/specdojo/schemas/v1/sch-strategy.schema.yaml +2 -2
- package/package.json +10 -7
- package/templates/antigravity/orchestrator.md +7 -3
- package/templates/claude/agents/specdojo-orchestrator.md +7 -3
- package/templates/codex/agents/specdojo-orchestrator.toml +7 -3
- package/templates/codex/orchestrator.md +7 -3
- package/templates/devcontainer/tmux.conf +6 -0
- package/templates/init-exec-defaults.yaml +13 -0
- package/templates/lefthook/tools/specdojo-pre-commit.mjs +8 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +8 -4
|
@@ -1,17 +1,38 @@
|
|
|
1
1
|
import { relative, resolve, sep } from "node:path";
|
|
2
|
+
import { ChangeScopeGate } from "./change-scope.js";
|
|
3
|
+
import { enforceExecutorReportContract, executorStageResumeHint, recordExecutorEvidence, recordReporterFailureOutput, writeExecutorEvidence, } from "../evidence.js";
|
|
4
|
+
import { integrationCommitSkipHooks } from "../commit-hook-skips.js";
|
|
5
|
+
import { integratedCommitRange, runPostIntegration } from "../post-integration.js";
|
|
6
|
+
import { reviewTaskBlockReason } from "../review-completion.js";
|
|
2
7
|
import { limitEventMeta } from "../limit.js";
|
|
8
|
+
import { createPipelineState, loadPipelineResumeCheckpoint, pipelineStateLocation, updatePipelineStage, writePipelineState, } from "../pipeline-state.js";
|
|
9
|
+
import { commitProductWorktrees, integrateTaskRepositories, PROJECT_REPO_NAME, projectMergeBlockers, RepoIntegrationError, } from "../repo-integration.js";
|
|
10
|
+
import { deriveReporterFacts, evidenceForReporter, runReporterWithFormatRetry, } from "../reporter.js";
|
|
3
11
|
import { readResultFrontmatterSnapshot, renderReporterResult, updateResultStatus, } from "../results.js";
|
|
4
|
-
import {
|
|
12
|
+
import { recordPathForRead, runLogPath, snapshotRunAttempt, taskRecordPaths, } from "../run-records.js";
|
|
5
13
|
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";
|
|
14
|
+
import { branchOwnedRunRecordPaths } from "../trailing-records.js";
|
|
15
|
+
import { assertCommitScope, commitTargetPaths, commitWorktreeChanges, isExecBranchMergedIntoCurrent, mergeWorktreeIntoCurrent, releaseRootWorkingCopies, removeWorktree, taskTargetsAtHead, WorktreeRemovedBranchDeletionError, worktreeStatusPaths, } from "../worktree-ops.js";
|
|
16
|
+
import { gitOutput } from "../worktree.js";
|
|
12
17
|
import { refreshParentValidationsForReporterResume } from "./agent-pipeline.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
18
|
+
import { DeferredCleanup, runWithDeferredCleanup } from "./deferred-cleanup.js";
|
|
19
|
+
import { agentEnvironment, appendParentValidationsToExecutorEvidence, buildExecutorPrompt, extractBlockReason, pathInsideWorktree, resumedTargetCoverageFailure, runWithRetry, } from "./agent.js";
|
|
20
|
+
import { commitSubject, integrateLogPath, pipelineRecoveryMeta, recordIntegrateStage, recordRepoIntegration, repoRelativePath, spawnBlock, spawnComplete, stageActorMeta, } from "./mode-shared.js";
|
|
21
|
+
import { downgradeUnfilledResult, enforceScheduleKataReview, readCompletionPreflight, } from "./schedule-prepare.js";
|
|
22
|
+
import { execLifecyclePoolPath } from "./lock.js";
|
|
23
|
+
import { CrossProcessMutex } from "../../shared/cross-process-lock.js";
|
|
24
|
+
// 統合の段(commit・merge・記帳)は root の index と HEAD を書き換える。register ... --commit と
|
|
25
|
+
// specdojo git -- commit は project の lifecycle ロックの下で stage・commit(hook を含む)を行う。
|
|
26
|
+
// 統合も同じロックを取り、記帳の commit の途中に stage 済みのファイルを stagedMergeBlocker で
|
|
27
|
+
// 拒否しない(PJR-Y3XS)。プロセス内の直列化(schedule の準備との排他)は外側の lock が担う。
|
|
28
|
+
export function withExecLifecycleMutex(inner, executionPath, owner) {
|
|
29
|
+
const mutex = new CrossProcessMutex(execLifecyclePoolPath(executionPath), owner, {
|
|
30
|
+
onWait: () => process.stdout.write(" Waiting for the register lifecycle lock held by another operation\n"),
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
runExclusive: (fn) => inner ? inner.runExclusive(() => mutex.runExclusive(fn)) : mutex.runExclusive(fn),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
15
36
|
export async function runPreparedTask(prepared, projectId, repoRoot, schedulePath, executionPath, catalogPath, execDefaults, dryRun, lifecycleLock) {
|
|
16
37
|
if (dryRun)
|
|
17
38
|
return "success";
|
|
@@ -77,7 +98,8 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
77
98
|
}
|
|
78
99
|
else if (prepared.pipelineResumeStage === "reporter" &&
|
|
79
100
|
checkpoint.evidence &&
|
|
80
|
-
checkpoint.state.stages.executor.artifact_ref
|
|
101
|
+
checkpoint.state.stages.executor.artifact_ref &&
|
|
102
|
+
!prepared.reviewGradeRefreshed?.length) {
|
|
81
103
|
executorEvidence = checkpoint.evidence;
|
|
82
104
|
executorEvidenceRef = checkpoint.state.stages.executor.artifact_ref;
|
|
83
105
|
executorEvidencePath = resolve(prepared.worktree.path, executorEvidenceRef);
|
|
@@ -92,7 +114,9 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
92
114
|
});
|
|
93
115
|
}
|
|
94
116
|
else if (prepared.pipelineResumeStage === "reporter") {
|
|
95
|
-
process.stdout.write(
|
|
117
|
+
process.stdout.write(prepared.reviewGradeRefreshed?.length
|
|
118
|
+
? " Grade changed after the persisted review executor ran; starting a new executor run.\n"
|
|
119
|
+
: " Persisted executor evidence is invalid; starting a new executor run.\n");
|
|
96
120
|
pipelineState = undefined;
|
|
97
121
|
pipelineStatePath = undefined;
|
|
98
122
|
pipelineStateRef = undefined;
|
|
@@ -117,6 +141,14 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
117
141
|
updatedAt: now,
|
|
118
142
|
executorActor: prepared.agentCandidates[0]?.actor ?? prepared.actor,
|
|
119
143
|
reporterActor: prepared.reporterCandidates?.[0]?.actor,
|
|
144
|
+
artifacts: {
|
|
145
|
+
plan_ref: relative(repoRoot, recordPathForRead(executionPath, "plan", prepared.task.id))
|
|
146
|
+
.split(sep)
|
|
147
|
+
.join("/"),
|
|
148
|
+
result_ref: worktreeResultPath
|
|
149
|
+
? relative(prepared.worktree.path, worktreeResultPath).split(sep).join("/")
|
|
150
|
+
: "",
|
|
151
|
+
},
|
|
120
152
|
});
|
|
121
153
|
pipelineStatePath = location.path;
|
|
122
154
|
pipelineStateRef = location.ref;
|
|
@@ -127,6 +159,8 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
127
159
|
!resumeIntegration &&
|
|
128
160
|
pipelineState &&
|
|
129
161
|
pipelineStatePath) {
|
|
162
|
+
if (prepared.pipelineResumeStage === "executor")
|
|
163
|
+
snapshotRunAttempt(pipelineStatePath);
|
|
130
164
|
const executorStartedAt = new Date().toISOString();
|
|
131
165
|
pipelineState = updatePipelineStage(pipelineState, "executor", {
|
|
132
166
|
status: "running",
|
|
@@ -217,6 +251,31 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
217
251
|
});
|
|
218
252
|
}
|
|
219
253
|
}
|
|
254
|
+
// PJR-1GCD: a missing approach-required field (e.g. `condense_records`) is an executor failure.
|
|
255
|
+
// Checked before the reporter so fresh runs and reporter resumes both stop at the executor stage.
|
|
256
|
+
if (prepared.pipelineRunId &&
|
|
257
|
+
result === "success" &&
|
|
258
|
+
!resumeIntegration &&
|
|
259
|
+
executorEvidence &&
|
|
260
|
+
executorEvidencePath) {
|
|
261
|
+
const contractFailure = enforceExecutorReportContract({
|
|
262
|
+
evidence: executorEvidence,
|
|
263
|
+
evidencePath: executorEvidencePath,
|
|
264
|
+
contract: { approach: prepared.task.approach, mode: prepared.task.mode ?? "edit" },
|
|
265
|
+
resumeHint: executorStageResumeHint({ kind: "schedule", taskId: prepared.task.id }),
|
|
266
|
+
});
|
|
267
|
+
if (contractFailure) {
|
|
268
|
+
result = "failure";
|
|
269
|
+
stderr = contractFailure;
|
|
270
|
+
pipelineBlockReason = contractFailure;
|
|
271
|
+
if (pipelineState && pipelineStatePath) {
|
|
272
|
+
const blockedAt = new Date().toISOString();
|
|
273
|
+
pipelineState = updatePipelineStage(pipelineState, "executor", { status: "blocked", completed_at: blockedAt }, blockedAt);
|
|
274
|
+
writePipelineState(pipelineStatePath, pipelineState);
|
|
275
|
+
}
|
|
276
|
+
process.stdout.write(` Executor report rejected before the reporter: ${contractFailure}\n`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
220
279
|
if (prepared.pipelineRunId && result === "success" && !resumeIntegration) {
|
|
221
280
|
pipelineFailureStage = "reporter";
|
|
222
281
|
if (!executorEvidence ||
|
|
@@ -249,7 +308,7 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
249
308
|
evidence: reporterEvidence,
|
|
250
309
|
mode: prepared.task.mode ?? "edit",
|
|
251
310
|
invoke: async (reporterPrompt) => {
|
|
252
|
-
const outcome = await runWithRetry(prepared.reporterCandidates ?? [], reporterPrompt, execDefaults, prepared.worktree.path, agentEnvironment(repoRoot, prepared.worktree.path, schedulePath, executionPath, prepared.worktree.repos), worktreeResultPath, prepared.reporterRateLimitOptions);
|
|
311
|
+
const outcome = await runWithRetry(prepared.reporterCandidates ?? [], reporterPrompt, execDefaults, prepared.worktree.path, agentEnvironment(repoRoot, prepared.worktree.path, schedulePath, executionPath, prepared.worktree.repos), worktreeResultPath, prepared.reporterRateLimitOptions, "reporter");
|
|
253
312
|
reporterAttempts += outcome.attempts;
|
|
254
313
|
reporterActor = outcome.actor ?? reporterActor;
|
|
255
314
|
reporterRateLimitEvents.push(...outcome.rateLimitEvents);
|
|
@@ -334,7 +393,28 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
334
393
|
}
|
|
335
394
|
}
|
|
336
395
|
}
|
|
396
|
+
const failedStageActor = () => pipelineFailureStage === "reporter" ? (reporterActor ?? prepared.actor) : prepared.actor;
|
|
337
397
|
const finalize = async () => {
|
|
398
|
+
if (result === "success" && worktreeResultPath) {
|
|
399
|
+
enforceScheduleKataReview({
|
|
400
|
+
task: prepared.task,
|
|
401
|
+
catalogPath,
|
|
402
|
+
resultPath: worktreeResultPath,
|
|
403
|
+
projectId,
|
|
404
|
+
rootDir: prepared.worktree.path,
|
|
405
|
+
});
|
|
406
|
+
const reviewBlockReason = reviewTaskBlockReason({
|
|
407
|
+
mode: prepared.task.mode,
|
|
408
|
+
resultPath: worktreeResultPath,
|
|
409
|
+
...(prepared.reviewGradeOutcome ? { gradeOutcome: prepared.reviewGradeOutcome } : {}),
|
|
410
|
+
});
|
|
411
|
+
if (reviewBlockReason) {
|
|
412
|
+
result = "failure";
|
|
413
|
+
pipelineBlockReason = reviewBlockReason;
|
|
414
|
+
stderr = reviewBlockReason;
|
|
415
|
+
process.stdout.write(` Review not completed: ${reviewBlockReason}\n`);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
338
418
|
const completedAt = new Date().toISOString();
|
|
339
419
|
const context = {
|
|
340
420
|
repoRoot,
|
|
@@ -350,13 +430,38 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
350
430
|
// particular, resume --by may run a different agent from the one that owns the claim; if we
|
|
351
431
|
// merged first, the subsequent complete command would reject that actor and leave schedule
|
|
352
432
|
// state at doing even though the deliverables had already landed and the worktree was gone.
|
|
353
|
-
const completionPreflight = readCompletionPreflight(schedulePath, prepared.task.id, prepared.
|
|
433
|
+
const completionPreflight = readCompletionPreflight(schedulePath, prepared.task.id, prepared.claimActor);
|
|
354
434
|
if (!completionPreflight.ok) {
|
|
355
435
|
const reason = `completion preflight failed: ${completionPreflight.reason ?? "unknown reason"}`;
|
|
356
436
|
process.stderr.write(`${reason}\n`);
|
|
357
437
|
process.stdout.write(` Blocked before integration: ${prepared.task.id} (worktree kept: ${prepared.worktree.path})\n`);
|
|
358
438
|
return "failure";
|
|
359
439
|
}
|
|
440
|
+
// 統合の段の失敗を block として記帳する。merge の前の失敗と、merge の後の撤去の失敗で共通。
|
|
441
|
+
const blockIntegration = async (error) => {
|
|
442
|
+
const reason = integrationBlockReason(prepared.task.id, error instanceof Error ? error.message : String(error), prepared.worktree.path);
|
|
443
|
+
const integrateFailedAt = new Date().toISOString();
|
|
444
|
+
recordIntegrateStage(pipelineStatePath, integrateFailedAt, () => ({
|
|
445
|
+
status: "failed",
|
|
446
|
+
completed_at: integrateFailedAt,
|
|
447
|
+
}));
|
|
448
|
+
if (worktreeResultPath)
|
|
449
|
+
await updateResultStatus(worktreeResultPath, "blocked", completedAt, reason);
|
|
450
|
+
spawnBlock(projectId, prepared.task.id, prepared.claimActor, reason, {
|
|
451
|
+
...(pipelineStateRef
|
|
452
|
+
? pipelineRecoveryMeta({
|
|
453
|
+
stage: "integrate",
|
|
454
|
+
evidenceRef: executorEvidenceRef,
|
|
455
|
+
stateRef: pipelineStateRef,
|
|
456
|
+
runId: pipelineState?.run_id ?? prepared.pipelineRunId,
|
|
457
|
+
})
|
|
458
|
+
: { limit_deferred: "false" }),
|
|
459
|
+
...stageActorMeta(prepared.claimActor, prepared.actor),
|
|
460
|
+
});
|
|
461
|
+
process.stderr.write(`${reason}\n`);
|
|
462
|
+
process.stdout.write(` Blocked: ${prepared.task.id} (worktree kept: ${prepared.worktree.path})\n`);
|
|
463
|
+
return "failure";
|
|
464
|
+
};
|
|
360
465
|
// A previous attempt may have merged successfully and failed only while removing the
|
|
361
466
|
// worktree. In that case the branch is already contained in HEAD: do not create another
|
|
362
467
|
// commit or merge. Discard only runner-owned lifecycle diffs left by the failure handler,
|
|
@@ -364,6 +469,10 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
364
469
|
const alreadyMerged = resumeIntegration &&
|
|
365
470
|
isExecBranchMergedIntoCurrent({ context, worktree: prepared.worktree });
|
|
366
471
|
try {
|
|
472
|
+
assertCommitScope(context, prepared.worktree, prepared.task.id, {
|
|
473
|
+
scopeLogPath: integrateLogPath(pipelineStatePath),
|
|
474
|
+
allowEditedPlan: prepared.pipelineResumeStage === "executor",
|
|
475
|
+
});
|
|
367
476
|
if (alreadyMerged) {
|
|
368
477
|
const lifecyclePaths = new Set([worktreeResultPath, pipelineStatePath]
|
|
369
478
|
.filter((path) => !!path)
|
|
@@ -387,6 +496,13 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
387
496
|
// of the checkpoint files so they do not linger as reverse diffs.
|
|
388
497
|
releaseRootWorkingCopies(repoRoot, (prepared.checkpointPaths ?? []).map((path) => repoRelativePath(repoRoot, path)));
|
|
389
498
|
process.stdout.write(` [integrate] already merged: ${prepared.worktree.branch} (skipping commit and merge)\n`);
|
|
499
|
+
await runPostIntegration({
|
|
500
|
+
entries: execDefaults.pipeline?.post_integration,
|
|
501
|
+
repoRoot,
|
|
502
|
+
...integratedCommitRange(repoRoot, prepared.worktree.branch),
|
|
503
|
+
logPath: runLogPath(prepared.resultPath ??
|
|
504
|
+
taskRecordPaths(executionPath, prepared.task.id, prepared.pipelineRunId).result, "post-integration.log"),
|
|
505
|
+
});
|
|
390
506
|
}
|
|
391
507
|
else {
|
|
392
508
|
// Record completion and integration start before the first commit. The succeeded state
|
|
@@ -422,6 +538,12 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
422
538
|
failureLogPath: integrateLogPath(pipelineStatePath),
|
|
423
539
|
productsIntegratedByCaller: true,
|
|
424
540
|
productRootNewFiles,
|
|
541
|
+
allowEditedPlan: prepared.pipelineResumeStage === "executor",
|
|
542
|
+
skipHooks: integrationCommitSkipHooks({
|
|
543
|
+
pipeline: execDefaults.pipeline,
|
|
544
|
+
worktreePath: prepared.worktree.path,
|
|
545
|
+
pipelineStatePath,
|
|
546
|
+
}),
|
|
425
547
|
});
|
|
426
548
|
}
|
|
427
549
|
catch (error) {
|
|
@@ -438,6 +560,7 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
438
560
|
pending: [...productNames, PROJECT_REPO_NAME],
|
|
439
561
|
});
|
|
440
562
|
}
|
|
563
|
+
const baseCommit = gitOutput(repoRoot, ["rev-parse", "HEAD"]).trim();
|
|
441
564
|
integrateTaskRepositories({
|
|
442
565
|
worktree: prepared.worktree,
|
|
443
566
|
mergeMessage,
|
|
@@ -461,6 +584,7 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
461
584
|
taskId: prepared.task.id,
|
|
462
585
|
failureLogPath: integrateLogPath(pipelineStatePath),
|
|
463
586
|
productsIntegratedByCaller: true,
|
|
587
|
+
allowEditedPlan: prepared.pipelineResumeStage === "executor",
|
|
464
588
|
});
|
|
465
589
|
},
|
|
466
590
|
mergeProject: () => mergeWorktreeIntoCurrent({
|
|
@@ -469,50 +593,61 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
469
593
|
taskId: prepared.task.id,
|
|
470
594
|
message: mergeMessage,
|
|
471
595
|
releaseRootPaths: prepared.checkpointPaths,
|
|
596
|
+
// 失敗・延期の後の記帳 commit が root の作業コピーを先に統合ブランチへ入れている
|
|
597
|
+
// 場合、同じ run の記録は両側の追加として競合する。exec branch 側を最新とする。
|
|
598
|
+
resolveConflictsWithBranchPaths: [
|
|
599
|
+
...(prepared.checkpointPaths ?? []),
|
|
600
|
+
...branchOwnedRunRecordPaths({
|
|
601
|
+
repoRoot,
|
|
602
|
+
executionPath,
|
|
603
|
+
branch: prepared.worktree.branch,
|
|
604
|
+
taskId: prepared.task.id,
|
|
605
|
+
}),
|
|
606
|
+
],
|
|
472
607
|
failureLogPath: integrateLogPath(pipelineStatePath),
|
|
473
608
|
}),
|
|
474
609
|
record: (repo, patch) => recordRepoIntegration(pipelineStatePath, repo, patch),
|
|
475
610
|
failureLogPath: integrateLogPath(pipelineStatePath),
|
|
476
611
|
lockPath: schedulePath,
|
|
477
612
|
});
|
|
613
|
+
await runPostIntegration({
|
|
614
|
+
entries: execDefaults.pipeline?.post_integration,
|
|
615
|
+
repoRoot,
|
|
616
|
+
baseCommit,
|
|
617
|
+
outputCommit: gitOutput(repoRoot, ["rev-parse", "HEAD"]).trim(),
|
|
618
|
+
logPath: runLogPath(prepared.resultPath ??
|
|
619
|
+
taskRecordPaths(executionPath, prepared.task.id, prepared.pipelineRunId).result, "post-integration.log"),
|
|
620
|
+
});
|
|
478
621
|
}
|
|
479
|
-
removeWorktree({
|
|
480
|
-
context,
|
|
481
|
-
worktree: prepared.worktree,
|
|
482
|
-
taskId: prepared.task.id,
|
|
483
|
-
deleteBranch: true,
|
|
484
|
-
});
|
|
485
622
|
}
|
|
486
623
|
catch (error) {
|
|
487
|
-
if (
|
|
624
|
+
if (isExecBranchMergedIntoCurrent({ context, worktree: prepared.worktree })) {
|
|
625
|
+
await prepared.onScopeIntegrated?.();
|
|
626
|
+
await new ChangeScopeGate(executionPath).clearIntegrated(prepared.task.id);
|
|
627
|
+
}
|
|
628
|
+
return blockIntegration(error);
|
|
629
|
+
}
|
|
630
|
+
await prepared.onScopeIntegrated?.();
|
|
631
|
+
await new ChangeScopeGate(executionPath).clearIntegrated(prepared.task.id);
|
|
632
|
+
// PJR-NHT7: 撤去はロックの外で行い、完了の記帳はロックを取り直して行う。
|
|
633
|
+
return new DeferredCleanup(() => removeWorktree({
|
|
634
|
+
context,
|
|
635
|
+
worktree: prepared.worktree,
|
|
636
|
+
taskId: prepared.task.id,
|
|
637
|
+
deleteBranch: true,
|
|
638
|
+
}), async (outcome) => {
|
|
639
|
+
if (!outcome.ok) {
|
|
640
|
+
if (!(outcome.error instanceof WorktreeRemovedBranchDeletionError)) {
|
|
641
|
+
return blockIntegration(outcome.error);
|
|
642
|
+
}
|
|
488
643
|
// The task changes are already merged and the worktree is gone. Keep task completion
|
|
489
644
|
// independent from branch housekeeping, but make the residue and recovery command clear.
|
|
490
|
-
process.stderr.write(`Warning: ${error.message}; run exec worktree prune.\n`);
|
|
645
|
+
process.stderr.write(`Warning: ${outcome.error.message}; run exec worktree prune.\n`);
|
|
491
646
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
status: "failed",
|
|
497
|
-
completed_at: integrateFailedAt,
|
|
498
|
-
}));
|
|
499
|
-
if (worktreeResultPath)
|
|
500
|
-
await updateResultStatus(worktreeResultPath, "blocked", completedAt, reason);
|
|
501
|
-
spawnBlock(projectId, prepared.task.id, prepared.actor, reason, pipelineStateRef
|
|
502
|
-
? pipelineRecoveryMeta({
|
|
503
|
-
stage: "integrate",
|
|
504
|
-
evidenceRef: executorEvidenceRef,
|
|
505
|
-
stateRef: pipelineStateRef,
|
|
506
|
-
runId: pipelineState?.run_id ?? prepared.pipelineRunId,
|
|
507
|
-
})
|
|
508
|
-
: { limit_deferred: "false" });
|
|
509
|
-
process.stderr.write(`${reason}\n`);
|
|
510
|
-
process.stdout.write(` Blocked: ${prepared.task.id} (worktree kept: ${prepared.worktree.path})\n`);
|
|
511
|
-
return "failure";
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
spawnComplete(projectId, prepared.task.id, prepared.actor);
|
|
515
|
-
process.stdout.write(` Done: ${prepared.task.id}\n`);
|
|
647
|
+
spawnComplete(projectId, prepared.task.id, prepared.claimActor);
|
|
648
|
+
process.stdout.write(` Done: ${prepared.task.id}\n`);
|
|
649
|
+
return "success";
|
|
650
|
+
});
|
|
516
651
|
}
|
|
517
652
|
else if (effectiveResult === "rate_limit") {
|
|
518
653
|
// Keep the worktree for the due-time resume path; do not merge partial changes.
|
|
@@ -524,12 +659,14 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
524
659
|
: (pipelineBlockReason ?? "rate limit reached");
|
|
525
660
|
if (worktreeResultPath)
|
|
526
661
|
await updateResultStatus(worktreeResultPath, "blocked", completedAt, reason);
|
|
527
|
-
|
|
662
|
+
const rateLimitActorMeta = stageActorMeta(prepared.claimActor, failedStageActor());
|
|
663
|
+
spawnBlock(projectId, prepared.task.id, prepared.claimActor, reason, activeLimit
|
|
528
664
|
? {
|
|
529
665
|
...limitEventMeta(activeLimit, {
|
|
530
666
|
attempts: totalAttempts,
|
|
531
667
|
worktree: prepared.worktree.path,
|
|
532
668
|
}),
|
|
669
|
+
...rateLimitActorMeta,
|
|
533
670
|
...(prepared.pipelineRunId
|
|
534
671
|
? pipelineRecoveryMeta({
|
|
535
672
|
stage: pipelineFailureStage,
|
|
@@ -541,6 +678,7 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
541
678
|
}
|
|
542
679
|
: {
|
|
543
680
|
limit_deferred: "false",
|
|
681
|
+
...rateLimitActorMeta,
|
|
544
682
|
...(prepared.pipelineRunId
|
|
545
683
|
? pipelineRecoveryMeta({
|
|
546
684
|
stage: pipelineFailureStage,
|
|
@@ -560,8 +698,9 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
560
698
|
: (pipelineBlockReason ?? extractBlockReason(stderr));
|
|
561
699
|
if (worktreeResultPath)
|
|
562
700
|
await updateResultStatus(worktreeResultPath, "blocked", completedAt, blockReason);
|
|
563
|
-
spawnBlock(projectId, prepared.task.id, prepared.
|
|
701
|
+
spawnBlock(projectId, prepared.task.id, prepared.claimActor, blockReason, {
|
|
564
702
|
limit_deferred: "false",
|
|
703
|
+
...stageActorMeta(prepared.claimActor, failedStageActor()),
|
|
565
704
|
...(prepared.pipelineRunId
|
|
566
705
|
? pipelineRecoveryMeta({
|
|
567
706
|
stage: pipelineFailureStage,
|
|
@@ -575,7 +714,19 @@ export async function runPreparedTask(prepared, projectId, repoRoot, schedulePat
|
|
|
575
714
|
}
|
|
576
715
|
return effectiveResult;
|
|
577
716
|
};
|
|
578
|
-
return lifecycleLock
|
|
717
|
+
return runWithDeferredCleanup(withExecLifecycleMutex(lifecycleLock, executionPath, {
|
|
718
|
+
actor: prepared.claimActor,
|
|
719
|
+
label: `integrate ${prepared.task.id}`,
|
|
720
|
+
}), finalize);
|
|
721
|
+
}
|
|
722
|
+
// 統合の段の失敗の理由(検査の名前・commit の対象外のパス・merge の失敗など、失敗した操作の
|
|
723
|
+
// メッセージ)に、worktree の成果を保ったまま続ける次の操作を足す。block の理由と result の
|
|
724
|
+
// 両方へ同じ文を残す(PJR-ED0K)。
|
|
725
|
+
export function integrationBlockReason(taskId, cause, worktreePath) {
|
|
726
|
+
return (`integration failed: ${cause.trim() || "unknown error"}; worktree kept: ${worktreePath}; ` +
|
|
727
|
+
`next: fix the artifacts with exec resume --task ${taskId} --resume-from executor ` +
|
|
728
|
+
`(syncs the integration target first), or retry only the integration with ` +
|
|
729
|
+
`exec resume --task ${taskId}`);
|
|
579
730
|
}
|
|
580
731
|
export async function runPreparedTaskSafely(prepared, projectId, repoRoot, schedulePath, executionPath, catalogPath, execDefaults, dryRun, lifecycleLock) {
|
|
581
732
|
try {
|
|
@@ -590,7 +741,10 @@ export async function runPreparedTaskSafely(prepared, projectId, repoRoot, sched
|
|
|
590
741
|
const completedAt = new Date().toISOString();
|
|
591
742
|
if (prepared.resultPath)
|
|
592
743
|
await updateResultStatus(prepared.resultPath, "blocked", completedAt);
|
|
593
|
-
spawnBlock(projectId, prepared.task.id, prepared.
|
|
744
|
+
spawnBlock(projectId, prepared.task.id, prepared.claimActor, `runner error: ${message}`, {
|
|
745
|
+
limit_deferred: "false",
|
|
746
|
+
...stageActorMeta(prepared.claimActor, prepared.actor),
|
|
747
|
+
});
|
|
594
748
|
}
|
|
595
749
|
};
|
|
596
750
|
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
|
|
@@ -243,6 +243,10 @@ export function selectCandidates(requirements, roster, taskMode, busyActors, exe
|
|
|
243
243
|
// are skipped during auto-selection.
|
|
244
244
|
if (m.disabled === true)
|
|
245
245
|
return false;
|
|
246
|
+
// Opt-in tier: never enter an automatic primary/fallback pool implicitly, even when
|
|
247
|
+
// every ordinary member is busy. Named selections resolve outside this function.
|
|
248
|
+
if (m.proficiency === "frontier" && proficiency !== "frontier")
|
|
249
|
+
return false;
|
|
246
250
|
const caps = m.capabilities ?? [];
|
|
247
251
|
if (!required.every((c) => caps.includes(c)))
|
|
248
252
|
return false;
|
|
@@ -294,8 +298,9 @@ export function collectBusyActors(schedulePath) {
|
|
|
294
298
|
const initTasks = buildInitialStateFromStrategy(schedulePath, sch);
|
|
295
299
|
const snap = foldEventsToState(evts, sch, schedulePath, initTasks);
|
|
296
300
|
for (const taskState of Object.values(snap.tasks ?? {})) {
|
|
297
|
-
|
|
298
|
-
|
|
301
|
+
const owner = taskState?.state === "doing" ? claimOwnerOf(taskState) : undefined;
|
|
302
|
+
if (owner)
|
|
303
|
+
busy.add(owner);
|
|
299
304
|
}
|
|
300
305
|
}
|
|
301
306
|
catch {
|
|
@@ -414,6 +419,7 @@ export async function withProjectExecRunLock(opts, commandLabel, action, sharing
|
|
|
414
419
|
const handle = await acquireExecRunLock(resolvedPaths.executionPath, {
|
|
415
420
|
actor: opts.by ?? `exec-${commandLabel}`,
|
|
416
421
|
ifBusy: policy,
|
|
422
|
+
waitTimeoutMs: opts.lockWaitMs,
|
|
417
423
|
shareable: sharing.shareable || sharing.join,
|
|
418
424
|
...(sharing.join ? { join: { limit: joinLimit } } : {}),
|
|
419
425
|
onWait: () => process.stdout.write(sharing.join
|
|
@@ -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
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, statSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { basename, extname, join } from "node:path";
|
|
3
3
|
import { computeReadyIds, foldEventsToState, isExecEventV1, validateEventShape, } from "../events.js";
|
|
4
|
-
import { ensureDir, formatDays, listFilesRecursive, readJson, toArtifactPath, toScheduleFilePath, writeJson, } from "../shared.js";
|
|
4
|
+
import { ensureDir, formatDays, listFilesRecursive, readJson, readYaml, toArtifactPath, toScheduleFilePath, writeJson, } from "../shared.js";
|
|
5
5
|
import { eventsDirForProject, executionRootForProject, generatedDirForProject, } from "../project.js";
|
|
6
6
|
import { buildGanttChartMarkdown, buildGanttChartSvg, buildProgressSummaryLines, } from "./gantt-chart.js";
|
|
7
7
|
import { buildScheduleIndex } from "./index.js";
|
|
@@ -10,7 +10,9 @@ import { computeCpm, topoSort } from "./cpm.js";
|
|
|
10
10
|
import { buildReadySnapshot, orderReadyIds, writeReadyFiles, selectNextTask } from "./ready.js";
|
|
11
11
|
import { writeScheduleHashAndDiff } from "./hash.js";
|
|
12
12
|
import { buildInitialStateFromStrategy } from "./initial.js";
|
|
13
|
-
import { buildPhaseModeIndex,
|
|
13
|
+
import { buildPhaseModeIndex, resolveAgentPipeline, resolveApproach, resolveScheduledTaskAgent, resolveTaskCapabilities, resolveTaskExecution, resolveTaskMode, resolveTaskProficiency, } from "../strategy.js";
|
|
14
|
+
import { buildScheduleTrack } from "../../schedule/build.js";
|
|
15
|
+
import { specdojoRootDir } from "../../shared/specdojo-config.js";
|
|
14
16
|
export function findStaleGeneratedTracks(projectPath) {
|
|
15
17
|
const files = listFilesRecursive(projectPath);
|
|
16
18
|
const trackFiles = new Map();
|
|
@@ -43,6 +45,113 @@ export function findStaleGeneratedTrackWarnings(projectPath) {
|
|
|
43
45
|
: `${basename(stale.strategyFile)} is newer than ${basename(stale.trackFile)}. ` +
|
|
44
46
|
`Run: specdojo schedule build --track ${stale.track} --force before exec refresh.`);
|
|
45
47
|
}
|
|
48
|
+
function normalizeYamlValue(value) {
|
|
49
|
+
return JSON.parse(JSON.stringify(value ?? null));
|
|
50
|
+
}
|
|
51
|
+
function asRecordList(value) {
|
|
52
|
+
if (!Array.isArray(value))
|
|
53
|
+
return [];
|
|
54
|
+
return value.filter((item) => typeof item === "object" && item !== null && !Array.isArray(item));
|
|
55
|
+
}
|
|
56
|
+
// Phase tasks carry no explicit id in the track; identify them the same way the schedule index
|
|
57
|
+
// does (local_id + phase suffix), qualified by phase set and cycle so repeated phases stay apart.
|
|
58
|
+
function taskKey(task, index) {
|
|
59
|
+
if (typeof task.id === "string" && task.id)
|
|
60
|
+
return task.id;
|
|
61
|
+
if (typeof task.local_id !== "string" || !task.local_id)
|
|
62
|
+
return `tasks[${index}]`;
|
|
63
|
+
const parts = [`${task.local_id}-${String(task.phase_suffix ?? "")}`];
|
|
64
|
+
if (task.phase_set !== undefined)
|
|
65
|
+
parts.push(`phase_set=${String(task.phase_set)}`);
|
|
66
|
+
if (task.cycle !== undefined)
|
|
67
|
+
parts.push(`cycle=${String(task.cycle)}`);
|
|
68
|
+
if (task.iteration !== undefined)
|
|
69
|
+
parts.push(`iteration=${String(task.iteration)}`);
|
|
70
|
+
return parts.join(" ");
|
|
71
|
+
}
|
|
72
|
+
function diffTrackTasks(generated, actual) {
|
|
73
|
+
const expectedTasks = new Map(asRecordList(generated).map((t, i) => [taskKey(t, i), t]));
|
|
74
|
+
const actualTasks = new Map(asRecordList(actual).map((t, i) => [taskKey(t, i), t]));
|
|
75
|
+
const differences = [];
|
|
76
|
+
const ids = [...new Set([...expectedTasks.keys(), ...actualTasks.keys()])].sort();
|
|
77
|
+
for (const id of ids) {
|
|
78
|
+
const expected = expectedTasks.get(id);
|
|
79
|
+
const current = actualTasks.get(id);
|
|
80
|
+
if (!current) {
|
|
81
|
+
differences.push(`${id}: missing`);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (!expected) {
|
|
85
|
+
differences.push(`${id}: not generated`);
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const fields = [...new Set([...Object.keys(expected), ...Object.keys(current)])].sort();
|
|
89
|
+
for (const field of fields) {
|
|
90
|
+
if (JSON.stringify(expected[field]) !== JSON.stringify(current[field])) {
|
|
91
|
+
differences.push(`${id}: ${field}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return differences;
|
|
96
|
+
}
|
|
97
|
+
// Detect generated tracks whose content no longer matches what `schedule build` would produce from
|
|
98
|
+
// the strategy (and catalogs), such as a direct edit of the track. Tracks that are missing or older
|
|
99
|
+
// than their strategy are reported by findStaleGeneratedTracks instead, and a strategy that cannot be
|
|
100
|
+
// built is left to `schedule build` to report, so this detector never duplicates those messages.
|
|
101
|
+
export function findEditedGeneratedTracks(projectPath, baseDir = specdojoRootDir()) {
|
|
102
|
+
const staleTracks = new Set(findStaleGeneratedTracks(projectPath).map((stale) => stale.track));
|
|
103
|
+
const files = listFilesRecursive(projectPath);
|
|
104
|
+
const trackFiles = new Map();
|
|
105
|
+
for (const file of files) {
|
|
106
|
+
const match = basename(file).match(/^sch-track-(.+)\.yaml$/);
|
|
107
|
+
if (match)
|
|
108
|
+
trackFiles.set(match[1], file);
|
|
109
|
+
}
|
|
110
|
+
const edited = [];
|
|
111
|
+
for (const strategyFile of files) {
|
|
112
|
+
const match = basename(strategyFile).match(/^sch-strategy-(.+)\.yaml$/);
|
|
113
|
+
if (!match)
|
|
114
|
+
continue;
|
|
115
|
+
const track = match[1];
|
|
116
|
+
const trackFile = trackFiles.get(track);
|
|
117
|
+
if (!trackFile || staleTracks.has(track))
|
|
118
|
+
continue;
|
|
119
|
+
let generated;
|
|
120
|
+
try {
|
|
121
|
+
generated = buildScheduleTrack(strategyFile, baseDir);
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (generated.errors.length > 0)
|
|
127
|
+
continue;
|
|
128
|
+
const actual = readYaml(trackFile);
|
|
129
|
+
if (typeof actual !== "object" || actual === null || Array.isArray(actual))
|
|
130
|
+
continue;
|
|
131
|
+
const actualDoc = actual;
|
|
132
|
+
const differences = diffTrackTasks(normalizeYamlValue(generated.tasks), actualDoc.tasks);
|
|
133
|
+
const expectedSettings = generated.startDate !== null ? { start_date: generated.startDate } : {};
|
|
134
|
+
if (JSON.stringify(normalizeYamlValue(expectedSettings)) !==
|
|
135
|
+
JSON.stringify(normalizeYamlValue(actualDoc.settings ?? {}))) {
|
|
136
|
+
differences.push("settings");
|
|
137
|
+
}
|
|
138
|
+
if (differences.length > 0)
|
|
139
|
+
edited.push({ track, strategyFile, trackFile, differences });
|
|
140
|
+
}
|
|
141
|
+
return edited.sort((a, b) => a.track.localeCompare(b.track));
|
|
142
|
+
}
|
|
143
|
+
const MAX_REPORTED_TRACK_DIFFERENCES = 10;
|
|
144
|
+
export function findEditedGeneratedTrackWarnings(projectPath, baseDir = specdojoRootDir()) {
|
|
145
|
+
return findEditedGeneratedTracks(projectPath, baseDir).map((edited) => {
|
|
146
|
+
const shown = edited.differences.slice(0, MAX_REPORTED_TRACK_DIFFERENCES);
|
|
147
|
+
const rest = edited.differences.length - shown.length;
|
|
148
|
+
return (`${basename(edited.trackFile)} (track ${edited.track}) differs from the result rebuilt from ` +
|
|
149
|
+
`${basename(edited.strategyFile)} (direct edit, or a catalog change not rebuilt yet; ` +
|
|
150
|
+
`change the strategy instead of the track): ` +
|
|
151
|
+
`${shown.join(", ")}${rest > 0 ? ` (+${rest} more)` : ""}. ` +
|
|
152
|
+
`Run: specdojo schedule build --track ${edited.track} --force`);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
46
155
|
export function validateAll(projectPath) {
|
|
47
156
|
const errors = [];
|
|
48
157
|
const warnings = [];
|
|
@@ -52,6 +161,7 @@ export function validateAll(projectPath) {
|
|
|
52
161
|
warnings.push(`No schedule nodes loaded from sch-*.yaml under: ${projectPath}`);
|
|
53
162
|
}
|
|
54
163
|
warnings.push(...findStaleGeneratedTrackWarnings(projectPath));
|
|
164
|
+
warnings.push(...findEditedGeneratedTrackWarnings(projectPath));
|
|
55
165
|
for (const node of schedule.nodes.values()) {
|
|
56
166
|
for (const dep of node.depends_on) {
|
|
57
167
|
if (!schedule.nodes.has(dep)) {
|
|
@@ -238,8 +348,10 @@ export function writeGeneratedCore(projectPath, events, schedule, cpm) {
|
|
|
238
348
|
const agentPipeline = resolveAgentPipeline(task.local_id, task.id, phaseModeIndex, task.phase_suffix, task.phase_set);
|
|
239
349
|
if (agentPipeline !== undefined)
|
|
240
350
|
task.agent_pipeline = agentPipeline;
|
|
241
|
-
const agent =
|
|
242
|
-
if (agent
|
|
351
|
+
const agent = resolveScheduledTaskAgent(task, phaseModeIndex);
|
|
352
|
+
if (agent === undefined)
|
|
353
|
+
delete task.agent;
|
|
354
|
+
else
|
|
243
355
|
task.agent = agent;
|
|
244
356
|
}
|
|
245
357
|
writeReadyFiles(projectPath, readySnapshot);
|