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
package/dist/exec/shared.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { toArtifactPath, toPortablePath } from "../shared/artifact-path.js";
|
|
2
2
|
export { ensureDir, listFilesRecursive, readJson, readYaml, writeJson } from "../shared/fs.js";
|
|
3
|
-
export { displayWidth, escapeMarkdownInline, expandTemplate, inlineCodeAnglePlaceholders, padEndDisplay, redactSensitiveText, stripTerminalControlSequences, } from "../shared/text.js";
|
|
3
|
+
export { displayWidth, escapeMarkdownInline, expandTemplate, inlineCodeAnglePlaceholders, inlineCodeFrontmatterAnglePlaceholders, padEndDisplay, redactSensitiveText, stripTerminalControlSequences, } from "../shared/text.js";
|
|
4
4
|
export { formatDateOnlyUtc, isUtcIsoSeconds, normalizeDateOnly, nowUtcIsoSeconds, } from "../shared/time.js";
|
|
5
5
|
export { randomHex } from "../shared/random.js";
|
|
6
6
|
export { isSchYamlFilename, toScheduleFilePath } from "../shared/schedule-paths.js";
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { atomicWriteFile, registerEventActor } from "../register/core.js";
|
|
4
|
+
import { readRegisterEventsFromContent, registerEventFilePath, } from "../register/events.js";
|
|
5
|
+
import { resolveRegisterPaths, runRegisterMutationInCurrentWorktree, } from "../register/register.js";
|
|
6
|
+
import { loadItemForUpdate } from "../register/update.js";
|
|
7
|
+
import { CrossProcessMutex } from "../shared/cross-process-lock.js";
|
|
8
|
+
import { loadExecDefaultsConfig } from "./agent-config.js";
|
|
9
|
+
import { resolveProjectPaths } from "./project.js";
|
|
10
|
+
import { normalizePjrId, parseRegisterIds, requireRunnableRegisterItem } from "./register.js";
|
|
11
|
+
import { loadRosterForExecutionPath } from "./run/agent.js";
|
|
12
|
+
import { spawnSelf } from "./run/mode-shared.js";
|
|
13
|
+
import { resolveRegisterPipelineCommand } from "./run/register-core.js";
|
|
14
|
+
import { resolveExecDefaultsPath } from "./run/shared.js";
|
|
15
|
+
// New tickets delimit the list explicitly. The legacy JSEY completion condition remains usable.
|
|
16
|
+
export function appendSmokeTargets(content, targets) {
|
|
17
|
+
const marked = /<!-- specdojo:smoke-targets -->[\s\S]*?<!-- \/specdojo:smoke-targets -->/g;
|
|
18
|
+
const legacy = /(PJR-[0-9A-Z]{4}(?:・PJR-[0-9A-Z]{4})*)(?=のうち)/g;
|
|
19
|
+
const markedLists = [...content.matchAll(marked)];
|
|
20
|
+
const lists = markedLists.length ? markedLists : [...content.matchAll(legacy)];
|
|
21
|
+
if (lists.length !== 1)
|
|
22
|
+
throw new Error("Expected one smoke target list; delimit it with <!-- specdojo:smoke-targets --> and <!-- /specdojo:smoke-targets -->");
|
|
23
|
+
const match = lists[0];
|
|
24
|
+
const list = match[0];
|
|
25
|
+
const existing = new Set(list.match(/PJR-[0-9A-Z]{4}/g) ?? []);
|
|
26
|
+
const added = [...new Set(targets)].filter((id) => !existing.has(id));
|
|
27
|
+
if (!added.length)
|
|
28
|
+
return content;
|
|
29
|
+
const updated = markedLists.length
|
|
30
|
+
? list.replace(/\s*<!-- \/specdojo:smoke-targets -->$/, `\n${added.join("・")}\n<!-- /specdojo:smoke-targets -->`)
|
|
31
|
+
: list.slice(0, -1) + "・" + added.join("・") + ")";
|
|
32
|
+
return content.slice(0, match.index) + updated + content.slice(match.index + list.length);
|
|
33
|
+
}
|
|
34
|
+
export function verifySmokeEvents(before, after, actor) {
|
|
35
|
+
if (before.some((event, index) => JSON.stringify(event) !== JSON.stringify(after[index])))
|
|
36
|
+
throw new Error("Register event history changed during smoke run");
|
|
37
|
+
const fresh = after.slice(before.length);
|
|
38
|
+
const starts = fresh.filter((event) => event.action === "start");
|
|
39
|
+
const reviews = fresh.filter((event) => event.action === "review");
|
|
40
|
+
if (starts.length !== 1 || reviews.length !== 1)
|
|
41
|
+
throw new Error("Expected one new start and one new review event from this run");
|
|
42
|
+
const start = starts[0];
|
|
43
|
+
const review = reviews[0];
|
|
44
|
+
if (fresh.indexOf(start) >= fresh.indexOf(review) ||
|
|
45
|
+
fresh.at(-1) !== review ||
|
|
46
|
+
start.to_status !== "in-progress" ||
|
|
47
|
+
review.from_status !== "in-progress" ||
|
|
48
|
+
review.to_status !== "review" ||
|
|
49
|
+
fresh.some((event) => event.action === "wait" || event.action === "reopen"))
|
|
50
|
+
throw new Error("Smoke run did not proceed from start to review without interruption");
|
|
51
|
+
if (start.actor !== actor || review.actor !== actor)
|
|
52
|
+
throw new Error(`Expected concrete actor ${actor}; start=${start.actor}, review=${review.actor}`);
|
|
53
|
+
return { start, review };
|
|
54
|
+
}
|
|
55
|
+
function readEvents(paths, id) {
|
|
56
|
+
const path = registerEventFilePath(paths.projectRegisterPath, id);
|
|
57
|
+
return readRegisterEventsFromContent(readFileSync(path, "utf8"), path);
|
|
58
|
+
}
|
|
59
|
+
function checkTickets(paths, id, targets) {
|
|
60
|
+
if (targets.includes(id))
|
|
61
|
+
throw new Error("Smoke item cannot also be a target");
|
|
62
|
+
for (const target of targets) {
|
|
63
|
+
const view = loadItemForUpdate(paths, target);
|
|
64
|
+
if (!["review", "done"].includes(view.item.status))
|
|
65
|
+
throw new Error(`Target ${target} must be review or done; actual=${view.item.status}`);
|
|
66
|
+
}
|
|
67
|
+
const view = loadItemForUpdate(paths, id);
|
|
68
|
+
if (!["done", "open", "review"].includes(view.item.status))
|
|
69
|
+
throw new Error(`Smoke item ${id} must be done, open or review; actual=${view.item.status}. Resolve or resume the existing run first.`);
|
|
70
|
+
if (requireRunnableRegisterItem({ ...view.item, status: "open" }) !== "edit")
|
|
71
|
+
throw new Error(`Smoke item ${id} must be an edit task`);
|
|
72
|
+
appendSmokeTargets(readFileSync(view.ticketPath, "utf8"), targets);
|
|
73
|
+
return view;
|
|
74
|
+
}
|
|
75
|
+
export async function runExecSmoke(opts) {
|
|
76
|
+
let stage = "preflight";
|
|
77
|
+
const step = (name, description) => {
|
|
78
|
+
stage = name;
|
|
79
|
+
process.stdout.write(`[smoke:${name}] ${description}\n`);
|
|
80
|
+
};
|
|
81
|
+
try {
|
|
82
|
+
const id = normalizePjrId(opts.register);
|
|
83
|
+
const targets = parseRegisterIds(opts.targets).ids;
|
|
84
|
+
if (!targets.length)
|
|
85
|
+
throw new Error("--targets requires at least one item ID");
|
|
86
|
+
const paths = resolveRegisterPaths(opts);
|
|
87
|
+
const project = paths.projectId;
|
|
88
|
+
const executionPath = paths.executionPath;
|
|
89
|
+
const projectPaths = resolveProjectPaths({ project });
|
|
90
|
+
const defaults = loadExecDefaultsConfig(resolveExecDefaultsPath({}, projectPaths.schedulePath), executionPath);
|
|
91
|
+
const roster = loadRosterForExecutionPath(executionPath);
|
|
92
|
+
const { executor } = resolveRegisterPipelineCommand(roster, opts, defaults);
|
|
93
|
+
const actor = executor.actor;
|
|
94
|
+
const by = registerEventActor({ project, by: opts.by });
|
|
95
|
+
const view = checkTickets(paths, id, targets);
|
|
96
|
+
readEvents(paths, id);
|
|
97
|
+
const reason = `${targets.join("・")} の統合後の動作確認`;
|
|
98
|
+
const runArgs = [
|
|
99
|
+
"exec",
|
|
100
|
+
"run",
|
|
101
|
+
"--project",
|
|
102
|
+
project,
|
|
103
|
+
"--register",
|
|
104
|
+
id,
|
|
105
|
+
"--worktree",
|
|
106
|
+
"--executor-by",
|
|
107
|
+
opts.executorBy,
|
|
108
|
+
"--reporter-by",
|
|
109
|
+
opts.reporterBy,
|
|
110
|
+
"--on-rate-limit",
|
|
111
|
+
"stop",
|
|
112
|
+
];
|
|
113
|
+
if (opts.worktreeBase)
|
|
114
|
+
runArgs.push("--worktree-base", opts.worktreeBase);
|
|
115
|
+
if (opts.dryRun) {
|
|
116
|
+
const content = readFileSync(view.ticketPath, "utf8");
|
|
117
|
+
step("targets", appendSmokeTargets(content, targets) === content
|
|
118
|
+
? `Would keep ${view.ticketPath}; all targets are already listed, no target commit needed`
|
|
119
|
+
: `Would append missing IDs from ${targets.join(", ")} to ${view.ticketPath} and commit the ticket under exec-lifecycle lock`);
|
|
120
|
+
step("reopen", view.item.status === "done"
|
|
121
|
+
? `Would register reopen ${id} --by ${by} --commit`
|
|
122
|
+
: `Would skip reopen (${view.item.status})`);
|
|
123
|
+
step("run", `Would run specdojo ${runArgs.join(" ")}`);
|
|
124
|
+
step("verify", `Would require new start → review events with concrete actor ${actor}; leave items for register close`);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const mutex = new CrossProcessMutex(join(executionPath, "exec", ".locks", "exec-smoke"), {
|
|
128
|
+
actor: by,
|
|
129
|
+
label: `smoke ${id}`,
|
|
130
|
+
});
|
|
131
|
+
await mutex.runExclusive(async () => {
|
|
132
|
+
step("targets", `Record ${targets.join(", ")} in ${id}`);
|
|
133
|
+
await runRegisterMutationInCurrentWorktree("smoke-targets", { project, by, commit: true }, (context) => {
|
|
134
|
+
const current = checkTickets(context.paths, id, targets);
|
|
135
|
+
const path = current.ticketPath;
|
|
136
|
+
const eventPath = registerEventFilePath(context.paths.projectRegisterPath, id);
|
|
137
|
+
context.assertCommitTargetsClean([path, eventPath]);
|
|
138
|
+
const content = readFileSync(path, "utf8");
|
|
139
|
+
const updated = appendSmokeTargets(content, targets);
|
|
140
|
+
if (updated !== content)
|
|
141
|
+
atomicWriteFile(path, updated);
|
|
142
|
+
return { id, title: current.item.title };
|
|
143
|
+
});
|
|
144
|
+
step("reopen", `Open ${id} if terminal`);
|
|
145
|
+
if (loadItemForUpdate(paths, id).item.status === "done") {
|
|
146
|
+
if (!spawnSelf([
|
|
147
|
+
"register",
|
|
148
|
+
"reopen",
|
|
149
|
+
"--project",
|
|
150
|
+
project,
|
|
151
|
+
"--id",
|
|
152
|
+
id,
|
|
153
|
+
"--by",
|
|
154
|
+
by,
|
|
155
|
+
"--reason",
|
|
156
|
+
reason,
|
|
157
|
+
"--commit",
|
|
158
|
+
]))
|
|
159
|
+
throw new Error(`register reopen failed for ${id}; see command output above`);
|
|
160
|
+
}
|
|
161
|
+
const before = readEvents(paths, id);
|
|
162
|
+
step("run", `Run ${id} with ${opts.executorBy} (${actor})`);
|
|
163
|
+
if (!spawnSelf(runArgs))
|
|
164
|
+
throw new Error(`exec run failed for ${id}; see command output above; inspect the run before retrying`);
|
|
165
|
+
step("verify", "Check this run's events and final item status");
|
|
166
|
+
const { start, review } = verifySmokeEvents(before, readEvents(paths, id), actor);
|
|
167
|
+
if (loadItemForUpdate(paths, id).item.status !== "review")
|
|
168
|
+
throw new Error(`${id} did not reach review`);
|
|
169
|
+
process.stdout.write(`Smoke passed: ${id}; targets=${targets.join(",")}; actor=${actor}; start=${start.id}; review=${review.id}\nClose ${id} and the targets with register close after checking their completion conditions.\n`);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
process.stderr.write(`[smoke:${stage}] failed: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
174
|
+
process.exitCode = 1;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
export function registerExecSmokeCommand(exec) {
|
|
178
|
+
exec
|
|
179
|
+
.command("smoke")
|
|
180
|
+
.description("Record integration targets, reopen a smoke item, run it in a worktree, and verify concrete event actors")
|
|
181
|
+
.option("--project <id>", "Project id")
|
|
182
|
+
.requiredOption("--register <id>", "Smoke register item ID (project-specific)")
|
|
183
|
+
.requiredOption("--targets <ids>", "Comma-separated integrated register item IDs")
|
|
184
|
+
.requiredOption("--executor-by <nickname>", "Executor nickname or alias")
|
|
185
|
+
.requiredOption("--reporter-by <nickname>", "Reporter nickname or alias")
|
|
186
|
+
.option("--by <actor>", "Actor for target recording and reopen", "specdojo-orchestrator")
|
|
187
|
+
.option("--worktree-base <path>", "Base directory for execution worktrees")
|
|
188
|
+
.option("--dry-run", "Print steps without writing, committing or launching agents", false)
|
|
189
|
+
.action(runExecSmoke);
|
|
190
|
+
}
|
package/dist/exec/strategy.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { listFilesRecursive, readYaml } from "./shared.js";
|
|
2
|
+
import { isProficiency } from "../shared/agent-types.js";
|
|
2
3
|
import { extractPhaseSuffix, normalizePhaseSetSelection, phaseSetNames, } from "../schedule/phase-sets.js";
|
|
3
4
|
function isTaskMode(value) {
|
|
4
5
|
return value === "edit" || value === "review";
|
|
@@ -6,6 +7,7 @@ function isTaskMode(value) {
|
|
|
6
7
|
function isApproach(value) {
|
|
7
8
|
return (value === "draft" ||
|
|
8
9
|
value === "fully-guided" ||
|
|
10
|
+
value === "condense" ||
|
|
9
11
|
value === "recipe-guided" ||
|
|
10
12
|
value === "freeform" ||
|
|
11
13
|
value === "bootstrap" ||
|
|
@@ -24,9 +26,6 @@ function isApproach(value) {
|
|
|
24
26
|
value === "finalize" ||
|
|
25
27
|
value === "bootstrap-finalize");
|
|
26
28
|
}
|
|
27
|
-
function isProficiency(value) {
|
|
28
|
-
return value === "low" || value === "normal" || value === "high" || value === "expert";
|
|
29
|
-
}
|
|
30
29
|
function isExecution(value) {
|
|
31
30
|
return value === "agent" || value === "human";
|
|
32
31
|
}
|
|
@@ -329,6 +328,18 @@ export function resolveAgentAssignment(localId, taskId, index, phaseSuffix, phas
|
|
|
329
328
|
}
|
|
330
329
|
return undefined;
|
|
331
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* Resolves the agent pinned on a scheduled task for ready.json, task views and runs alike.
|
|
333
|
+
* A track generated from a strategy takes the strategy as the source of truth, so the agent copied
|
|
334
|
+
* into the track (or a cached ready.json) is ignored there: a pass agent, then
|
|
335
|
+
* `owner_rules[].phase_overrides[].agent`, then the phase agent. Only a task whose track has no
|
|
336
|
+
* strategy keeps the agent written on the task itself. CLI overrides and auto-selection apply later.
|
|
337
|
+
*/
|
|
338
|
+
export function resolveScheduledTaskAgent(task, index) {
|
|
339
|
+
if (taskTrack(task.id, index) === undefined)
|
|
340
|
+
return task.agent;
|
|
341
|
+
return resolveAgentAssignment(task.local_id, task.id, index, task.phase_suffix, task.phase_set);
|
|
342
|
+
}
|
|
332
343
|
/** Resolves the optional executor/reporter pipeline declared on a phase. */
|
|
333
344
|
export function resolveAgentPipeline(localId, taskId, index, phaseSuffix, phaseSet) {
|
|
334
345
|
// Cross-deliverable-pass tasks (target_local_ids, no single local_id) declare
|
package/dist/exec/task-view.js
CHANGED
|
@@ -2,7 +2,7 @@ import { existsSync } from "node:fs";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { buildScheduleIndex } from "./schedule/schedule.js";
|
|
4
4
|
import { readReadySnapshot } from "./schedule/ready.js";
|
|
5
|
-
import { buildPhaseModeIndex,
|
|
5
|
+
import { buildPhaseModeIndex, resolveAgentPipeline, resolveApproach, resolveScheduledTaskAgent, resolveTaskCapabilities, resolveTaskExecution, resolveTaskMode, resolveTaskProficiency, } from "./strategy.js";
|
|
6
6
|
import { extractLocalId, extractPhaseSuffix } from "../schedule/phase-sets.js";
|
|
7
7
|
// Reconstruct a full ReadyTaskView for a task from the schedule (+ ready.json when
|
|
8
8
|
// present), filling mode/execution/approach/capabilities/proficiency/pipeline from strategy
|
|
@@ -57,8 +57,10 @@ export function buildTaskView(schedulePath, executionPath, taskId) {
|
|
|
57
57
|
task.agent_pipeline =
|
|
58
58
|
task.agent_pipeline ??
|
|
59
59
|
resolveAgentPipeline(task.local_id, task.id, phaseIndex, task.phase_suffix, task.phase_set);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const agent = resolveScheduledTaskAgent(task, phaseIndex);
|
|
61
|
+
if (agent === undefined)
|
|
62
|
+
delete task.agent;
|
|
63
|
+
else
|
|
64
|
+
task.agent = agent;
|
|
63
65
|
return task;
|
|
64
66
|
}
|
|
@@ -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";
|
|
@@ -35,6 +36,7 @@ async function runOneTrial(params) {
|
|
|
35
36
|
const parentValidationStartedAt = Date.now();
|
|
36
37
|
const parentValidationBatch = await runConfiguredParentValidationBatch(params.execDefaults, worktree.path, {
|
|
37
38
|
label: `${params.record.task_id} (${trial.trial_id})`,
|
|
39
|
+
metricsPath: join(comparisonDir(params.executionPath, params.record.comparison_id), "trials", trial.trial_id, "parent-validation-metrics.jsonl"),
|
|
38
40
|
});
|
|
39
41
|
parentValidations = parentValidationBatch.validations;
|
|
40
42
|
parentValidationFailureOutputs = parentValidationBatch.failureOutputs;
|
|
@@ -92,7 +94,7 @@ async function runOneTrial(params) {
|
|
|
92
94
|
evidence: reporterEvidence,
|
|
93
95
|
mode: parsePlanTaskIdentity(params.plan)?.mode ?? "edit",
|
|
94
96
|
invoke: async (reporterPrompt) => {
|
|
95
|
-
const reporterOutcome = await spawnAgent(params.reporterCommand, reporterPrompt, worktree.path, worktreeEnvironment(params.repoRoot, worktree.path, params.schedulePath, params.executionPath));
|
|
97
|
+
const reporterOutcome = await spawnAgent(params.reporterCommand, reporterPrompt, worktree.path, worktreeEnvironment(params.repoRoot, worktree.path, params.schedulePath, params.executionPath), "reporter");
|
|
96
98
|
const result = reporterOutcome.exitCode === 0
|
|
97
99
|
? "success"
|
|
98
100
|
: isRateLimitError(reporterOutcome.exitCode, `${reporterOutcome.stdout}\n${reporterOutcome.stderr}`, params.reporterRateLimitDetection)
|
|
@@ -203,7 +205,7 @@ async function runTrials(opts) {
|
|
|
203
205
|
const planPath = resolve(opts.plan);
|
|
204
206
|
if (!existsSync(planPath))
|
|
205
207
|
throw new Error(`Plan not found: ${planPath}`);
|
|
206
|
-
const planContent =
|
|
208
|
+
const planContent = readPlanFile(planPath);
|
|
207
209
|
const identity = parsePlanTaskIdentity(planContent);
|
|
208
210
|
if (!identity)
|
|
209
211
|
throw new Error("Trial plan must have SpecDojo task_id/mode/project_id frontmatter.");
|
|
@@ -476,7 +478,9 @@ function commandError(error) {
|
|
|
476
478
|
process.exitCode = 1;
|
|
477
479
|
}
|
|
478
480
|
export function registerExecTrialCommands(exec) {
|
|
479
|
-
const trial = exec
|
|
481
|
+
const trial = exec
|
|
482
|
+
.command("trial", { hidden: true })
|
|
483
|
+
.description("Compare multiple agents on one immutable plan");
|
|
480
484
|
trial
|
|
481
485
|
.command("run")
|
|
482
486
|
.requiredOption("--project <projectId>", "Project id")
|
package/dist/exec/trial-core.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
+
import { trackExecutor } from "./validation-metrics.js";
|
|
2
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
4
|
import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
4
5
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
5
6
|
import { agentProtectedConfigViolation, captureAgentProtectedConfigSnapshot, changedAgentProtectedConfigPaths, } from "./agent-protected-config.js";
|
|
6
7
|
import { agentGitStateViolation, captureAgentGitStateSnapshot, changedAgentGitStateFields, } from "./agent-git-state.js";
|
|
7
8
|
import { ensureDir, safeSlug } from "./shared.js";
|
|
9
|
+
import { localConfigEnvironment } from "../shared/local-config.js";
|
|
8
10
|
import { gitEnvironment, gitResult, worktreeNameFromTaskId } from "./worktree.js";
|
|
9
11
|
import { getProjectSchedulePath, loadConfig, resolveAgentMember, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
10
12
|
export const TRIAL_PROMPT_SUFFIX = `
|
|
@@ -179,11 +181,12 @@ export function resolveMember(roster, nickname, stageRole) {
|
|
|
179
181
|
}
|
|
180
182
|
return member;
|
|
181
183
|
}
|
|
182
|
-
export function spawnAgent(command, prompt, cwd, env) {
|
|
184
|
+
export function spawnAgent(command, prompt, cwd, env, stageRole = "executor") {
|
|
183
185
|
return new Promise((resolveOutcome) => {
|
|
184
186
|
const protectedConfigBefore = captureAgentProtectedConfigSnapshot(cwd);
|
|
185
187
|
const gitStateBefore = captureAgentGitStateSnapshot(cwd);
|
|
186
188
|
const child = spawn(command, { cwd, env, shell: true, stdio: ["pipe", "pipe", "pipe"] });
|
|
189
|
+
const stopTracking = stageRole === "executor" ? trackExecutor(child.pid, cwd) : () => undefined;
|
|
187
190
|
let stdout = "";
|
|
188
191
|
let stderr = "";
|
|
189
192
|
let settled = false;
|
|
@@ -202,6 +205,7 @@ export function spawnAgent(command, prompt, cwd, env) {
|
|
|
202
205
|
if (settled)
|
|
203
206
|
return;
|
|
204
207
|
settled = true;
|
|
208
|
+
stopTracking();
|
|
205
209
|
const protectedChanges = changedAgentProtectedConfigPaths(cwd, protectedConfigBefore);
|
|
206
210
|
if (protectedChanges.length > 0) {
|
|
207
211
|
outcome.stderr += `${agentProtectedConfigViolation(protectedChanges)}\n`;
|
|
@@ -225,6 +229,7 @@ export function spawnAgent(command, prompt, cwd, env) {
|
|
|
225
229
|
export function worktreeEnvironment(repoRoot, worktreePath, schedulePath, executionPath) {
|
|
226
230
|
return {
|
|
227
231
|
...gitEnvironment(),
|
|
232
|
+
...localConfigEnvironment(repoRoot),
|
|
228
233
|
SPECDOJO_SCHEDULE_PATH: resolve(worktreePath, repoRelative(repoRoot, schedulePath)),
|
|
229
234
|
SPECDOJO_EXECUTION_PATH: resolve(worktreePath, repoRelative(repoRoot, executionPath)),
|
|
230
235
|
};
|