specdojo 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/agents/specdojo-orchestrator.md +7 -3
- package/CHANGELOG.md +217 -0
- package/dist/catalog/build.js +24 -1
- package/dist/catalog/catalog.js +16 -14
- package/dist/catalog/plan.js +1 -1
- package/dist/catalog/scaffold.js +4 -1
- package/dist/commands/agent.js +5 -3
- package/dist/commands/build.js +69 -10
- package/dist/commands/git.js +206 -0
- package/dist/commands/init.js +9 -3
- package/dist/commands/night-orchestrator.js +6 -4
- package/dist/commands/where.js +25 -0
- package/dist/dashboard/dashboard-timeline.js +18 -16
- package/dist/dashboard/dashboard.js +616 -261
- package/dist/dashboard/epic-plan.js +81 -0
- package/dist/dashboard/exec-records.js +16 -20
- package/dist/dashboard/routines.js +11 -12
- package/dist/dashboard/timeline-build.js +5 -9
- package/dist/dashboard/timeline.js +23 -18
- package/dist/devcontainer/scaffold.js +18 -0
- package/dist/docs/frontmatter-namespace.js +1 -48
- package/dist/docs/index-command.js +2 -2
- package/dist/docs/yaml-business-tables.js +243 -0
- package/dist/docs/yaml-interface-tables.js +106 -0
- package/dist/docs/yaml-pages-command.js +5 -3
- package/dist/docs/yaml-pages.js +268 -3
- package/dist/docs/yaml-table-shared.js +70 -0
- package/dist/docs/yaml-tables.js +39 -0
- package/dist/exec/agent-config.js +31 -0
- package/dist/exec/agent-plan.js +3 -2
- package/dist/exec/agent-protected-config.js +2 -0
- package/dist/exec/commands.js +100 -39
- package/dist/exec/commit-hook-skips.js +78 -0
- package/dist/exec/core.js +19 -7
- package/dist/exec/events.js +179 -8
- package/dist/exec/evidence.js +77 -19
- package/dist/exec/handoff.js +9 -13
- package/dist/exec/limit.js +1 -1
- package/dist/exec/mechanical-result.js +45 -0
- package/dist/exec/migrate-records.js +249 -0
- package/dist/exec/parent-validation.js +209 -15
- package/dist/exec/pipeline-state.js +27 -5
- package/dist/exec/plans-condense-findings.js +89 -0
- package/dist/exec/plans-core.js +45 -19
- package/dist/exec/plans-generation.js +52 -30
- package/dist/exec/plans-grade-findings.js +8 -3
- package/dist/exec/plans-kata-findings.js +61 -0
- package/dist/exec/plans-planning.js +3 -3
- package/dist/exec/plans-storage.js +12 -24
- package/dist/exec/post-integration.js +162 -0
- package/dist/exec/queue-command.js +166 -0
- package/dist/exec/queue.js +285 -0
- package/dist/exec/register-foreign-wait.js +84 -0
- package/dist/exec/register-resume.js +55 -56
- package/dist/exec/register.js +26 -22
- package/dist/exec/repo-integration-sync.js +21 -5
- package/dist/exec/repo-integration.js +21 -1
- package/dist/exec/reporter.js +121 -23
- package/dist/exec/results.js +106 -25
- package/dist/exec/review-completion.js +47 -0
- package/dist/exec/review-kata.js +112 -0
- package/dist/exec/run/agent-pipeline.js +78 -8
- package/dist/exec/run/agent.js +32 -13
- package/dist/exec/run/change-scope.js +365 -0
- package/dist/exec/run/deferred-cleanup.js +31 -0
- package/dist/exec/run/in-place.js +73 -33
- package/dist/exec/run/job-lock.js +66 -0
- package/dist/exec/run/job-sequence.js +137 -0
- package/dist/exec/run/job.js +135 -41
- package/dist/exec/run/lifecycle-commands.js +189 -37
- package/dist/exec/run/lock.js +22 -1
- package/dist/exec/run/mode-shared.js +11 -3
- package/dist/exec/run/register-command.js +14 -15
- package/dist/exec/run/register-core.js +20 -13
- package/dist/exec/run/register-mode.js +77 -17
- package/dist/exec/run/register-post-review.js +21 -9
- package/dist/exec/run/register-resume.js +95 -31
- package/dist/exec/run/register-state.js +23 -15
- package/dist/exec/run/register-worktree.js +184 -139
- package/dist/exec/run/schedule-mode.js +79 -18
- package/dist/exec/run/schedule-prepare.js +204 -59
- package/dist/exec/run/schedule-task.js +203 -49
- package/dist/exec/run/shared.js +9 -3
- package/dist/exec/run/trailing-records.js +35 -0
- package/dist/exec/run-records.js +2 -0
- package/dist/exec/schedule/schedule.js +116 -4
- package/dist/exec/shared.js +1 -1
- package/dist/exec/smoke.js +190 -0
- package/dist/exec/strategy.js +14 -3
- package/dist/exec/task-view.js +6 -4
- package/dist/exec/trailing-records.js +242 -0
- package/dist/exec/trial-commands.js +8 -4
- package/dist/exec/trial-core.js +6 -1
- package/dist/exec/validate-records-commit.js +110 -0
- package/dist/exec/validate-records.js +148 -0
- package/dist/exec/validation-metrics.js +181 -0
- package/dist/exec/worktree-cleanup-lock.js +26 -0
- package/dist/exec/worktree-command.js +38 -17
- package/dist/exec/worktree-ops-commit.js +119 -48
- package/dist/exec/worktree-ops-lifecycle.js +77 -48
- package/dist/exec/worktree-ops-merge.js +13 -2
- package/dist/exec/worktree-ops.js +2 -2
- package/dist/exec/worktree.js +32 -4
- package/dist/grade/apply.js +32 -6
- package/dist/grade/command-apply.js +3 -3
- package/dist/grade/command-inspect.js +7 -5
- package/dist/grade/command-plan.js +1 -1
- package/dist/grade/command-run.js +7 -1
- package/dist/grade/command-shared.js +1 -1
- package/dist/grade/core.js +18 -5
- package/dist/grade/markdown.js +3 -3
- package/dist/grade/pipeline-state.js +15 -11
- package/dist/grade/plan.js +37 -17
- package/dist/grade/result.js +3 -3
- package/dist/grade/run.js +87 -11
- package/dist/grade/target-discovery.js +17 -4
- package/dist/grade/targets.js +12 -11
- package/dist/job/definition.js +84 -8
- package/dist/job/job.js +109 -39
- package/dist/job/noop.js +104 -0
- package/dist/register/authoring-sources.js +22 -16
- package/dist/register/core.js +2 -0
- package/dist/register/create-commands.js +28 -3
- package/dist/register/deliverable-target.js +9 -1
- package/dist/register/epic.js +104 -26
- package/dist/register/event-merge.js +3 -0
- package/dist/register/events.js +4 -0
- package/dist/register/external-project.js +3 -0
- package/dist/register/item.js +6 -0
- package/dist/register/maintenance-commands.js +6 -3
- package/dist/register/planning.js +7 -14
- package/dist/register/register.js +74 -16
- package/dist/register/track-domains.js +34 -0
- package/dist/register/track-plan.js +78 -0
- package/dist/register/transition-commands.js +8 -0
- package/dist/register/work-table.js +64 -0
- package/dist/review/grade.js +35 -13
- package/dist/routine/definition.js +13 -3
- package/dist/routine/failure.js +30 -0
- package/dist/routine/routine.js +189 -71
- package/dist/routine/status.js +62 -0
- package/dist/routine/storage.js +33 -0
- package/dist/schedule/schedule.js +39 -39
- package/dist/schedule/strategy-generate-document.js +26 -14
- package/dist/schedule/strategy-generate-scope.js +17 -45
- package/dist/schedule/strategy-generate.js +33 -3
- package/dist/schedule/strategy-profiles.js +86 -12
- package/dist/shared/agent-types.js +7 -0
- package/dist/shared/condense-records.js +25 -0
- package/dist/shared/cross-process-lock.js +9 -1
- package/dist/shared/deprecation.js +8 -0
- package/dist/shared/dist-freshness.js +8 -2
- package/dist/shared/document-metadata.js +20 -0
- package/dist/shared/finding-cause.js +20 -0
- package/dist/shared/frontmatter-namespace.js +48 -0
- package/dist/shared/git-environment.js +2 -1
- package/dist/shared/git.js +186 -16
- package/dist/shared/grade-result.js +17 -1
- package/dist/shared/lefthook-scaffold.js +3 -0
- package/dist/shared/local-config.js +244 -0
- package/dist/shared/local-state.js +20 -0
- package/dist/shared/markdownlint-config.js +8 -3
- package/dist/shared/plan-conventions.js +129 -0
- package/dist/shared/plan-templates.js +57 -41
- package/dist/shared/run-records.js +224 -0
- package/dist/shared/specdojo-config.js +73 -41
- package/dist/shared/specdojo-gitignore.js +1 -0
- package/dist/shared/text.js +74 -6
- package/dist/shared/timeline-index.js +2 -0
- package/dist/shared/where-alias.js +13 -0
- package/dist/specdojo.js +4 -0
- package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +11 -2
- package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +4 -74
- package/docs/ja/specdojo/exec-templates/xep-condense-template.md +50 -0
- package/docs/ja/specdojo/exec-templates/xep-draft-template.md +17 -5
- package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +16 -3
- package/docs/ja/specdojo/exec-templates/xep-recipe-guided-template.md +15 -5
- package/docs/ja/specdojo/exec-templates/xep-recipe-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +1 -1
- package/docs/ja/specdojo/exec-templates/xep-rulebook-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-sample-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-template-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xer-condense-template.md +25 -0
- package/docs/ja/specdojo/exec-templates/xp-common-conventions-template.md +50 -0
- package/docs/ja/specdojo/exec-templates/xrp-common-conventions-template.md +30 -0
- package/docs/ja/specdojo/guides/branch-workflow-guide.md +1 -1
- package/docs/ja/specdojo/guides/docs-editing-guide.md +12 -0
- package/docs/ja/specdojo/guides/docs-structure-guide.md +48 -15
- package/docs/ja/specdojo/guides/exec-config-guide.md +69 -19
- package/docs/ja/specdojo/guides/exec-operation-guide.md +97 -18
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +20 -11
- package/docs/ja/specdojo/guides/job-sequence-guide.md +77 -0
- package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +92 -55
- package/docs/ja/specdojo/guides/project-move-guide.md +381 -0
- package/docs/ja/specdojo/guides/quick-start-guide.md +73 -17
- package/docs/ja/specdojo/guides/register-operation-guide.md +26 -6
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +2 -0
- package/docs/ja/specdojo/guides/review-guide.md +22 -19
- package/docs/ja/specdojo/guides/routine-operation-guide.md +23 -12
- package/docs/ja/specdojo/guides/ryu-guide.md +23 -13
- package/docs/ja/specdojo/guides/schedule-design-guide.md +27 -21
- package/docs/ja/specdojo/guides/schedule-operation-guide.md +27 -3
- package/docs/ja/specdojo/guides/specdojo-overview-guide.md +5 -4
- package/docs/ja/specdojo/guides/timeline-design-guide.md +27 -144
- package/docs/ja/specdojo/guides/use-case-guide.md +92 -155
- package/docs/ja/specdojo/guides/waza-guide.md +12 -8
- package/docs/ja/specdojo/recipes/bac-recipe.md +111 -0
- package/docs/ja/specdojo/recipes/bes-recipe.md +141 -0
- package/docs/ja/specdojo/recipes/bps-recipe.md +88 -139
- package/docs/ja/specdojo/recipes/br-recipe.md +77 -0
- package/docs/ja/specdojo/recipes/cdfd-overview-recipe.md +97 -109
- package/docs/ja/specdojo/recipes/cdfd-recipe.md +85 -146
- package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +92 -99
- package/docs/ja/specdojo/recipes/cnd-recipe.md +135 -0
- package/docs/ja/specdojo/recipes/cpd-recipe.md +140 -0
- package/docs/ja/specdojo/recipes/cxd-recipe.md +162 -0
- package/docs/ja/specdojo/recipes/ifd-recipe.md +145 -0
- package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +112 -90
- package/docs/ja/specdojo/recipes/ifx-index-recipe.md +164 -0
- package/docs/ja/specdojo/recipes/pm-communication-plan-recipe.md +60 -49
- package/docs/ja/specdojo/recipes/pm-members-recipe.md +50 -51
- package/docs/ja/specdojo/recipes/pm-organization-recipe.md +59 -48
- package/docs/ja/specdojo/recipes/pm-plan-recipe.md +72 -50
- package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +40 -49
- package/docs/ja/specdojo/recipes/pm-raci-recipe.md +42 -48
- package/docs/ja/specdojo/recipes/pm-roles-recipe.md +52 -81
- package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +64 -91
- package/docs/ja/specdojo/recipes/prj-charter-recipe.md +71 -106
- package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +78 -156
- package/docs/ja/specdojo/recipes/prj-issues-and-approach-recipe.md +62 -111
- package/docs/ja/specdojo/recipes/prj-scope-recipe.md +67 -123
- package/docs/ja/specdojo/recipes/prj-stakeholder-register-recipe.md +60 -96
- package/docs/ja/specdojo/recipes/prj-success-criteria-and-acceptance-criteria-recipe.md +61 -105
- package/docs/ja/specdojo/recipes/stsd-recipe.md +88 -80
- package/docs/ja/specdojo/recipes/sysd-critical-flows-recipe.md +129 -0
- package/docs/ja/specdojo/recipes/sysd-cross-cutting-policy-recipe.md +146 -0
- package/docs/ja/specdojo/recipes/sysd-index-recipe.md +141 -0
- package/docs/ja/specdojo/recipes/tsd-recipe.md +149 -129
- package/docs/ja/specdojo/references/command-reference.md +303 -148
- package/docs/ja/specdojo/references/deliverables-reference.md +30 -16
- package/docs/ja/specdojo/references/directory-layout-reference.md +3 -2
- package/docs/ja/specdojo/references/specdojo-config-reference.md +54 -18
- package/docs/ja/specdojo/rulebooks/atc-index-rulebook.md +101 -257
- package/docs/ja/specdojo/rulebooks/atc-rulebook.md +102 -228
- package/docs/ja/specdojo/rulebooks/bac-rulebook.md +63 -290
- package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +162 -80
- package/docs/ja/specdojo/rulebooks/bds-rulebook.md +118 -155
- package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +128 -60
- package/docs/ja/specdojo/rulebooks/bes-rulebook.md +70 -94
- package/docs/ja/specdojo/rulebooks/bps-rulebook.md +24 -56
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +58 -103
- package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +103 -223
- package/docs/ja/specdojo/rulebooks/cdfd-d2-rulebook.md +18 -93
- package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +18 -52
- package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +109 -147
- package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +80 -108
- package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +51 -55
- package/docs/ja/specdojo/rulebooks/cdr-rulebook.md +144 -0
- package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +81 -68
- package/docs/ja/specdojo/rulebooks/cdt-rulebook.md +139 -0
- package/docs/ja/specdojo/rulebooks/cld-rulebook.md +9 -184
- package/docs/ja/specdojo/rulebooks/clis-rulebook.md +170 -0
- package/docs/ja/specdojo/rulebooks/cnd-mermaid-rulebook.md +33 -86
- package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +79 -249
- package/docs/ja/specdojo/rulebooks/cop-index-rulebook.md +45 -131
- package/docs/ja/specdojo/rulebooks/cop-rulebook.md +69 -275
- package/docs/ja/specdojo/rulebooks/cpd-mermaid-rulebook.md +20 -112
- package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +79 -249
- package/docs/ja/specdojo/rulebooks/cxd-mermaid-rulebook.md +12 -145
- package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +115 -256
- package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +79 -109
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +119 -174
- package/docs/ja/specdojo/rulebooks/dec-rulebook.md +6 -14
- package/docs/ja/specdojo/rulebooks/dmd-index-rulebook.md +22 -66
- package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +36 -94
- package/docs/ja/specdojo/rulebooks/dss-rulebook.md +171 -0
- package/docs/ja/specdojo/rulebooks/etc-index-rulebook.md +31 -131
- package/docs/ja/specdojo/rulebooks/etc-rulebook.md +50 -104
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +93 -57
- package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +63 -253
- package/docs/ja/specdojo/rulebooks/ifx-api-rulebook.md +14 -20
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +79 -76
- package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +182 -237
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +111 -40
- package/docs/ja/specdojo/rulebooks/ifx-msg-rulebook.md +14 -22
- package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +23 -46
- package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +41 -64
- package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +16 -40
- package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +34 -61
- package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +27 -50
- package/docs/ja/specdojo/rulebooks/itc-index-rulebook.md +70 -199
- package/docs/ja/specdojo/rulebooks/itc-rulebook.md +65 -153
- package/docs/ja/specdojo/rulebooks/mip-index-rulebook.md +74 -150
- package/docs/ja/specdojo/rulebooks/mm-rulebook.md +12 -23
- package/docs/ja/specdojo/rulebooks/mtp-rulebook.md +99 -176
- package/docs/ja/specdojo/rulebooks/nfr-availability-rulebook.md +35 -61
- package/docs/ja/specdojo/rulebooks/nfr-index-rulebook.md +75 -117
- package/docs/ja/specdojo/rulebooks/nfr-integrity-rulebook.md +31 -60
- package/docs/ja/specdojo/rulebooks/nfr-maintainability-rulebook.md +26 -81
- package/docs/ja/specdojo/rulebooks/nfr-operations-rulebook.md +32 -70
- package/docs/ja/specdojo/rulebooks/nfr-performance-rulebook.md +45 -87
- package/docs/ja/specdojo/rulebooks/nfr-reliability-rulebook.md +48 -101
- package/docs/ja/specdojo/rulebooks/nfr-security-safety-rulebook.md +44 -80
- package/docs/ja/specdojo/rulebooks/nfr-usability-rulebook.md +59 -127
- package/docs/ja/specdojo/rulebooks/opd-index-rulebook.md +31 -50
- package/docs/ja/specdojo/rulebooks/opd-rulebook.md +42 -109
- package/docs/ja/specdojo/rulebooks/opr-index-rulebook.md +29 -42
- package/docs/ja/specdojo/rulebooks/opr-rulebook.md +29 -87
- package/docs/ja/specdojo/rulebooks/otp-index-rulebook.md +62 -84
- package/docs/ja/specdojo/rulebooks/otp-rulebook.md +11 -61
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +92 -102
- package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +25 -34
- package/docs/ja/specdojo/rulebooks/pm-communication-plan-rulebook.md +30 -53
- package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +23 -35
- package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +27 -45
- package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +45 -59
- package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +56 -66
- package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +54 -62
- package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +46 -65
- package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +28 -35
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +65 -97
- package/docs/ja/specdojo/rulebooks/pr-rulebook.md +6 -18
- package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +48 -78
- package/docs/ja/specdojo/rulebooks/prj-charter-rulebook.md +23 -97
- package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +61 -153
- package/docs/ja/specdojo/rulebooks/prj-issues-and-approach-rulebook.md +43 -116
- package/docs/ja/specdojo/rulebooks/prj-scope-rulebook.md +16 -51
- package/docs/ja/specdojo/rulebooks/prj-stakeholder-register-rulebook.md +47 -92
- package/docs/ja/specdojo/rulebooks/prj-success-criteria-and-acceptance-criteria-rulebook.md +25 -84
- package/docs/ja/specdojo/rulebooks/sac-rulebook.md +44 -107
- package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +106 -32
- package/docs/ja/specdojo/rulebooks/sf-rulebook.md +111 -61
- package/docs/ja/specdojo/rulebooks/sld-rulebook.md +129 -59
- package/docs/ja/specdojo/rulebooks/stc-index-rulebook.md +90 -189
- package/docs/ja/specdojo/rulebooks/stc-rulebook.md +45 -105
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +46 -40
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +104 -68
- package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +64 -330
- package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +70 -263
- package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +58 -200
- package/docs/ja/specdojo/rulebooks/sysd-rulebook.md +47 -60
- package/docs/ja/specdojo/rulebooks/tml-rulebook.md +4 -9
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +69 -71
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +65 -72
- package/docs/ja/specdojo/rulebooks/tsd-index-rulebook.md +35 -46
- package/docs/ja/specdojo/rulebooks/tsd-rulebook.md +49 -66
- package/docs/ja/specdojo/rulebooks/tsp-index-rulebook.md +64 -139
- package/docs/ja/specdojo/rulebooks/uis-rulebook.md +91 -161
- package/docs/ja/specdojo/rulebooks/utc-index-rulebook.md +49 -144
- package/docs/ja/specdojo/rulebooks/utc-rulebook.md +67 -155
- package/docs/ja/specdojo/samples/bac-sample.md +106 -21
- package/docs/ja/specdojo/samples/bdd-sample.yaml +143 -35
- package/docs/ja/specdojo/samples/bds-sample.md +87 -21
- package/docs/ja/specdojo/samples/bes-index-sample.md +42 -20
- package/docs/ja/specdojo/samples/bes-sample.md +70 -21
- package/docs/ja/specdojo/samples/bps-sample.md +42 -54
- package/docs/ja/specdojo/samples/br-sample.md +57 -15
- package/docs/ja/specdojo/samples/ccd-sample.md +80 -19
- package/docs/ja/specdojo/samples/cdfd-sample.md +172 -99
- package/docs/ja/specdojo/samples/cdfd-uc-sample.md +9 -7
- package/docs/ja/specdojo/samples/cdr-sample.md +78 -0
- package/docs/ja/specdojo/samples/cdsd-sample.md +73 -20
- package/docs/ja/specdojo/samples/cdt-sample.md +116 -0
- package/docs/ja/specdojo/samples/cld-sample.md +3 -30
- package/docs/ja/specdojo/samples/clis-sample.md +125 -0
- package/docs/ja/specdojo/samples/cnd-sample.md +127 -21
- package/docs/ja/specdojo/samples/cpd-sample.md +136 -22
- package/docs/ja/specdojo/samples/cxd-sample.md +108 -22
- package/docs/ja/specdojo/samples/dct-index-sample.yaml +63 -17
- package/docs/ja/specdojo/samples/dec-sample.md +2 -3
- package/docs/ja/specdojo/samples/dss-sample.md +175 -0
- package/docs/ja/specdojo/samples/gl-sample.yaml +50 -14
- package/docs/ja/specdojo/samples/ifd-sample.md +105 -21
- package/docs/ja/specdojo/samples/ifx-api-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +91 -60
- package/docs/ja/specdojo/samples/ifx-file-sample.md +462 -21
- package/docs/ja/specdojo/samples/ifx-index-sample.yaml +87 -19
- package/docs/ja/specdojo/samples/ifx-msg-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/job-sequence.yaml +67 -0
- package/docs/ja/specdojo/samples/mip-index-sample.md +98 -20
- package/docs/ja/specdojo/samples/pm-communication-plan-sample.md +26 -19
- package/docs/ja/specdojo/samples/pm-members-sample.yaml +37 -13
- package/docs/ja/specdojo/samples/pm-organization-sample.md +42 -21
- package/docs/ja/specdojo/samples/pm-plan-sample.md +78 -26
- package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +41 -22
- package/docs/ja/specdojo/samples/pm-raci-sample.md +63 -28
- package/docs/ja/specdojo/samples/pm-roles-sample.yaml +13 -12
- package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +33 -25
- package/docs/ja/specdojo/samples/prj-charter-sample.md +42 -59
- package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +83 -62
- package/docs/ja/specdojo/samples/prj-success-criteria-and-acceptance-criteria-sample.md +30 -33
- package/docs/ja/specdojo/samples/sf-index-sample.md +47 -20
- package/docs/ja/specdojo/samples/sf-sample.md +109 -21
- package/docs/ja/specdojo/samples/sld-sample.md +88 -21
- package/docs/ja/specdojo/samples/stsd-sample.md +54 -26
- package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +166 -21
- package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +178 -21
- package/docs/ja/specdojo/samples/sysd-index-sample.md +82 -21
- package/docs/ja/specdojo/samples/tml-sample.yaml +4 -1
- package/docs/ja/specdojo/samples/uis-sample.md +141 -20
- package/docs/ja/specdojo/standards/document-metadata-standard.md +33 -4
- package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +3 -1
- package/docs/ja/specdojo/standards/job-definition-standard.md +24 -9
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +1 -0
- package/docs/ja/specdojo/templates/bac-template.md +76 -0
- package/docs/ja/specdojo/templates/bes-template.md +56 -0
- package/docs/ja/specdojo/templates/br-template.md +64 -0
- package/docs/ja/specdojo/templates/cdfd-template.md +81 -54
- package/docs/ja/specdojo/templates/cdfd-uc-template.md +9 -5
- package/docs/ja/specdojo/templates/cdr-template.md +58 -0
- package/docs/ja/specdojo/templates/cnd-template.md +137 -0
- package/docs/ja/specdojo/templates/cpd-template.md +129 -0
- package/docs/ja/specdojo/templates/cxd-template.md +105 -0
- package/docs/ja/specdojo/templates/dct-data-model-cdt-template.yaml +40 -0
- package/docs/ja/specdojo/templates/dct-data-model-cld-template.yaml +7 -14
- package/docs/ja/specdojo/templates/dct-index-template.md +9 -20
- package/docs/ja/specdojo/templates/dct-project-management-template.yaml +5 -1
- package/docs/ja/specdojo/templates/ifd-template.md +86 -0
- package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +44 -28
- package/docs/ja/specdojo/templates/ifx-index-template.yaml +40 -0
- package/docs/ja/specdojo/templates/opr-template.md +2 -4
- package/docs/ja/specdojo/templates/pm-organization-template.md +9 -3
- package/docs/ja/specdojo/templates/pm-plan-template.md +4 -4
- package/docs/ja/specdojo/templates/pm-quality-management-plan-template.md +17 -9
- package/docs/ja/specdojo/templates/pm-raci-template.md +24 -13
- package/docs/ja/specdojo/templates/pm-roles-template.yaml +3 -2
- package/docs/ja/specdojo/templates/prj-assumptions-constraints-dependencies-template.md +6 -3
- package/docs/ja/specdojo/templates/prj-comparison-of-alternatives-template.md +22 -19
- package/docs/ja/specdojo/templates/stsd-template.md +46 -21
- package/docs/ja/specdojo/templates/sysd-critical-flows-template.md +94 -0
- package/docs/ja/specdojo/templates/sysd-cross-cutting-policy-template.md +122 -0
- package/docs/ja/specdojo/templates/sysd-index-template.md +89 -0
- package/docs/specdojo/lib/yaml-metadata.cjs +7 -0
- package/docs/specdojo/schemas/v1/bdd.schema.yaml +25 -57
- package/docs/specdojo/schemas/v1/condense-records.schema.yaml +26 -0
- package/docs/specdojo/schemas/v1/dct.schema.yaml +10 -0
- package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +3 -0
- package/docs/specdojo/schemas/v1/esil.schema.yaml +7 -141
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +5 -1
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +95 -8
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +38 -0
- package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +14 -0
- package/docs/specdojo/schemas/v1/exec-result-frontmatter.schema.yaml +18 -0
- package/docs/specdojo/schemas/v1/finding-cause.schema.yaml +22 -0
- package/docs/specdojo/schemas/v1/grade-pipeline-state.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/grade-result.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +65 -5
- package/docs/specdojo/schemas/v1/ifx-index.schema.yaml +142 -0
- package/docs/specdojo/schemas/v1/job-run.schema.yaml +23 -0
- package/docs/specdojo/schemas/v1/job.schema.yaml +63 -2
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +17 -1
- package/docs/specdojo/schemas/v1/sch-strategy.schema.yaml +2 -2
- package/package.json +10 -7
- package/templates/antigravity/orchestrator.md +7 -3
- package/templates/claude/agents/specdojo-orchestrator.md +7 -3
- package/templates/codex/agents/specdojo-orchestrator.toml +7 -3
- package/templates/codex/orchestrator.md +7 -3
- package/templates/devcontainer/tmux.conf +6 -0
- package/templates/init-exec-defaults.yaml +13 -0
- package/templates/lefthook/tools/specdojo-pre-commit.mjs +8 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +8 -4
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync, } from "node:fs";
|
|
4
|
+
import { isAbsolute, join, posix, relative } from "node:path";
|
|
5
|
+
import { unified } from "unified";
|
|
6
|
+
import remarkParse from "remark-parse";
|
|
7
|
+
import { collectDocIndexEntries } from "../../docs/doc-index.js";
|
|
8
|
+
import { authoredKataPath, authoringKind, isAuthoringApproach } from "../../kata/authoring.js";
|
|
9
|
+
import { readSpecdojoNamespace } from "../../docs/frontmatter-namespace.js";
|
|
10
|
+
import { gitEnvironment } from "../../shared/git-environment.js";
|
|
11
|
+
import { resolveDeliverableByDocId } from "../plans-core.js";
|
|
12
|
+
import { delay, isLiveLock, readLockOwner, releaseLock, tryAcquireLock, } from "../slot-lock.js";
|
|
13
|
+
import { execLocksDir } from "./lock.js";
|
|
14
|
+
export function parseUnknownScopePolicy(value) {
|
|
15
|
+
if (value === undefined || value === "parallel" || value === "serialize")
|
|
16
|
+
return value ?? "parallel";
|
|
17
|
+
throw new Error("--unknown-scope must be parallel or serialize");
|
|
18
|
+
}
|
|
19
|
+
// No filesystem access: declarations may name a file that does not exist yet. Glob prefixes
|
|
20
|
+
// conservatively reserve their parent directory; line/function suffixes reserve the whole file.
|
|
21
|
+
export function normalizeScopePath(value) {
|
|
22
|
+
const text = value
|
|
23
|
+
.trim()
|
|
24
|
+
.replaceAll("\\", "/")
|
|
25
|
+
.replace(/#.*$|:\d+(?::\d+)?$/g, "");
|
|
26
|
+
if (!text || text.startsWith("/") || text.includes("://"))
|
|
27
|
+
return undefined;
|
|
28
|
+
const match = text.match(/^(?:([a-zA-Z][\w-]*):)?(.*)$/);
|
|
29
|
+
if (!match)
|
|
30
|
+
return undefined;
|
|
31
|
+
const repo = match[1] ?? "project";
|
|
32
|
+
let path = match[2];
|
|
33
|
+
const glob = path.search(/[*?{[]/);
|
|
34
|
+
if (glob >= 0)
|
|
35
|
+
path = path.slice(0, glob).replace(/[^/]*$/, "");
|
|
36
|
+
path = posix.normalize(path).replace(/\/$/, "");
|
|
37
|
+
if (path === ".." || path.startsWith("../"))
|
|
38
|
+
return undefined;
|
|
39
|
+
return `${repo}:${path}`;
|
|
40
|
+
}
|
|
41
|
+
// Generated plans mix task inputs with shared operating instructions. Read only task-specific
|
|
42
|
+
// sections, including findings nested under the otherwise shared procedure section. Parse real
|
|
43
|
+
// headings so headings in fenced examples cannot change which sections are selected.
|
|
44
|
+
function scopeInputText(text) {
|
|
45
|
+
const isPlan = readSpecdojoNamespace(text).type === "exec-plan" || /^# .*Plan:/m.test(text);
|
|
46
|
+
const body = text.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "");
|
|
47
|
+
const headings = unified()
|
|
48
|
+
.use(remarkParse)
|
|
49
|
+
.parse(body)
|
|
50
|
+
.children.filter((node) => node.type === "heading");
|
|
51
|
+
const parts = [];
|
|
52
|
+
let include = true;
|
|
53
|
+
let start = 0;
|
|
54
|
+
let currentSection = "";
|
|
55
|
+
for (const heading of headings) {
|
|
56
|
+
const offset = heading.position.start.offset;
|
|
57
|
+
if (include)
|
|
58
|
+
parts.push(body.slice(start, offset));
|
|
59
|
+
const title = body
|
|
60
|
+
.slice(offset, heading.position.end.offset)
|
|
61
|
+
.replace(/^#+\s+(?:\d+(?:\.\d+)*\.\s*)?/, "")
|
|
62
|
+
.trim();
|
|
63
|
+
if (heading.depth === 2) {
|
|
64
|
+
if (/^(?:対応結果|関連ドキュメント|共通|変更範囲による実行待ち)/.test(title)) {
|
|
65
|
+
include = false;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
include =
|
|
69
|
+
!isPlan ||
|
|
70
|
+
/^(?:この.*行うこと|対象|個票の(?:入力|追加完了条件)|概要|入力|完了条件|完了の狙い|作業内容|制約|根拠となる成果物と編集対象|新しく作る実践の型)/.test(title);
|
|
71
|
+
}
|
|
72
|
+
else if (isPlan && heading.depth === 3) {
|
|
73
|
+
// Findings are item-specific even when embedded in common instructions.
|
|
74
|
+
if (/^(?:grade result から展開された finding|成果物から届いた Kata が原因の finding)$/.test(title))
|
|
75
|
+
include = true;
|
|
76
|
+
else if (/^進め方$/.test(currentSection))
|
|
77
|
+
include = false;
|
|
78
|
+
}
|
|
79
|
+
if (heading.depth === 2)
|
|
80
|
+
currentSection = title;
|
|
81
|
+
start = offset;
|
|
82
|
+
}
|
|
83
|
+
if (include)
|
|
84
|
+
parts.push(body.slice(start));
|
|
85
|
+
return parts.join("\n");
|
|
86
|
+
}
|
|
87
|
+
// Exclude only prose clauses that explicitly say not to edit their paths. Do not blacklist
|
|
88
|
+
// protected filenames: a positive mention elsewhere or an explicit target must still reserve
|
|
89
|
+
// them. Keep inline code intact so punctuation in paths cannot split a clause.
|
|
90
|
+
function scopeChangeText(text) {
|
|
91
|
+
const unchanged = /(?:変え(?:ない|ず)|(?:変更|編集|更新|修正)(?:し(?:ない|ません|なく)|せず)|触ら(?:ない|ず))(?:こと)?(?:が)?(?:\s*[((][^()()]*[))])?\s*$/;
|
|
92
|
+
const continuedAction = /(?:変更|編集|更新|修正|追加|削除)(?:し|して|する|します)(?:が)?\s*$/;
|
|
93
|
+
const parts = [];
|
|
94
|
+
let clause = "";
|
|
95
|
+
const flush = () => {
|
|
96
|
+
if (!unchanged.test(clause))
|
|
97
|
+
parts.push(clause);
|
|
98
|
+
clause = "";
|
|
99
|
+
};
|
|
100
|
+
for (const [token] of text.matchAll(/`[^`\n]+`|[。;;\n|、,]|[^`。;;\n|、,]+|`/g)) {
|
|
101
|
+
if (/^[。;;\n|]$/.test(token)) {
|
|
102
|
+
flush();
|
|
103
|
+
}
|
|
104
|
+
else if (/^[、,]$/.test(token) && (unchanged.test(clause) || continuedAction.test(clause))) {
|
|
105
|
+
// Split after a predicate, but keep comma-separated path lists with their predicate.
|
|
106
|
+
flush();
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
clause += token;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
flush();
|
|
113
|
+
return parts.join("\n");
|
|
114
|
+
}
|
|
115
|
+
export function inferChangeScope(params) {
|
|
116
|
+
const paths = new Set();
|
|
117
|
+
let unresolved = false;
|
|
118
|
+
const add = (path) => {
|
|
119
|
+
const normalized = normalizeScopePath(path);
|
|
120
|
+
if (!normalized) {
|
|
121
|
+
unresolved = true;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (!/(?:^|\/)generated(?:\/|$)/.test(normalized.split(":")[1]))
|
|
125
|
+
paths.add(normalized);
|
|
126
|
+
};
|
|
127
|
+
const configPath = (path) => (isAbsolute(path) ? relative(params.repoRoot, path) : path);
|
|
128
|
+
let index = params.documentPaths;
|
|
129
|
+
const targets = isAuthoringApproach(params.approach)
|
|
130
|
+
? params.targets?.slice(0, 1)
|
|
131
|
+
: params.targets;
|
|
132
|
+
// Commit permissions cover whole kata directories; reserve only the resolved task targets.
|
|
133
|
+
for (const target of targets ?? []) {
|
|
134
|
+
if (params.approach === "catalog-planning" &&
|
|
135
|
+
/^domain:[\w-]+$/.test(target) &&
|
|
136
|
+
params.catalogPath) {
|
|
137
|
+
// Every domain may also update the shared dct-index.yaml.
|
|
138
|
+
add(configPath(params.catalogPath));
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (params.approach === "strategy-planning" &&
|
|
142
|
+
/^track:[\w-]+$/.test(target) &&
|
|
143
|
+
params.schedulePath) {
|
|
144
|
+
const track = target.slice("track:".length);
|
|
145
|
+
add(join(configPath(params.schedulePath), `sch-strategy-${track}.yaml`));
|
|
146
|
+
add(join(configPath(params.schedulePath), `sch-track-${track}.yaml`));
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (target.includes("/") || /\.(?:md|tsx?|jsx?|json|ya?ml)$/.test(target)) {
|
|
150
|
+
add(target);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (params.targetPath && target === targets?.[0]) {
|
|
154
|
+
add(params.targetPath);
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
index ??= collectDocIndexEntries(join(params.repoRoot, "docs"), params.repoRoot);
|
|
158
|
+
const indexed = index[target]?.replace(/:\d+$/, "");
|
|
159
|
+
if (indexed) {
|
|
160
|
+
add(indexed);
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
const kind = authoringKind(params.approach);
|
|
164
|
+
if (kind) {
|
|
165
|
+
add(authoredKataPath(target, kind));
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
add(resolveDeliverableByDocId(params.catalogPath ?? "", params.projectId, target, params.repoRoot).info.resolvedPath);
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
unresolved = true;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (params.targetPath)
|
|
176
|
+
add(params.targetPath);
|
|
177
|
+
// Backticks support root files; prose supports src/foo.ts.
|
|
178
|
+
const texts = typeof params.text === "string" ? [params.text] : (params.text ?? []);
|
|
179
|
+
const body = texts.map((text) => scopeChangeText(scopeInputText(text))).join("\n");
|
|
180
|
+
const addTextPath = (path) => {
|
|
181
|
+
// Per-item bookkeeping is already serialized by lifecycle and same-item locks. Its presence
|
|
182
|
+
// in a generated plan must not make an otherwise unknown implementation scope look known.
|
|
183
|
+
if (/(?:^|\/)execution\/(?:runs|exec|conventions)\/|(?:^|\/)controls\/project-register\/pjr-[^/]+\.md$/.test(path))
|
|
184
|
+
return;
|
|
185
|
+
add(path);
|
|
186
|
+
};
|
|
187
|
+
for (const match of body.matchAll(/`([^`\n]+)`/g)) {
|
|
188
|
+
const value = match[1].replace(/#.*$|:\d+(?::\d+)?$/g, "");
|
|
189
|
+
if (/^(?:[\w-]+:)?(?:\.?\/?[\w@.-]+\/)+[\w@.*?{}[\]/-]*$/.test(value) ||
|
|
190
|
+
/^[\w.-]+\.[a-z0-9]+$/i.test(value))
|
|
191
|
+
addTextPath(value);
|
|
192
|
+
}
|
|
193
|
+
for (const match of body.matchAll(/(?:^|[\s`((・])((?:[\w-]+:)?(?:[\w@.-]+\/)+[\w@.*?{}[\]/-]+)/gm)) {
|
|
194
|
+
const value = match[1];
|
|
195
|
+
// A slash in prose can also mean alternatives (executor/reporter). Accept filenames,
|
|
196
|
+
// explicit directory/glob syntax, or an existing repository path rather than every slash.
|
|
197
|
+
const normalized = normalizeScopePath(value);
|
|
198
|
+
if (/\/[^/]*\.[\w]+$|\/$|[*?{[]/.test(value) ||
|
|
199
|
+
(normalized?.startsWith("project:") &&
|
|
200
|
+
existsSync(join(params.repoRoot, normalized.slice("project:".length)))))
|
|
201
|
+
addTextPath(value);
|
|
202
|
+
}
|
|
203
|
+
// Ignore derived views even when their layout predates generated/. Keep candidates if Git
|
|
204
|
+
// cannot verify ignore rules (for example, a project not yet initialized as a repository).
|
|
205
|
+
const candidates = [...paths]
|
|
206
|
+
.filter((path) => path.startsWith("project:"))
|
|
207
|
+
.map((path) => path.slice("project:".length));
|
|
208
|
+
if (candidates.length) {
|
|
209
|
+
const ignored = spawnSync("git", ["check-ignore", "-z", "--stdin"], {
|
|
210
|
+
cwd: params.repoRoot,
|
|
211
|
+
env: gitEnvironment(),
|
|
212
|
+
input: `${candidates.join("\0")}\0`,
|
|
213
|
+
encoding: "utf8",
|
|
214
|
+
timeout: 10_000,
|
|
215
|
+
});
|
|
216
|
+
if (!ignored.error && (ignored.status === 0 || ignored.status === 1))
|
|
217
|
+
for (const path of ignored.stdout.split("\0").filter(Boolean))
|
|
218
|
+
paths.delete(`project:${path}`);
|
|
219
|
+
}
|
|
220
|
+
return { paths: [...paths].sort(), unknown: unresolved || paths.size === 0 };
|
|
221
|
+
}
|
|
222
|
+
export function scopeOverlap(a, b) {
|
|
223
|
+
if (a.unknown || b.unknown)
|
|
224
|
+
return "unknown scope (serialize)";
|
|
225
|
+
for (const left of a.paths)
|
|
226
|
+
for (const right of b.paths) {
|
|
227
|
+
const root = (value) => (value.endsWith(":.") ? value.slice(0, -1) : `${value}/`);
|
|
228
|
+
if (left === right || left.startsWith(root(right)) || right.startsWith(root(left)))
|
|
229
|
+
return `${left} <> ${right}`;
|
|
230
|
+
}
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
function writeReservation(path, record) {
|
|
234
|
+
writeFileSync(`${path}.tmp`, JSON.stringify(record));
|
|
235
|
+
renameSync(`${path}.tmp`, path);
|
|
236
|
+
}
|
|
237
|
+
// The short registry mutex protects check+reserve as one operation, including across --join
|
|
238
|
+
// processes. Per-item heartbeat locks cover setup, agents, validation AND integration. Failed
|
|
239
|
+
// or crashed reservations remain barriers until that same item is retried/resumed.
|
|
240
|
+
export class ChangeScopeGate {
|
|
241
|
+
policy;
|
|
242
|
+
options;
|
|
243
|
+
directory;
|
|
244
|
+
waits = new Map();
|
|
245
|
+
constructor(executionPath, policy = "parallel", options = {}) {
|
|
246
|
+
this.policy = policy;
|
|
247
|
+
this.options = options;
|
|
248
|
+
this.directory = join(execLocksDir(executionPath), "change-scopes");
|
|
249
|
+
}
|
|
250
|
+
async registry(action) {
|
|
251
|
+
mkdirSync(this.directory, { recursive: true });
|
|
252
|
+
let handle;
|
|
253
|
+
while (!(handle = tryAcquireLock(join(this.directory, "registry.lock"), { actor: "change-scope" }, this.options)))
|
|
254
|
+
await delay(this.options.pollMs ?? 200);
|
|
255
|
+
try {
|
|
256
|
+
return action();
|
|
257
|
+
}
|
|
258
|
+
finally {
|
|
259
|
+
releaseLock(handle);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
async tryAcquire(item, scope) {
|
|
263
|
+
return this.registry(() => {
|
|
264
|
+
const effective = { ...scope, unknown: scope.unknown && this.policy === "serialize" };
|
|
265
|
+
const key = createHash("sha256").update(item).digest("hex");
|
|
266
|
+
const recordPath = join(this.directory, `${key}.json`);
|
|
267
|
+
const lockPath = join(this.directory, `${key}.lock`);
|
|
268
|
+
if (existsSync(recordPath)) {
|
|
269
|
+
const prior = JSON.parse(readFileSync(recordPath, "utf8"));
|
|
270
|
+
effective.paths = [...new Set([...prior.scope.paths, ...effective.paths])];
|
|
271
|
+
effective.unknown ||= prior.scope.unknown;
|
|
272
|
+
}
|
|
273
|
+
for (const name of readdirSync(this.directory).filter((name) => /^[a-f0-9]{64}\.json$/.test(name))) {
|
|
274
|
+
const record = JSON.parse(readFileSync(join(this.directory, name), "utf8"));
|
|
275
|
+
const live = isLiveLock(join(this.directory, name.replace(/\.json$/, ".lock")), this.options.staleMs);
|
|
276
|
+
if (record.item === item && !live)
|
|
277
|
+
continue;
|
|
278
|
+
const overlap = record.item === item ? "same item" : scopeOverlap(effective, record.scope);
|
|
279
|
+
if (!overlap)
|
|
280
|
+
continue;
|
|
281
|
+
const waits = this.waits.get(item) ?? [];
|
|
282
|
+
if (!waits.some((wait) => wait.blocker === record.item && wait.overlap === overlap)) {
|
|
283
|
+
const wait = { item, blocker: record.item, overlap, at: new Date().toISOString() };
|
|
284
|
+
waits.push(wait);
|
|
285
|
+
this.waits.set(item, waits);
|
|
286
|
+
appendFileSync(join(this.directory, "waits.jsonl"), `${JSON.stringify(wait)}\n`);
|
|
287
|
+
process.stdout.write(` [scope] waiting: ${item} — ${record.item}: ${overlap}\n`);
|
|
288
|
+
}
|
|
289
|
+
if (record.state === "blocked" || !live)
|
|
290
|
+
throw new Error(`[scope] ${item} blocked by unintegrated ${record.item}: ${overlap}; resume/retry ${record.item} first`);
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
const handle = tryAcquireLock(lockPath, { actor: "change-scope", label: item }, this.options);
|
|
294
|
+
if (!handle)
|
|
295
|
+
return null;
|
|
296
|
+
try {
|
|
297
|
+
writeReservation(recordPath, { item, scope: effective, state: "running" });
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
releaseLock(handle);
|
|
301
|
+
throw error;
|
|
302
|
+
}
|
|
303
|
+
const waits = this.waits.get(item) ?? [];
|
|
304
|
+
this.waits.delete(item);
|
|
305
|
+
let finished = false;
|
|
306
|
+
return {
|
|
307
|
+
waits,
|
|
308
|
+
finish: async (integrated) => {
|
|
309
|
+
await this.registry(() => {
|
|
310
|
+
if (finished)
|
|
311
|
+
return;
|
|
312
|
+
if (readLockOwner(lockPath)?.token !== handle.token) {
|
|
313
|
+
releaseLock(handle);
|
|
314
|
+
finished = true;
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (integrated)
|
|
318
|
+
rmSync(recordPath, { force: true });
|
|
319
|
+
else
|
|
320
|
+
writeReservation(recordPath, { item, scope: effective, state: "blocked" });
|
|
321
|
+
releaseLock(handle);
|
|
322
|
+
finished = true;
|
|
323
|
+
});
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
async acquire(item, scope) {
|
|
329
|
+
while (true) {
|
|
330
|
+
const lease = await this.tryAcquire(item, scope);
|
|
331
|
+
if (lease)
|
|
332
|
+
return lease;
|
|
333
|
+
await delay(this.options.pollMs ?? 200);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
async clearIntegrated(item) {
|
|
337
|
+
await this.registry(() => {
|
|
338
|
+
const key = createHash("sha256").update(item).digest("hex");
|
|
339
|
+
// Batch leases are released by the worker. Standalone schedule resumes run under the
|
|
340
|
+
// exclusive project lock and clear the retained failure barrier after integration.
|
|
341
|
+
if (!isLiveLock(join(this.directory, `${key}.lock`), this.options.staleMs))
|
|
342
|
+
rmSync(join(this.directory, `${key}.json`), { force: true });
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
export function appendScopeWaitNotes(planPath, waits) {
|
|
347
|
+
if (!waits?.length || !existsSync(planPath))
|
|
348
|
+
return;
|
|
349
|
+
const plan = readFileSync(planPath, "utf8");
|
|
350
|
+
// Convention expansion and checkpoint discovery require the snapshot reference to remain
|
|
351
|
+
// the final paragraph. Insert runner notes before it, including for legacy plan references.
|
|
352
|
+
const reference = /\n(?:`共通規約 sha256:[a-f0-9]{64}` `[^`\r\n]+`|\[共通規約 sha256:[a-f0-9]{64}\]\([^\s)]+\))\s*$/.exec(plan);
|
|
353
|
+
const offset = reference?.index ?? plan.length;
|
|
354
|
+
const notes = `## 変更範囲による実行待ち\n\n${waits.map((wait) => `- ${wait.at}: \`${wait.item}\` は \`${wait.blocker}\` の統合を待った。重複: \`${wait.overlap}\`。`).join("\n")}\n`;
|
|
355
|
+
writeFileSync(planPath, `${plan.slice(0, offset).trimEnd()}\n\n${notes}${plan.slice(offset)}`);
|
|
356
|
+
}
|
|
357
|
+
export function scopePlanMetadata(text) {
|
|
358
|
+
const metadata = readSpecdojoNamespace(text);
|
|
359
|
+
return {
|
|
360
|
+
targets: Array.isArray(metadata.targets)
|
|
361
|
+
? metadata.targets.filter((v) => typeof v === "string")
|
|
362
|
+
: undefined,
|
|
363
|
+
approach: metadata.approach,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// 統合の後の片付け(worktree と exec branch の撤去)。`run` はロックの外で走り、`after` は
|
|
2
|
+
// 片付けの結果を受けて、もう一度ロックの中で記帳を仕上げる。
|
|
3
|
+
export class DeferredCleanup {
|
|
4
|
+
run;
|
|
5
|
+
after;
|
|
6
|
+
constructor(run, after) {
|
|
7
|
+
this.run = run;
|
|
8
|
+
this.after = after;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function runLocked(lock, fn) {
|
|
12
|
+
return lock ? lock.runExclusive(fn) : Promise.resolve().then(fn);
|
|
13
|
+
}
|
|
14
|
+
// PJR-NHT7: 遅いファイルシステムでは `git worktree remove` が数十分かかる。統合と記帳は
|
|
15
|
+
// ロックの中で行い、片付けはロックを解放してから行う。片付けの間、別の項目の記帳や
|
|
16
|
+
// `specdojo git` はロックを待たない。`integrate` が DeferredCleanup 以外を返した場合は、
|
|
17
|
+
// それをそのまま結果にする。
|
|
18
|
+
export async function runWithDeferredCleanup(lock, integrate) {
|
|
19
|
+
const integrated = await runLocked(lock, integrate);
|
|
20
|
+
if (!(integrated instanceof DeferredCleanup))
|
|
21
|
+
return integrated;
|
|
22
|
+
let outcome;
|
|
23
|
+
try {
|
|
24
|
+
await integrated.run();
|
|
25
|
+
outcome = { ok: true };
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
outcome = { ok: false, error };
|
|
29
|
+
}
|
|
30
|
+
return runLocked(lock, () => integrated.after(outcome));
|
|
31
|
+
}
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
+
import { readPlanFile } from "../../shared/plan-conventions.js";
|
|
1
2
|
import { spawn } from "node:child_process";
|
|
2
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
-
import {
|
|
4
|
+
import { relative, resolve, sep } from "node:path";
|
|
5
|
+
import { extractLocalId } from "../../schedule/phase-sets.js";
|
|
6
|
+
import { resolveAgentMember, specdojoRootDir, } from "../../shared/specdojo-config.js";
|
|
4
7
|
import { loadExecDefaultsConfig, resolveMemberCommand, } from "../agent-config.js";
|
|
8
|
+
import { agentGitStateViolation, captureAgentGitStateSnapshot, changedAgentGitStateFields, } from "../agent-git-state.js";
|
|
9
|
+
import { agentProtectedConfigViolation, captureAgentProtectedConfigSnapshot, changedAgentProtectedConfigPaths, } from "../agent-protected-config.js";
|
|
10
|
+
import { enforceExecutorReportContract, executorStageResumeHint, recordExecutorEvidence, recordReporterFailureOutput, writeExecutorEvidence, } from "../evidence.js";
|
|
11
|
+
import { createPipelineState, pipelineStateLocation, updatePipelineStage, writePipelineState, } from "../pipeline-state.js";
|
|
12
|
+
import { archivePlan, buildInPlaceStem, finalizeResultSectionsForDeliverable, generateDeliverablePlan, generateSinglePlan, parsePlanTaskIdentity, resolveDeliverableTarget, stemFromPlanPath, targetDocIdsForScheduledTask, } from "../plans.js";
|
|
5
13
|
import { activateResolvedProjectPaths, resolveProjectPaths } from "../project.js";
|
|
14
|
+
import { recordGitStateBlock, recordProtectedConfigBlock } from "../protection-handoff.js";
|
|
15
|
+
import { deriveReporterFacts, evidenceForReporter, runReporterWithFormatRetry, } from "../reporter.js";
|
|
16
|
+
import { isResultUnfilled, readResultFrontmatterSnapshot, renderReporterResult, scaffoldResult, updateResultStatus, } from "../results.js";
|
|
17
|
+
import { isRunRecordPath, recordRef, recordStem, taskRecordPaths } from "../run-records.js";
|
|
6
18
|
import { randomHex } from "../shared.js";
|
|
7
|
-
import {
|
|
8
|
-
import { extractLocalId } from "../../schedule/phase-sets.js";
|
|
9
|
-
import { archivePlan, buildInPlaceStem, generateDeliverablePlan, generateSinglePlan, parsePlanTaskIdentity, resolveDeliverableTarget, finalizeResultSectionsForDeliverable, targetDocIdsForScheduledTask, stemFromPlanPath, } from "../plans.js";
|
|
19
|
+
import { configuredProductCheckouts, productRepoEnvironment, withAgentExtraRoots, withoutInheritedRepoEnvironment, } from "../task-repos.js";
|
|
10
20
|
import { buildTaskView } from "../task-view.js";
|
|
11
|
-
import { isResultUnfilled, readResultFrontmatterSnapshot, renderReporterResult, scaffoldResult, updateResultStatus, } from "../results.js";
|
|
12
21
|
import { gitEnvironment } from "../worktree.js";
|
|
13
|
-
import {
|
|
14
|
-
import { agentGitStateViolation, captureAgentGitStateSnapshot, changedAgentGitStateFields, } from "../agent-git-state.js";
|
|
15
|
-
import { recordGitStateBlock, recordProtectedConfigBlock } from "../protection-handoff.js";
|
|
16
|
-
import { recordExecutorEvidence, recordReporterFailureOutput, writeExecutorEvidence, } from "../evidence.js";
|
|
17
|
-
import { deriveReporterFacts, evidenceForReporter, runReporterWithFormatRetry, } from "../reporter.js";
|
|
18
|
-
import { createPipelineState, pipelineStateLocation, updatePipelineStage, writePipelineState, } from "../pipeline-state.js";
|
|
19
|
-
import { pinnedExecutor, pinnedReporter, resolvePinnedRateLimitRunOptions, resolveExecDefaultsPath, selectCandidates, } from "./shared.js";
|
|
22
|
+
import { trackExecutor } from "../validation-metrics.js";
|
|
20
23
|
import { appendParentValidationsToExecutorEvidence, buildExecutorPrompt, executorRequirements, expandPromptRefs, extractBlockReason, loadRosterForExecutionPath, reportProtectionHandoffRecord, resolveReporterAgentCandidates, runWithRetry, } from "./agent.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
+
import { pipelineRecoveryMeta, spawnBlock, spawnClaim, spawnComplete, stageActorMeta, } from "./mode-shared.js";
|
|
25
|
+
import { enforceScheduleKataReview, gradeBeforeReviewPlan } from "./schedule-prepare.js";
|
|
26
|
+
import { reviewTaskBlockReason } from "../review-completion.js";
|
|
27
|
+
import { pinnedExecutor, pinnedReporter, resolveExecDefaultsPath, resolvePinnedRateLimitRunOptions, selectCandidates, } from "./shared.js";
|
|
24
28
|
// Resolve the agent command and the actor for an in-place run, ignoring task state. Unlike the
|
|
25
29
|
// worktree flow, this never requires the task to be claimable. The actor is derived the same way
|
|
26
30
|
// as the worktree path (`prepareTask`): explicit --by wins, otherwise the resolved member's
|
|
@@ -119,12 +123,14 @@ export async function spawnAgentInPlace(command, prompt, cwd, schedulePath, exec
|
|
|
119
123
|
stdio: ["pipe", "inherit", "inherit"],
|
|
120
124
|
});
|
|
121
125
|
// executeAgent と同じ理由で、stdin を読まないコマンドの EPIPE は無視する。
|
|
126
|
+
const stopTracking = trackExecutor(child.pid, cwd);
|
|
122
127
|
child.stdin.on("error", () => undefined);
|
|
123
128
|
child.stdin.end(prompt);
|
|
124
129
|
const exitCode = await new Promise((resolveExit) => {
|
|
125
130
|
child.once("error", () => resolveExit(1));
|
|
126
131
|
child.once("close", (code) => resolveExit(code ?? 1));
|
|
127
132
|
});
|
|
133
|
+
stopTracking();
|
|
128
134
|
const protectedConfigChanges = changedAgentProtectedConfigPaths(cwd, protectedConfigBefore);
|
|
129
135
|
if (protectedConfigChanges.length > 0) {
|
|
130
136
|
const reason = agentProtectedConfigViolation(protectedConfigChanges);
|
|
@@ -162,18 +168,11 @@ export async function runInPlaceMode(opts) {
|
|
|
162
168
|
const projectId = resolvedPaths.projectId ?? opts.project ?? process.env.SPECDOJO_PROJECT ?? "";
|
|
163
169
|
const roster = loadRosterForExecutionPath(executionPath);
|
|
164
170
|
const execDefaults = loadExecDefaultsConfig(resolveExecDefaultsPath(opts, schedulePath), executionPath);
|
|
165
|
-
//
|
|
166
|
-
// file naming. Task-identity runs (--task) always use the fixed `<task-id>` stem (shared with
|
|
167
|
-
// claim / run --track-state), so an in-place result can be adopted by claim/complete without
|
|
168
|
-
// renaming; re-runs overwrite the same plan/result and git history is the audit trail. Only
|
|
169
|
-
// --deliverable / ad-hoc runs (no task identity) use a unique stem to avoid id collisions.
|
|
171
|
+
// State tracking and artifact identity are independent: each new execution gets its own run.
|
|
170
172
|
const trackState = !!opts.trackState;
|
|
171
|
-
const plansDir = join(executionPath, "exec", "plans");
|
|
172
173
|
let planPath;
|
|
173
174
|
let slug;
|
|
174
|
-
//
|
|
175
|
-
// recovered from the plan filename so re-running the same plan overwrites the tied result; for
|
|
176
|
-
// --deliverable it is unique per run (`<slug>-<UTC>-<rand>`).
|
|
175
|
+
// The run id is recovered from a supplied managed plan or minted for a new execution.
|
|
177
176
|
let stem;
|
|
178
177
|
let task = null;
|
|
179
178
|
// null target = bring-your-own --plan (not generated, not archived).
|
|
@@ -212,14 +211,14 @@ export async function runInPlaceMode(opts) {
|
|
|
212
211
|
const taskId = opts.task.trim();
|
|
213
212
|
task = buildTaskView(schedulePath, executionPath, taskId);
|
|
214
213
|
slug = taskId;
|
|
215
|
-
stem = taskId;
|
|
216
|
-
planPath =
|
|
214
|
+
stem = buildInPlaceStem(taskId);
|
|
215
|
+
planPath = taskRecordPaths(executionPath, taskId, stem).plan;
|
|
217
216
|
}
|
|
218
217
|
else {
|
|
219
218
|
target = resolveDeliverableTarget(catalogPath ?? "", opts.deliverable.trim());
|
|
220
219
|
slug = target.slug;
|
|
221
220
|
stem = buildInPlaceStem(slug);
|
|
222
|
-
planPath =
|
|
221
|
+
planPath = taskRecordPaths(executionPath, slug, stem).plan;
|
|
223
222
|
task = {
|
|
224
223
|
id: slug,
|
|
225
224
|
local_id: target.localId,
|
|
@@ -259,8 +258,9 @@ export async function runInPlaceMode(opts) {
|
|
|
259
258
|
}
|
|
260
259
|
// Generate the plan on demand (skip for bring-your-own --plan).
|
|
261
260
|
const generatedPlan = !opts.plan;
|
|
261
|
+
let reviewGradeOutcome;
|
|
262
262
|
if (opts.task && task) {
|
|
263
|
-
|
|
263
|
+
reviewGradeOutcome = await gradeBeforeReviewPlan({
|
|
264
264
|
task,
|
|
265
265
|
projectId,
|
|
266
266
|
catalogPath,
|
|
@@ -275,6 +275,7 @@ export async function runInPlaceMode(opts) {
|
|
|
275
275
|
viewpointsPath,
|
|
276
276
|
projectContext,
|
|
277
277
|
task,
|
|
278
|
+
outPath: planPath,
|
|
278
279
|
...(stem ? { stem } : {}),
|
|
279
280
|
...(reviewGradeOutcome ? { reviewGradeOutcome } : {}),
|
|
280
281
|
});
|
|
@@ -288,10 +289,11 @@ export async function runInPlaceMode(opts) {
|
|
|
288
289
|
viewpointsPath,
|
|
289
290
|
projectContext,
|
|
290
291
|
target,
|
|
292
|
+
outPath: planPath,
|
|
291
293
|
...(stem ? { stem } : {}),
|
|
292
294
|
});
|
|
293
295
|
}
|
|
294
|
-
const planPrompt = expandPromptRefs(
|
|
296
|
+
const planPrompt = expandPromptRefs(readPlanFile(planPath));
|
|
295
297
|
const prompt = task?.agent_pipeline
|
|
296
298
|
? buildExecutorPrompt(planPrompt, execDefaults.pipeline?.parent_validations)
|
|
297
299
|
: planPrompt;
|
|
@@ -318,7 +320,7 @@ export async function runInPlaceMode(opts) {
|
|
|
318
320
|
taskId: slug,
|
|
319
321
|
mode: task.mode ?? "edit",
|
|
320
322
|
projectId: projectId || planProjectId,
|
|
321
|
-
planRef:
|
|
323
|
+
planRef: recordRef(executionPath, planPath),
|
|
322
324
|
agent: actor,
|
|
323
325
|
startedAt: new Date().toISOString(),
|
|
324
326
|
...(stem ? { stem } : {}),
|
|
@@ -335,9 +337,12 @@ export async function runInPlaceMode(opts) {
|
|
|
335
337
|
let pipelineStateRef;
|
|
336
338
|
let pipelineRunId;
|
|
337
339
|
let pipelineFailureStage = "executor";
|
|
340
|
+
let failedStageActor = actor;
|
|
338
341
|
if (task?.agent_pipeline) {
|
|
339
342
|
const startedAt = new Date().toISOString();
|
|
340
|
-
pipelineRunId =
|
|
343
|
+
pipelineRunId = isRunRecordPath(planPath)
|
|
344
|
+
? recordStem(planPath)
|
|
345
|
+
: `${new Date().toISOString().replace(/[-:.]/g, "")}-${randomHex(4)}`;
|
|
341
346
|
const stateLocation = pipelineStateLocation({
|
|
342
347
|
repoRoot,
|
|
343
348
|
worktreePath: repoRoot,
|
|
@@ -414,7 +419,25 @@ export async function runInPlaceMode(opts) {
|
|
|
414
419
|
evidencePath: recorded.evidencePath,
|
|
415
420
|
});
|
|
416
421
|
}
|
|
417
|
-
|
|
422
|
+
failedStageActor = outcome.actor ?? actor;
|
|
423
|
+
// PJR-1GCD: a missing approach-required field is an executor failure, not a reporter failure.
|
|
424
|
+
const contractFailure = outcome.result === "success"
|
|
425
|
+
? enforceExecutorReportContract({
|
|
426
|
+
evidence: recorded.evidence,
|
|
427
|
+
evidencePath: recorded.evidencePath,
|
|
428
|
+
contract: { approach: task.approach, mode: task.mode ?? "edit" },
|
|
429
|
+
resumeHint: executorStageResumeHint({ kind: "schedule", taskId: task.id }),
|
|
430
|
+
})
|
|
431
|
+
: undefined;
|
|
432
|
+
if (contractFailure) {
|
|
433
|
+
const blockedAt = new Date().toISOString();
|
|
434
|
+
pipelineState = updatePipelineStage(pipelineState, "executor", { status: "blocked", completed_at: blockedAt }, blockedAt);
|
|
435
|
+
writePipelineState(stateLocation.path, pipelineState);
|
|
436
|
+
process.stdout.write(`Executor report rejected before the reporter: ${contractFailure}\n`);
|
|
437
|
+
pipelineBlockReason = contractFailure;
|
|
438
|
+
exitCode = 1;
|
|
439
|
+
}
|
|
440
|
+
else if (outcome.result === "success") {
|
|
418
441
|
pipelineFailureStage = "reporter";
|
|
419
442
|
const reporterEvidence = evidenceForReporter(recorded.evidence, {
|
|
420
443
|
repoRoot,
|
|
@@ -444,7 +467,7 @@ export async function runInPlaceMode(opts) {
|
|
|
444
467
|
SPECDOJO_EXECUTION_PATH: executionPath,
|
|
445
468
|
}, resultPath, (opts.reporterBy ?? pinnedReporter(task))
|
|
446
469
|
? resolvePinnedRateLimitRunOptions(opts, execDefaults, roster, "reporter", reporterCandidates[0])
|
|
447
|
-
: undefined);
|
|
470
|
+
: undefined, "reporter");
|
|
448
471
|
reporterAttempts += reporterOutcome.attempts;
|
|
449
472
|
reporterActor = reporterOutcome.actor ?? reporterActor;
|
|
450
473
|
reporterRateLimitEvents.push(...reporterOutcome.rateLimitEvents);
|
|
@@ -493,6 +516,7 @@ export async function runInPlaceMode(opts) {
|
|
|
493
516
|
invocationOutputs: reporter.invocationOutputs,
|
|
494
517
|
});
|
|
495
518
|
}
|
|
519
|
+
failedStageActor = reporterActor ?? failedStageActor;
|
|
496
520
|
const reporterCompletedAt = new Date().toISOString();
|
|
497
521
|
pipelineState = updatePipelineStage(pipelineState, "reporter", {
|
|
498
522
|
status: exitCode === 0
|
|
@@ -528,7 +552,22 @@ export async function runInPlaceMode(opts) {
|
|
|
528
552
|
// normally. The agent's core duty is to fill the result while preserving its scaffold
|
|
529
553
|
// frontmatter, so treat an incomplete or modified result as a block even on exit 0.
|
|
530
554
|
let effectiveExit = exitCode;
|
|
555
|
+
if (exitCode === 0 && task && resultPath) {
|
|
556
|
+
enforceScheduleKataReview({ task, catalogPath, resultPath, projectId, rootDir: repoRoot });
|
|
557
|
+
}
|
|
531
558
|
let blockReason = pipelineBlockReason;
|
|
559
|
+
const reviewBlockReason = exitCode === 0 && task && resultPath
|
|
560
|
+
? reviewTaskBlockReason({
|
|
561
|
+
mode: task.mode,
|
|
562
|
+
resultPath,
|
|
563
|
+
...(reviewGradeOutcome ? { gradeOutcome: reviewGradeOutcome } : {}),
|
|
564
|
+
})
|
|
565
|
+
: undefined;
|
|
566
|
+
if (reviewBlockReason) {
|
|
567
|
+
effectiveExit = 1;
|
|
568
|
+
blockReason = reviewBlockReason;
|
|
569
|
+
process.stdout.write(`run blocked: ${label} (${reviewBlockReason})\n`);
|
|
570
|
+
}
|
|
532
571
|
if (exitCode === 0 &&
|
|
533
572
|
resultPath &&
|
|
534
573
|
task &&
|
|
@@ -549,6 +588,7 @@ export async function runInPlaceMode(opts) {
|
|
|
549
588
|
else
|
|
550
589
|
spawnBlock(projectId, opts.task.trim(), actor, blockReason ?? "agent exited with non-zero code", {
|
|
551
590
|
limit_deferred: "false",
|
|
591
|
+
...stageActorMeta(actor, failedStageActor),
|
|
552
592
|
...(pipelineRunId
|
|
553
593
|
? pipelineRecoveryMeta({
|
|
554
594
|
stage: pipelineFailureStage,
|