specdojo 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/agents/specdojo-orchestrator.md +3 -2
- package/CHANGELOG.md +153 -0
- package/dist/catalog/build.js +24 -1
- package/dist/catalog/plan.js +1 -1
- package/dist/catalog/scaffold.js +4 -1
- package/dist/commands/init.js +5 -1
- package/dist/commands/night-orchestrator.js +6 -4
- package/dist/dashboard/dashboard-timeline.js +18 -16
- package/dist/dashboard/dashboard.js +612 -259
- package/dist/dashboard/epic-plan.js +81 -0
- package/dist/dashboard/exec-records.js +16 -20
- package/dist/dashboard/routines.js +8 -6
- package/dist/dashboard/timeline-build.js +5 -9
- package/dist/dashboard/timeline.js +9 -4
- package/dist/devcontainer/scaffold.js +18 -0
- package/dist/docs/frontmatter-namespace.js +1 -48
- package/dist/docs/yaml-pages.js +125 -3
- package/dist/exec/agent-config.js +22 -0
- package/dist/exec/agent-plan.js +3 -2
- package/dist/exec/commands.js +69 -21
- package/dist/exec/commit-hook-skips.js +78 -0
- package/dist/exec/core.js +19 -7
- package/dist/exec/events.js +159 -8
- package/dist/exec/evidence.js +64 -16
- package/dist/exec/handoff.js +9 -13
- package/dist/exec/limit.js +1 -1
- package/dist/exec/mechanical-result.js +45 -0
- package/dist/exec/migrate-records.js +249 -0
- package/dist/exec/parent-validation.js +153 -12
- package/dist/exec/pipeline-state.js +27 -5
- package/dist/exec/plans-condense-findings.js +89 -0
- package/dist/exec/plans-core.js +24 -17
- package/dist/exec/plans-generation.js +48 -25
- package/dist/exec/plans-grade-findings.js +8 -3
- package/dist/exec/plans-kata-findings.js +61 -0
- package/dist/exec/plans-planning.js +3 -3
- package/dist/exec/plans-storage.js +12 -24
- package/dist/exec/register-resume.js +55 -56
- package/dist/exec/register.js +26 -22
- package/dist/exec/repo-integration-sync.js +8 -4
- package/dist/exec/repo-integration.js +21 -1
- package/dist/exec/reporter.js +121 -23
- package/dist/exec/results.js +85 -24
- package/dist/exec/review-completion.js +47 -0
- package/dist/exec/review-kata.js +109 -0
- package/dist/exec/run/agent-pipeline.js +75 -6
- package/dist/exec/run/agent.js +20 -7
- package/dist/exec/run/in-place.js +69 -32
- package/dist/exec/run/job.js +81 -24
- package/dist/exec/run/lifecycle-commands.js +188 -36
- package/dist/exec/run/mode-shared.js +11 -3
- package/dist/exec/run/register-command.js +6 -10
- package/dist/exec/run/register-core.js +20 -13
- package/dist/exec/run/register-mode.js +12 -12
- package/dist/exec/run/register-post-review.js +21 -9
- package/dist/exec/run/register-resume.js +28 -18
- package/dist/exec/run/register-state.js +10 -7
- package/dist/exec/run/register-worktree.js +60 -30
- package/dist/exec/run/schedule-mode.js +4 -4
- package/dist/exec/run/schedule-prepare.js +201 -59
- package/dist/exec/run/schedule-task.js +129 -25
- package/dist/exec/run/shared.js +4 -3
- package/dist/exec/run/trailing-records.js +35 -0
- package/dist/exec/run-records.js +2 -0
- package/dist/exec/strategy.js +1 -0
- package/dist/exec/trailing-records.js +242 -0
- package/dist/exec/trial-commands.js +3 -2
- package/dist/exec/validate-records-commit.js +110 -0
- package/dist/exec/validate-records.js +148 -0
- package/dist/exec/worktree-command.js +29 -16
- package/dist/exec/worktree-ops-commit.js +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 +19 -2
- package/dist/grade/apply.js +32 -6
- package/dist/grade/command-inspect.js +2 -2
- package/dist/grade/command-run.js +2 -0
- package/dist/grade/command-shared.js +1 -1
- package/dist/grade/core.js +18 -5
- package/dist/grade/markdown.js +3 -3
- package/dist/grade/pipeline-state.js +15 -11
- package/dist/grade/plan.js +37 -17
- package/dist/grade/result.js +3 -3
- package/dist/grade/run.js +23 -3
- package/dist/grade/target-discovery.js +17 -4
- package/dist/grade/targets.js +12 -11
- package/dist/job/job.js +31 -17
- package/dist/job/noop.js +104 -0
- package/dist/register/core.js +2 -0
- package/dist/register/create-commands.js +28 -3
- package/dist/register/deliverable-target.js +9 -1
- package/dist/register/epic.js +104 -26
- package/dist/register/event-merge.js +3 -0
- package/dist/register/events.js +4 -0
- package/dist/register/external-project.js +3 -0
- package/dist/register/item.js +6 -0
- package/dist/register/maintenance-commands.js +4 -1
- package/dist/register/planning.js +7 -14
- package/dist/register/register.js +43 -9
- package/dist/register/track-domains.js +34 -0
- package/dist/register/track-plan.js +78 -0
- package/dist/register/transition-commands.js +8 -0
- package/dist/register/work-table.js +64 -0
- package/dist/review/grade.js +35 -13
- package/dist/routine/definition.js +4 -3
- package/dist/routine/failure.js +30 -0
- package/dist/routine/routine.js +56 -32
- package/dist/routine/storage.js +33 -0
- package/dist/schedule/schedule.js +1 -0
- package/dist/schedule/strategy-generate-document.js +26 -14
- package/dist/schedule/strategy-generate-scope.js +17 -45
- package/dist/schedule/strategy-generate.js +33 -3
- package/dist/schedule/strategy-profiles.js +86 -12
- package/dist/shared/agent-types.js +2 -0
- package/dist/shared/condense-records.js +25 -0
- package/dist/shared/deprecation.js +8 -0
- package/dist/shared/document-metadata.js +20 -0
- package/dist/shared/finding-cause.js +20 -0
- package/dist/shared/frontmatter-namespace.js +48 -0
- package/dist/shared/git.js +142 -15
- package/dist/shared/grade-result.js +17 -1
- package/dist/shared/local-state.js +20 -0
- package/dist/shared/markdownlint-config.js +8 -3
- package/dist/shared/plan-conventions.js +129 -0
- package/dist/shared/plan-templates.js +57 -41
- package/dist/shared/run-records.js +224 -0
- package/dist/shared/specdojo-config.js +39 -21
- package/dist/shared/text.js +65 -5
- package/dist/shared/timeline-index.js +2 -0
- package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +9 -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 +47 -16
- package/docs/ja/specdojo/guides/exec-operation-guide.md +53 -17
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +20 -11
- 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 +70 -14
- package/docs/ja/specdojo/guides/register-operation-guide.md +25 -5
- 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 +14 -8
- package/docs/ja/specdojo/guides/ryu-guide.md +23 -13
- package/docs/ja/specdojo/guides/schedule-design-guide.md +7 -4
- package/docs/ja/specdojo/guides/schedule-operation-guide.md +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/recipes/bac-recipe.md +94 -0
- package/docs/ja/specdojo/recipes/bes-recipe.md +105 -0
- package/docs/ja/specdojo/recipes/br-recipe.md +84 -0
- package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +36 -24
- package/docs/ja/specdojo/recipes/cnd-recipe.md +125 -0
- package/docs/ja/specdojo/recipes/cpd-recipe.md +126 -0
- package/docs/ja/specdojo/recipes/cxd-recipe.md +145 -0
- package/docs/ja/specdojo/recipes/ifd-recipe.md +134 -0
- package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +135 -86
- package/docs/ja/specdojo/recipes/ifx-index-recipe.md +130 -0
- package/docs/ja/specdojo/recipes/pm-organization-recipe.md +29 -26
- package/docs/ja/specdojo/recipes/pm-plan-recipe.md +35 -26
- package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +38 -28
- package/docs/ja/specdojo/recipes/pm-raci-recipe.md +39 -31
- package/docs/ja/specdojo/recipes/pm-roles-recipe.md +26 -28
- package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +10 -8
- package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +18 -17
- package/docs/ja/specdojo/recipes/stsd-recipe.md +100 -62
- package/docs/ja/specdojo/recipes/sysd-critical-flows-recipe.md +106 -0
- package/docs/ja/specdojo/recipes/sysd-cross-cutting-policy-recipe.md +137 -0
- package/docs/ja/specdojo/recipes/sysd-index-recipe.md +122 -0
- package/docs/ja/specdojo/references/command-reference.md +79 -64
- package/docs/ja/specdojo/references/deliverables-reference.md +9 -4
- package/docs/ja/specdojo/references/directory-layout-reference.md +3 -2
- package/docs/ja/specdojo/references/specdojo-config-reference.md +17 -16
- package/docs/ja/specdojo/rulebooks/bac-rulebook.md +72 -290
- package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +212 -79
- package/docs/ja/specdojo/rulebooks/bds-rulebook.md +138 -154
- package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +147 -59
- package/docs/ja/specdojo/rulebooks/bes-rulebook.md +100 -96
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +88 -108
- package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +126 -211
- package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +56 -35
- package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +102 -68
- package/docs/ja/specdojo/rulebooks/cdt-rulebook.md +152 -0
- package/docs/ja/specdojo/rulebooks/cld-rulebook.md +9 -184
- package/docs/ja/specdojo/rulebooks/clis-rulebook.md +187 -0
- package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +93 -247
- package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +104 -241
- package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +124 -257
- package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +87 -98
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +9 -7
- package/docs/ja/specdojo/rulebooks/dec-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/dss-rulebook.md +193 -0
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +100 -54
- package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +69 -252
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +91 -76
- package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +252 -226
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +118 -40
- package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +11 -11
- package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +9 -9
- package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +4 -4
- package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +11 -11
- package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +11 -11
- package/docs/ja/specdojo/rulebooks/mm-rulebook.md +4 -3
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +34 -29
- package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +8 -8
- package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +2 -2
- package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +50 -56
- package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +46 -55
- package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +57 -54
- package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +50 -65
- package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +2 -2
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +70 -97
- package/docs/ja/specdojo/rulebooks/pr-rulebook.md +2 -1
- package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +47 -56
- package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +61 -135
- package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +116 -32
- package/docs/ja/specdojo/rulebooks/sf-rulebook.md +118 -61
- package/docs/ja/specdojo/rulebooks/sld-rulebook.md +152 -57
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +51 -39
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +101 -46
- package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +72 -329
- package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +74 -263
- package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +78 -195
- package/docs/ja/specdojo/rulebooks/tml-rulebook.md +4 -9
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +3 -4
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +3 -3
- package/docs/ja/specdojo/rulebooks/uis-rulebook.md +140 -143
- package/docs/ja/specdojo/samples/bac-sample.md +106 -21
- package/docs/ja/specdojo/samples/bdd-sample.yaml +143 -35
- package/docs/ja/specdojo/samples/bds-sample.md +100 -21
- package/docs/ja/specdojo/samples/bes-index-sample.md +59 -20
- package/docs/ja/specdojo/samples/bes-sample.md +80 -21
- package/docs/ja/specdojo/samples/br-sample.md +68 -14
- package/docs/ja/specdojo/samples/ccd-sample.md +81 -19
- package/docs/ja/specdojo/samples/cdfd-sample.md +172 -99
- package/docs/ja/specdojo/samples/cdfd-uc-sample.md +9 -7
- package/docs/ja/specdojo/samples/cdsd-sample.md +89 -20
- package/docs/ja/specdojo/samples/cdt-sample.md +116 -0
- package/docs/ja/specdojo/samples/cld-sample.md +3 -30
- package/docs/ja/specdojo/samples/clis-sample.md +132 -0
- package/docs/ja/specdojo/samples/cnd-sample.md +127 -21
- package/docs/ja/specdojo/samples/cpd-sample.md +136 -22
- package/docs/ja/specdojo/samples/cxd-sample.md +108 -22
- package/docs/ja/specdojo/samples/dct-index-sample.yaml +63 -17
- package/docs/ja/specdojo/samples/dss-sample.md +175 -0
- package/docs/ja/specdojo/samples/gl-sample.yaml +50 -14
- package/docs/ja/specdojo/samples/ifd-sample.md +105 -21
- package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +91 -60
- package/docs/ja/specdojo/samples/ifx-file-sample.md +462 -21
- package/docs/ja/specdojo/samples/ifx-index-sample.yaml +87 -19
- package/docs/ja/specdojo/samples/pm-members-sample.yaml +37 -13
- package/docs/ja/specdojo/samples/pm-organization-sample.md +52 -20
- package/docs/ja/specdojo/samples/pm-plan-sample.md +84 -26
- package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +55 -22
- package/docs/ja/specdojo/samples/pm-raci-sample.md +69 -28
- package/docs/ja/specdojo/samples/pm-roles-sample.yaml +13 -12
- package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +50 -26
- package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +89 -62
- package/docs/ja/specdojo/samples/sf-index-sample.md +89 -20
- package/docs/ja/specdojo/samples/sf-sample.md +121 -21
- package/docs/ja/specdojo/samples/sld-sample.md +107 -21
- package/docs/ja/specdojo/samples/stsd-sample.md +54 -26
- package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +166 -21
- package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +178 -21
- package/docs/ja/specdojo/samples/sysd-index-sample.md +82 -21
- package/docs/ja/specdojo/samples/tml-sample.yaml +4 -1
- package/docs/ja/specdojo/samples/uis-sample.md +164 -20
- package/docs/ja/specdojo/standards/document-metadata-standard.md +33 -4
- package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +3 -1
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +1 -0
- package/docs/ja/specdojo/templates/bac-template.md +76 -0
- package/docs/ja/specdojo/templates/bes-template.md +56 -0
- package/docs/ja/specdojo/templates/br-template.md +64 -0
- package/docs/ja/specdojo/templates/cdfd-template.md +81 -54
- package/docs/ja/specdojo/templates/cdfd-uc-template.md +9 -5
- package/docs/ja/specdojo/templates/cnd-template.md +137 -0
- package/docs/ja/specdojo/templates/cpd-template.md +129 -0
- package/docs/ja/specdojo/templates/cxd-template.md +105 -0
- package/docs/ja/specdojo/templates/dct-data-model-cdt-template.yaml +40 -0
- package/docs/ja/specdojo/templates/dct-data-model-cld-template.yaml +7 -14
- package/docs/ja/specdojo/templates/dct-index-template.md +9 -20
- package/docs/ja/specdojo/templates/dct-project-management-template.yaml +5 -1
- package/docs/ja/specdojo/templates/ifd-template.md +86 -0
- package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +44 -28
- package/docs/ja/specdojo/templates/ifx-index-template.yaml +40 -0
- package/docs/ja/specdojo/templates/opr-template.md +2 -4
- package/docs/ja/specdojo/templates/pm-organization-template.md +9 -3
- package/docs/ja/specdojo/templates/pm-plan-template.md +4 -4
- package/docs/ja/specdojo/templates/pm-quality-management-plan-template.md +17 -9
- package/docs/ja/specdojo/templates/pm-raci-template.md +24 -13
- package/docs/ja/specdojo/templates/pm-roles-template.yaml +3 -2
- package/docs/ja/specdojo/templates/prj-assumptions-constraints-dependencies-template.md +6 -3
- package/docs/ja/specdojo/templates/prj-comparison-of-alternatives-template.md +22 -19
- package/docs/ja/specdojo/templates/stsd-template.md +46 -21
- package/docs/ja/specdojo/templates/sysd-critical-flows-template.md +94 -0
- package/docs/ja/specdojo/templates/sysd-cross-cutting-policy-template.md +122 -0
- package/docs/ja/specdojo/templates/sysd-index-template.md +89 -0
- package/docs/specdojo/lib/yaml-metadata.cjs +7 -0
- package/docs/specdojo/schemas/v1/bdd.schema.yaml +25 -57
- package/docs/specdojo/schemas/v1/condense-records.schema.yaml +26 -0
- package/docs/specdojo/schemas/v1/dct.schema.yaml +10 -0
- package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +3 -0
- package/docs/specdojo/schemas/v1/esil.schema.yaml +7 -141
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +3 -0
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +53 -3
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +3 -0
- package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +14 -0
- package/docs/specdojo/schemas/v1/exec-result-frontmatter.schema.yaml +18 -0
- package/docs/specdojo/schemas/v1/finding-cause.schema.yaml +22 -0
- package/docs/specdojo/schemas/v1/grade-pipeline-state.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/grade-result.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +65 -5
- package/docs/specdojo/schemas/v1/ifx-index.schema.yaml +142 -0
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +17 -1
- package/package.json +2 -2
- package/templates/antigravity/orchestrator.md +3 -2
- package/templates/claude/agents/specdojo-orchestrator.md +3 -2
- package/templates/codex/agents/specdojo-orchestrator.toml +3 -2
- package/templates/codex/orchestrator.md +3 -2
- package/templates/devcontainer/tmux.conf +6 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +3 -2
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { basename, dirname, isAbsolute, join, relative } from "node:path";
|
|
3
|
+
import { declaredKata, loadRulebookRefs, resolveKataRefs } from "../kata/kata.js";
|
|
4
|
+
import { reviewGradeFreshness, renderReviewGradeSummary } from "../review/grade.js";
|
|
5
|
+
import { getProjectSchedulePath, loadConfig, specdojoRootDir } from "../shared/specdojo-config.js";
|
|
6
|
+
import { load } from "../shared/yaml.js";
|
|
7
|
+
/**
|
|
8
|
+
* `schedule_file` in ready/cpm snapshots is relative to the project's schedule directory, not to
|
|
9
|
+
* the process cwd (PJR-X05N). Resolve it against the configured schedule path first and keep the
|
|
10
|
+
* cwd-relative and absolute forms for callers that already pass a resolvable path.
|
|
11
|
+
*/
|
|
12
|
+
function strategyDirectories(scheduleFile, projectId) {
|
|
13
|
+
const directories = [];
|
|
14
|
+
if (!isAbsolute(scheduleFile) && projectId) {
|
|
15
|
+
const rootDir = specdojoRootDir();
|
|
16
|
+
const project = loadConfig(rootDir).config?.projects[projectId];
|
|
17
|
+
if (project)
|
|
18
|
+
directories.push(join(rootDir, getProjectSchedulePath(project), dirname(scheduleFile)));
|
|
19
|
+
}
|
|
20
|
+
directories.push(dirname(scheduleFile));
|
|
21
|
+
return directories;
|
|
22
|
+
}
|
|
23
|
+
/** Read the intent from the task's own track, even when the review approach is fully-guided. */
|
|
24
|
+
export function scheduleKataReviewSubjects(task, deliverable, projectId) {
|
|
25
|
+
if (!task.local_id || !task.schedule_file)
|
|
26
|
+
return [];
|
|
27
|
+
const track = basename(task.schedule_file).match(/^sch-track-(.+)\.ya?ml$/)?.[1];
|
|
28
|
+
if (!track || !task.id.startsWith(`T-${track.toUpperCase()}-`))
|
|
29
|
+
return [];
|
|
30
|
+
const strategyPath = strategyDirectories(task.schedule_file, projectId)
|
|
31
|
+
.flatMap((directory) => ["yaml", "yml"].map((ext) => join(directory, `sch-strategy-${track}.${ext}`)))
|
|
32
|
+
.find(existsSync);
|
|
33
|
+
if (!strategyPath)
|
|
34
|
+
return [];
|
|
35
|
+
const strategy = load(readFileSync(strategyPath, "utf8"));
|
|
36
|
+
const rule = strategy.approach_rules?.find((rule) => rule.local_ids.includes(task.local_id));
|
|
37
|
+
if (!rule || !["improve-kata", "bootstrap-kata-set"].includes(rule.intent))
|
|
38
|
+
return [];
|
|
39
|
+
const rulebook = deliverable?.deliverable.rulebook;
|
|
40
|
+
const refs = resolveKataRefs(rulebook, deliverable?.deliverable.kind);
|
|
41
|
+
const subjects = [{ path: refs.rulebook, label: "rulebook" }];
|
|
42
|
+
const declarations = rulebook ? loadRulebookRefs(rulebook) : {};
|
|
43
|
+
const declared = rulebook ? declaredKata(rulebook) : [];
|
|
44
|
+
for (const kind of ["recipe", "sample", "template"]) {
|
|
45
|
+
const matches = declared.filter((item) => item.kind === kind);
|
|
46
|
+
if (matches.length) {
|
|
47
|
+
subjects.push(...matches.map((item) => ({
|
|
48
|
+
path: relative(specdojoRootDir(), item.fsPath).replaceAll("\\", "/"),
|
|
49
|
+
label: `${kind}: ${item.id}`,
|
|
50
|
+
})));
|
|
51
|
+
}
|
|
52
|
+
else if ((kind === "sample" && declarations.sample !== "not-needed") ||
|
|
53
|
+
rule.bootstrap_scope?.includes(kind)) {
|
|
54
|
+
// An absent/undecided required reference must hold the review, not disappear from it.
|
|
55
|
+
subjects.push({ path: "_MISSING_", label: kind });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return subjects.filter((subject, index) => subjects.findIndex((other) => other.path === subject.path && other.label === subject.label) === index);
|
|
59
|
+
}
|
|
60
|
+
export function kataReviewVerdict(subjects, projectId, rootDir) {
|
|
61
|
+
const grades = subjects.map((subject) => reviewGradeFreshness({
|
|
62
|
+
subjectPath: subject.path === "_MISSING_" ? "" : subject.path,
|
|
63
|
+
projectId,
|
|
64
|
+
rootDir,
|
|
65
|
+
}));
|
|
66
|
+
if (grades.some((grade) => grade.state === "unreadable"))
|
|
67
|
+
return "grade-unavailable";
|
|
68
|
+
if (grades.some((grade) => grade.state !== "fresh"))
|
|
69
|
+
return "grade-stale";
|
|
70
|
+
if (grades.some((grade) => grade.state === "fresh" &&
|
|
71
|
+
(grade.result.target !== "kata" || grade.result.verdict !== "pass")))
|
|
72
|
+
return "incomplete";
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
export function kataReviewSummary(subjects, projectId) {
|
|
76
|
+
if (!subjects.length)
|
|
77
|
+
return "";
|
|
78
|
+
return [
|
|
79
|
+
"型の整備を含む schedule の追加完了条件: 以下の型すべてに最新の `--target kata` の `pass` が必要。`needs-work` / `fail` は `incomplete` とし、`complete-with-findings` でも完了扱いにしない。未評価・未解決・古い結果は `grade-stale`、読取不能は `grade-unavailable` とする。各対象の鮮度を判定前にも確認し、review 中の変更は `changed-during-review` とする。",
|
|
80
|
+
...subjects.flatMap((subject) => {
|
|
81
|
+
const freshness = reviewGradeFreshness({
|
|
82
|
+
subjectPath: subject.path === "_MISSING_" ? "" : subject.path,
|
|
83
|
+
projectId,
|
|
84
|
+
rootDir: specdojoRootDir(),
|
|
85
|
+
});
|
|
86
|
+
return [
|
|
87
|
+
"",
|
|
88
|
+
`型の評価対象(\`${subject.label}\`、\`--target kata\`): \`${subject.path}\``,
|
|
89
|
+
"sidecarPath" in freshness && freshness.sidecarPath
|
|
90
|
+
? `評価結果サイドカー: \`${relative(specdojoRootDir(), freshness.sidecarPath).replaceAll("\\", "/")}\``
|
|
91
|
+
: "評価結果サイドカー: 解決できない",
|
|
92
|
+
"",
|
|
93
|
+
renderReviewGradeSummary(freshness),
|
|
94
|
+
];
|
|
95
|
+
}),
|
|
96
|
+
].join("\n");
|
|
97
|
+
}
|
|
98
|
+
/** Guard the recorded verdict as well as the reviewer prompt, including legacy non-pipeline runs. */
|
|
99
|
+
export function enforceKataReviewVerdict(resultPath, subjects, projectId, rootDir) {
|
|
100
|
+
if (!subjects.length || !existsSync(resultPath))
|
|
101
|
+
return;
|
|
102
|
+
const verdict = kataReviewVerdict(subjects, projectId, rootDir);
|
|
103
|
+
if (!verdict)
|
|
104
|
+
return;
|
|
105
|
+
const content = readFileSync(resultPath, "utf8");
|
|
106
|
+
const updated = content.replace(/^- verdict:\s*(complete|complete-with-findings)\s*$/m, `- verdict: ${verdict}`);
|
|
107
|
+
if (updated !== content)
|
|
108
|
+
writeFileSync(resultPath, `${updated.trimEnd()}\n\n型の grade の追加完了条件を満たさないため、runner が verdict を \`${verdict}\` に制限した。\n`);
|
|
109
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { relative, sep } from "node:path";
|
|
2
|
-
import { executorCompletionFailure, recordExecutorEvidence, recordParentValidationFailureOutput, recordReporterFailureOutput, snapshotWorktreeChanges, writeExecutorEvidence, } from "../evidence.js";
|
|
3
|
-
import { failedParentValidationReason, hasRecordedParentValidations, parentValidationRoots, replaceParentValidationResults, } from "../parent-validation.js";
|
|
2
|
+
import { enforceExecutorReportContract, executorCompletionFailure, recordExecutorEvidence, recordParentValidationFailureOutput, recordReporterFailureOutput, snapshotWorktreeChanges, writeExecutorEvidence, } from "../evidence.js";
|
|
3
|
+
import { failedParentValidationReason, hasRecordedParentValidations, parentValidationRoots, parentValidationSelectionForEvidence, replaceParentValidationResults, } from "../parent-validation.js";
|
|
4
4
|
import { createPipelineState, pipelineStateLocation, updatePipelineStage, writePipelineState, } from "../pipeline-state.js";
|
|
5
5
|
import { deriveReporterFacts, evidenceForReporter, runReporterWithFormatRetry, } from "../reporter.js";
|
|
6
|
-
import {
|
|
6
|
+
import { mechanicalEditReporterOutput } from "../mechanical-result.js";
|
|
7
|
+
import { readResultFrontmatterSnapshot, renderReporterResult } from "../results.js";
|
|
8
|
+
import { isRunRecordPath, recordStem, snapshotRunAttempt } from "../run-records.js";
|
|
7
9
|
import { randomHex } from "../shared.js";
|
|
8
10
|
import { withProductRepoPrompt } from "../task-repos.js";
|
|
9
11
|
import { worktreeStatusPaths } from "../worktree-ops.js";
|
|
@@ -18,7 +20,11 @@ export async function refreshParentValidationsForReporterResume(params) {
|
|
|
18
20
|
}
|
|
19
21
|
process.stdout.write(` Refreshing parent validations before ${params.stageLabel ?? "reporter"} resume` +
|
|
20
22
|
`${force ? " (integration targets were merged into the worktree)" : ""}.\n`);
|
|
21
|
-
const parentValidationBatch = await runConfiguredParentValidationBatch(params.execDefaults, parentValidationRoots(params.cwd, params.productWorktrees), {
|
|
23
|
+
const parentValidationBatch = await runConfiguredParentValidationBatch(params.execDefaults, parentValidationRoots(params.cwd, params.productWorktrees), {
|
|
24
|
+
label: params.evidence.task_id,
|
|
25
|
+
// 統合先を取り込んだ後は executor の変更以外も入るため、変更の種類で選ばずすべて流す。
|
|
26
|
+
...(force ? {} : { selection: parentValidationSelectionForEvidence(params.evidence) }),
|
|
27
|
+
});
|
|
22
28
|
const evidenceWithValidations = replaceParentValidationResults(params.evidence, parentValidationBatch.validations);
|
|
23
29
|
const evidence = recordParentValidationFailureOutput({
|
|
24
30
|
worktreePath: params.cwd,
|
|
@@ -32,11 +38,48 @@ export async function refreshParentValidationsForReporterResume(params) {
|
|
|
32
38
|
process.stdout.write(` Refreshed executor evidence: ${relative(params.cwd, params.evidencePath).split(sep).join("/")}\n`);
|
|
33
39
|
return evidence;
|
|
34
40
|
}
|
|
41
|
+
// PJR-T01P: 決まった形の edit result は reporter を起動せずに runner が作る。作れない場合や
|
|
42
|
+
// 描画に失敗した場合は undefined を返し、呼び出し側は従来どおり reporter を起動する。
|
|
43
|
+
async function writeMechanicalResult(params) {
|
|
44
|
+
if (!params.enabled)
|
|
45
|
+
return false;
|
|
46
|
+
const output = mechanicalEditReporterOutput(params.evidence, params.mode);
|
|
47
|
+
if (!output)
|
|
48
|
+
return false;
|
|
49
|
+
try {
|
|
50
|
+
await renderReporterResult(params.resultPath, output, params.evidence);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
process.stdout.write(` Mechanical result failed; running the reporter instead: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const DEFAULT_EXECUTOR_RESUME_HINT = "resume the executor stage with --resume-from executor (add --executor-by <nickname> to switch the executor agent)";
|
|
35
59
|
// register pipeline の reporter 段だけを実行する。executor 直後の通常経路と、executor が
|
|
36
60
|
// 成功したまま reporter だけが失敗した run の再開経路の双方から共有し、reporter 起動・
|
|
37
61
|
// result 描画・pipeline-state 更新のみを担う(register の状態遷移と commit は呼び出し側)。
|
|
38
62
|
export async function runReporterStage(params) {
|
|
39
63
|
const { repoRoot, cwd, schedulePath, executionPath, reporterCandidates, execDefaults } = params;
|
|
64
|
+
// PJR-1GCD: an envelope missing an approach-required field is an executor failure. Checking it
|
|
65
|
+
// here also covers reporter-only resumes of evidence recorded before this check existed.
|
|
66
|
+
const resultApproach = readResultFrontmatterSnapshot(params.resultPath).approach;
|
|
67
|
+
const contractFailure = enforceExecutorReportContract({
|
|
68
|
+
evidence: params.evidence,
|
|
69
|
+
evidencePath: params.evidencePath,
|
|
70
|
+
contract: {
|
|
71
|
+
...(typeof resultApproach === "string" ? { approach: resultApproach } : {}),
|
|
72
|
+
mode: params.mode ?? "edit",
|
|
73
|
+
},
|
|
74
|
+
resumeHint: params.executorResumeHint ?? DEFAULT_EXECUTOR_RESUME_HINT,
|
|
75
|
+
});
|
|
76
|
+
if (contractFailure) {
|
|
77
|
+
const blockedAt = new Date().toISOString();
|
|
78
|
+
const state = updatePipelineStage(params.state, "executor", { status: "blocked", completed_at: blockedAt }, blockedAt);
|
|
79
|
+
writePipelineState(params.statePath, state);
|
|
80
|
+
process.stdout.write(` Executor report rejected before the reporter: ${contractFailure}\n`);
|
|
81
|
+
return { exitCode: 1, runResult: "failure", blockReason: contractFailure, state };
|
|
82
|
+
}
|
|
40
83
|
const env = agentEnvironment(repoRoot, cwd, schedulePath, executionPath, params.productWorktrees);
|
|
41
84
|
const reporterEvidence = evidenceForReporter(params.evidence, {
|
|
42
85
|
repoRoot,
|
|
@@ -46,6 +89,27 @@ export async function runReporterStage(params) {
|
|
|
46
89
|
...(params.registerPaths ? { registerPaths: params.registerPaths } : {}),
|
|
47
90
|
});
|
|
48
91
|
let state = params.state;
|
|
92
|
+
const mechanical = await writeMechanicalResult({
|
|
93
|
+
enabled: execDefaults.pipeline?.mechanical_result === true,
|
|
94
|
+
mode: params.mode ?? "edit",
|
|
95
|
+
resultPath: params.resultPath,
|
|
96
|
+
evidence: reporterEvidence,
|
|
97
|
+
});
|
|
98
|
+
if (mechanical) {
|
|
99
|
+
const completedAt = new Date().toISOString();
|
|
100
|
+
state = updatePipelineStage(state, "reporter", {
|
|
101
|
+
status: "succeeded",
|
|
102
|
+
// register の遷移と再開は reporter の actor を実行者として使うため、割り当てた reporter を
|
|
103
|
+
// 記録する。runner が書いたことは result の「進め方」とログに残る。
|
|
104
|
+
actor: reporterCandidates[0]?.actor ?? null,
|
|
105
|
+
started_at: completedAt,
|
|
106
|
+
completed_at: completedAt,
|
|
107
|
+
artifact_ref: relative(cwd, params.resultPath).split(sep).join("/"),
|
|
108
|
+
}, completedAt);
|
|
109
|
+
writePipelineState(params.statePath, state);
|
|
110
|
+
process.stdout.write(" Reporter skipped: the runner wrote the result from executor evidence (pipeline.mechanical_result).\n");
|
|
111
|
+
return { exitCode: 0, runResult: "success", state };
|
|
112
|
+
}
|
|
49
113
|
const reporterStartedAt = new Date().toISOString();
|
|
50
114
|
state = updatePipelineStage(state, "reporter", {
|
|
51
115
|
status: "running",
|
|
@@ -130,13 +194,15 @@ export async function runReporterStage(params) {
|
|
|
130
194
|
// 1件の plan/result を executor→reporter の2段階で実行する。register 項目と Job Run の
|
|
131
195
|
// 双方が使い、in-place(cwd: repoRoot)・worktree(cwd: worktree.path)から共有する。
|
|
132
196
|
// evidence・pipeline-state の記録先は
|
|
133
|
-
// Schedule タスクの pipeline
|
|
197
|
+
// Schedule タスクの pipeline と同じ run ディレクトリにすることで、
|
|
134
198
|
// 監査証跡のフォーマットを実行経路によらず統一する。state には plan / result の参照も
|
|
135
199
|
// 記録し、reporter だけが失敗した場合に `--resume` が入力を復元できるようにする。
|
|
136
200
|
export async function runAgentPipeline(params) {
|
|
137
201
|
const { repoRoot, cwd, schedulePath, executionPath, taskId, executor, reporterCandidates, planPrompt, resultPath, execDefaults, } = params;
|
|
138
202
|
const startedAt = new Date().toISOString();
|
|
139
|
-
const runId = params.
|
|
203
|
+
const runId = isRunRecordPath(params.planPath)
|
|
204
|
+
? recordStem(params.planPath)
|
|
205
|
+
: (params.runId ?? `${new Date().toISOString().replace(/[-:.]/g, "")}-${randomHex(4)}`);
|
|
140
206
|
const stateLocation = pipelineStateLocation({
|
|
141
207
|
repoRoot,
|
|
142
208
|
worktreePath: cwd,
|
|
@@ -144,6 +210,8 @@ export async function runAgentPipeline(params) {
|
|
|
144
210
|
taskId,
|
|
145
211
|
runId,
|
|
146
212
|
});
|
|
213
|
+
if (params.resumedExecutor)
|
|
214
|
+
snapshotRunAttempt(stateLocation.path);
|
|
147
215
|
let state = createPipelineState({
|
|
148
216
|
taskId,
|
|
149
217
|
runId,
|
|
@@ -269,6 +337,7 @@ export async function runAgentPipeline(params) {
|
|
|
269
337
|
productWorktrees: params.productWorktrees,
|
|
270
338
|
mode: params.mode,
|
|
271
339
|
rateLimitOptions: params.reporterRateLimitOptions,
|
|
340
|
+
...(params.executorResumeHint ? { executorResumeHint: params.executorResumeHint } : {}),
|
|
272
341
|
});
|
|
273
342
|
return {
|
|
274
343
|
exitCode: reporterOutcome.exitCode,
|
package/dist/exec/run/agent.js
CHANGED
|
@@ -6,7 +6,7 @@ import { decidePinnedWait, normalizeAgentLimit, } from "../limit.js";
|
|
|
6
6
|
import { replaceDocIndexRefs } from "../../docs/doc-index.js";
|
|
7
7
|
import { loadPlan, parsePlanTaskIdentity } from "../plans.js";
|
|
8
8
|
import { recordParentValidationFailureOutput, validateResumedTargetCoverage, writeExecutorEvidence, } from "../evidence.js";
|
|
9
|
-
import { parentValidationDisplayCommands, parentValidationGateFor, parentValidationLabels, parentValidationRoots, recordedParentValidationLabel, replaceParentValidationResults, runParentValidationBatch, } from "../parent-validation.js";
|
|
9
|
+
import { parentValidationDisplayCommands, parentValidationGateFor, parentValidationLabels, parentValidationRoots, parentValidationSelectionForEvidence, recordedParentValidationLabel, replaceParentValidationResults, runParentValidationBatch, } from "../parent-validation.js";
|
|
10
10
|
import { getProjectExecutionPath, loadConfig, loadMemberRoster, specdojoRootDir, } from "../../shared/specdojo-config.js";
|
|
11
11
|
import { agentProtectedConfigViolation, captureAgentProtectedConfigAcrossRepos, changedAgentProtectedConfigAcrossRepos, qualifiedRepoPaths, } from "../agent-protected-config.js";
|
|
12
12
|
import { agentGitStateViolation, captureAgentGitStateAcrossRepos, changedAgentGitStateAcrossRepos, qualifiedGitStateFields, } from "../agent-git-state.js";
|
|
@@ -51,7 +51,7 @@ function executorEvidenceContract(parentValidations, options = {}) {
|
|
|
51
51
|
const parentValidationLabelList = parentValidationLabels(parentValidations);
|
|
52
52
|
const parentValidationCommands = parentValidationDisplayCommands(parentValidations);
|
|
53
53
|
const parentValidationInstruction = parentValidationLabelList.length > 0
|
|
54
|
-
? `\nThe SpecDojo parent runner will execute these allowlisted validations after you exit: ${parentValidationLabelList.join(", ")} (${parentValidationCommands.join(", ")}). Do not run those commands inside the agent sandbox or report duplicate executor results for them. Run only the remaining sandbox-safe validations required by the plan. Parent-run results will be appended to evidence with source=runner and are authoritative.\n`
|
|
54
|
+
? `\nThe SpecDojo parent runner will execute these allowlisted validations after you exit: ${parentValidationLabelList.join(", ")} (${parentValidationCommands.join(", ")}). Do not run those commands inside the agent sandbox or report duplicate executor results for them. If you still list one, use one validation entry per command with its exact command; never combine several parent validations into one entry. Run only the remaining sandbox-safe validations required by the plan. Parent-run results will be appended to evidence with source=runner and are authoritative.\n`
|
|
55
55
|
: "";
|
|
56
56
|
const coverage = {
|
|
57
57
|
source: options.coverageSource ?? "none",
|
|
@@ -153,17 +153,27 @@ blocking completion, but rejects the claim when it can confirm the check applies
|
|
|
153
153
|
change-type condition below is met.
|
|
154
154
|
- \`npm run validate:schema:file\` requires a changed \`*.yaml\` or \`*.yml\` file; Prettier
|
|
155
155
|
requires a changed \`*.md\`, \`*.ts\`, \`*.js\`, \`*.json\`, \`*.yaml\`, or \`*.yml\` file;
|
|
156
|
-
markdownlint requires a changed \`*.md\` file
|
|
156
|
+
markdownlint requires a changed \`*.md\` file; \`npm run validate:history-links\` requires a
|
|
157
|
+
changed history file (\`docs/ja/projects/**/controls/project-register/pjr-*.md\` excluding
|
|
158
|
+
\`pjr-index.md\`, or an existing \`plan.md\` / \`result.md\` under
|
|
159
|
+
\`execution/runs/<origin>/<item>/<run>/\` or legacy \`exec/plans/**/*.md\` /
|
|
160
|
+
\`exec/results/**/*.md\` that you changed yourself).
|
|
157
161
|
- A command that targets a declared product repository (a \`<repo>:<path>\` argument or
|
|
158
162
|
\`--prefix <repo>\`) is judged by that repository's package.json, not the project repository's.
|
|
159
|
-
- \`specdojo catalog validate\`: the run's target project (or
|
|
160
|
-
and your changes reach \`docs/ja/projects/\`.
|
|
163
|
+
- \`specdojo catalog validate\` / \`npm run validate:catalog\`: the run's target project (or
|
|
164
|
+
\`--project <id>\`) sets \`catalog_path\` and your deliverable changes reach \`docs/ja/projects/\`.
|
|
165
|
+
Runner-managed files under \`exec/\` (\`plans/\`, \`results/\`, \`evidence/\`, \`events/\`, \`.locks/\`)
|
|
166
|
+
do not count as your changes. A project without \`catalog_path\`, or changes
|
|
161
167
|
outside \`docs/ja/projects/\`, is a valid reason; state it in \`reason\`.
|
|
162
168
|
|
|
163
169
|
Do not run or report \`specdojo index build\`. It writes \`.specdojo/doc-index.json\`, which the
|
|
164
170
|
agent may not write, and the runner regenerates the index while preparing the worktree and before
|
|
165
171
|
integration.
|
|
166
172
|
|
|
173
|
+
For a plan with approach \`condense\`, also include \`condense_records\` in this envelope
|
|
174
|
+
as specified by the plan (an empty array if there are no candidates). The runner writes those
|
|
175
|
+
validated executor facts to the result frontmatter and table; do not edit the result yourself.
|
|
176
|
+
|
|
167
177
|
End the final response with exactly one machine-readable report using this envelope. Do not place
|
|
168
178
|
Markdown fences around the JSON.
|
|
169
179
|
|
|
@@ -203,7 +213,7 @@ export async function runConfiguredParentValidationBatch(execDefaults, cwd, opti
|
|
|
203
213
|
const label = options.label ?? basename(typeof cwd === "string" ? cwd : cwd.project);
|
|
204
214
|
const batch = await parentValidationGateFor(execDefaults).run(label, labels, async () => {
|
|
205
215
|
process.stdout.write(` Running parent validations (${label}): ${labels.join(", ")}\n`);
|
|
206
|
-
return await runParentValidationBatch(entries, cwd, options.invoke);
|
|
216
|
+
return await runParentValidationBatch(entries, cwd, options.invoke, options.selection);
|
|
207
217
|
});
|
|
208
218
|
for (const validation of batch.validations) {
|
|
209
219
|
process.stdout.write(` Parent validation ${recordedParentValidationLabel(validation)}: ${validation.status}\n`);
|
|
@@ -217,7 +227,10 @@ export async function runConfiguredParentValidations(execDefaults, cwd, options
|
|
|
217
227
|
// その途中で runner が終了しても agent 出力と変更一覧を失わないよう、ここでは保存済み evidence
|
|
218
228
|
// へ runner-owned validation だけを追記する。
|
|
219
229
|
export async function appendParentValidationsToExecutorEvidence(params) {
|
|
220
|
-
const parentValidationBatch = await runConfiguredParentValidationBatch(params.execDefaults, parentValidationRoots(params.cwd, params.productWorktrees), {
|
|
230
|
+
const parentValidationBatch = await runConfiguredParentValidationBatch(params.execDefaults, parentValidationRoots(params.cwd, params.productWorktrees), {
|
|
231
|
+
label: params.evidence.task_id,
|
|
232
|
+
selection: parentValidationSelectionForEvidence(params.evidence),
|
|
233
|
+
});
|
|
221
234
|
const evidenceWithValidations = replaceParentValidationResults(params.evidence, parentValidationBatch.validations);
|
|
222
235
|
const evidence = recordParentValidationFailureOutput({
|
|
223
236
|
worktreePath: params.cwd,
|
|
@@ -1,26 +1,29 @@
|
|
|
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 { agentProtectedConfigViolation, captureAgentProtectedConfigSnapshot, changedAgentProtectedConfigPaths, } from "../agent-protected-config.js";
|
|
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";
|
|
20
22
|
import { appendParentValidationsToExecutorEvidence, buildExecutorPrompt, executorRequirements, expandPromptRefs, extractBlockReason, loadRosterForExecutionPath, reportProtectionHandoffRecord, resolveReporterAgentCandidates, runWithRetry, } from "./agent.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
23
|
+
import { pipelineRecoveryMeta, spawnBlock, spawnClaim, spawnComplete, stageActorMeta, } from "./mode-shared.js";
|
|
24
|
+
import { enforceScheduleKataReview, gradeBeforeReviewPlan } from "./schedule-prepare.js";
|
|
25
|
+
import { reviewTaskBlockReason } from "../review-completion.js";
|
|
26
|
+
import { pinnedExecutor, pinnedReporter, resolveExecDefaultsPath, resolvePinnedRateLimitRunOptions, selectCandidates, } from "./shared.js";
|
|
24
27
|
// Resolve the agent command and the actor for an in-place run, ignoring task state. Unlike the
|
|
25
28
|
// worktree flow, this never requires the task to be claimable. The actor is derived the same way
|
|
26
29
|
// as the worktree path (`prepareTask`): explicit --by wins, otherwise the resolved member's
|
|
@@ -162,18 +165,11 @@ export async function runInPlaceMode(opts) {
|
|
|
162
165
|
const projectId = resolvedPaths.projectId ?? opts.project ?? process.env.SPECDOJO_PROJECT ?? "";
|
|
163
166
|
const roster = loadRosterForExecutionPath(executionPath);
|
|
164
167
|
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.
|
|
168
|
+
// State tracking and artifact identity are independent: each new execution gets its own run.
|
|
170
169
|
const trackState = !!opts.trackState;
|
|
171
|
-
const plansDir = join(executionPath, "exec", "plans");
|
|
172
170
|
let planPath;
|
|
173
171
|
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>`).
|
|
172
|
+
// The run id is recovered from a supplied managed plan or minted for a new execution.
|
|
177
173
|
let stem;
|
|
178
174
|
let task = null;
|
|
179
175
|
// null target = bring-your-own --plan (not generated, not archived).
|
|
@@ -212,14 +208,14 @@ export async function runInPlaceMode(opts) {
|
|
|
212
208
|
const taskId = opts.task.trim();
|
|
213
209
|
task = buildTaskView(schedulePath, executionPath, taskId);
|
|
214
210
|
slug = taskId;
|
|
215
|
-
stem = taskId;
|
|
216
|
-
planPath =
|
|
211
|
+
stem = buildInPlaceStem(taskId);
|
|
212
|
+
planPath = taskRecordPaths(executionPath, taskId, stem).plan;
|
|
217
213
|
}
|
|
218
214
|
else {
|
|
219
215
|
target = resolveDeliverableTarget(catalogPath ?? "", opts.deliverable.trim());
|
|
220
216
|
slug = target.slug;
|
|
221
217
|
stem = buildInPlaceStem(slug);
|
|
222
|
-
planPath =
|
|
218
|
+
planPath = taskRecordPaths(executionPath, slug, stem).plan;
|
|
223
219
|
task = {
|
|
224
220
|
id: slug,
|
|
225
221
|
local_id: target.localId,
|
|
@@ -259,8 +255,9 @@ export async function runInPlaceMode(opts) {
|
|
|
259
255
|
}
|
|
260
256
|
// Generate the plan on demand (skip for bring-your-own --plan).
|
|
261
257
|
const generatedPlan = !opts.plan;
|
|
258
|
+
let reviewGradeOutcome;
|
|
262
259
|
if (opts.task && task) {
|
|
263
|
-
|
|
260
|
+
reviewGradeOutcome = await gradeBeforeReviewPlan({
|
|
264
261
|
task,
|
|
265
262
|
projectId,
|
|
266
263
|
catalogPath,
|
|
@@ -275,6 +272,7 @@ export async function runInPlaceMode(opts) {
|
|
|
275
272
|
viewpointsPath,
|
|
276
273
|
projectContext,
|
|
277
274
|
task,
|
|
275
|
+
outPath: planPath,
|
|
278
276
|
...(stem ? { stem } : {}),
|
|
279
277
|
...(reviewGradeOutcome ? { reviewGradeOutcome } : {}),
|
|
280
278
|
});
|
|
@@ -288,10 +286,11 @@ export async function runInPlaceMode(opts) {
|
|
|
288
286
|
viewpointsPath,
|
|
289
287
|
projectContext,
|
|
290
288
|
target,
|
|
289
|
+
outPath: planPath,
|
|
291
290
|
...(stem ? { stem } : {}),
|
|
292
291
|
});
|
|
293
292
|
}
|
|
294
|
-
const planPrompt = expandPromptRefs(
|
|
293
|
+
const planPrompt = expandPromptRefs(readPlanFile(planPath));
|
|
295
294
|
const prompt = task?.agent_pipeline
|
|
296
295
|
? buildExecutorPrompt(planPrompt, execDefaults.pipeline?.parent_validations)
|
|
297
296
|
: planPrompt;
|
|
@@ -318,7 +317,7 @@ export async function runInPlaceMode(opts) {
|
|
|
318
317
|
taskId: slug,
|
|
319
318
|
mode: task.mode ?? "edit",
|
|
320
319
|
projectId: projectId || planProjectId,
|
|
321
|
-
planRef:
|
|
320
|
+
planRef: recordRef(executionPath, planPath),
|
|
322
321
|
agent: actor,
|
|
323
322
|
startedAt: new Date().toISOString(),
|
|
324
323
|
...(stem ? { stem } : {}),
|
|
@@ -335,9 +334,12 @@ export async function runInPlaceMode(opts) {
|
|
|
335
334
|
let pipelineStateRef;
|
|
336
335
|
let pipelineRunId;
|
|
337
336
|
let pipelineFailureStage = "executor";
|
|
337
|
+
let failedStageActor = actor;
|
|
338
338
|
if (task?.agent_pipeline) {
|
|
339
339
|
const startedAt = new Date().toISOString();
|
|
340
|
-
pipelineRunId =
|
|
340
|
+
pipelineRunId = isRunRecordPath(planPath)
|
|
341
|
+
? recordStem(planPath)
|
|
342
|
+
: `${new Date().toISOString().replace(/[-:.]/g, "")}-${randomHex(4)}`;
|
|
341
343
|
const stateLocation = pipelineStateLocation({
|
|
342
344
|
repoRoot,
|
|
343
345
|
worktreePath: repoRoot,
|
|
@@ -414,7 +416,25 @@ export async function runInPlaceMode(opts) {
|
|
|
414
416
|
evidencePath: recorded.evidencePath,
|
|
415
417
|
});
|
|
416
418
|
}
|
|
417
|
-
|
|
419
|
+
failedStageActor = outcome.actor ?? actor;
|
|
420
|
+
// PJR-1GCD: a missing approach-required field is an executor failure, not a reporter failure.
|
|
421
|
+
const contractFailure = outcome.result === "success"
|
|
422
|
+
? enforceExecutorReportContract({
|
|
423
|
+
evidence: recorded.evidence,
|
|
424
|
+
evidencePath: recorded.evidencePath,
|
|
425
|
+
contract: { approach: task.approach, mode: task.mode ?? "edit" },
|
|
426
|
+
resumeHint: executorStageResumeHint({ kind: "schedule", taskId: task.id }),
|
|
427
|
+
})
|
|
428
|
+
: undefined;
|
|
429
|
+
if (contractFailure) {
|
|
430
|
+
const blockedAt = new Date().toISOString();
|
|
431
|
+
pipelineState = updatePipelineStage(pipelineState, "executor", { status: "blocked", completed_at: blockedAt }, blockedAt);
|
|
432
|
+
writePipelineState(stateLocation.path, pipelineState);
|
|
433
|
+
process.stdout.write(`Executor report rejected before the reporter: ${contractFailure}\n`);
|
|
434
|
+
pipelineBlockReason = contractFailure;
|
|
435
|
+
exitCode = 1;
|
|
436
|
+
}
|
|
437
|
+
else if (outcome.result === "success") {
|
|
418
438
|
pipelineFailureStage = "reporter";
|
|
419
439
|
const reporterEvidence = evidenceForReporter(recorded.evidence, {
|
|
420
440
|
repoRoot,
|
|
@@ -493,6 +513,7 @@ export async function runInPlaceMode(opts) {
|
|
|
493
513
|
invocationOutputs: reporter.invocationOutputs,
|
|
494
514
|
});
|
|
495
515
|
}
|
|
516
|
+
failedStageActor = reporterActor ?? failedStageActor;
|
|
496
517
|
const reporterCompletedAt = new Date().toISOString();
|
|
497
518
|
pipelineState = updatePipelineStage(pipelineState, "reporter", {
|
|
498
519
|
status: exitCode === 0
|
|
@@ -528,7 +549,22 @@ export async function runInPlaceMode(opts) {
|
|
|
528
549
|
// normally. The agent's core duty is to fill the result while preserving its scaffold
|
|
529
550
|
// frontmatter, so treat an incomplete or modified result as a block even on exit 0.
|
|
530
551
|
let effectiveExit = exitCode;
|
|
552
|
+
if (exitCode === 0 && task && resultPath) {
|
|
553
|
+
enforceScheduleKataReview({ task, catalogPath, resultPath, projectId, rootDir: repoRoot });
|
|
554
|
+
}
|
|
531
555
|
let blockReason = pipelineBlockReason;
|
|
556
|
+
const reviewBlockReason = exitCode === 0 && task && resultPath
|
|
557
|
+
? reviewTaskBlockReason({
|
|
558
|
+
mode: task.mode,
|
|
559
|
+
resultPath,
|
|
560
|
+
...(reviewGradeOutcome ? { gradeOutcome: reviewGradeOutcome } : {}),
|
|
561
|
+
})
|
|
562
|
+
: undefined;
|
|
563
|
+
if (reviewBlockReason) {
|
|
564
|
+
effectiveExit = 1;
|
|
565
|
+
blockReason = reviewBlockReason;
|
|
566
|
+
process.stdout.write(`run blocked: ${label} (${reviewBlockReason})\n`);
|
|
567
|
+
}
|
|
532
568
|
if (exitCode === 0 &&
|
|
533
569
|
resultPath &&
|
|
534
570
|
task &&
|
|
@@ -549,6 +585,7 @@ export async function runInPlaceMode(opts) {
|
|
|
549
585
|
else
|
|
550
586
|
spawnBlock(projectId, opts.task.trim(), actor, blockReason ?? "agent exited with non-zero code", {
|
|
551
587
|
limit_deferred: "false",
|
|
588
|
+
...stageActorMeta(actor, failedStageActor),
|
|
552
589
|
...(pipelineRunId
|
|
553
590
|
? pipelineRecoveryMeta({
|
|
554
591
|
stage: pipelineFailureStage,
|