specdojo 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/agents/specdojo-orchestrator.md +7 -3
- package/CHANGELOG.md +217 -0
- package/dist/catalog/build.js +24 -1
- package/dist/catalog/catalog.js +16 -14
- package/dist/catalog/plan.js +1 -1
- package/dist/catalog/scaffold.js +4 -1
- package/dist/commands/agent.js +5 -3
- package/dist/commands/build.js +69 -10
- package/dist/commands/git.js +206 -0
- package/dist/commands/init.js +9 -3
- package/dist/commands/night-orchestrator.js +6 -4
- package/dist/commands/where.js +25 -0
- package/dist/dashboard/dashboard-timeline.js +18 -16
- package/dist/dashboard/dashboard.js +616 -261
- package/dist/dashboard/epic-plan.js +81 -0
- package/dist/dashboard/exec-records.js +16 -20
- package/dist/dashboard/routines.js +11 -12
- package/dist/dashboard/timeline-build.js +5 -9
- package/dist/dashboard/timeline.js +23 -18
- package/dist/devcontainer/scaffold.js +18 -0
- package/dist/docs/frontmatter-namespace.js +1 -48
- package/dist/docs/index-command.js +2 -2
- package/dist/docs/yaml-business-tables.js +243 -0
- package/dist/docs/yaml-interface-tables.js +106 -0
- package/dist/docs/yaml-pages-command.js +5 -3
- package/dist/docs/yaml-pages.js +268 -3
- package/dist/docs/yaml-table-shared.js +70 -0
- package/dist/docs/yaml-tables.js +39 -0
- package/dist/exec/agent-config.js +31 -0
- package/dist/exec/agent-plan.js +3 -2
- package/dist/exec/agent-protected-config.js +2 -0
- package/dist/exec/commands.js +100 -39
- package/dist/exec/commit-hook-skips.js +78 -0
- package/dist/exec/core.js +19 -7
- package/dist/exec/events.js +179 -8
- package/dist/exec/evidence.js +77 -19
- package/dist/exec/handoff.js +9 -13
- package/dist/exec/limit.js +1 -1
- package/dist/exec/mechanical-result.js +45 -0
- package/dist/exec/migrate-records.js +249 -0
- package/dist/exec/parent-validation.js +209 -15
- package/dist/exec/pipeline-state.js +27 -5
- package/dist/exec/plans-condense-findings.js +89 -0
- package/dist/exec/plans-core.js +45 -19
- package/dist/exec/plans-generation.js +52 -30
- package/dist/exec/plans-grade-findings.js +8 -3
- package/dist/exec/plans-kata-findings.js +61 -0
- package/dist/exec/plans-planning.js +3 -3
- package/dist/exec/plans-storage.js +12 -24
- package/dist/exec/post-integration.js +162 -0
- package/dist/exec/queue-command.js +166 -0
- package/dist/exec/queue.js +285 -0
- package/dist/exec/register-foreign-wait.js +84 -0
- package/dist/exec/register-resume.js +55 -56
- package/dist/exec/register.js +26 -22
- package/dist/exec/repo-integration-sync.js +21 -5
- package/dist/exec/repo-integration.js +21 -1
- package/dist/exec/reporter.js +121 -23
- package/dist/exec/results.js +106 -25
- package/dist/exec/review-completion.js +47 -0
- package/dist/exec/review-kata.js +112 -0
- package/dist/exec/run/agent-pipeline.js +78 -8
- package/dist/exec/run/agent.js +32 -13
- package/dist/exec/run/change-scope.js +365 -0
- package/dist/exec/run/deferred-cleanup.js +31 -0
- package/dist/exec/run/in-place.js +73 -33
- package/dist/exec/run/job-lock.js +66 -0
- package/dist/exec/run/job-sequence.js +137 -0
- package/dist/exec/run/job.js +135 -41
- package/dist/exec/run/lifecycle-commands.js +189 -37
- package/dist/exec/run/lock.js +22 -1
- package/dist/exec/run/mode-shared.js +11 -3
- package/dist/exec/run/register-command.js +14 -15
- package/dist/exec/run/register-core.js +20 -13
- package/dist/exec/run/register-mode.js +77 -17
- package/dist/exec/run/register-post-review.js +21 -9
- package/dist/exec/run/register-resume.js +95 -31
- package/dist/exec/run/register-state.js +23 -15
- package/dist/exec/run/register-worktree.js +184 -139
- package/dist/exec/run/schedule-mode.js +79 -18
- package/dist/exec/run/schedule-prepare.js +204 -59
- package/dist/exec/run/schedule-task.js +203 -49
- package/dist/exec/run/shared.js +9 -3
- package/dist/exec/run/trailing-records.js +35 -0
- package/dist/exec/run-records.js +2 -0
- package/dist/exec/schedule/schedule.js +116 -4
- package/dist/exec/shared.js +1 -1
- package/dist/exec/smoke.js +190 -0
- package/dist/exec/strategy.js +14 -3
- package/dist/exec/task-view.js +6 -4
- package/dist/exec/trailing-records.js +242 -0
- package/dist/exec/trial-commands.js +8 -4
- package/dist/exec/trial-core.js +6 -1
- package/dist/exec/validate-records-commit.js +110 -0
- package/dist/exec/validate-records.js +148 -0
- package/dist/exec/validation-metrics.js +181 -0
- package/dist/exec/worktree-cleanup-lock.js +26 -0
- package/dist/exec/worktree-command.js +38 -17
- package/dist/exec/worktree-ops-commit.js +119 -48
- package/dist/exec/worktree-ops-lifecycle.js +77 -48
- package/dist/exec/worktree-ops-merge.js +13 -2
- package/dist/exec/worktree-ops.js +2 -2
- package/dist/exec/worktree.js +32 -4
- package/dist/grade/apply.js +32 -6
- package/dist/grade/command-apply.js +3 -3
- package/dist/grade/command-inspect.js +7 -5
- package/dist/grade/command-plan.js +1 -1
- package/dist/grade/command-run.js +7 -1
- package/dist/grade/command-shared.js +1 -1
- package/dist/grade/core.js +18 -5
- package/dist/grade/markdown.js +3 -3
- package/dist/grade/pipeline-state.js +15 -11
- package/dist/grade/plan.js +37 -17
- package/dist/grade/result.js +3 -3
- package/dist/grade/run.js +87 -11
- package/dist/grade/target-discovery.js +17 -4
- package/dist/grade/targets.js +12 -11
- package/dist/job/definition.js +84 -8
- package/dist/job/job.js +109 -39
- package/dist/job/noop.js +104 -0
- package/dist/register/authoring-sources.js +22 -16
- package/dist/register/core.js +2 -0
- package/dist/register/create-commands.js +28 -3
- package/dist/register/deliverable-target.js +9 -1
- package/dist/register/epic.js +104 -26
- package/dist/register/event-merge.js +3 -0
- package/dist/register/events.js +4 -0
- package/dist/register/external-project.js +3 -0
- package/dist/register/item.js +6 -0
- package/dist/register/maintenance-commands.js +6 -3
- package/dist/register/planning.js +7 -14
- package/dist/register/register.js +74 -16
- package/dist/register/track-domains.js +34 -0
- package/dist/register/track-plan.js +78 -0
- package/dist/register/transition-commands.js +8 -0
- package/dist/register/work-table.js +64 -0
- package/dist/review/grade.js +35 -13
- package/dist/routine/definition.js +13 -3
- package/dist/routine/failure.js +30 -0
- package/dist/routine/routine.js +189 -71
- package/dist/routine/status.js +62 -0
- package/dist/routine/storage.js +33 -0
- package/dist/schedule/schedule.js +39 -39
- package/dist/schedule/strategy-generate-document.js +26 -14
- package/dist/schedule/strategy-generate-scope.js +17 -45
- package/dist/schedule/strategy-generate.js +33 -3
- package/dist/schedule/strategy-profiles.js +86 -12
- package/dist/shared/agent-types.js +7 -0
- package/dist/shared/condense-records.js +25 -0
- package/dist/shared/cross-process-lock.js +9 -1
- package/dist/shared/deprecation.js +8 -0
- package/dist/shared/dist-freshness.js +8 -2
- package/dist/shared/document-metadata.js +20 -0
- package/dist/shared/finding-cause.js +20 -0
- package/dist/shared/frontmatter-namespace.js +48 -0
- package/dist/shared/git-environment.js +2 -1
- package/dist/shared/git.js +186 -16
- package/dist/shared/grade-result.js +17 -1
- package/dist/shared/lefthook-scaffold.js +3 -0
- package/dist/shared/local-config.js +244 -0
- package/dist/shared/local-state.js +20 -0
- package/dist/shared/markdownlint-config.js +8 -3
- package/dist/shared/plan-conventions.js +129 -0
- package/dist/shared/plan-templates.js +57 -41
- package/dist/shared/run-records.js +224 -0
- package/dist/shared/specdojo-config.js +73 -41
- package/dist/shared/specdojo-gitignore.js +1 -0
- package/dist/shared/text.js +74 -6
- package/dist/shared/timeline-index.js +2 -0
- package/dist/shared/where-alias.js +13 -0
- package/dist/specdojo.js +4 -0
- package/docs/ja/specdojo/defaults/pm-review-viewpoints.yaml +11 -2
- package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +4 -74
- package/docs/ja/specdojo/exec-templates/xep-condense-template.md +50 -0
- package/docs/ja/specdojo/exec-templates/xep-draft-template.md +17 -5
- package/docs/ja/specdojo/exec-templates/xep-fully-guided-template.md +16 -3
- package/docs/ja/specdojo/exec-templates/xep-recipe-guided-template.md +15 -5
- package/docs/ja/specdojo/exec-templates/xep-recipe-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-register-template.md +1 -1
- package/docs/ja/specdojo/exec-templates/xep-rulebook-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-sample-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xep-template-maintenance-template.md +6 -0
- package/docs/ja/specdojo/exec-templates/xer-condense-template.md +25 -0
- package/docs/ja/specdojo/exec-templates/xp-common-conventions-template.md +50 -0
- package/docs/ja/specdojo/exec-templates/xrp-common-conventions-template.md +30 -0
- package/docs/ja/specdojo/guides/branch-workflow-guide.md +1 -1
- package/docs/ja/specdojo/guides/docs-editing-guide.md +12 -0
- package/docs/ja/specdojo/guides/docs-structure-guide.md +48 -15
- package/docs/ja/specdojo/guides/exec-config-guide.md +69 -19
- package/docs/ja/specdojo/guides/exec-operation-guide.md +97 -18
- package/docs/ja/specdojo/guides/exec-worktree-guide.md +20 -11
- package/docs/ja/specdojo/guides/job-sequence-guide.md +77 -0
- package/docs/ja/specdojo/guides/plan-result-lifecycle-guide.md +92 -55
- package/docs/ja/specdojo/guides/project-move-guide.md +381 -0
- package/docs/ja/specdojo/guides/quick-start-guide.md +73 -17
- package/docs/ja/specdojo/guides/register-operation-guide.md +26 -6
- package/docs/ja/specdojo/guides/remote-host-development-guide.md +2 -0
- package/docs/ja/specdojo/guides/review-guide.md +22 -19
- package/docs/ja/specdojo/guides/routine-operation-guide.md +23 -12
- package/docs/ja/specdojo/guides/ryu-guide.md +23 -13
- package/docs/ja/specdojo/guides/schedule-design-guide.md +27 -21
- package/docs/ja/specdojo/guides/schedule-operation-guide.md +27 -3
- package/docs/ja/specdojo/guides/specdojo-overview-guide.md +5 -4
- package/docs/ja/specdojo/guides/timeline-design-guide.md +27 -144
- package/docs/ja/specdojo/guides/use-case-guide.md +92 -155
- package/docs/ja/specdojo/guides/waza-guide.md +12 -8
- package/docs/ja/specdojo/recipes/bac-recipe.md +111 -0
- package/docs/ja/specdojo/recipes/bes-recipe.md +141 -0
- package/docs/ja/specdojo/recipes/bps-recipe.md +88 -139
- package/docs/ja/specdojo/recipes/br-recipe.md +77 -0
- package/docs/ja/specdojo/recipes/cdfd-overview-recipe.md +97 -109
- package/docs/ja/specdojo/recipes/cdfd-recipe.md +85 -146
- package/docs/ja/specdojo/recipes/cdfd-uc-recipe.md +92 -99
- package/docs/ja/specdojo/recipes/cnd-recipe.md +135 -0
- package/docs/ja/specdojo/recipes/cpd-recipe.md +140 -0
- package/docs/ja/specdojo/recipes/cxd-recipe.md +162 -0
- package/docs/ja/specdojo/recipes/ifd-recipe.md +145 -0
- package/docs/ja/specdojo/recipes/ifx-cmd-recipe.md +112 -90
- package/docs/ja/specdojo/recipes/ifx-index-recipe.md +164 -0
- package/docs/ja/specdojo/recipes/pm-communication-plan-recipe.md +60 -49
- package/docs/ja/specdojo/recipes/pm-members-recipe.md +50 -51
- package/docs/ja/specdojo/recipes/pm-organization-recipe.md +59 -48
- package/docs/ja/specdojo/recipes/pm-plan-recipe.md +72 -50
- package/docs/ja/specdojo/recipes/pm-quality-management-plan-recipe.md +40 -49
- package/docs/ja/specdojo/recipes/pm-raci-recipe.md +42 -48
- package/docs/ja/specdojo/recipes/pm-roles-recipe.md +52 -81
- package/docs/ja/specdojo/recipes/prj-assumptions-constraints-dependencies-recipe.md +64 -91
- package/docs/ja/specdojo/recipes/prj-charter-recipe.md +71 -106
- package/docs/ja/specdojo/recipes/prj-comparison-of-alternatives-recipe.md +78 -156
- package/docs/ja/specdojo/recipes/prj-issues-and-approach-recipe.md +62 -111
- package/docs/ja/specdojo/recipes/prj-scope-recipe.md +67 -123
- package/docs/ja/specdojo/recipes/prj-stakeholder-register-recipe.md +60 -96
- package/docs/ja/specdojo/recipes/prj-success-criteria-and-acceptance-criteria-recipe.md +61 -105
- package/docs/ja/specdojo/recipes/stsd-recipe.md +88 -80
- package/docs/ja/specdojo/recipes/sysd-critical-flows-recipe.md +129 -0
- package/docs/ja/specdojo/recipes/sysd-cross-cutting-policy-recipe.md +146 -0
- package/docs/ja/specdojo/recipes/sysd-index-recipe.md +141 -0
- package/docs/ja/specdojo/recipes/tsd-recipe.md +149 -129
- package/docs/ja/specdojo/references/command-reference.md +303 -148
- package/docs/ja/specdojo/references/deliverables-reference.md +30 -16
- package/docs/ja/specdojo/references/directory-layout-reference.md +3 -2
- package/docs/ja/specdojo/references/specdojo-config-reference.md +54 -18
- package/docs/ja/specdojo/rulebooks/atc-index-rulebook.md +101 -257
- package/docs/ja/specdojo/rulebooks/atc-rulebook.md +102 -228
- package/docs/ja/specdojo/rulebooks/bac-rulebook.md +63 -290
- package/docs/ja/specdojo/rulebooks/bdd-rulebook.md +162 -80
- package/docs/ja/specdojo/rulebooks/bds-rulebook.md +118 -155
- package/docs/ja/specdojo/rulebooks/bes-index-rulebook.md +128 -60
- package/docs/ja/specdojo/rulebooks/bes-rulebook.md +70 -94
- package/docs/ja/specdojo/rulebooks/bps-rulebook.md +24 -56
- package/docs/ja/specdojo/rulebooks/br-rulebook.md +58 -103
- package/docs/ja/specdojo/rulebooks/ccd-mermaid-rulebook.md +103 -223
- package/docs/ja/specdojo/rulebooks/cdfd-d2-rulebook.md +18 -93
- package/docs/ja/specdojo/rulebooks/cdfd-mermaid-rulebook.md +18 -52
- package/docs/ja/specdojo/rulebooks/cdfd-overview-rulebook.md +109 -147
- package/docs/ja/specdojo/rulebooks/cdfd-rulebook.md +80 -108
- package/docs/ja/specdojo/rulebooks/cdfd-uc-rulebook.md +51 -55
- package/docs/ja/specdojo/rulebooks/cdr-rulebook.md +144 -0
- package/docs/ja/specdojo/rulebooks/cdsd-rulebook.md +81 -68
- package/docs/ja/specdojo/rulebooks/cdt-rulebook.md +139 -0
- package/docs/ja/specdojo/rulebooks/cld-rulebook.md +9 -184
- package/docs/ja/specdojo/rulebooks/clis-rulebook.md +170 -0
- package/docs/ja/specdojo/rulebooks/cnd-mermaid-rulebook.md +33 -86
- package/docs/ja/specdojo/rulebooks/cnd-rulebook.md +79 -249
- package/docs/ja/specdojo/rulebooks/cop-index-rulebook.md +45 -131
- package/docs/ja/specdojo/rulebooks/cop-rulebook.md +69 -275
- package/docs/ja/specdojo/rulebooks/cpd-mermaid-rulebook.md +20 -112
- package/docs/ja/specdojo/rulebooks/cpd-rulebook.md +79 -249
- package/docs/ja/specdojo/rulebooks/cxd-mermaid-rulebook.md +12 -145
- package/docs/ja/specdojo/rulebooks/cxd-rulebook.md +115 -256
- package/docs/ja/specdojo/rulebooks/dct-index-rulebook.md +79 -109
- package/docs/ja/specdojo/rulebooks/dct-rulebook.md +119 -174
- package/docs/ja/specdojo/rulebooks/dec-rulebook.md +6 -14
- package/docs/ja/specdojo/rulebooks/dmd-index-rulebook.md +22 -66
- package/docs/ja/specdojo/rulebooks/dmd-rulebook.md +36 -94
- package/docs/ja/specdojo/rulebooks/dss-rulebook.md +171 -0
- package/docs/ja/specdojo/rulebooks/etc-index-rulebook.md +31 -131
- package/docs/ja/specdojo/rulebooks/etc-rulebook.md +50 -104
- package/docs/ja/specdojo/rulebooks/gl-rulebook.md +93 -57
- package/docs/ja/specdojo/rulebooks/ifd-mermaid-rulebook.md +63 -253
- package/docs/ja/specdojo/rulebooks/ifx-api-rulebook.md +14 -20
- package/docs/ja/specdojo/rulebooks/ifx-cmd-rulebook.md +79 -76
- package/docs/ja/specdojo/rulebooks/ifx-file-rulebook.md +182 -237
- package/docs/ja/specdojo/rulebooks/ifx-index-rulebook.md +111 -40
- package/docs/ja/specdojo/rulebooks/ifx-msg-rulebook.md +14 -22
- package/docs/ja/specdojo/rulebooks/imp-business-rulebook.md +23 -46
- package/docs/ja/specdojo/rulebooks/imp-data-rulebook.md +41 -64
- package/docs/ja/specdojo/rulebooks/imp-interface-rulebook.md +16 -40
- package/docs/ja/specdojo/rulebooks/imp-operations-rulebook.md +34 -61
- package/docs/ja/specdojo/rulebooks/imp-test-rulebook.md +27 -50
- package/docs/ja/specdojo/rulebooks/itc-index-rulebook.md +70 -199
- package/docs/ja/specdojo/rulebooks/itc-rulebook.md +65 -153
- package/docs/ja/specdojo/rulebooks/mip-index-rulebook.md +74 -150
- package/docs/ja/specdojo/rulebooks/mm-rulebook.md +12 -23
- package/docs/ja/specdojo/rulebooks/mtp-rulebook.md +99 -176
- package/docs/ja/specdojo/rulebooks/nfr-availability-rulebook.md +35 -61
- package/docs/ja/specdojo/rulebooks/nfr-index-rulebook.md +75 -117
- package/docs/ja/specdojo/rulebooks/nfr-integrity-rulebook.md +31 -60
- package/docs/ja/specdojo/rulebooks/nfr-maintainability-rulebook.md +26 -81
- package/docs/ja/specdojo/rulebooks/nfr-operations-rulebook.md +32 -70
- package/docs/ja/specdojo/rulebooks/nfr-performance-rulebook.md +45 -87
- package/docs/ja/specdojo/rulebooks/nfr-reliability-rulebook.md +48 -101
- package/docs/ja/specdojo/rulebooks/nfr-security-safety-rulebook.md +44 -80
- package/docs/ja/specdojo/rulebooks/nfr-usability-rulebook.md +59 -127
- package/docs/ja/specdojo/rulebooks/opd-index-rulebook.md +31 -50
- package/docs/ja/specdojo/rulebooks/opd-rulebook.md +42 -109
- package/docs/ja/specdojo/rulebooks/opr-index-rulebook.md +29 -42
- package/docs/ja/specdojo/rulebooks/opr-rulebook.md +29 -87
- package/docs/ja/specdojo/rulebooks/otp-index-rulebook.md +62 -84
- package/docs/ja/specdojo/rulebooks/otp-rulebook.md +11 -61
- package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +92 -102
- package/docs/ja/specdojo/rulebooks/pm-change-request-log-rulebook.md +25 -34
- package/docs/ja/specdojo/rulebooks/pm-communication-plan-rulebook.md +30 -53
- package/docs/ja/specdojo/rulebooks/pm-issue-log-rulebook.md +23 -35
- package/docs/ja/specdojo/rulebooks/pm-members-rulebook.md +27 -45
- package/docs/ja/specdojo/rulebooks/pm-organization-rulebook.md +45 -59
- package/docs/ja/specdojo/rulebooks/pm-plan-rulebook.md +56 -66
- package/docs/ja/specdojo/rulebooks/pm-quality-management-plan-rulebook.md +54 -62
- package/docs/ja/specdojo/rulebooks/pm-raci-rulebook.md +46 -65
- package/docs/ja/specdojo/rulebooks/pm-risk-register-rulebook.md +28 -35
- package/docs/ja/specdojo/rulebooks/pm-roles-rulebook.md +65 -97
- package/docs/ja/specdojo/rulebooks/pr-rulebook.md +6 -18
- package/docs/ja/specdojo/rulebooks/prj-assumptions-constraints-dependencies-rulebook.md +48 -78
- package/docs/ja/specdojo/rulebooks/prj-charter-rulebook.md +23 -97
- package/docs/ja/specdojo/rulebooks/prj-comparison-of-alternatives-rulebook.md +61 -153
- package/docs/ja/specdojo/rulebooks/prj-issues-and-approach-rulebook.md +43 -116
- package/docs/ja/specdojo/rulebooks/prj-scope-rulebook.md +16 -51
- package/docs/ja/specdojo/rulebooks/prj-stakeholder-register-rulebook.md +47 -92
- package/docs/ja/specdojo/rulebooks/prj-success-criteria-and-acceptance-criteria-rulebook.md +25 -84
- package/docs/ja/specdojo/rulebooks/sac-rulebook.md +44 -107
- package/docs/ja/specdojo/rulebooks/sf-index-rulebook.md +106 -32
- package/docs/ja/specdojo/rulebooks/sf-rulebook.md +111 -61
- package/docs/ja/specdojo/rulebooks/sld-rulebook.md +129 -59
- package/docs/ja/specdojo/rulebooks/stc-index-rulebook.md +90 -189
- package/docs/ja/specdojo/rulebooks/stc-rulebook.md +45 -105
- package/docs/ja/specdojo/rulebooks/stsd-mermaid-rulebook.md +46 -40
- package/docs/ja/specdojo/rulebooks/stsd-rulebook.md +104 -68
- package/docs/ja/specdojo/rulebooks/sysd-critical-flows-rulebook.md +64 -330
- package/docs/ja/specdojo/rulebooks/sysd-cross-cutting-policy-rulebook.md +70 -263
- package/docs/ja/specdojo/rulebooks/sysd-index-rulebook.md +58 -200
- package/docs/ja/specdojo/rulebooks/sysd-rulebook.md +47 -60
- package/docs/ja/specdojo/rulebooks/tml-rulebook.md +4 -9
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-specs-rulebook.md +69 -71
- package/docs/ja/specdojo/rulebooks/trc-requirements-to-tests-rulebook.md +65 -72
- package/docs/ja/specdojo/rulebooks/tsd-index-rulebook.md +35 -46
- package/docs/ja/specdojo/rulebooks/tsd-rulebook.md +49 -66
- package/docs/ja/specdojo/rulebooks/tsp-index-rulebook.md +64 -139
- package/docs/ja/specdojo/rulebooks/uis-rulebook.md +91 -161
- package/docs/ja/specdojo/rulebooks/utc-index-rulebook.md +49 -144
- package/docs/ja/specdojo/rulebooks/utc-rulebook.md +67 -155
- package/docs/ja/specdojo/samples/bac-sample.md +106 -21
- package/docs/ja/specdojo/samples/bdd-sample.yaml +143 -35
- package/docs/ja/specdojo/samples/bds-sample.md +87 -21
- package/docs/ja/specdojo/samples/bes-index-sample.md +42 -20
- package/docs/ja/specdojo/samples/bes-sample.md +70 -21
- package/docs/ja/specdojo/samples/bps-sample.md +42 -54
- package/docs/ja/specdojo/samples/br-sample.md +57 -15
- package/docs/ja/specdojo/samples/ccd-sample.md +80 -19
- package/docs/ja/specdojo/samples/cdfd-sample.md +172 -99
- package/docs/ja/specdojo/samples/cdfd-uc-sample.md +9 -7
- package/docs/ja/specdojo/samples/cdr-sample.md +78 -0
- package/docs/ja/specdojo/samples/cdsd-sample.md +73 -20
- package/docs/ja/specdojo/samples/cdt-sample.md +116 -0
- package/docs/ja/specdojo/samples/cld-sample.md +3 -30
- package/docs/ja/specdojo/samples/clis-sample.md +125 -0
- package/docs/ja/specdojo/samples/cnd-sample.md +127 -21
- package/docs/ja/specdojo/samples/cpd-sample.md +136 -22
- package/docs/ja/specdojo/samples/cxd-sample.md +108 -22
- package/docs/ja/specdojo/samples/dct-index-sample.yaml +63 -17
- package/docs/ja/specdojo/samples/dec-sample.md +2 -3
- package/docs/ja/specdojo/samples/dss-sample.md +175 -0
- package/docs/ja/specdojo/samples/gl-sample.yaml +50 -14
- package/docs/ja/specdojo/samples/ifd-sample.md +105 -21
- package/docs/ja/specdojo/samples/ifx-api-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/ifx-cmd-sample.yaml +91 -60
- package/docs/ja/specdojo/samples/ifx-file-sample.md +462 -21
- package/docs/ja/specdojo/samples/ifx-index-sample.yaml +87 -19
- package/docs/ja/specdojo/samples/ifx-msg-sample.yaml +0 -2
- package/docs/ja/specdojo/samples/job-sequence.yaml +67 -0
- package/docs/ja/specdojo/samples/mip-index-sample.md +98 -20
- package/docs/ja/specdojo/samples/pm-communication-plan-sample.md +26 -19
- package/docs/ja/specdojo/samples/pm-members-sample.yaml +37 -13
- package/docs/ja/specdojo/samples/pm-organization-sample.md +42 -21
- package/docs/ja/specdojo/samples/pm-plan-sample.md +78 -26
- package/docs/ja/specdojo/samples/pm-quality-management-plan-sample.md +41 -22
- package/docs/ja/specdojo/samples/pm-raci-sample.md +63 -28
- package/docs/ja/specdojo/samples/pm-roles-sample.yaml +13 -12
- package/docs/ja/specdojo/samples/prj-assumptions-constraints-dependencies-sample.md +33 -25
- package/docs/ja/specdojo/samples/prj-charter-sample.md +42 -59
- package/docs/ja/specdojo/samples/prj-comparison-of-alternatives-sample.md +83 -62
- package/docs/ja/specdojo/samples/prj-success-criteria-and-acceptance-criteria-sample.md +30 -33
- package/docs/ja/specdojo/samples/sf-index-sample.md +47 -20
- package/docs/ja/specdojo/samples/sf-sample.md +109 -21
- package/docs/ja/specdojo/samples/sld-sample.md +88 -21
- package/docs/ja/specdojo/samples/stsd-sample.md +54 -26
- package/docs/ja/specdojo/samples/sysd-critical-flows-sample.md +166 -21
- package/docs/ja/specdojo/samples/sysd-cross-cutting-policy-sample.md +178 -21
- package/docs/ja/specdojo/samples/sysd-index-sample.md +82 -21
- package/docs/ja/specdojo/samples/tml-sample.yaml +4 -1
- package/docs/ja/specdojo/samples/uis-sample.md +141 -20
- package/docs/ja/specdojo/standards/document-metadata-standard.md +33 -4
- package/docs/ja/specdojo/standards/id-and-file-naming-standard.md +3 -1
- package/docs/ja/specdojo/standards/job-definition-standard.md +24 -9
- package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +1 -0
- package/docs/ja/specdojo/templates/bac-template.md +76 -0
- package/docs/ja/specdojo/templates/bes-template.md +56 -0
- package/docs/ja/specdojo/templates/br-template.md +64 -0
- package/docs/ja/specdojo/templates/cdfd-template.md +81 -54
- package/docs/ja/specdojo/templates/cdfd-uc-template.md +9 -5
- package/docs/ja/specdojo/templates/cdr-template.md +58 -0
- package/docs/ja/specdojo/templates/cnd-template.md +137 -0
- package/docs/ja/specdojo/templates/cpd-template.md +129 -0
- package/docs/ja/specdojo/templates/cxd-template.md +105 -0
- package/docs/ja/specdojo/templates/dct-data-model-cdt-template.yaml +40 -0
- package/docs/ja/specdojo/templates/dct-data-model-cld-template.yaml +7 -14
- package/docs/ja/specdojo/templates/dct-index-template.md +9 -20
- package/docs/ja/specdojo/templates/dct-project-management-template.yaml +5 -1
- package/docs/ja/specdojo/templates/ifd-template.md +86 -0
- package/docs/ja/specdojo/templates/ifx-cmd-template.yaml +44 -28
- package/docs/ja/specdojo/templates/ifx-index-template.yaml +40 -0
- package/docs/ja/specdojo/templates/opr-template.md +2 -4
- package/docs/ja/specdojo/templates/pm-organization-template.md +9 -3
- package/docs/ja/specdojo/templates/pm-plan-template.md +4 -4
- package/docs/ja/specdojo/templates/pm-quality-management-plan-template.md +17 -9
- package/docs/ja/specdojo/templates/pm-raci-template.md +24 -13
- package/docs/ja/specdojo/templates/pm-roles-template.yaml +3 -2
- package/docs/ja/specdojo/templates/prj-assumptions-constraints-dependencies-template.md +6 -3
- package/docs/ja/specdojo/templates/prj-comparison-of-alternatives-template.md +22 -19
- package/docs/ja/specdojo/templates/stsd-template.md +46 -21
- package/docs/ja/specdojo/templates/sysd-critical-flows-template.md +94 -0
- package/docs/ja/specdojo/templates/sysd-cross-cutting-policy-template.md +122 -0
- package/docs/ja/specdojo/templates/sysd-index-template.md +89 -0
- package/docs/specdojo/lib/yaml-metadata.cjs +7 -0
- package/docs/specdojo/schemas/v1/bdd.schema.yaml +25 -57
- package/docs/specdojo/schemas/v1/condense-records.schema.yaml +26 -0
- package/docs/specdojo/schemas/v1/dct.schema.yaml +10 -0
- package/docs/specdojo/schemas/v1/deliverable-frontmatter.schema.yaml +3 -0
- package/docs/specdojo/schemas/v1/esil.schema.yaml +7 -141
- package/docs/specdojo/schemas/v1/exec-common.schema.yaml +5 -1
- package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +95 -8
- package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +38 -0
- package/docs/specdojo/schemas/v1/exec-plan-frontmatter.schema.yaml +14 -0
- package/docs/specdojo/schemas/v1/exec-result-frontmatter.schema.yaml +18 -0
- package/docs/specdojo/schemas/v1/finding-cause.schema.yaml +22 -0
- package/docs/specdojo/schemas/v1/grade-pipeline-state.schema.yaml +1 -1
- package/docs/specdojo/schemas/v1/grade-result.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/ifx-cmd.schema.yaml +65 -5
- package/docs/specdojo/schemas/v1/ifx-index.schema.yaml +142 -0
- package/docs/specdojo/schemas/v1/job-run.schema.yaml +23 -0
- package/docs/specdojo/schemas/v1/job.schema.yaml +63 -2
- package/docs/specdojo/schemas/v1/register-events.schema.yaml +2 -0
- package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +17 -1
- package/docs/specdojo/schemas/v1/sch-strategy.schema.yaml +2 -2
- package/package.json +10 -7
- package/templates/antigravity/orchestrator.md +7 -3
- package/templates/claude/agents/specdojo-orchestrator.md +7 -3
- package/templates/codex/agents/specdojo-orchestrator.toml +7 -3
- package/templates/codex/orchestrator.md +7 -3
- package/templates/devcontainer/tmux.conf +6 -0
- package/templates/init-exec-defaults.yaml +13 -0
- package/templates/lefthook/tools/specdojo-pre-commit.mjs +8 -0
- package/templates/opencode/agents/specdojo-orchestrator.md +8 -4
package/dist/exec/reporter.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join, relative, resolve, sep } from "node:path";
|
|
3
|
-
import { executorCompletionFailure } from "./evidence.js";
|
|
4
|
-
import { PARENT_VALIDATION_PROJECT_REPO, failedParentValidationReason, } from "./parent-validation.js";
|
|
5
3
|
import { getProjectExecutionPath, resolveRepoRoot, specdojoRootDir, } from "../shared/specdojo-config.js";
|
|
4
|
+
import { executorCompletionFailure } from "./evidence.js";
|
|
5
|
+
import { PARENT_VALIDATION_PROJECT_REPO, failedParentValidationReason, isAggregatedParentValidationSatisfied, } from "./parent-validation.js";
|
|
6
6
|
import { MAX_TEXT_LENGTH, parseReporterOutput, reporterOutputSchemaForMode, } from "./reporter-output.js";
|
|
7
|
+
import { isRunRecordPath, runnerRecordPrefixes } from "./run-records.js";
|
|
7
8
|
import { repoEnvironmentVariableName } from "./task-repos.js";
|
|
8
9
|
export { REPORTER_OUTPUT_SCHEMA, REVIEW_VERDICTS, parseReporterOutput, reporterOutputSchemaForMode, } from "./reporter-output.js";
|
|
9
10
|
const REPORTER_FORMAT_ATTEMPTS = 3;
|
|
@@ -41,6 +42,7 @@ function isRunnerManagedChangePath(path, scope) {
|
|
|
41
42
|
const execRoot = repoRelativePath(scope.repoRoot, join(scope.executionPath, "exec"));
|
|
42
43
|
const managedRoots = [
|
|
43
44
|
execRoot,
|
|
45
|
+
...runnerRecordPrefixes(repoRelativePath(scope.repoRoot, scope.executionPath)).map((path) => path.replace(/\/$/u, "")),
|
|
44
46
|
...(scope.registerPaths ?? []).map((path) => repoRelativePath(scope.repoRoot, path)),
|
|
45
47
|
];
|
|
46
48
|
const resultPath = scope.resultPath
|
|
@@ -69,10 +71,15 @@ export function evidenceForReporter(evidence, scope) {
|
|
|
69
71
|
const projectId = scope.projectId ??
|
|
70
72
|
factOptions.projectId ??
|
|
71
73
|
projectIdForExecutionPath(config, scope.repoRoot, scope.executionPath);
|
|
74
|
+
const resultPath = scope.resultPath
|
|
75
|
+
? repoRelativePath(scope.worktreePath, scope.resultPath)
|
|
76
|
+
: undefined;
|
|
77
|
+
const executorAttemptPaths = factOptions.executorAttemptPaths ?? executorAttemptPathsForEvidence(evidence, resultPath);
|
|
72
78
|
const scopedFactOptions = {
|
|
73
79
|
...factOptions,
|
|
74
80
|
...(projectId ? { projectId } : {}),
|
|
75
81
|
changedPaths: changes.map((change) => change.path),
|
|
82
|
+
...(executorAttemptPaths ? { executorAttemptPaths } : {}),
|
|
76
83
|
};
|
|
77
84
|
const mechanicallyNotApplicable = evidence.validations.flatMap((validation) => {
|
|
78
85
|
if (validation.source === "runner" || validation.status !== "not_run")
|
|
@@ -143,6 +150,7 @@ export function deriveReporterFacts(evidence, options = {}) {
|
|
|
143
150
|
const packageDependencies = options.packageDependencies ?? defaultPackageDependencies();
|
|
144
151
|
const specdojoConfig = options.specdojoConfig === undefined ? defaultSpecdojoConfig() : options.specdojoConfig;
|
|
145
152
|
const projectId = options.projectId ?? evidence.runner_scope?.project_id;
|
|
153
|
+
const executorAttemptPaths = options.executorAttemptPaths ?? executorAttemptPathsForEvidence(evidence);
|
|
146
154
|
const applicabilityOptions = {
|
|
147
155
|
packageScripts,
|
|
148
156
|
packageDependencies,
|
|
@@ -152,6 +160,7 @@ export function deriveReporterFacts(evidence, options = {}) {
|
|
|
152
160
|
? { productPackageManifests: options.productPackageManifests }
|
|
153
161
|
: {}),
|
|
154
162
|
changedPaths: options.changedPaths ?? evidence.changes.map((change) => change.path),
|
|
163
|
+
...(executorAttemptPaths ? { executorAttemptPaths } : {}),
|
|
155
164
|
};
|
|
156
165
|
const passedCommandsByRepo = new Map();
|
|
157
166
|
const runnerPassedCommandsByRepo = new Map();
|
|
@@ -165,6 +174,11 @@ export function deriveReporterFacts(evidence, options = {}) {
|
|
|
165
174
|
// 親検証の結果を正として満たされたものと扱う。executor の failed は runner の結果で
|
|
166
175
|
// 打ち消さない(PJR-2GZE、PJR-7AW0)。
|
|
167
176
|
for (const validation of evidence.validations) {
|
|
177
|
+
// runner が変更の種類で流さなかった検証(PJR-T01P)も、委譲先として済んだものと扱う。
|
|
178
|
+
if (validation.source === "runner" && validation.status === "not_applicable") {
|
|
179
|
+
addPassedCommand(runnerPassedCommandsByRepo, validation.repo ?? PARENT_VALIDATION_PROJECT_REPO, normalizeValidationCommand(validation.command));
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
168
182
|
if (validation.status !== "passed")
|
|
169
183
|
continue;
|
|
170
184
|
if (validation.source === "runner") {
|
|
@@ -224,6 +238,11 @@ export function deriveReporterFacts(evidence, options = {}) {
|
|
|
224
238
|
isPassedParentValidation(validation.command)) {
|
|
225
239
|
return false;
|
|
226
240
|
}
|
|
241
|
+
// 親検証をまとめて書いた 1 行は、挙がった検証がすべて親 runner で通っていれば満たす(PJR-Q2AT)。
|
|
242
|
+
if ((validation.status === "not_run" || validation.status === "not_applicable") &&
|
|
243
|
+
isAggregatedParentValidationSatisfied(validation.command, evidence.validations)) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
227
246
|
if (validation.status === "not_applicable") {
|
|
228
247
|
return !isValidNotApplicableValidation(validation.command, validation.reason, applicabilityOptions);
|
|
229
248
|
}
|
|
@@ -288,6 +307,34 @@ function specdojoCommandArgs(command) {
|
|
|
288
307
|
return (/^(?:npx\s+)?specdojo\s+(.+)$/u.exec(normalized)?.[1] ??
|
|
289
308
|
/^(?:(?:node --import tsx|npx tsx|tsx)\s+(?:\.\/)?src\/specdojo\.ts|node\s+(?:\.\/)?dist\/specdojo\.js)\s+(.+)$/u.exec(normalized)?.[1]);
|
|
290
309
|
}
|
|
310
|
+
function catalogValidateCommandArgs(command, scripts) {
|
|
311
|
+
const normalized = normalizeValidationCommand(command);
|
|
312
|
+
const direct = specdojoCommandArgs(normalized);
|
|
313
|
+
if (direct !== undefined && /^catalog\s+validate(?:\s|$)/u.test(direct)) {
|
|
314
|
+
return direct;
|
|
315
|
+
}
|
|
316
|
+
const helperMatch = /^node\s+(?:--import\s+tsx\s+)?(?:\.\/)?tools\/catalog-validate-if-configured\.mjs(?:\s+(.*))?$/u.exec(normalized);
|
|
317
|
+
if (helperMatch) {
|
|
318
|
+
return `catalog validate${helperMatch[1] ? ` ${helperMatch[1]}` : ""}`;
|
|
319
|
+
}
|
|
320
|
+
const scriptMatch = /^npm run ([A-Za-z0-9:_.-]+)(?:\s+(.*))?$/u.exec(normalized);
|
|
321
|
+
if (!scriptMatch)
|
|
322
|
+
return undefined;
|
|
323
|
+
const [, scriptName, rest] = scriptMatch;
|
|
324
|
+
if (!scriptName || (scripts !== undefined && !hasApplicableScript(scripts, scriptName))) {
|
|
325
|
+
return undefined;
|
|
326
|
+
}
|
|
327
|
+
const suffix = rest ? ` ${rest.replace(/^--\s*/u, "")}` : "";
|
|
328
|
+
if (scriptName === "validate:catalog") {
|
|
329
|
+
return `catalog validate${suffix}`;
|
|
330
|
+
}
|
|
331
|
+
const body = scripts?.[scriptName];
|
|
332
|
+
const bodyArgs = body ? specdojoCommandArgs(body) : undefined;
|
|
333
|
+
if (bodyArgs !== undefined && /^catalog\s+validate(?:\s|$)/u.test(bodyArgs)) {
|
|
334
|
+
return `${bodyArgs}${suffix}`;
|
|
335
|
+
}
|
|
336
|
+
return undefined;
|
|
337
|
+
}
|
|
291
338
|
/**
|
|
292
339
|
* Returns why a validation is owned by the runner rather than the executor. `specdojo index build`
|
|
293
340
|
* writes `.specdojo/doc-index.json`, which agents may not write; the runner regenerates the index
|
|
@@ -301,12 +348,45 @@ export function runnerOwnedValidationReason(command) {
|
|
|
301
348
|
return "index は runner が worktree の準備と統合の前に再生成する";
|
|
302
349
|
}
|
|
303
350
|
const PROJECT_DOCUMENTS_ROOT = "docs/ja/projects/";
|
|
351
|
+
const RUNNER_MANAGED_EXEC_RECORD_PATTERN = /(?:^|\/)exec\/(?:plans|results|evidence|events|\.locks)\//u;
|
|
352
|
+
const EXECUTOR_EDITABLE_EXEC_HISTORY_PATTERN = /(?:^|\/)exec\/(?:plans|results)\/.+\.md$/u;
|
|
353
|
+
function executorAttemptPathsForEvidence(evidence, resultPath) {
|
|
354
|
+
const entries = [
|
|
355
|
+
...(evidence.attempt_changes ?? []),
|
|
356
|
+
...(evidence.runner_context?.runner_managed_attempt_changes ?? []),
|
|
357
|
+
];
|
|
358
|
+
if (entries.length === 0)
|
|
359
|
+
return undefined;
|
|
360
|
+
return new Set(entries
|
|
361
|
+
.flatMap((change) => changedPathSides(change.path))
|
|
362
|
+
.filter((path) => path !== resultPath));
|
|
363
|
+
}
|
|
364
|
+
function isRunnerManagedExecRecordPath(path, executorAttemptPaths) {
|
|
365
|
+
const normalized = path.replaceAll("\\", "/").replace(/^\.\//u, "");
|
|
366
|
+
if (!RUNNER_MANAGED_EXEC_RECORD_PATTERN.test(normalized) && !isRunRecordPath(normalized))
|
|
367
|
+
return false;
|
|
368
|
+
if (executorAttemptPaths?.has(normalized) &&
|
|
369
|
+
(EXECUTOR_EDITABLE_EXEC_HISTORY_PATTERN.test(normalized) ||
|
|
370
|
+
(isRunRecordPath(normalized) && /\/(plan|result)\.md$/u.test(normalized)))) {
|
|
371
|
+
return false;
|
|
372
|
+
}
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
function isHistoryLinkTargetPath(path) {
|
|
376
|
+
const normalized = path.replaceAll("\\", "/").replace(/^\.\//u, "");
|
|
377
|
+
if (normalized === "pjr-index.md" || normalized.endsWith("/pjr-index.md")) {
|
|
378
|
+
return false;
|
|
379
|
+
}
|
|
380
|
+
return (/^docs\/ja\/projects\/.+\/controls\/project-register\/pjr-[^/]+\.md$/u.test(normalized) ||
|
|
381
|
+
/^docs\/ja\/projects\/.+\/exec\/(?:plans|results)\/.+\.md$/u.test(normalized) ||
|
|
382
|
+
(isRunRecordPath(normalized) && /\/(plan|result)\.md$/u.test(normalized)));
|
|
383
|
+
}
|
|
304
384
|
const hasExtension = (extensions) => (path) => {
|
|
305
385
|
const normalized = path.toLowerCase();
|
|
306
386
|
return extensions.some((extension) => normalized.endsWith(extension));
|
|
307
387
|
};
|
|
308
388
|
// The command-to-change mapping is kept in one place and mirrors the change-type rows in
|
|
309
|
-
//
|
|
389
|
+
// xp-common-conventions-template.md. Checks such as typecheck intentionally remain outside this
|
|
310
390
|
// table: PJR-8WBN requires their existing script-based applicability to stay unchanged.
|
|
311
391
|
const CHANGE_SCOPED_VALIDATIONS = [
|
|
312
392
|
{
|
|
@@ -326,13 +406,25 @@ const CHANGE_SCOPED_VALIDATIONS = [
|
|
|
326
406
|
/^node\s+\S*specdojo-docs-lint\.js\s+markdownlint(?:\s|$)/u.test(command),
|
|
327
407
|
matchesPath: hasExtension([".md"]),
|
|
328
408
|
},
|
|
409
|
+
{
|
|
410
|
+
pathCondition: "履歴蓄積ファイル(登録簿の個票 controls/project-register/pjr-*.md など、pjr-index.md と runner が書く plan・result を除く)",
|
|
411
|
+
matchesCommand: (command) => /^npm run validate:history-links(?:\s|$)/u.test(command) ||
|
|
412
|
+
/^(?:npx\s+)?specdojo-docs-lint\s+history-links(?:\s|$)/u.test(command) ||
|
|
413
|
+
/^node\s+\S*specdojo-docs-lint\.js\s+history-links(?:\s|$)/u.test(command),
|
|
414
|
+
matchesPath: isHistoryLinkTargetPath,
|
|
415
|
+
},
|
|
329
416
|
];
|
|
330
417
|
function changedPathSides(path) {
|
|
331
418
|
return path.split(" -> ").map((side) => side.replaceAll("\\", "/").replace(/^\.\//u, ""));
|
|
332
419
|
}
|
|
333
|
-
function
|
|
420
|
+
function deliverableChangedPathSides(changedPaths, executorAttemptPaths) {
|
|
421
|
+
return changedPaths
|
|
422
|
+
.flatMap(changedPathSides)
|
|
423
|
+
.filter((path) => !isRunnerManagedExecRecordPath(path, executorAttemptPaths));
|
|
424
|
+
}
|
|
425
|
+
function changePathsForCommand(changedPaths, repoName, config, projectId, executorAttemptPaths) {
|
|
334
426
|
const repoNames = declaredRepos(config, projectId).map((repo) => repo.name);
|
|
335
|
-
return changedPaths
|
|
427
|
+
return deliverableChangedPathSides(changedPaths, executorAttemptPaths).flatMap((path) => {
|
|
336
428
|
if (repoName !== undefined) {
|
|
337
429
|
const prefix = `${repoName}:`;
|
|
338
430
|
return path.startsWith(prefix) ? [path.slice(prefix.length)] : [];
|
|
@@ -340,13 +432,13 @@ function changePathsForCommand(changedPaths, repoName, config, projectId) {
|
|
|
340
432
|
return repoNames.some((name) => path.startsWith(`${name}:`)) ? [] : [path];
|
|
341
433
|
});
|
|
342
434
|
}
|
|
343
|
-
function changeScopedValidationApplicability(command, changedPaths, repoName, config, projectId) {
|
|
435
|
+
function changeScopedValidationApplicability(command, changedPaths, repoName, config, projectId, executorAttemptPaths) {
|
|
344
436
|
const validation = CHANGE_SCOPED_VALIDATIONS.find(({ matchesCommand }) => matchesCommand(command));
|
|
345
437
|
if (!validation)
|
|
346
438
|
return { recognized: false };
|
|
347
439
|
if (changedPaths === undefined)
|
|
348
440
|
return { recognized: true };
|
|
349
|
-
const relevantPaths = changePathsForCommand(changedPaths, repoName, config, projectId);
|
|
441
|
+
const relevantPaths = changePathsForCommand(changedPaths, repoName, config, projectId, executorAttemptPaths);
|
|
350
442
|
return relevantPaths.some(validation.matchesPath)
|
|
351
443
|
? { recognized: true, applicable: true }
|
|
352
444
|
: {
|
|
@@ -355,19 +447,19 @@ function changeScopedValidationApplicability(command, changedPaths, repoName, co
|
|
|
355
447
|
reason: `変更に ${validation.pathCondition} がない`,
|
|
356
448
|
};
|
|
357
449
|
}
|
|
358
|
-
function changesReachProjectDocuments(changedPaths) {
|
|
359
|
-
return changedPaths
|
|
360
|
-
.flatMap((path) => path.split(" -> "))
|
|
361
|
-
.some((path) => path.replaceAll("\\", "/").replace(/^\.\//u, "").startsWith(PROJECT_DOCUMENTS_ROOT));
|
|
450
|
+
function changesReachProjectDocuments(changedPaths, executorAttemptPaths) {
|
|
451
|
+
return deliverableChangedPathSides(changedPaths, executorAttemptPaths).some((path) => path.startsWith(PROJECT_DOCUMENTS_ROOT));
|
|
362
452
|
}
|
|
363
453
|
function projectOptionOf(args) {
|
|
364
454
|
return /(?:^|\s)--project(?:=|\s+)([A-Za-z0-9_-]+)(?=\s|$)/u.exec(args)?.[1];
|
|
365
455
|
}
|
|
366
|
-
function specdojoCommandApplicability(command, config, runProjectId, changedPaths) {
|
|
367
|
-
const
|
|
368
|
-
|
|
456
|
+
function specdojoCommandApplicability(command, config, runProjectId, changedPaths, scripts, executorAttemptPaths) {
|
|
457
|
+
const directArgs = specdojoCommandArgs(command);
|
|
458
|
+
const catalogArgs = catalogValidateCommandArgs(command, scripts);
|
|
459
|
+
if (directArgs === undefined && catalogArgs === undefined)
|
|
369
460
|
return { recognized: false };
|
|
370
|
-
|
|
461
|
+
const args = catalogArgs ?? directArgs;
|
|
462
|
+
if (args === undefined || !/^catalog\s+validate(?:\s|$)/u.test(args)) {
|
|
371
463
|
return { recognized: true, applicable: undefined };
|
|
372
464
|
}
|
|
373
465
|
const configuredProjectId = config?.current_project;
|
|
@@ -381,8 +473,10 @@ function specdojoCommandApplicability(command, config, runProjectId, changedPath
|
|
|
381
473
|
return { recognized: true, applicable: undefined };
|
|
382
474
|
}
|
|
383
475
|
if (typeof project.catalog_path === "string" && project.catalog_path.trim()) {
|
|
384
|
-
// plan の共通規約は catalog validate を docs/ja/projects/
|
|
385
|
-
|
|
476
|
+
// plan の共通規約は catalog validate を docs/ja/projects/ 配下の変更(runner が書く
|
|
477
|
+
// exec/ 配下の plan・result などを除く)に限って求める。
|
|
478
|
+
if (changedPaths !== undefined &&
|
|
479
|
+
!changesReachProjectDocuments(changedPaths, executorAttemptPaths)) {
|
|
386
480
|
return {
|
|
387
481
|
recognized: true,
|
|
388
482
|
applicable: false,
|
|
@@ -407,12 +501,12 @@ function specdojoCommandApplicability(command, config, runProjectId, changedPath
|
|
|
407
501
|
export function mechanicallyNotApplicableReason(command, options = {}) {
|
|
408
502
|
const normalized = normalizeValidationCommand(command);
|
|
409
503
|
const config = options.specdojoConfig === undefined ? defaultSpecdojoConfig() : options.specdojoConfig;
|
|
410
|
-
const
|
|
504
|
+
const manifest = commandManifest(normalized, options, config);
|
|
505
|
+
const specdojo = specdojoCommandApplicability(manifest.command, config, options.projectId, options.changedPaths, manifest.scripts, options.executorAttemptPaths);
|
|
411
506
|
if (specdojo.recognized) {
|
|
412
507
|
return specdojo.applicable === false ? specdojo.reason : undefined;
|
|
413
508
|
}
|
|
414
|
-
const
|
|
415
|
-
const changeScoped = changeScopedValidationApplicability(manifest.command, options.changedPaths, manifest.repoName, config, options.projectId);
|
|
509
|
+
const changeScoped = changeScopedValidationApplicability(manifest.command, options.changedPaths, manifest.repoName, config, options.projectId, options.executorAttemptPaths);
|
|
416
510
|
if (changeScoped.applicable === false)
|
|
417
511
|
return changeScoped.reason;
|
|
418
512
|
const packageJson = manifest.repoName === undefined ? "package.json" : `${manifest.repoName} の package.json`;
|
|
@@ -433,13 +527,17 @@ function isValidNotApplicableValidation(command, reason, options) {
|
|
|
433
527
|
return false;
|
|
434
528
|
const normalized = normalizeValidationCommand(command);
|
|
435
529
|
const config = options.specdojoConfig === undefined ? defaultSpecdojoConfig() : options.specdojoConfig;
|
|
436
|
-
const
|
|
530
|
+
const manifest = commandManifest(normalized, options, config);
|
|
531
|
+
const specdojo = specdojoCommandApplicability(manifest.command, config, options.projectId, options.changedPaths, manifest.scripts, options.executorAttemptPaths);
|
|
437
532
|
if (specdojo.recognized)
|
|
438
533
|
return specdojo.applicable !== true;
|
|
439
|
-
const
|
|
440
|
-
const changeScoped = changeScopedValidationApplicability(manifest.command, options.changedPaths, manifest.repoName, config, options.projectId);
|
|
534
|
+
const changeScoped = changeScopedValidationApplicability(manifest.command, options.changedPaths, manifest.repoName, config, options.projectId, options.executorAttemptPaths);
|
|
441
535
|
if (changeScoped.applicable === false)
|
|
442
536
|
return true;
|
|
537
|
+
if (changeScoped.applicable === true &&
|
|
538
|
+
/^node\s+\S*specdojo-docs-lint\.js\s+(?:history-links|markdownlint)(?:\s|$)/u.test(manifest.command)) {
|
|
539
|
+
return false;
|
|
540
|
+
}
|
|
443
541
|
const scriptName = invokedScriptNameOf(manifest.command);
|
|
444
542
|
if (scriptName !== undefined && hasApplicableScript(manifest.scripts, scriptName))
|
|
445
543
|
return false;
|
package/dist/exec/results.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync,
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join, resolve, sep } from "node:path";
|
|
4
4
|
import { isDeepStrictEqual } from "node:util";
|
|
5
5
|
import { buildSpecdojoFrontmatter, parseSpecdojoDocument } from "../docs/frontmatter-namespace.js";
|
|
6
|
-
import { escapeMarkdownInline, expandTemplate, stripTerminalControlSequences } from "./shared.js";
|
|
7
|
-
import { formatMarkdownFile } from "./format.js";
|
|
8
|
-
import { deriveReporterFacts, mechanicallyNotApplicableReason, runnerOwnedValidationReason, } from "./reporter.js";
|
|
9
6
|
import { resolveSpecdojoPath, resolveSpecdojoPathIfExists } from "../docs/template-resolution.js";
|
|
10
|
-
import { dump } from "../shared/yaml.js";
|
|
11
7
|
import { gitEnvironment } from "../shared/git-environment.js";
|
|
8
|
+
import { dump } from "../shared/yaml.js";
|
|
9
|
+
import { formatMarkdownFile } from "./format.js";
|
|
10
|
+
import { deriveReporterFacts, mechanicallyNotApplicableReason, runnerOwnedValidationReason, } from "./reporter.js";
|
|
11
|
+
import { isRunRecordPath, listRunRecords, recordPathForRead, recordStem, resolveRunPlanRef, resultForPlan, taskRecordPaths, } from "./run-records.js";
|
|
12
|
+
import { escapeMarkdownInline, expandTemplate, inlineCodeFrontmatterAnglePlaceholders, stripTerminalControlSequences, } from "./shared.js";
|
|
13
|
+
import { isCondenseRecords } from "../shared/condense-records.js";
|
|
14
|
+
import { inlineCode } from "./plans-grade-findings.js";
|
|
12
15
|
export const MAX_INDIVIDUAL_CHANGED_FILES = 50;
|
|
13
16
|
// ---------------------------------------------------------------------------
|
|
14
17
|
// Frontmatter helpers
|
|
@@ -25,6 +28,22 @@ function serializeYamlString(value) {
|
|
|
25
28
|
const serialized = dump(value, { lineWidth: -1, noRefs: true }).replace(/\n$/, "");
|
|
26
29
|
return serialized.includes("\n") ? JSON.stringify(value) : serialized;
|
|
27
30
|
}
|
|
31
|
+
// executor 由来の condense の記録を frontmatter へ書き写す前に、コードスパン外の山括弧を
|
|
32
|
+
// code span 化する。むき出しの `<provider>` などは lint-fm で失敗する(PJR-V141)。
|
|
33
|
+
// 既に code span の語は変えないため、再シリアライズでも値は変わらない。
|
|
34
|
+
function frontmatterCondenseRecords(records) {
|
|
35
|
+
return records.map((record) => ({
|
|
36
|
+
...record,
|
|
37
|
+
location: inlineCodeFrontmatterAnglePlaceholders(record.location),
|
|
38
|
+
reason: inlineCodeFrontmatterAnglePlaceholders(record.reason),
|
|
39
|
+
cause: record.cause.type === "kata"
|
|
40
|
+
? {
|
|
41
|
+
...record.cause,
|
|
42
|
+
location: inlineCodeFrontmatterAnglePlaceholders(record.cause.location),
|
|
43
|
+
}
|
|
44
|
+
: record.cause,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
28
47
|
function serializeFrontmatter(meta) {
|
|
29
48
|
const inner = [
|
|
30
49
|
`id: ${serializeYamlString(meta.id)}`,
|
|
@@ -56,11 +75,17 @@ function serializeFrontmatter(meta) {
|
|
|
56
75
|
for (const target of meta.targets)
|
|
57
76
|
inner.push(` - ${serializeYamlString(target)}`);
|
|
58
77
|
}
|
|
78
|
+
if (meta.condense_records) {
|
|
79
|
+
inner.push(...dump({ condense_records: frontmatterCondenseRecords(meta.condense_records) }, { lineWidth: -1, noRefs: true })
|
|
80
|
+
.trimEnd()
|
|
81
|
+
.split("\n"));
|
|
82
|
+
}
|
|
59
83
|
// reason は agent stderr や subprocess の生出力由来で任意文字を含みうる。まず ANSI エスケープ
|
|
60
84
|
// シーケンスや制御文字を除去し(色付き hook 出力が result 表示を壊すのを防ぐ)、JSON の
|
|
61
85
|
// 文字列形式で YAML へ埋め込む。改行・引用符・バックスラッシュも値を変えずに保持できる。
|
|
62
86
|
if (meta.block_reason) {
|
|
63
|
-
|
|
87
|
+
// executor の stderr(`blocked: <reason>` など)の山括弧も lint-fm で失敗するため code span 化する。
|
|
88
|
+
const safeReason = inlineCodeFrontmatterAnglePlaceholders(stripTerminalControlSequences(meta.block_reason));
|
|
64
89
|
inner.push(`block_reason: ${JSON.stringify(safeReason)}`);
|
|
65
90
|
}
|
|
66
91
|
return buildSpecdojoFrontmatter(inner);
|
|
@@ -84,7 +109,12 @@ function parseFrontmatter(content) {
|
|
|
84
109
|
else if (typeof value === "number" || typeof value === "boolean")
|
|
85
110
|
meta[key] = String(value);
|
|
86
111
|
}
|
|
87
|
-
return {
|
|
112
|
+
return {
|
|
113
|
+
meta,
|
|
114
|
+
...(targets ? { targets } : {}),
|
|
115
|
+
body,
|
|
116
|
+
...(isCondenseRecords(data.condense_records) ? { condenseRecords: data.condense_records } : {}),
|
|
117
|
+
};
|
|
88
118
|
}
|
|
89
119
|
function frontmatterWithBody(frontmatter, body) {
|
|
90
120
|
return `${frontmatter}\n\n${body.replace(/^\n+/, "")}`;
|
|
@@ -111,6 +141,9 @@ function loadResultTemplate(mode, approach, execution) {
|
|
|
111
141
|
if (mode === "edit" && execution === "human" && approach === "draft") {
|
|
112
142
|
return readFileSync(resolveSpecdojoPath("docs/ja/specdojo/exec-templates/xer-human-draft-template.md"), "utf8");
|
|
113
143
|
}
|
|
144
|
+
if (mode === "edit" && approach === "condense") {
|
|
145
|
+
return readFileSync(resolveSpecdojoPath("docs/ja/specdojo/exec-templates/xer-condense-template.md"), "utf8");
|
|
146
|
+
}
|
|
114
147
|
if (mode === "edit" && approach === "cross-deliverable-dedup") {
|
|
115
148
|
const crossDeliverablePath = resolveSpecdojoPathIfExists("docs/ja/specdojo/exec-templates/xer-cross-deliverable-dedup-template.md");
|
|
116
149
|
if (crossDeliverablePath)
|
|
@@ -128,17 +161,14 @@ function loadResultTemplate(mode, approach, execution) {
|
|
|
128
161
|
// Public API
|
|
129
162
|
// ---------------------------------------------------------------------------
|
|
130
163
|
export function resultPathForTask(executionPath, nameBase) {
|
|
131
|
-
return
|
|
164
|
+
return recordPathForRead(executionPath, "result", nameBase);
|
|
132
165
|
}
|
|
133
166
|
// A unique-name run retains every attempt as a separate result. When a new result is scaffolded,
|
|
134
167
|
// close older unfinished attempts for the same task so they no longer look active or actionable.
|
|
135
168
|
// Fixed-name runs return before this helper is reached and continue to reuse their single result.
|
|
136
169
|
async function supersedePriorResults(resultsDir, taskId, nextResultPath, supersededAt) {
|
|
137
170
|
const supersededPaths = [];
|
|
138
|
-
for (const
|
|
139
|
-
if (!fileName.endsWith("-result.md"))
|
|
140
|
-
continue;
|
|
141
|
-
const candidatePath = join(resultsDir, fileName);
|
|
171
|
+
for (const candidatePath of listRunRecords(resultsDir, "result")) {
|
|
142
172
|
if (candidatePath === nextResultPath)
|
|
143
173
|
continue;
|
|
144
174
|
let meta;
|
|
@@ -172,13 +202,18 @@ const APPROACH_SECTION_WITHOUT_APPROACH = [
|
|
|
172
202
|
].join("\n");
|
|
173
203
|
export async function scaffoldResult(opts) {
|
|
174
204
|
const { executionPath, taskId, mode, projectId, planRef, agent, startedAt, approach } = opts;
|
|
175
|
-
|
|
176
|
-
|
|
205
|
+
if (approach === "condense" && (mode !== "edit" || opts.targets?.length !== 1)) {
|
|
206
|
+
throw new Error("condense requires edit mode and exactly one target");
|
|
207
|
+
}
|
|
208
|
+
const stem = opts.stem ?? (planRef && isRunRecordPath(planRef) ? recordStem(planRef) : taskId);
|
|
209
|
+
const resultPath = planRef && isRunRecordPath(planRef)
|
|
210
|
+
? resultForPlan(resolveRunPlanRef(executionPath, planRef))
|
|
211
|
+
: taskRecordPaths(executionPath, taskId, opts.runId ?? stem, opts.origin).result;
|
|
177
212
|
// Idempotent: claim and exec run can both reach this; never clobber an in-progress result.
|
|
178
213
|
if (existsSync(resultPath)) {
|
|
179
214
|
return { resultPath, created: false, supersededPaths: [] };
|
|
180
215
|
}
|
|
181
|
-
const resultsDir =
|
|
216
|
+
const resultsDir = dirname(resultPath);
|
|
182
217
|
if (!existsSync(resultsDir))
|
|
183
218
|
mkdirSync(resultsDir, { recursive: true });
|
|
184
219
|
const template = loadResultTemplate(mode, approach, opts.execution);
|
|
@@ -197,6 +232,7 @@ export async function scaffoldResult(opts) {
|
|
|
197
232
|
...(planRef ? { plan_ref: planRef } : {}),
|
|
198
233
|
...(opts.execution ? { execution: opts.execution } : {}),
|
|
199
234
|
...(approach ? { approach } : {}),
|
|
235
|
+
...(approach === "condense" ? { condense_records: [] } : {}),
|
|
200
236
|
...(opts.targets && opts.targets.length > 0 ? { targets: opts.targets } : {}),
|
|
201
237
|
};
|
|
202
238
|
const values = {
|
|
@@ -218,7 +254,7 @@ export async function scaffoldResult(opts) {
|
|
|
218
254
|
}
|
|
219
255
|
writeFileSync(resultPath, content, "utf8");
|
|
220
256
|
await formatMarkdownFile(resultPath);
|
|
221
|
-
const supersededPaths = await supersedePriorResults(
|
|
257
|
+
const supersededPaths = await supersedePriorResults(executionPath, taskId, resultPath, startedAt);
|
|
222
258
|
return { resultPath, created: true, supersededPaths };
|
|
223
259
|
}
|
|
224
260
|
// 必須節が未記入(テンプレートのプレースホルダのまま)かを検知するためのマーカー。
|
|
@@ -295,10 +331,24 @@ export function isResultUnfilled(resultPath, mode, scaffoldFrontmatter, original
|
|
|
295
331
|
return true;
|
|
296
332
|
if (!hasNonEmptyScaffoldFields(current.data, mode))
|
|
297
333
|
return true;
|
|
334
|
+
if (current.data.approach === "condense" &&
|
|
335
|
+
(mode !== "edit" ||
|
|
336
|
+
!isCondenseRecords(current.data.condense_records) ||
|
|
337
|
+
!Array.isArray(current.data.targets) ||
|
|
338
|
+
current.data.targets.length !== 1))
|
|
339
|
+
return true;
|
|
340
|
+
// Condense records are executor facts, filled after scaffolding. Identity and lifecycle
|
|
341
|
+
// fields retain the same comparisons as every other approach.
|
|
342
|
+
const comparable = (data) => {
|
|
343
|
+
const copy = { ...data };
|
|
344
|
+
if (data.approach === "condense" && isCondenseRecords(data.condense_records))
|
|
345
|
+
delete copy.condense_records;
|
|
346
|
+
return copy;
|
|
347
|
+
};
|
|
298
348
|
if (scaffoldFrontmatter !== undefined) {
|
|
299
349
|
if (!hasNonEmptyScaffoldFields(scaffoldFrontmatter, mode))
|
|
300
350
|
return true;
|
|
301
|
-
if (!isDeepStrictEqual(current.data, scaffoldFrontmatter))
|
|
351
|
+
if (!isDeepStrictEqual(comparable(current.data), comparable(scaffoldFrontmatter)))
|
|
302
352
|
return true;
|
|
303
353
|
}
|
|
304
354
|
// resume 時は、実行直前の worktree result を上の厳密比較に使う。さらに root に保持した
|
|
@@ -307,7 +357,7 @@ export function isResultUnfilled(resultPath, mode, scaffoldFrontmatter, original
|
|
|
307
357
|
if (originalScaffoldFrontmatter !== undefined) {
|
|
308
358
|
if (!hasNonEmptyScaffoldFields(originalScaffoldFrontmatter, mode))
|
|
309
359
|
return true;
|
|
310
|
-
if (!isDeepStrictEqual(immutableScaffoldFields(current.data), immutableScaffoldFields(originalScaffoldFrontmatter))) {
|
|
360
|
+
if (!isDeepStrictEqual(immutableScaffoldFields(comparable(current.data)), immutableScaffoldFields(comparable(originalScaffoldFrontmatter)))) {
|
|
311
361
|
return true;
|
|
312
362
|
}
|
|
313
363
|
}
|
|
@@ -610,7 +660,7 @@ export function renderEditReporterBody(output, evidence, options) {
|
|
|
610
660
|
? `rate limit 後に ${event.resume_at ?? "再開可能時刻"} まで待ち、${event.to_actor} で ${event.resumed_at} に再開`
|
|
611
661
|
: `${event.trigger === "connection_error" ? "接続エラー" : "rate limit"}後に ${event.from_actor} から ${event.to_actor} へ切り替え、${event.resumed_at} に再開`);
|
|
612
662
|
return [
|
|
613
|
-
"# Edit Result",
|
|
663
|
+
options?.approach === "condense" ? "# Condense Result" : "# Edit Result",
|
|
614
664
|
"",
|
|
615
665
|
"## 1. 実施内容",
|
|
616
666
|
"",
|
|
@@ -667,9 +717,24 @@ function renderReviewReporterBody(output, evidence) {
|
|
|
667
717
|
`- verdict: ${output.verdict}`,
|
|
668
718
|
].join("\n");
|
|
669
719
|
}
|
|
720
|
+
function renderCondenseRecords(records) {
|
|
721
|
+
if (!records.length)
|
|
722
|
+
return "なし";
|
|
723
|
+
const cell = (text) => inlineCode(text).replaceAll("|", "\\|");
|
|
724
|
+
return [
|
|
725
|
+
"| 場所(修正前) | 種類 | 直し方 | 残した理由/意味の維持 | 原因 |",
|
|
726
|
+
"| --- | --- | --- | --- | --- |",
|
|
727
|
+
...records.map((record) => {
|
|
728
|
+
const cause = record.cause.type === "kata"
|
|
729
|
+
? `kata:${record.cause.kind}; location=${record.cause.location}`
|
|
730
|
+
: "document";
|
|
731
|
+
return `| ${[record.location, record.category, record.action, record.reason, cause].map(cell).join(" | ")} |`;
|
|
732
|
+
}),
|
|
733
|
+
].join("\n");
|
|
734
|
+
}
|
|
670
735
|
/**
|
|
671
|
-
*
|
|
672
|
-
*
|
|
736
|
+
* Renders reporter prose and runner-owned facts. Condense records come only from validated
|
|
737
|
+
* executor evidence; all other approaches preserve the scaffold frontmatter byte-for-byte.
|
|
673
738
|
*/
|
|
674
739
|
export async function renderReporterResult(resultPath, output, evidence, options) {
|
|
675
740
|
if (!existsSync(resultPath))
|
|
@@ -679,7 +744,7 @@ export async function renderReporterResult(resultPath, output, evidence, options
|
|
|
679
744
|
if (parsed.data.mode !== output.mode) {
|
|
680
745
|
throw new Error(`reporter mode does not match result scaffold: ${output.mode}`);
|
|
681
746
|
}
|
|
682
|
-
|
|
747
|
+
let frontmatter = content.match(/^---\r?\n[\s\S]*?\r?\n---/)?.[0];
|
|
683
748
|
if (!frontmatter)
|
|
684
749
|
throw new Error(`Result frontmatter not found: ${resultPath}`);
|
|
685
750
|
const approach = options?.approach ??
|
|
@@ -691,17 +756,30 @@ export async function renderReporterResult(resultPath, output, evidence, options
|
|
|
691
756
|
...(approach ? { approach } : {}),
|
|
692
757
|
worktreeDir: options?.worktreeDir ?? findGitRoot(dirname(resultPath)) ?? undefined,
|
|
693
758
|
};
|
|
759
|
+
let recordsBody = "";
|
|
760
|
+
if (approach === "condense" && output.mode === "edit") {
|
|
761
|
+
if (!isCondenseRecords(evidence.condense_records)) {
|
|
762
|
+
throw new Error("condense requires valid executor condense_records (use [] when no candidates)");
|
|
763
|
+
}
|
|
764
|
+
// Preserve scaffold ownership; add only validated executor facts, never reporter prose.
|
|
765
|
+
const scaffold = {
|
|
766
|
+
...parsed.data,
|
|
767
|
+
condense_records: frontmatterCondenseRecords(evidence.condense_records),
|
|
768
|
+
};
|
|
769
|
+
frontmatter = `---\n${dump({ specdojo: scaffold }, { lineWidth: -1, noRefs: true }).trimEnd()}\n---`;
|
|
770
|
+
recordsBody = `\n\n## 5. 修正・保持の記録\n\n${renderCondenseRecords(evidence.condense_records)}`;
|
|
771
|
+
}
|
|
694
772
|
const body = output.mode === "edit"
|
|
695
773
|
? renderEditReporterBody(output, evidence, resolvedOptions)
|
|
696
774
|
: renderReviewReporterBody(output, evidence);
|
|
697
|
-
writeFileSync(resultPath, frontmatterWithBody(frontmatter, body), "utf8");
|
|
775
|
+
writeFileSync(resultPath, frontmatterWithBody(frontmatter, body + recordsBody), "utf8");
|
|
698
776
|
await formatMarkdownFile(resultPath);
|
|
699
777
|
}
|
|
700
778
|
export async function updateResultStatus(resultPath, status, completedAt, reason) {
|
|
701
779
|
if (!existsSync(resultPath))
|
|
702
780
|
return;
|
|
703
781
|
const content = readFileSync(resultPath, "utf8");
|
|
704
|
-
const { meta: existingMeta, targets: existingTargets, body } = parseFrontmatter(content);
|
|
782
|
+
const { meta: existingMeta, targets: existingTargets, condenseRecords, body, } = parseFrontmatter(content);
|
|
705
783
|
// block 理由は blocked のときのみ保持する。新しい reason を優先し、無ければ既存値を残す。
|
|
706
784
|
// complete へ遷移した場合は理由を消す。
|
|
707
785
|
const blockReason = status === "blocked" ? (reason ?? existingMeta.block_reason ?? undefined) : undefined;
|
|
@@ -724,6 +802,7 @@ export async function updateResultStatus(resultPath, status, completedAt, reason
|
|
|
724
802
|
: {}),
|
|
725
803
|
approach: existingMeta.approach ? existingMeta.approach : undefined,
|
|
726
804
|
...(existingTargets ? { targets: existingTargets } : {}),
|
|
805
|
+
...(condenseRecords ? { condense_records: condenseRecords } : {}),
|
|
727
806
|
...(blockReason ? { block_reason: blockReason } : {}),
|
|
728
807
|
};
|
|
729
808
|
writeFileSync(resultPath, frontmatterWithBody(serializeFrontmatter(updatedMeta), body), "utf8");
|
|
@@ -736,7 +815,7 @@ export async function resetResultForClaim(resultPath, agent, startedAt, executio
|
|
|
736
815
|
if (!existsSync(resultPath))
|
|
737
816
|
return;
|
|
738
817
|
const content = readFileSync(resultPath, "utf8");
|
|
739
|
-
const { meta: existingMeta, targets: existingTargets, body } = parseFrontmatter(content);
|
|
818
|
+
const { meta: existingMeta, targets: existingTargets, condenseRecords, body, } = parseFrontmatter(content);
|
|
740
819
|
const existingExecution = existingMeta.execution === "human" || existingMeta.execution === "agent"
|
|
741
820
|
? existingMeta.execution
|
|
742
821
|
: undefined;
|
|
@@ -757,6 +836,7 @@ export async function resetResultForClaim(resultPath, agent, startedAt, executio
|
|
|
757
836
|
...(nextExecution ? { execution: nextExecution } : {}),
|
|
758
837
|
approach: existingMeta.approach ? existingMeta.approach : undefined,
|
|
759
838
|
...(existingTargets ? { targets: existingTargets } : {}),
|
|
839
|
+
...(condenseRecords ? { condense_records: condenseRecords } : {}),
|
|
760
840
|
};
|
|
761
841
|
writeFileSync(resultPath, frontmatterWithBody(serializeFrontmatter(updatedMeta), body), "utf8");
|
|
762
842
|
await formatMarkdownFile(resultPath);
|
|
@@ -775,6 +855,7 @@ export function parseResultTaskIdentity(resultContent) {
|
|
|
775
855
|
[
|
|
776
856
|
"draft",
|
|
777
857
|
"fully-guided",
|
|
858
|
+
"condense",
|
|
778
859
|
"recipe-guided",
|
|
779
860
|
"freeform",
|
|
780
861
|
"bootstrap",
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { isReviewVerdict } from "../review/types.js";
|
|
3
|
+
// review の verdict のうち、タスクの完了可否を判断していない(保留を表す)値。review result を
|
|
4
|
+
// 記録できても、runner はこの verdict のタスクを done にせず blocked にする(PJR-M18B)。
|
|
5
|
+
export const PENDING_REVIEW_VERDICTS = new Set([
|
|
6
|
+
"grade-stale",
|
|
7
|
+
"grade-unavailable",
|
|
8
|
+
"changed-during-review",
|
|
9
|
+
]);
|
|
10
|
+
const PENDING_VERDICT_NEXT_ACTION = {
|
|
11
|
+
"grade-stale": "run `specdojo grade run` for the review subject until it succeeds, then re-run the review task",
|
|
12
|
+
"grade-unavailable": "repair the unreadable grade result sidecar or re-run `specdojo grade run`, then re-run the review task",
|
|
13
|
+
"changed-during-review": "re-run the review task against the current content of the review subject",
|
|
14
|
+
};
|
|
15
|
+
/** Read the review verdict recorded in a review result. */
|
|
16
|
+
export function reviewResultVerdict(resultPath) {
|
|
17
|
+
if (!existsSync(resultPath))
|
|
18
|
+
return undefined;
|
|
19
|
+
const value = readFileSync(resultPath, "utf8").match(/^- verdict:\s*(\S+)\s*$/m)?.[1];
|
|
20
|
+
return isReviewVerdict(value) ? value : undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Decide whether a review task must be blocked instead of completed. A grade that still failed
|
|
24
|
+
* after its retries, or a pending verdict, leaves the subject without a usable grade.
|
|
25
|
+
* Returns the block reason with the next action, or undefined when completion may proceed.
|
|
26
|
+
*/
|
|
27
|
+
export function reviewCompletionBlockReason(params) {
|
|
28
|
+
const { verdict, gradeOutcome } = params;
|
|
29
|
+
if (gradeOutcome?.action === "failed") {
|
|
30
|
+
return (`review grade failed after ${gradeOutcome.attempts} attempt(s): ${gradeOutcome.detail}` +
|
|
31
|
+
`; need=fix the grade failure (for example the grade output format) and re-run the review task` +
|
|
32
|
+
`; ref=grade run ${gradeOutcome.runId}`);
|
|
33
|
+
}
|
|
34
|
+
if (verdict && PENDING_REVIEW_VERDICTS.has(verdict)) {
|
|
35
|
+
return `review verdict is ${verdict}; need=${PENDING_VERDICT_NEXT_ACTION[verdict]}`;
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
/** Read the result verdict and decide the block reason for a review-mode task. */
|
|
40
|
+
export function reviewTaskBlockReason(params) {
|
|
41
|
+
if (params.mode !== "review")
|
|
42
|
+
return undefined;
|
|
43
|
+
return reviewCompletionBlockReason({
|
|
44
|
+
verdict: reviewResultVerdict(params.resultPath),
|
|
45
|
+
...(params.gradeOutcome ? { gradeOutcome: params.gradeOutcome } : {}),
|
|
46
|
+
});
|
|
47
|
+
}
|