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,112 @@
|
|
|
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
|
+
// improve-kata・bootstrap-kata-set の段は実践の型そのものを評価するため、kind: generated の
|
|
41
|
+
// 成果物でも宣言された rulebook を解決する(PJR-DM9B)。generated の扱いだけを外す。
|
|
42
|
+
const kind = deliverable?.deliverable.kind;
|
|
43
|
+
const refs = resolveKataRefs(rulebook, kind === "generated" ? undefined : kind);
|
|
44
|
+
const subjects = [{ path: refs.rulebook, label: "rulebook" }];
|
|
45
|
+
const declarations = rulebook ? loadRulebookRefs(rulebook) : {};
|
|
46
|
+
const declared = rulebook ? declaredKata(rulebook) : [];
|
|
47
|
+
for (const kind of ["recipe", "sample", "template"]) {
|
|
48
|
+
const matches = declared.filter((item) => item.kind === kind);
|
|
49
|
+
if (matches.length) {
|
|
50
|
+
subjects.push(...matches.map((item) => ({
|
|
51
|
+
path: relative(specdojoRootDir(), item.fsPath).replaceAll("\\", "/"),
|
|
52
|
+
label: `${kind}: ${item.id}`,
|
|
53
|
+
})));
|
|
54
|
+
}
|
|
55
|
+
else if ((kind === "sample" && declarations.sample !== "not-needed") ||
|
|
56
|
+
rule.bootstrap_scope?.includes(kind)) {
|
|
57
|
+
// An absent/undecided required reference must hold the review, not disappear from it.
|
|
58
|
+
subjects.push({ path: "_MISSING_", label: kind });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return subjects.filter((subject, index) => subjects.findIndex((other) => other.path === subject.path && other.label === subject.label) === index);
|
|
62
|
+
}
|
|
63
|
+
export function kataReviewVerdict(subjects, projectId, rootDir) {
|
|
64
|
+
const grades = subjects.map((subject) => reviewGradeFreshness({
|
|
65
|
+
subjectPath: subject.path === "_MISSING_" ? "" : subject.path,
|
|
66
|
+
projectId,
|
|
67
|
+
rootDir,
|
|
68
|
+
}));
|
|
69
|
+
if (grades.some((grade) => grade.state === "unreadable"))
|
|
70
|
+
return "grade-unavailable";
|
|
71
|
+
if (grades.some((grade) => grade.state !== "fresh"))
|
|
72
|
+
return "grade-stale";
|
|
73
|
+
if (grades.some((grade) => grade.state === "fresh" &&
|
|
74
|
+
(grade.result.target !== "kata" || grade.result.verdict !== "pass")))
|
|
75
|
+
return "incomplete";
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
export function kataReviewSummary(subjects, projectId) {
|
|
79
|
+
if (!subjects.length)
|
|
80
|
+
return "";
|
|
81
|
+
return [
|
|
82
|
+
"型の整備を含む schedule の追加完了条件: 以下の型すべてに最新の `--target kata` の `pass` が必要。`needs-work` / `fail` は `incomplete` とし、`complete-with-findings` でも完了扱いにしない。未評価・未解決・古い結果は `grade-stale`、読取不能は `grade-unavailable` とする。各対象の鮮度を判定前にも確認し、review 中の変更は `changed-during-review` とする。",
|
|
83
|
+
...subjects.flatMap((subject) => {
|
|
84
|
+
const freshness = reviewGradeFreshness({
|
|
85
|
+
subjectPath: subject.path === "_MISSING_" ? "" : subject.path,
|
|
86
|
+
projectId,
|
|
87
|
+
rootDir: specdojoRootDir(),
|
|
88
|
+
});
|
|
89
|
+
return [
|
|
90
|
+
"",
|
|
91
|
+
`型の評価対象(\`${subject.label}\`、\`--target kata\`): \`${subject.path}\``,
|
|
92
|
+
"sidecarPath" in freshness && freshness.sidecarPath
|
|
93
|
+
? `評価結果サイドカー: \`${relative(specdojoRootDir(), freshness.sidecarPath).replaceAll("\\", "/")}\``
|
|
94
|
+
: "評価結果サイドカー: 解決できない",
|
|
95
|
+
"",
|
|
96
|
+
renderReviewGradeSummary(freshness),
|
|
97
|
+
];
|
|
98
|
+
}),
|
|
99
|
+
].join("\n");
|
|
100
|
+
}
|
|
101
|
+
/** Guard the recorded verdict as well as the reviewer prompt, including legacy non-pipeline runs. */
|
|
102
|
+
export function enforceKataReviewVerdict(resultPath, subjects, projectId, rootDir) {
|
|
103
|
+
if (!subjects.length || !existsSync(resultPath))
|
|
104
|
+
return;
|
|
105
|
+
const verdict = kataReviewVerdict(subjects, projectId, rootDir);
|
|
106
|
+
if (!verdict)
|
|
107
|
+
return;
|
|
108
|
+
const content = readFileSync(resultPath, "utf8");
|
|
109
|
+
const updated = content.replace(/^- verdict:\s*(complete|complete-with-findings)\s*$/m, `- verdict: ${verdict}`);
|
|
110
|
+
if (updated !== content)
|
|
111
|
+
writeFileSync(resultPath, `${updated.trimEnd()}\n\n型の grade の追加完了条件を満たさないため、runner が verdict を \`${verdict}\` に制限した。\n`);
|
|
112
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
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";
|
|
1
|
+
import { dirname, join, relative, sep } from "node:path";
|
|
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,12 @@ 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
|
+
metricsPath: join(dirname(params.evidencePath), "parent-validation-metrics.jsonl"),
|
|
26
|
+
// 統合先を取り込んだ後は executor の変更以外も入るため、変更の種類で選ばずすべて流す。
|
|
27
|
+
...(force ? {} : { selection: parentValidationSelectionForEvidence(params.evidence) }),
|
|
28
|
+
});
|
|
22
29
|
const evidenceWithValidations = replaceParentValidationResults(params.evidence, parentValidationBatch.validations);
|
|
23
30
|
const evidence = recordParentValidationFailureOutput({
|
|
24
31
|
worktreePath: params.cwd,
|
|
@@ -32,11 +39,48 @@ export async function refreshParentValidationsForReporterResume(params) {
|
|
|
32
39
|
process.stdout.write(` Refreshed executor evidence: ${relative(params.cwd, params.evidencePath).split(sep).join("/")}\n`);
|
|
33
40
|
return evidence;
|
|
34
41
|
}
|
|
42
|
+
// PJR-T01P: 決まった形の edit result は reporter を起動せずに runner が作る。作れない場合や
|
|
43
|
+
// 描画に失敗した場合は undefined を返し、呼び出し側は従来どおり reporter を起動する。
|
|
44
|
+
async function writeMechanicalResult(params) {
|
|
45
|
+
if (!params.enabled)
|
|
46
|
+
return false;
|
|
47
|
+
const output = mechanicalEditReporterOutput(params.evidence, params.mode);
|
|
48
|
+
if (!output)
|
|
49
|
+
return false;
|
|
50
|
+
try {
|
|
51
|
+
await renderReporterResult(params.resultPath, output, params.evidence);
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
process.stdout.write(` Mechanical result failed; running the reporter instead: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const DEFAULT_EXECUTOR_RESUME_HINT = "resume the executor stage with --resume-from executor (add --executor-by <nickname> to switch the executor agent)";
|
|
35
60
|
// register pipeline の reporter 段だけを実行する。executor 直後の通常経路と、executor が
|
|
36
61
|
// 成功したまま reporter だけが失敗した run の再開経路の双方から共有し、reporter 起動・
|
|
37
62
|
// result 描画・pipeline-state 更新のみを担う(register の状態遷移と commit は呼び出し側)。
|
|
38
63
|
export async function runReporterStage(params) {
|
|
39
64
|
const { repoRoot, cwd, schedulePath, executionPath, reporterCandidates, execDefaults } = params;
|
|
65
|
+
// PJR-1GCD: an envelope missing an approach-required field is an executor failure. Checking it
|
|
66
|
+
// here also covers reporter-only resumes of evidence recorded before this check existed.
|
|
67
|
+
const resultApproach = readResultFrontmatterSnapshot(params.resultPath).approach;
|
|
68
|
+
const contractFailure = enforceExecutorReportContract({
|
|
69
|
+
evidence: params.evidence,
|
|
70
|
+
evidencePath: params.evidencePath,
|
|
71
|
+
contract: {
|
|
72
|
+
...(typeof resultApproach === "string" ? { approach: resultApproach } : {}),
|
|
73
|
+
mode: params.mode ?? "edit",
|
|
74
|
+
},
|
|
75
|
+
resumeHint: params.executorResumeHint ?? DEFAULT_EXECUTOR_RESUME_HINT,
|
|
76
|
+
});
|
|
77
|
+
if (contractFailure) {
|
|
78
|
+
const blockedAt = new Date().toISOString();
|
|
79
|
+
const state = updatePipelineStage(params.state, "executor", { status: "blocked", completed_at: blockedAt }, blockedAt);
|
|
80
|
+
writePipelineState(params.statePath, state);
|
|
81
|
+
process.stdout.write(` Executor report rejected before the reporter: ${contractFailure}\n`);
|
|
82
|
+
return { exitCode: 1, runResult: "failure", blockReason: contractFailure, state };
|
|
83
|
+
}
|
|
40
84
|
const env = agentEnvironment(repoRoot, cwd, schedulePath, executionPath, params.productWorktrees);
|
|
41
85
|
const reporterEvidence = evidenceForReporter(params.evidence, {
|
|
42
86
|
repoRoot,
|
|
@@ -46,6 +90,27 @@ export async function runReporterStage(params) {
|
|
|
46
90
|
...(params.registerPaths ? { registerPaths: params.registerPaths } : {}),
|
|
47
91
|
});
|
|
48
92
|
let state = params.state;
|
|
93
|
+
const mechanical = await writeMechanicalResult({
|
|
94
|
+
enabled: execDefaults.pipeline?.mechanical_result === true,
|
|
95
|
+
mode: params.mode ?? "edit",
|
|
96
|
+
resultPath: params.resultPath,
|
|
97
|
+
evidence: reporterEvidence,
|
|
98
|
+
});
|
|
99
|
+
if (mechanical) {
|
|
100
|
+
const completedAt = new Date().toISOString();
|
|
101
|
+
state = updatePipelineStage(state, "reporter", {
|
|
102
|
+
status: "succeeded",
|
|
103
|
+
// register の遷移と再開は reporter の actor を実行者として使うため、割り当てた reporter を
|
|
104
|
+
// 記録する。runner が書いたことは result の「進め方」とログに残る。
|
|
105
|
+
actor: reporterCandidates[0]?.actor ?? null,
|
|
106
|
+
started_at: completedAt,
|
|
107
|
+
completed_at: completedAt,
|
|
108
|
+
artifact_ref: relative(cwd, params.resultPath).split(sep).join("/"),
|
|
109
|
+
}, completedAt);
|
|
110
|
+
writePipelineState(params.statePath, state);
|
|
111
|
+
process.stdout.write(" Reporter skipped: the runner wrote the result from executor evidence (pipeline.mechanical_result).\n");
|
|
112
|
+
return { exitCode: 0, runResult: "success", state };
|
|
113
|
+
}
|
|
49
114
|
const reporterStartedAt = new Date().toISOString();
|
|
50
115
|
state = updatePipelineStage(state, "reporter", {
|
|
51
116
|
status: "running",
|
|
@@ -63,7 +128,7 @@ export async function runReporterStage(params) {
|
|
|
63
128
|
evidence: reporterEvidence,
|
|
64
129
|
mode: params.mode ?? "edit",
|
|
65
130
|
invoke: async (reporterPrompt) => {
|
|
66
|
-
const reporterOutcome = await runWithRetry(reporterCandidates, reporterPrompt, execDefaults, cwd, env, params.resultPath, params.rateLimitOptions);
|
|
131
|
+
const reporterOutcome = await runWithRetry(reporterCandidates, reporterPrompt, execDefaults, cwd, env, params.resultPath, params.rateLimitOptions, "reporter");
|
|
67
132
|
reporterAttempts += reporterOutcome.attempts;
|
|
68
133
|
reporterActor = reporterOutcome.actor ?? reporterActor;
|
|
69
134
|
rateLimitEvents.push(...reporterOutcome.rateLimitEvents);
|
|
@@ -130,13 +195,15 @@ export async function runReporterStage(params) {
|
|
|
130
195
|
// 1件の plan/result を executor→reporter の2段階で実行する。register 項目と Job Run の
|
|
131
196
|
// 双方が使い、in-place(cwd: repoRoot)・worktree(cwd: worktree.path)から共有する。
|
|
132
197
|
// evidence・pipeline-state の記録先は
|
|
133
|
-
// Schedule タスクの pipeline
|
|
198
|
+
// Schedule タスクの pipeline と同じ run ディレクトリにすることで、
|
|
134
199
|
// 監査証跡のフォーマットを実行経路によらず統一する。state には plan / result の参照も
|
|
135
200
|
// 記録し、reporter だけが失敗した場合に `--resume` が入力を復元できるようにする。
|
|
136
201
|
export async function runAgentPipeline(params) {
|
|
137
202
|
const { repoRoot, cwd, schedulePath, executionPath, taskId, executor, reporterCandidates, planPrompt, resultPath, execDefaults, } = params;
|
|
138
203
|
const startedAt = new Date().toISOString();
|
|
139
|
-
const runId = params.
|
|
204
|
+
const runId = isRunRecordPath(params.planPath)
|
|
205
|
+
? recordStem(params.planPath)
|
|
206
|
+
: (params.runId ?? `${new Date().toISOString().replace(/[-:.]/g, "")}-${randomHex(4)}`);
|
|
140
207
|
const stateLocation = pipelineStateLocation({
|
|
141
208
|
repoRoot,
|
|
142
209
|
worktreePath: cwd,
|
|
@@ -144,6 +211,8 @@ export async function runAgentPipeline(params) {
|
|
|
144
211
|
taskId,
|
|
145
212
|
runId,
|
|
146
213
|
});
|
|
214
|
+
if (params.resumedExecutor)
|
|
215
|
+
snapshotRunAttempt(stateLocation.path);
|
|
147
216
|
let state = createPipelineState({
|
|
148
217
|
taskId,
|
|
149
218
|
runId,
|
|
@@ -269,6 +338,7 @@ export async function runAgentPipeline(params) {
|
|
|
269
338
|
productWorktrees: params.productWorktrees,
|
|
270
339
|
mode: params.mode,
|
|
271
340
|
rateLimitOptions: params.reporterRateLimitOptions,
|
|
341
|
+
...(params.executorResumeHint ? { executorResumeHint: params.executorResumeHint } : {}),
|
|
272
342
|
});
|
|
273
343
|
return {
|
|
274
344
|
exitCode: reporterOutcome.exitCode,
|
package/dist/exec/run/agent.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
|
-
import { basename, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
import { trackExecutor, withValidationMetrics } from "../validation-metrics.js";
|
|
4
5
|
import { resolveConnectionErrorDetection, resolveMemberCommand, resolveRateLimitDetection, resolveRateLimitPolicy, } from "../agent-config.js";
|
|
5
6
|
import { decidePinnedWait, normalizeAgentLimit, } from "../limit.js";
|
|
6
7
|
import { replaceDocIndexRefs } from "../../docs/doc-index.js";
|
|
8
|
+
import { localConfigEnvironment } from "../../shared/local-config.js";
|
|
7
9
|
import { loadPlan, parsePlanTaskIdentity } from "../plans.js";
|
|
8
10
|
import { recordParentValidationFailureOutput, validateResumedTargetCoverage, writeExecutorEvidence, } from "../evidence.js";
|
|
9
|
-
import { parentValidationDisplayCommands, parentValidationGateFor, parentValidationLabels, parentValidationRoots, recordedParentValidationLabel, replaceParentValidationResults, runParentValidationBatch, } from "../parent-validation.js";
|
|
11
|
+
import { parentValidationDisplayCommands, parentValidationGateFor, parentValidationLabels, parentValidationRoots, parentValidationSelectionForEvidence, recordedParentValidationLabel, replaceParentValidationResults, runParentValidationBatch, } from "../parent-validation.js";
|
|
10
12
|
import { getProjectExecutionPath, loadConfig, loadMemberRoster, specdojoRootDir, } from "../../shared/specdojo-config.js";
|
|
11
13
|
import { agentProtectedConfigViolation, captureAgentProtectedConfigAcrossRepos, changedAgentProtectedConfigAcrossRepos, qualifiedRepoPaths, } from "../agent-protected-config.js";
|
|
12
14
|
import { agentGitStateViolation, captureAgentGitStateAcrossRepos, changedAgentGitStateAcrossRepos, qualifiedGitStateFields, } from "../agent-git-state.js";
|
|
@@ -51,7 +53,7 @@ function executorEvidenceContract(parentValidations, options = {}) {
|
|
|
51
53
|
const parentValidationLabelList = parentValidationLabels(parentValidations);
|
|
52
54
|
const parentValidationCommands = parentValidationDisplayCommands(parentValidations);
|
|
53
55
|
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`
|
|
56
|
+
? `\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
57
|
: "";
|
|
56
58
|
const coverage = {
|
|
57
59
|
source: options.coverageSource ?? "none",
|
|
@@ -153,17 +155,27 @@ blocking completion, but rejects the claim when it can confirm the check applies
|
|
|
153
155
|
change-type condition below is met.
|
|
154
156
|
- \`npm run validate:schema:file\` requires a changed \`*.yaml\` or \`*.yml\` file; Prettier
|
|
155
157
|
requires a changed \`*.md\`, \`*.ts\`, \`*.js\`, \`*.json\`, \`*.yaml\`, or \`*.yml\` file;
|
|
156
|
-
markdownlint requires a changed \`*.md\` file
|
|
158
|
+
markdownlint requires a changed \`*.md\` file; \`npm run validate:history-links\` requires a
|
|
159
|
+
changed history file (\`docs/ja/projects/**/controls/project-register/pjr-*.md\` excluding
|
|
160
|
+
\`pjr-index.md\`, or an existing \`plan.md\` / \`result.md\` under
|
|
161
|
+
\`execution/runs/<origin>/<item>/<run>/\` or legacy \`exec/plans/**/*.md\` /
|
|
162
|
+
\`exec/results/**/*.md\` that you changed yourself).
|
|
157
163
|
- A command that targets a declared product repository (a \`<repo>:<path>\` argument or
|
|
158
164
|
\`--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/\`.
|
|
165
|
+
- \`specdojo catalog validate\` / \`npm run validate:catalog\`: the run's target project (or
|
|
166
|
+
\`--project <id>\`) sets \`catalog_path\` and your deliverable changes reach \`docs/ja/projects/\`.
|
|
167
|
+
Runner-managed files under \`exec/\` (\`plans/\`, \`results/\`, \`evidence/\`, \`events/\`, \`.locks/\`)
|
|
168
|
+
do not count as your changes. A project without \`catalog_path\`, or changes
|
|
161
169
|
outside \`docs/ja/projects/\`, is a valid reason; state it in \`reason\`.
|
|
162
170
|
|
|
163
171
|
Do not run or report \`specdojo index build\`. It writes \`.specdojo/doc-index.json\`, which the
|
|
164
172
|
agent may not write, and the runner regenerates the index while preparing the worktree and before
|
|
165
173
|
integration.
|
|
166
174
|
|
|
175
|
+
For a plan with approach \`condense\`, also include \`condense_records\` in this envelope
|
|
176
|
+
as specified by the plan (an empty array if there are no candidates). The runner writes those
|
|
177
|
+
validated executor facts to the result frontmatter and table; do not edit the result yourself.
|
|
178
|
+
|
|
167
179
|
End the final response with exactly one machine-readable report using this envelope. Do not place
|
|
168
180
|
Markdown fences around the JSON.
|
|
169
181
|
|
|
@@ -201,10 +213,10 @@ export async function runConfiguredParentValidationBatch(execDefaults, cwd, opti
|
|
|
201
213
|
return { validations: [], failureOutputs: [] };
|
|
202
214
|
const labels = parentValidationLabels(entries);
|
|
203
215
|
const label = options.label ?? basename(typeof cwd === "string" ? cwd : cwd.project);
|
|
204
|
-
const batch = await parentValidationGateFor(execDefaults).run(label, labels, async () => {
|
|
216
|
+
const batch = await withValidationMetrics(label, options.metricsPath, () => parentValidationGateFor(execDefaults).run(label, labels, async () => {
|
|
205
217
|
process.stdout.write(` Running parent validations (${label}): ${labels.join(", ")}\n`);
|
|
206
|
-
return await runParentValidationBatch(entries, cwd, options.invoke);
|
|
207
|
-
});
|
|
218
|
+
return await runParentValidationBatch(entries, cwd, options.invoke, options.selection);
|
|
219
|
+
}));
|
|
208
220
|
for (const validation of batch.validations) {
|
|
209
221
|
process.stdout.write(` Parent validation ${recordedParentValidationLabel(validation)}: ${validation.status}\n`);
|
|
210
222
|
}
|
|
@@ -217,7 +229,11 @@ export async function runConfiguredParentValidations(execDefaults, cwd, options
|
|
|
217
229
|
// その途中で runner が終了しても agent 出力と変更一覧を失わないよう、ここでは保存済み evidence
|
|
218
230
|
// へ runner-owned validation だけを追記する。
|
|
219
231
|
export async function appendParentValidationsToExecutorEvidence(params) {
|
|
220
|
-
const parentValidationBatch = await runConfiguredParentValidationBatch(params.execDefaults, parentValidationRoots(params.cwd, params.productWorktrees), {
|
|
232
|
+
const parentValidationBatch = await runConfiguredParentValidationBatch(params.execDefaults, parentValidationRoots(params.cwd, params.productWorktrees), {
|
|
233
|
+
label: params.evidence.task_id,
|
|
234
|
+
metricsPath: join(dirname(params.evidencePath), "parent-validation-metrics.jsonl"),
|
|
235
|
+
selection: parentValidationSelectionForEvidence(params.evidence),
|
|
236
|
+
});
|
|
221
237
|
const evidenceWithValidations = replaceParentValidationResults(params.evidence, parentValidationBatch.validations);
|
|
222
238
|
const evidence = recordParentValidationFailureOutput({
|
|
223
239
|
worktreePath: params.cwd,
|
|
@@ -300,7 +316,7 @@ export function loadRosterForExecutionPath(executionPath) {
|
|
|
300
316
|
}
|
|
301
317
|
return null;
|
|
302
318
|
}
|
|
303
|
-
export async function executeAgent(agentCommand, prompt, detection, provider, cooldownSeconds, cwd, env, quiet = false) {
|
|
319
|
+
export async function executeAgent(agentCommand, prompt, detection, provider, cooldownSeconds, cwd, env, quiet = false, stageRole = "executor") {
|
|
304
320
|
if (!agentCommand.trim()) {
|
|
305
321
|
return { result: "failure", exitCode: null, stdout: "", stderr: "Empty agent command" };
|
|
306
322
|
}
|
|
@@ -313,6 +329,7 @@ export async function executeAgent(agentCommand, prompt, detection, provider, co
|
|
|
313
329
|
shell: true,
|
|
314
330
|
stdio: ["pipe", "pipe", "pipe"],
|
|
315
331
|
});
|
|
332
|
+
const stopTracking = stageRole === "executor" ? trackExecutor(child.pid, cwd) : () => undefined;
|
|
316
333
|
// stdin を読まずに即終了するコマンドへの書き込みは EPIPE になる。未処理だと
|
|
317
334
|
// プロセスごと落ちて失敗時の後処理(block 遷移・result 更新)が走らないため無視する。
|
|
318
335
|
// 実行結果は終了コードで判定する。
|
|
@@ -338,6 +355,7 @@ export async function executeAgent(agentCommand, prompt, detection, provider, co
|
|
|
338
355
|
});
|
|
339
356
|
child.once("close", (code) => resolveExit(code));
|
|
340
357
|
});
|
|
358
|
+
stopTracking();
|
|
341
359
|
const combinedOutput = `${stdout}\n${stderr}`;
|
|
342
360
|
if (isRateLimitError(exitCode, combinedOutput, detection)) {
|
|
343
361
|
return {
|
|
@@ -379,7 +397,7 @@ export function reportProtectionHandoffRecord(recorded, resultPath) {
|
|
|
379
397
|
function rateLimitPrefix(result) {
|
|
380
398
|
return result === "rate_limit" ? "rate limit reached; " : "";
|
|
381
399
|
}
|
|
382
|
-
export async function runWithRetry(candidates, prompt, execDefaults, cwd, env, resultPath, pinned) {
|
|
400
|
+
export async function runWithRetry(candidates, prompt, execDefaults, cwd, env, resultPath, pinned, stageRole = "executor") {
|
|
383
401
|
const policy = resolveRateLimitPolicy(execDefaults, candidates[0]?.provider);
|
|
384
402
|
let attempts = 0;
|
|
385
403
|
// PJR-98G4: agentEnvironment が渡したプロダクト worktree を、provider の追加ディレクトリと
|
|
@@ -407,7 +425,7 @@ export async function runWithRetry(candidates, prompt, execDefaults, cwd, env, r
|
|
|
407
425
|
lastActor = candidate.actor;
|
|
408
426
|
const protectedConfigBefore = captureAgentProtectedConfigAcrossRepos(agentRepos);
|
|
409
427
|
const gitStateBefore = captureAgentGitStateAcrossRepos(agentRepos);
|
|
410
|
-
const attempt = await executeAgent(withAgentExtraRoots(candidate.command, candidate.provider, productRoots.map((root) => root.path)), prompt, detection, candidate.provider, candidatePolicy?.cooldown_seconds, cwd, env);
|
|
428
|
+
const attempt = await executeAgent(withAgentExtraRoots(candidate.command, candidate.provider, productRoots.map((root) => root.path)), prompt, detection, candidate.provider, candidatePolicy?.cooldown_seconds, cwd, env, false, stageRole);
|
|
411
429
|
const protectedConfigChanges = changedAgentProtectedConfigAcrossRepos(protectedConfigBefore);
|
|
412
430
|
if (protectedConfigChanges.length > 0) {
|
|
413
431
|
// 利用上限で止まった場合も保護の検査は飛ばさない。止まった理由として利用上限を先に記録する。
|
|
@@ -605,6 +623,7 @@ export function reportProductWorktrees(worktree) {
|
|
|
605
623
|
export function agentEnvironment(repoRoot, worktreePath, schedulePath, executionPath, productWorktrees) {
|
|
606
624
|
return {
|
|
607
625
|
...withoutInheritedRepoEnvironment(gitEnvironment()),
|
|
626
|
+
...localConfigEnvironment(repoRoot),
|
|
608
627
|
SPECDOJO_SCHEDULE_PATH: pathInsideWorktree(repoRoot, worktreePath, schedulePath),
|
|
609
628
|
SPECDOJO_EXECUTION_PATH: pathInsideWorktree(repoRoot, worktreePath, executionPath),
|
|
610
629
|
...productRepoEnvironment(worktreePath, productWorktrees),
|