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
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { join, resolve } from "node:path";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { repoRelative, stageCommitTargets, worktreeStatusPaths as statusPaths, } from "../shared/git.js";
|
|
5
|
+
import { DEFAULT_MARKDOWNLINT_CONFIG, hasMarkdownlintConfig, } from "../shared/markdownlint-config.js";
|
|
6
|
+
import { specdojoPackageRootDir } from "../shared/package-paths.js";
|
|
4
7
|
import { load } from "../shared/yaml.js";
|
|
8
|
+
import { agentProtectedConfigPaths, agentProtectedConfigViolation, qualifiedRepoPaths, } from "./agent-protected-config.js";
|
|
5
9
|
import { deliverableDocPath, parsePlanTaskIdentity, targetReferenceDirsForApproach, } from "./plans.js";
|
|
10
|
+
import { recordProtectedConfigBlockAcrossRepos, recordProtectionHandoff, } from "./protection-handoff.js";
|
|
6
11
|
import { parseResultTaskIdentity } from "./results.js";
|
|
12
|
+
import { isOtherRunRecord, isPlanOrResultRecord, isRunRecordPath, recordPathForRead, recordStem, runRecordPrefixes, taskRecordPrefixes, } from "./run-records.js";
|
|
13
|
+
import { lefthookExcludeEnvironment } from "./commit-hook-skips.js";
|
|
7
14
|
import { stripTerminalControlSequences } from "./shared.js";
|
|
8
|
-
import { agentProtectedConfigPaths, agentProtectedConfigViolation, qualifiedRepoPaths, } from "./agent-protected-config.js";
|
|
9
|
-
import { recordProtectedConfigBlockAcrossRepos } from "./protection-handoff.js";
|
|
10
15
|
import { assertNoPendingProductChanges, productIntegrationTarget } from "./task-repos.js";
|
|
11
|
-
import {
|
|
12
|
-
import { DEFAULT_MARKDOWNLINT_CONFIG, hasMarkdownlintConfig, } from "../shared/markdownlint-config.js";
|
|
13
|
-
import { repoRelative, stageCommitTargets, worktreeStatusPaths as statusPaths, } from "../shared/git.js";
|
|
16
|
+
import { appendGitFailureLog, appendGitResultFailureLog, formatGitResultFailure, gitEnvironment, gitOutput, gitResult, summarizeGitHookFailure, } from "./worktree.js";
|
|
14
17
|
export { repoRelative, selectStageablePaths, stageCommitTargets, unstageCommitTargets, worktreeStatusPaths, } from "../shared/git.js";
|
|
15
|
-
import { appendGitFailureLog, appendGitResultFailureLog, formatGitResultFailure, gitEnvironment, gitOutput, gitResult, summarizeGitHookFailure, worktreeNameFromTaskId, } from "./worktree.js";
|
|
16
18
|
const MAX_COMMIT_STABILIZATION_ATTEMPTS = 3;
|
|
17
19
|
export function currentBranch(repoRoot) {
|
|
18
20
|
const branch = gitOutput(repoRoot, ["branch", "--show-current"]).trim();
|
|
@@ -20,27 +22,31 @@ export function currentBranch(repoRoot) {
|
|
|
20
22
|
throw new Error("Detached HEAD is not supported for exec worktree commands.");
|
|
21
23
|
return branch;
|
|
22
24
|
}
|
|
23
|
-
export function taskPaths(context, taskId) {
|
|
25
|
+
export function taskPaths(context, taskId, worktreePath = context.repoRoot) {
|
|
24
26
|
const executionRel = repoRelative(context.repoRoot, context.executionPath);
|
|
27
|
+
const executionPath = resolve(worktreePath, executionRel);
|
|
25
28
|
return {
|
|
26
29
|
executionRel,
|
|
27
|
-
planRel:
|
|
28
|
-
resultRel:
|
|
30
|
+
planRel: repoRelative(worktreePath, recordPathForRead(executionPath, "plan", taskId)),
|
|
31
|
+
resultRel: repoRelative(worktreePath, recordPathForRead(executionPath, "result", taskId)),
|
|
29
32
|
};
|
|
30
33
|
}
|
|
31
|
-
export function isCommitTargetPath(path, executionRel, resultRel) {
|
|
34
|
+
export function isCommitTargetPath(path, executionRel, resultRel, allowedPlanRel, currentRunPrefixes = []) {
|
|
32
35
|
const normalized = path.replaceAll("\\", "/");
|
|
33
36
|
if (normalized === resultRel)
|
|
34
37
|
return true;
|
|
38
|
+
if (allowedPlanRel && normalized === allowedPlanRel)
|
|
39
|
+
return true;
|
|
35
40
|
// doc-index は root と worktree の双方で再生成される生成物。commit-target に含めると
|
|
36
41
|
// merge 時の overlap ガードで衝突するため除外する。
|
|
37
42
|
if (normalized === ".specdojo/doc-index.json")
|
|
38
43
|
return false;
|
|
39
44
|
if (normalized === "tmp" || normalized.startsWith("tmp/"))
|
|
40
45
|
return false;
|
|
41
|
-
if (normalized
|
|
46
|
+
if (isPlanOrResultRecord(normalized))
|
|
42
47
|
return false;
|
|
43
|
-
if (normalized
|
|
48
|
+
if (isOtherRunRecord(normalized, resultRel) &&
|
|
49
|
+
!currentRunPrefixes.some((prefix) => normalized.startsWith(prefix)))
|
|
44
50
|
return false;
|
|
45
51
|
if (normalized.startsWith(`${executionRel}/exec/events/`))
|
|
46
52
|
return false;
|
|
@@ -48,6 +54,13 @@ export function isCommitTargetPath(path, executionRel, resultRel) {
|
|
|
48
54
|
return false;
|
|
49
55
|
return true;
|
|
50
56
|
}
|
|
57
|
+
// Commit evidence and logs only from the run containing the selected result.
|
|
58
|
+
function currentRunPrefixes(context, worktree, taskId, resultRel) {
|
|
59
|
+
const { executionRel, planRel } = taskPaths(context, taskId, worktree.path);
|
|
60
|
+
const plan = readWorktreeHeadFile(worktree.path, planRel);
|
|
61
|
+
const recordTaskId = (plan ? parsePlanTaskIdentity(plan)?.taskId : undefined) ?? taskId;
|
|
62
|
+
return runRecordPrefixes(executionRel, recordTaskId, recordStem(resultRel));
|
|
63
|
+
}
|
|
51
64
|
// Reads a deliverable's frontmatter `status`. Markdown deliverables carry it in the
|
|
52
65
|
// leading `---` frontmatter block; yaml/json deliverables carry it as a top-level field.
|
|
53
66
|
// Returns undefined when absent or unparsable (treated as "not ready").
|
|
@@ -84,14 +97,14 @@ export function deliverableStatus(content, relPath) {
|
|
|
84
97
|
// that transitions a deliverable to "ready" here; humans promote out-of-band via a direct
|
|
85
98
|
// edit and git commit, which never passes through this path.
|
|
86
99
|
function assertNoAgentReadyPromotion(context, worktree, taskId, paths) {
|
|
87
|
-
const { resultRel } = taskPaths(context, taskId);
|
|
100
|
+
const { planRel, resultRel } = taskPaths(context, taskId, worktree.path);
|
|
88
101
|
const resultContent = readWorktreeHeadFile(worktree.path, resultRel);
|
|
89
102
|
if (resultContent && parseResultTaskIdentity(resultContent)?.execution === "human") {
|
|
90
103
|
return;
|
|
91
104
|
}
|
|
92
105
|
const promoted = [];
|
|
93
106
|
for (const relPath of paths) {
|
|
94
|
-
if (relPath === resultRel)
|
|
107
|
+
if (relPath === resultRel || relPath === planRel)
|
|
95
108
|
continue;
|
|
96
109
|
const absPath = resolve(worktree.path, relPath);
|
|
97
110
|
if (!existsSync(absPath))
|
|
@@ -110,7 +123,7 @@ function assertNoAgentReadyPromotion(context, worktree, taskId, paths) {
|
|
|
110
123
|
}
|
|
111
124
|
}
|
|
112
125
|
function isHumanWorktreeExecution(context, worktree, taskId) {
|
|
113
|
-
const { resultRel } = taskPaths(context, taskId);
|
|
126
|
+
const { resultRel } = taskPaths(context, taskId, worktree.path);
|
|
114
127
|
const resultContent = readWorktreeHeadFile(worktree.path, resultRel);
|
|
115
128
|
return !!resultContent && parseResultTaskIdentity(resultContent)?.execution === "human";
|
|
116
129
|
}
|
|
@@ -120,7 +133,7 @@ function isHumanWorktreeExecution(context, worktree, taskId) {
|
|
|
120
133
|
function assertNoAgentProtectedConfigChanges(context, worktree, taskId) {
|
|
121
134
|
if (isHumanWorktreeExecution(context, worktree, taskId))
|
|
122
135
|
return;
|
|
123
|
-
const { resultRel } = taskPaths(context, taskId);
|
|
136
|
+
const { resultRel } = taskPaths(context, taskId, worktree.path);
|
|
124
137
|
const rootHead = gitOutput(context.repoRoot, ["rev-parse", "HEAD"]).trim();
|
|
125
138
|
const compareBase = gitOutput(worktree.path, ["merge-base", "HEAD", rootHead]).trim();
|
|
126
139
|
const committed = zeroSeparatedPaths(worktree.path, [
|
|
@@ -213,8 +226,8 @@ function headDocIndexLookup(worktreePath) {
|
|
|
213
226
|
// 導出する。いずれも task 識別を復元できない場合は null を返し、呼び出し側は従来の
|
|
214
227
|
// 除外リスト方式へフォールバックする。checkpoint 済みの HEAD を読むため、agent の
|
|
215
228
|
// working tree 改変からは影響を受けない。
|
|
216
|
-
export function resolveCommitScope(context, worktree, taskId) {
|
|
217
|
-
const { executionRel, planRel, resultRel } = taskPaths(context, taskId);
|
|
229
|
+
export function resolveCommitScope(context, worktree, taskId, options = {}) {
|
|
230
|
+
const { executionRel, planRel, resultRel } = taskPaths(context, taskId, worktree.path);
|
|
218
231
|
const resultContent = readWorktreeHeadFile(worktree.path, resultRel);
|
|
219
232
|
const resultIdentity = resultContent ? parseResultTaskIdentity(resultContent) : null;
|
|
220
233
|
const planContent = readWorktreeHeadFile(worktree.path, planRel);
|
|
@@ -226,7 +239,11 @@ export function resolveCommitScope(context, worktree, taskId) {
|
|
|
226
239
|
return { scope: null, unresolvedTargets: [] };
|
|
227
240
|
if (identity.mode === "review") {
|
|
228
241
|
return {
|
|
229
|
-
scope: {
|
|
242
|
+
scope: {
|
|
243
|
+
mode: "review",
|
|
244
|
+
allowedFiles: [resultRel, ...(options.allowEditedPlan ? [planRel] : [])],
|
|
245
|
+
allowedDirPrefixes: taskRecordPrefixes(executionRel, taskId),
|
|
246
|
+
},
|
|
230
247
|
unresolvedTargets: [],
|
|
231
248
|
};
|
|
232
249
|
}
|
|
@@ -243,7 +260,7 @@ export function resolveCommitScope(context, worktree, taskId) {
|
|
|
243
260
|
`Schedule-originated edit tasks must declare targets; ` +
|
|
244
261
|
`register-originated tasks must declare "origin: register".`);
|
|
245
262
|
}
|
|
246
|
-
const allowedFiles = new Set([resultRel]);
|
|
263
|
+
const allowedFiles = new Set([resultRel, ...(options.allowEditedPlan ? [planRel] : [])]);
|
|
247
264
|
const unresolvedTargets = [];
|
|
248
265
|
const lookup = headDocIndexLookup(worktree.path);
|
|
249
266
|
for (const target of identity.targets ?? []) {
|
|
@@ -273,7 +290,7 @@ export function resolveCommitScope(context, worktree, taskId) {
|
|
|
273
290
|
// Pipeline evidence is runner-owned and stored per task/run. It must be committed together with
|
|
274
291
|
// the eventual reporter-generated result so the structured executor record survives worktree
|
|
275
292
|
// removal. Legacy tasks create no files under this prefix, so their commit scope is unchanged.
|
|
276
|
-
allowedDirPrefixes.push(
|
|
293
|
+
allowedDirPrefixes.push(...taskRecordPrefixes(executionRel, taskId));
|
|
277
294
|
return {
|
|
278
295
|
scope: { mode: "edit", allowedFiles: [...allowedFiles], allowedDirPrefixes },
|
|
279
296
|
unresolvedTargets,
|
|
@@ -282,7 +299,7 @@ export function resolveCommitScope(context, worktree, taskId) {
|
|
|
282
299
|
// checkpoint 済みの HEAD の plan(human は result)frontmatter の targets。agent の working tree
|
|
283
300
|
// 改変の影響を受けない。プロダクトリポジトリの commit 対象(`<repo>:<path>`)の導出に使う。
|
|
284
301
|
export function taskTargetsAtHead(context, worktree, taskId) {
|
|
285
|
-
const { planRel, resultRel } = taskPaths(context, taskId);
|
|
302
|
+
const { planRel, resultRel } = taskPaths(context, taskId, worktree.path);
|
|
286
303
|
const resultContent = readWorktreeHeadFile(worktree.path, resultRel);
|
|
287
304
|
const resultIdentity = resultContent ? parseResultTaskIdentity(resultContent) : null;
|
|
288
305
|
if (resultIdentity?.execution === "human")
|
|
@@ -314,7 +331,7 @@ export const REGISTER_NEW_FILE_DIR_PREFIXES = [
|
|
|
314
331
|
// evidence 配下・個票 targets から解決したパスに限り、それ以外を commit 範囲外とする。
|
|
315
332
|
// 既存ファイルの変更と削除は従来どおり除外リスト方式で判定する。
|
|
316
333
|
function registerNewFileIsAllowed(worktree, context, taskId) {
|
|
317
|
-
const { executionRel, planRel, resultRel } = taskPaths(context, taskId);
|
|
334
|
+
const { executionRel, planRel, resultRel } = taskPaths(context, taskId, worktree.path);
|
|
318
335
|
const topLevelDirs = zeroSeparatedPaths(worktree.path, [
|
|
319
336
|
"ls-tree",
|
|
320
337
|
"-d",
|
|
@@ -325,7 +342,7 @@ function registerNewFileIsAllowed(worktree, context, taskId) {
|
|
|
325
342
|
const allowedDirPrefixes = [
|
|
326
343
|
...REGISTER_NEW_FILE_DIR_PREFIXES,
|
|
327
344
|
...topLevelDirs,
|
|
328
|
-
|
|
345
|
+
...taskRecordPrefixes(executionRel, taskId),
|
|
329
346
|
];
|
|
330
347
|
const planContent = readWorktreeHeadFile(worktree.path, planRel);
|
|
331
348
|
const targets = (planContent ? parsePlanTaskIdentity(planContent) : null)?.targets ?? [];
|
|
@@ -355,42 +372,90 @@ function pathsTrackedAtHead(worktreePath, paths) {
|
|
|
355
372
|
]));
|
|
356
373
|
}
|
|
357
374
|
function isRegisterOriginTask(context, worktree, taskId) {
|
|
358
|
-
const planContent = readWorktreeHeadFile(worktree.path, taskPaths(context, taskId).planRel);
|
|
375
|
+
const planContent = readWorktreeHeadFile(worktree.path, taskPaths(context, taskId, worktree.path).planRel);
|
|
359
376
|
return (planContent ? parsePlanTaskIdentity(planContent) : null)?.origin === "register";
|
|
360
377
|
}
|
|
361
378
|
// worktree の変更を「commit するパス」「許可リスト外のため commit しないパス」に分ける。
|
|
362
379
|
// 除外リスト(isCommitTargetPath)は許可リストの内側でも引き続き適用する。
|
|
363
|
-
export function partitionCommitTargets(context, worktree, taskId) {
|
|
364
|
-
const { executionRel, resultRel } = taskPaths(context, taskId);
|
|
365
|
-
const
|
|
366
|
-
const
|
|
380
|
+
export function partitionCommitTargets(context, worktree, taskId, options = {}) {
|
|
381
|
+
const { executionRel, planRel, resultRel } = taskPaths(context, taskId, worktree.path);
|
|
382
|
+
const allowedPlanRel = options.allowEditedPlan ? planRel : undefined;
|
|
383
|
+
const runPrefixes = currentRunPrefixes(context, worktree, taskId, resultRel);
|
|
384
|
+
const changes = statusPaths(worktree.path);
|
|
385
|
+
const candidates = changes.filter((path) => isCommitTargetPath(path, executionRel, resultRel, allowedPlanRel, runPrefixes));
|
|
386
|
+
// Do not silently discard run records via the exclusion filter: report them using
|
|
387
|
+
// the same stdout/integrate.log warning as other changes outside the commit scope.
|
|
388
|
+
const excludedRecords = changes.filter((path) => isRunRecordPath(path) && !candidates.includes(path));
|
|
389
|
+
const { scope, unresolvedTargets } = resolveCommitScope(context, worktree, taskId, options);
|
|
367
390
|
if (!scope) {
|
|
368
391
|
// 人間の作業は agent の一時ファイル対策の対象外とし、従来どおり除外リスト方式で commit する。
|
|
369
392
|
if (!isRegisterOriginTask(context, worktree, taskId) ||
|
|
370
393
|
isHumanWorktreeExecution(context, worktree, taskId)) {
|
|
371
|
-
return { targets: candidates, outOfScope:
|
|
394
|
+
return { targets: candidates, outOfScope: excludedRecords, unresolvedTargets };
|
|
372
395
|
}
|
|
373
396
|
const tracked = pathsTrackedAtHead(worktree.path, candidates);
|
|
374
397
|
const isAllowedNewFile = registerNewFileIsAllowed(worktree, context, taskId);
|
|
375
398
|
const targets = [];
|
|
376
|
-
const outOfScope = [];
|
|
399
|
+
const outOfScope = [...excludedRecords];
|
|
377
400
|
for (const path of candidates) {
|
|
378
|
-
const allowed =
|
|
401
|
+
const allowed = runPrefixes.some((prefix) => path.startsWith(prefix)) ||
|
|
402
|
+
tracked.has(path) ||
|
|
403
|
+
isAllowedNewFile(path);
|
|
379
404
|
(allowed ? targets : outOfScope).push(path);
|
|
380
405
|
}
|
|
381
406
|
return { targets, outOfScope, unresolvedTargets };
|
|
382
407
|
}
|
|
383
408
|
const targets = [];
|
|
384
|
-
const outOfScope = [];
|
|
409
|
+
const outOfScope = [...excludedRecords];
|
|
385
410
|
for (const path of candidates) {
|
|
386
|
-
const allowed =
|
|
411
|
+
const allowed = runPrefixes.some((prefix) => path.startsWith(prefix)) ||
|
|
412
|
+
scope.allowedFiles.includes(path) ||
|
|
387
413
|
scope.allowedDirPrefixes.some((prefix) => path.startsWith(prefix));
|
|
388
414
|
(allowed ? targets : outOfScope).push(path);
|
|
389
415
|
}
|
|
390
416
|
return { targets, outOfScope, unresolvedTargets };
|
|
391
417
|
}
|
|
392
|
-
export function commitTargetPaths(context, worktree, taskId) {
|
|
393
|
-
return partitionCommitTargets(context, worktree, taskId).targets;
|
|
418
|
+
export function commitTargetPaths(context, worktree, taskId, options = {}) {
|
|
419
|
+
return partitionCommitTargets(context, worktree, taskId, options).targets;
|
|
420
|
+
}
|
|
421
|
+
export class UncommittedChangesError extends Error {
|
|
422
|
+
files;
|
|
423
|
+
constructor(files, logPath) {
|
|
424
|
+
// This message becomes the result's block_reason; retain every excluded path.
|
|
425
|
+
super(`uncommitted=${files.length}; log=${logPath}; files=${files.join(", ")}`);
|
|
426
|
+
this.files = files;
|
|
427
|
+
this.name = "UncommittedChangesError";
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
// Agent integration must retain every non-target change for review, regardless of origin.
|
|
431
|
+
// In particular, dropping an untracked move destination loses the deliverable.
|
|
432
|
+
export function assertCommitScope(context, worktree, taskId, options = {}) {
|
|
433
|
+
// Human schedule tasks retain their explicit result-based selection behavior.
|
|
434
|
+
if (isHumanWorktreeExecution(context, worktree, taskId) &&
|
|
435
|
+
!isRegisterOriginTask(context, worktree, taskId))
|
|
436
|
+
return;
|
|
437
|
+
const { outOfScope } = partitionCommitTargets(context, worktree, taskId, options);
|
|
438
|
+
if (outOfScope.length === 0)
|
|
439
|
+
return;
|
|
440
|
+
const { resultRel } = taskPaths(context, taskId, worktree.path);
|
|
441
|
+
const logPath = options.scopeLogPath ?? join(dirname(resolve(worktree.path, resultRel)), "integrate.log");
|
|
442
|
+
const warning = `commit-scope: integration blocked; ${outOfScope.length} non-target changes (worktree kept):\n` +
|
|
443
|
+
`${outOfScope.map((path) => ` ${path}`).join("\n")}\n`;
|
|
444
|
+
process.stdout.write(warning);
|
|
445
|
+
if (!options.dryRun) {
|
|
446
|
+
mkdirSync(resolve(logPath, ".."), { recursive: true });
|
|
447
|
+
appendFileSync(logPath, warning, "utf8");
|
|
448
|
+
recordProtectionHandoff(resolve(worktree.path, resultRel), {
|
|
449
|
+
mechanism: "agent-commit-scope",
|
|
450
|
+
subjectLabel: "commit 対象外のパス",
|
|
451
|
+
subjects: outOfScope,
|
|
452
|
+
reason: warning.trim(),
|
|
453
|
+
evidenceLabel: "次のアクション",
|
|
454
|
+
evidenceLanguage: "text",
|
|
455
|
+
evidence: "worktree を保持して統合を停止した。対象外の変更を確認し、必要な変更は targets の見直しまたは別タスクで取り込む。型のカタログ・schema・メニューなどの対象外ファイルは、変更理由と提案差分を報告してから executor を再開する。",
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
throw new UncommittedChangesError(outOfScope, repoRelative(worktree.path, logPath));
|
|
394
459
|
}
|
|
395
460
|
// markdownlint-cli の終了コード。1 だけが記法違反を表し、それ以外は実行環境の問題である。
|
|
396
461
|
const MARKDOWNLINT_EXIT_LINT_ERRORS = 1;
|
|
@@ -416,7 +481,7 @@ export function normalizeResultWhitespace(resultPath) {
|
|
|
416
481
|
writeFileSync(resultPath, normalized, "utf8");
|
|
417
482
|
}
|
|
418
483
|
export function assertResultMarkdownlint(context, worktree, taskId) {
|
|
419
|
-
const { resultRel } = taskPaths(context, taskId);
|
|
484
|
+
const { resultRel } = taskPaths(context, taskId, worktree.path);
|
|
420
485
|
const resultPath = resolve(worktree.path, resultRel);
|
|
421
486
|
if (!existsSync(resultPath)) {
|
|
422
487
|
process.stdout.write(`result-markdownlint: result ${resultRel} not found; skipped pre-commit lint\n`);
|
|
@@ -571,16 +636,17 @@ export function recordRootNewFilesHandoff(resultPath, files) {
|
|
|
571
636
|
}
|
|
572
637
|
// Commit the task result and deliverable changes inside the worktree onto its exec branch.
|
|
573
638
|
// The commit is limited to the mode-based allowlist (resolveCommitScope); out-of-scope
|
|
574
|
-
// changes
|
|
639
|
+
// changes block agent commits. Excludes plans, events,
|
|
575
640
|
// generated files, and other tasks' results (see isCommitTargetPath).
|
|
576
641
|
export function commitWorktreeChanges(params) {
|
|
577
|
-
const { context, worktree, taskId } = params;
|
|
642
|
+
const { context, worktree, taskId, allowEditedPlan } = params;
|
|
578
643
|
assertNoAgentProtectedConfigChanges(context, worktree, taskId);
|
|
579
644
|
if (!params.productsIntegratedByCaller)
|
|
580
645
|
assertNoPendingProductChanges(worktree);
|
|
581
|
-
|
|
646
|
+
assertCommitScope(context, worktree, taskId, params);
|
|
647
|
+
let partition = partitionCommitTargets(context, worktree, taskId, { allowEditedPlan });
|
|
582
648
|
const scopeWarnings = [
|
|
583
|
-
...partition.unresolvedTargets.map((target) => `commit-scope: unresolved target doc id (
|
|
649
|
+
...partition.unresolvedTargets.map((target) => `commit-scope: unresolved target doc id (no individual path; approach directory permissions still apply): ${target}\n`),
|
|
584
650
|
...(partition.outOfScope.length > 0
|
|
585
651
|
? [
|
|
586
652
|
`commit-scope: skipped non-target changes (left in worktree):\n${partition.outOfScope
|
|
@@ -595,9 +661,9 @@ export function commitWorktreeChanges(params) {
|
|
|
595
661
|
mkdirSync(resolve(params.scopeLogPath, ".."), { recursive: true });
|
|
596
662
|
appendFileSync(params.scopeLogPath, scopeWarnings.join(""), "utf8");
|
|
597
663
|
// 追記したログ自体を commit 対象に含めるため、分類をやり直す。
|
|
598
|
-
partition = partitionCommitTargets(context, worktree, taskId);
|
|
664
|
+
partition = partitionCommitTargets(context, worktree, taskId, { allowEditedPlan });
|
|
599
665
|
}
|
|
600
|
-
const { resultRel } = taskPaths(context, taskId);
|
|
666
|
+
const { resultRel } = taskPaths(context, taskId, worktree.path);
|
|
601
667
|
const trackedAtHead = pathsTrackedAtHead(worktree.path, partition.targets);
|
|
602
668
|
const projectRootNewFiles = partition.targets.filter((path) => !path.includes("/") && !trackedAtHead.has(path) && path !== resultRel);
|
|
603
669
|
if (projectRootNewFiles.length > 0) {
|
|
@@ -607,14 +673,14 @@ export function commitWorktreeChanges(params) {
|
|
|
607
673
|
if (params.scopeLogPath && !params.dryRun) {
|
|
608
674
|
mkdirSync(resolve(params.scopeLogPath, ".."), { recursive: true });
|
|
609
675
|
appendFileSync(params.scopeLogPath, rootNewWarning, "utf8");
|
|
610
|
-
partition = partitionCommitTargets(context, worktree, taskId);
|
|
676
|
+
partition = partitionCommitTargets(context, worktree, taskId, { allowEditedPlan });
|
|
611
677
|
}
|
|
612
678
|
}
|
|
613
679
|
const allRootNewFiles = [...(params.productRootNewFiles ?? []), ...projectRootNewFiles];
|
|
614
680
|
if (allRootNewFiles.length > 0 && !params.dryRun) {
|
|
615
681
|
const resultPath = resolve(worktree.path, resultRel);
|
|
616
682
|
if (recordRootNewFilesHandoff(resultPath, allRootNewFiles)) {
|
|
617
|
-
partition = partitionCommitTargets(context, worktree, taskId);
|
|
683
|
+
partition = partitionCommitTargets(context, worktree, taskId, { allowEditedPlan });
|
|
618
684
|
}
|
|
619
685
|
}
|
|
620
686
|
const paths = partition.targets;
|
|
@@ -645,7 +711,11 @@ export function commitWorktreeChanges(params) {
|
|
|
645
711
|
"--",
|
|
646
712
|
...paths,
|
|
647
713
|
];
|
|
648
|
-
const
|
|
714
|
+
const hookEnvironment = lefthookExcludeEnvironment(params.skipHooks ?? []);
|
|
715
|
+
if (hookEnvironment) {
|
|
716
|
+
process.stdout.write(`commit hooks skipped (covered by passed parent validations): ${(params.skipHooks ?? []).join(", ")}\n`);
|
|
717
|
+
}
|
|
718
|
+
const commit = gitResult(worktree.path, commitArgs, undefined, hookEnvironment);
|
|
649
719
|
if (commit.status !== 0) {
|
|
650
720
|
const output = [commit.stdout, commit.stderr]
|
|
651
721
|
.filter((part) => typeof part === "string" && part.length > 0)
|
|
@@ -661,6 +731,7 @@ export function commitWorktreeChanges(params) {
|
|
|
661
731
|
]);
|
|
662
732
|
throw new Error(`git commit failed: ${summarizeGitHookFailure(output)}`);
|
|
663
733
|
}
|
|
664
|
-
stabilizeCommitTargets(worktree.path, () => commitTargetPaths(context, worktree, taskId), undefined, params.failureLogPath);
|
|
734
|
+
stabilizeCommitTargets(worktree.path, () => commitTargetPaths(context, worktree, taskId, { allowEditedPlan }), undefined, params.failureLogPath);
|
|
735
|
+
assertCommitScope(context, worktree, taskId, params);
|
|
665
736
|
return { targets: paths, committed: true };
|
|
666
737
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { copyFileSync, existsSync, lstatSync, mkdirSync, rmSync } from "node:fs";
|
|
1
|
+
import { copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, rmSync } from "node:fs";
|
|
2
|
+
import { withPlanConventionsFiles } from "../shared/plan-conventions.js";
|
|
2
3
|
import { resolve } from "node:path";
|
|
3
4
|
import { stripTerminalControlSequences } from "./shared.js";
|
|
4
5
|
import { discardStaleProductWorktrees, ensureProductWorktrees, projectRepoDirName, productWorktreeRemovalBlockers, removeEmptyTaskDirectory, removeProductWorktrees, } from "./task-repos.js";
|
|
5
6
|
import { appendGitFailureLog, appendGitResultFailureLog, ensureExecWorktree, execBranchExists, findExecWorktree, formatGitResultFailure, generateWorktreeArtifacts, gitOutput, gitResult, listRegisteredWorktrees, summarizeGitHookFailure, worktreeNameFromTaskId, } from "./worktree.js";
|
|
6
|
-
import { commitTargetPaths, currentBranch, repoRelative, stageCommitTargets, unstageCommitTargets, worktreeStatusPaths, zeroSeparatedPaths, } from "./worktree-ops-commit.js";
|
|
7
|
+
import { assertCommitScope, commitTargetPaths, currentBranch, repoRelative, stageCommitTargets, unstageCommitTargets, worktreeStatusPaths, zeroSeparatedPaths, } from "./worktree-ops-commit.js";
|
|
7
8
|
// Remove a task worktree once its commit-target changes are committed and merged.
|
|
8
9
|
export function removeWorktree(params) {
|
|
9
10
|
const { context, worktree, taskId } = params;
|
|
@@ -11,6 +12,8 @@ export function removeWorktree(params) {
|
|
|
11
12
|
throw new Error("Run remove from the merge-target worktree, not the task worktree.");
|
|
12
13
|
}
|
|
13
14
|
const dirty = commitTargetPaths(context, worktree, taskId);
|
|
15
|
+
if (!params.force)
|
|
16
|
+
assertCommitScope(context, worktree, taskId, { dryRun: params.dryRun });
|
|
14
17
|
const merged = gitResult(context.repoRoot, ["merge-base", "--is-ancestor", worktree.branch, "HEAD"]).status ===
|
|
15
18
|
0;
|
|
16
19
|
if (!params.force && dirty.length > 0) {
|
|
@@ -234,7 +237,7 @@ function checkpointAndEnsureProjectWorktree(params, repoDirName, ensureSiblingWo
|
|
|
234
237
|
if (currentBranch(context.repoRoot) === branch) {
|
|
235
238
|
throw new Error(`Prepare must run from a branch other than ${branch}.`);
|
|
236
239
|
}
|
|
237
|
-
const paths = params.checkpointPaths.map((path) => repoRelative(context.repoRoot, path));
|
|
240
|
+
const paths = withPlanConventionsFiles(params.checkpointPaths).map((path) => repoRelative(context.repoRoot, path));
|
|
238
241
|
const stagedFiles = zeroSeparatedPaths(context.repoRoot, [
|
|
239
242
|
"diff",
|
|
240
243
|
"--cached",
|
|
@@ -252,52 +255,78 @@ function checkpointAndEnsureProjectWorktree(params, repoDirName, ensureSiblingWo
|
|
|
252
255
|
`${stagedFiles.map((path) => ` ${path}`).join("\n")}\n`);
|
|
253
256
|
}
|
|
254
257
|
const worktree = ensureProjectWorktree();
|
|
255
|
-
|
|
256
|
-
copyCheckpointPath(context.repoRoot, worktree.path, path);
|
|
257
|
-
try {
|
|
258
|
-
stageCommitTargets(worktree.path, paths);
|
|
259
|
-
const checkpointArgs = ["diff", "--cached", "--quiet", "--", ...paths];
|
|
260
|
-
const checkpoint = gitResult(worktree.path, checkpointArgs);
|
|
261
|
-
assertCheckpointInspection(checkpointArgs, checkpoint, params.failureLogPath);
|
|
262
|
-
if (checkpoint.status === 1) {
|
|
263
|
-
const committed = gitResult(worktree.path, [
|
|
264
|
-
"commit",
|
|
265
|
-
"-m",
|
|
266
|
-
params.commitMessage,
|
|
267
|
-
"--",
|
|
268
|
-
...paths,
|
|
269
|
-
]);
|
|
270
|
-
if (committed.status !== 0) {
|
|
271
|
-
// hook(lefthook 等)の生出力には ANSI エスケープや制御文字が含まれうる。この detail は
|
|
272
|
-
// register 経路で pjr-index の結論列・result の理由欄へ伝播するため、ここで除去して
|
|
273
|
-
// 表示崩れを防ぐ(register 側の sanitize と二重だが、非 register の呼び出し元も守る)。
|
|
274
|
-
const output = [committed.stdout, committed.stderr]
|
|
275
|
-
.map((part) => typeof part === "string" ? stripTerminalControlSequences(part).trim() : "")
|
|
276
|
-
.filter(Boolean)
|
|
277
|
-
.join("\n");
|
|
278
|
-
appendGitFailureLog(params.failureLogPath, [
|
|
279
|
-
`=== ${new Date().toISOString()} git commit checkpoint ===`,
|
|
280
|
-
`exit: ${committed.status ?? "unknown"}`,
|
|
281
|
-
"--- stdout ---",
|
|
282
|
-
typeof committed.stdout === "string" ? committed.stdout : "",
|
|
283
|
-
"--- stderr ---",
|
|
284
|
-
typeof committed.stderr === "string" ? committed.stderr : "",
|
|
285
|
-
"",
|
|
286
|
-
]);
|
|
287
|
-
throw new Error(
|
|
288
|
-
// register の短い block_reason にも step とエラーが残るよう、補足より先に要約を置く。
|
|
289
|
-
`Checkpoint commit failed: ${summarizeGitHookFailure(output)} ` +
|
|
290
|
-
`(${params.commitMessage}; staged changes rolled back; likely a failing git hook)`);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
catch (error) {
|
|
295
|
-
// stage 後の検査や hook が失敗しても、この checkpoint の対象だけを戻す。
|
|
296
|
-
// root の index と、hook が別途 stage した無関係なパスには触れない。
|
|
297
|
-
unstageCommitTargets(worktree.path, paths);
|
|
298
|
-
throw error;
|
|
299
|
-
}
|
|
258
|
+
commitCheckpointPaths(context.repoRoot, worktree.path, paths, params);
|
|
300
259
|
return worktree;
|
|
301
260
|
}
|
|
302
261
|
return ensureProjectWorktree();
|
|
303
262
|
}
|
|
263
|
+
// Copy root-side checkpoint files into the worktree and commit them on the exec branch.
|
|
264
|
+
function commitCheckpointPaths(repoRoot, worktreePath, paths, params) {
|
|
265
|
+
for (const path of paths)
|
|
266
|
+
copyCheckpointPath(repoRoot, worktreePath, path);
|
|
267
|
+
try {
|
|
268
|
+
stageCommitTargets(worktreePath, [...paths]);
|
|
269
|
+
const checkpointArgs = ["diff", "--cached", "--quiet", "--", ...paths];
|
|
270
|
+
const checkpoint = gitResult(worktreePath, checkpointArgs);
|
|
271
|
+
assertCheckpointInspection(checkpointArgs, checkpoint, params.failureLogPath);
|
|
272
|
+
if (checkpoint.status !== 1)
|
|
273
|
+
return;
|
|
274
|
+
const committed = gitResult(worktreePath, [
|
|
275
|
+
"commit",
|
|
276
|
+
"-m",
|
|
277
|
+
params.commitMessage,
|
|
278
|
+
"--",
|
|
279
|
+
...paths,
|
|
280
|
+
]);
|
|
281
|
+
if (committed.status === 0)
|
|
282
|
+
return;
|
|
283
|
+
// hook(lefthook 等)の生出力には ANSI エスケープや制御文字が含まれうる。この detail は
|
|
284
|
+
// register 経路で pjr-index の結論列・result の理由欄へ伝播するため、ここで除去して
|
|
285
|
+
// 表示崩れを防ぐ(register 側の sanitize と二重だが、非 register の呼び出し元も守る)。
|
|
286
|
+
const output = [committed.stdout, committed.stderr]
|
|
287
|
+
.map((part) => (typeof part === "string" ? stripTerminalControlSequences(part).trim() : ""))
|
|
288
|
+
.filter(Boolean)
|
|
289
|
+
.join("\n");
|
|
290
|
+
appendGitFailureLog(params.failureLogPath, [
|
|
291
|
+
`=== ${new Date().toISOString()} git commit checkpoint ===`,
|
|
292
|
+
`exit: ${committed.status ?? "unknown"}`,
|
|
293
|
+
"--- stdout ---",
|
|
294
|
+
typeof committed.stdout === "string" ? committed.stdout : "",
|
|
295
|
+
"--- stderr ---",
|
|
296
|
+
typeof committed.stderr === "string" ? committed.stderr : "",
|
|
297
|
+
"",
|
|
298
|
+
]);
|
|
299
|
+
throw new Error(
|
|
300
|
+
// register の短い block_reason にも step とエラーが残るよう、補足より先に要約を置く。
|
|
301
|
+
`Checkpoint commit failed: ${summarizeGitHookFailure(output)} ` +
|
|
302
|
+
`(${params.commitMessage}; staged changes rolled back; likely a failing git hook)`);
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
// stage 後の検査や hook が失敗しても、この checkpoint の対象だけを戻す。
|
|
306
|
+
// root の index と、hook が別途 stage した無関係なパスには触れない。
|
|
307
|
+
unstageCommitTargets(worktreePath, [...paths]);
|
|
308
|
+
throw error;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Bring root-side files that changed after the exec branch was prepared (for example a grade the
|
|
313
|
+
* runner re-ran before resuming a review, PJR-ZSRD) into the existing worktree as a checkpoint
|
|
314
|
+
* commit. Only files that exist at the root and differ from the worktree are copied. Returns the
|
|
315
|
+
* repo-relative paths that were refreshed.
|
|
316
|
+
*/
|
|
317
|
+
export function refreshWorktreeCheckpoint(params) {
|
|
318
|
+
const changed = [
|
|
319
|
+
...new Set(params.paths.map((path) => repoRelative(params.repoRoot, path))),
|
|
320
|
+
].filter((path) => {
|
|
321
|
+
const source = resolve(params.repoRoot, path);
|
|
322
|
+
if (!existsSync(source) || !lstatSync(source).isFile())
|
|
323
|
+
return false;
|
|
324
|
+
const target = resolve(params.worktreePath, path);
|
|
325
|
+
return !existsSync(target) || !readFileSync(source).equals(readFileSync(target));
|
|
326
|
+
});
|
|
327
|
+
changed.sort();
|
|
328
|
+
if (changed.length === 0)
|
|
329
|
+
return [];
|
|
330
|
+
commitCheckpointPaths(params.repoRoot, params.worktreePath, changed, params);
|
|
331
|
+
return changed;
|
|
332
|
+
}
|
|
@@ -6,8 +6,9 @@ import { rebuildRegisterTicketFromEvents, unionRegisterEventLogs, } from "../reg
|
|
|
6
6
|
import { displayIdFromRegisterEventFilename, REGISTER_EVENTS_DIRNAME } from "../register/events.js";
|
|
7
7
|
import { displayIdFromTicketFilename } from "../register/item.js";
|
|
8
8
|
import { isGradeCheckpointPath } from "./grade-checkpoint.js";
|
|
9
|
+
import { stagedMergeBlocker } from "../shared/git.js";
|
|
9
10
|
import { appendGitFailureLog, gitOutput, gitResult, summarizeGitHookFailure, } from "./worktree.js";
|
|
10
|
-
import { commitTargetPaths, currentBranch, repoRelative, rootDirtyPaths, zeroSeparatedPaths, } from "./worktree-ops-commit.js";
|
|
11
|
+
import { assertCommitScope, commitTargetPaths, currentBranch, repoRelative, rootDirtyPaths, zeroSeparatedPaths, } from "./worktree-ops-commit.js";
|
|
11
12
|
const DEFAULT_LOCK_TIMEOUT_MS = 10_000;
|
|
12
13
|
const DEFAULT_LOCK_STALE_MS = 300_000;
|
|
13
14
|
// A successful `git merge` runs post-merge, but a merge completed by the bookkeeping-conflict
|
|
@@ -192,6 +193,7 @@ function resolveBranchOwnedConflicts(params) {
|
|
|
192
193
|
// carries (see releaseRootWorkingCopies); they are restored when the merge does not complete.
|
|
193
194
|
export function mergeWorktreeIntoCurrent(params) {
|
|
194
195
|
const { context, worktree, taskId } = params;
|
|
196
|
+
assertCommitScope(context, worktree, taskId, { dryRun: params.dryRun });
|
|
195
197
|
const targetBranch = currentBranch(context.repoRoot);
|
|
196
198
|
if (targetBranch === worktree.branch) {
|
|
197
199
|
throw new Error(`Merge must run from a branch other than ${worktree.branch}.`);
|
|
@@ -208,6 +210,11 @@ export function mergeWorktreeIntoCurrent(params) {
|
|
|
208
210
|
lockTimeoutMs: DEFAULT_LOCK_TIMEOUT_MS,
|
|
209
211
|
lockStaleMs: DEFAULT_LOCK_STALE_MS,
|
|
210
212
|
});
|
|
213
|
+
}
|
|
214
|
+
const stagedBlocker = stagedMergeBlocker(context.repoRoot);
|
|
215
|
+
if (stagedBlocker)
|
|
216
|
+
throw new Error(stagedBlocker);
|
|
217
|
+
if (!params.dryRun) {
|
|
211
218
|
// Canonical grades may have been refreshed in the root after branching. Release only
|
|
212
219
|
// the checkpoint copies; refuse to discard a newer root-side evaluation.
|
|
213
220
|
const gradePaths = releasePaths.filter((path) => isGradeCheckpointPath(path, repoRelative(context.repoRoot, context.executionPath)));
|
|
@@ -240,7 +247,11 @@ export function mergeWorktreeIntoCurrent(params) {
|
|
|
240
247
|
const expected = gitResult(context.repoRoot, ["show", `${checkpoint}:${path}`]);
|
|
241
248
|
const absolute = resolve(context.repoRoot, path);
|
|
242
249
|
const current = existsSync(absolute) ? readFileSync(absolute, "utf8") : undefined;
|
|
243
|
-
|
|
250
|
+
// A resumed review may have refreshed the grade onto the branch (PJR-ZSRD). The root
|
|
251
|
+
// copy equal to the branch tip loses nothing when released.
|
|
252
|
+
const merged = gitResult(context.repoRoot, ["show", `${worktree.branch}:${path}`]);
|
|
253
|
+
if ((expected.status === 0 ? expected.stdout : undefined) !== current &&
|
|
254
|
+
(merged.status === 0 ? merged.stdout : undefined) !== current) {
|
|
244
255
|
throw new Error(`Grade sidecar changed after checkpoint; reconcile before merge: ${path}`);
|
|
245
256
|
}
|
|
246
257
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { REGISTER_NEW_FILE_DIR_PREFIXES, ROOT_NEW_FILES_HANDOFF_LABEL, applyRootNewFilesHandoff, assertResultMarkdownlint, commitTargetPaths, commitWorktreeChanges, currentBranch, deliverableStatus, isCommitTargetPath, normalizeResultWhitespace, partitionCommitTargets, recordRootNewFilesHandoff, repoRelative, resolveCommitScope, selectStageablePaths, stabilizeCommitTargets, stageCommitTargets, taskPaths, taskTargetsAtHead, unstageCommitTargets, worktreeStatusPaths, } from "./worktree-ops-commit.js";
|
|
1
|
+
export { REGISTER_NEW_FILE_DIR_PREFIXES, ROOT_NEW_FILES_HANDOFF_LABEL, applyRootNewFilesHandoff, assertResultMarkdownlint, assertCommitScope, commitTargetPaths, commitWorktreeChanges, currentBranch, deliverableStatus, isCommitTargetPath, normalizeResultWhitespace, partitionCommitTargets, recordRootNewFilesHandoff, repoRelative, resolveCommitScope, selectStageablePaths, stabilizeCommitTargets, stageCommitTargets, taskPaths, taskTargetsAtHead, unstageCommitTargets, worktreeStatusPaths, UncommittedChangesError, } from "./worktree-ops-commit.js";
|
|
2
2
|
export { abortMerge, isExecBranchMergedIntoCurrent, mergeWorktreeIntoCurrent, releaseRootWorkingCopies, restoreRootWorkingCopies, } from "./worktree-ops-merge.js";
|
|
3
|
-
export { WorktreeRemovedBranchDeletionError, checkpointAndEnsureWorktree, discardStaleExecWorktree, listOrphanedExecBranches, pruneOrphanedExecBranches, removeWorktree, } from "./worktree-ops-lifecycle.js";
|
|
3
|
+
export { WorktreeRemovedBranchDeletionError, checkpointAndEnsureWorktree, discardStaleExecWorktree, listOrphanedExecBranches, pruneOrphanedExecBranches, refreshWorktreeCheckpoint, removeWorktree, } from "./worktree-ops-lifecycle.js";
|