@warpgogol/forge 9.1.1 → 9.3.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/CHANGELOG.md +56 -0
- package/bin/cli.ts +5 -3
- package/dist/bin/cli.js +5 -3
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.d.ts +6 -0
- package/dist/os/adr/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.js +23 -15
- package/dist/os/adr/handlers/implement-stamp.js.map +1 -1
- package/dist/os/checks/handlers/counters-journal.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-journal.js +9 -1
- package/dist/os/checks/handlers/counters-journal.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +32 -39
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/lock-holder.d.ts +32 -0
- package/dist/os/core/lock-holder.d.ts.map +1 -0
- package/dist/os/core/lock-holder.js +81 -0
- package/dist/os/core/lock-holder.js.map +1 -0
- package/dist/os/core/stamp-lock.d.ts +30 -0
- package/dist/os/core/stamp-lock.d.ts.map +1 -0
- package/dist/os/core/stamp-lock.js +112 -0
- package/dist/os/core/stamp-lock.js.map +1 -0
- package/dist/os/flow/branch-name.d.ts +56 -0
- package/dist/os/flow/branch-name.d.ts.map +1 -0
- package/dist/os/flow/branch-name.js +108 -0
- package/dist/os/flow/branch-name.js.map +1 -0
- package/dist/os/flow/digest.d.ts +92 -0
- package/dist/os/flow/digest.d.ts.map +1 -0
- package/dist/os/flow/digest.js +663 -0
- package/dist/os/flow/digest.js.map +1 -0
- package/dist/os/flow/flow.module.d.ts +3 -0
- package/dist/os/flow/flow.module.d.ts.map +1 -0
- package/dist/os/flow/flow.module.js +771 -0
- package/dist/os/flow/flow.module.js.map +1 -0
- package/dist/os/flow/git.d.ts +68 -0
- package/dist/os/flow/git.d.ts.map +1 -0
- package/dist/os/flow/git.js +257 -0
- package/dist/os/flow/git.js.map +1 -0
- package/dist/os/flow/guard-files.d.ts +50 -0
- package/dist/os/flow/guard-files.d.ts.map +1 -0
- package/dist/os/flow/guard-files.js +147 -0
- package/dist/os/flow/guard-files.js.map +1 -0
- package/dist/os/flow/handlers/flow-backmerge.d.ts +27 -0
- package/dist/os/flow/handlers/flow-backmerge.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-backmerge.js +332 -0
- package/dist/os/flow/handlers/flow-backmerge.js.map +1 -0
- package/dist/os/flow/handlers/flow-check.d.ts +42 -0
- package/dist/os/flow/handlers/flow-check.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-check.js +347 -0
- package/dist/os/flow/handlers/flow-check.js.map +1 -0
- package/dist/os/flow/handlers/flow-cut.d.ts +71 -0
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-cut.js +722 -0
- package/dist/os/flow/handlers/flow-cut.js.map +1 -0
- package/dist/os/flow/handlers/flow-digest.d.ts +5 -0
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-digest.js +116 -0
- package/dist/os/flow/handlers/flow-digest.js.map +1 -0
- package/dist/os/flow/handlers/flow-discard.d.ts +22 -0
- package/dist/os/flow/handlers/flow-discard.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-discard.js +204 -0
- package/dist/os/flow/handlers/flow-discard.js.map +1 -0
- package/dist/os/flow/handlers/flow-fix.d.ts +47 -0
- package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-fix.js +532 -0
- package/dist/os/flow/handlers/flow-fix.js.map +1 -0
- package/dist/os/flow/handlers/flow-hold.d.ts +32 -0
- package/dist/os/flow/handlers/flow-hold.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-hold.js +359 -0
- package/dist/os/flow/handlers/flow-hold.js.map +1 -0
- package/dist/os/flow/handlers/flow-install.d.ts +92 -0
- package/dist/os/flow/handlers/flow-install.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-install.js +883 -0
- package/dist/os/flow/handlers/flow-install.js.map +1 -0
- package/dist/os/flow/handlers/flow-integrate.d.ts +35 -0
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-integrate.js +436 -0
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -0
- package/dist/os/flow/handlers/flow-open.d.ts +63 -0
- package/dist/os/flow/handlers/flow-open.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-open.js +294 -0
- package/dist/os/flow/handlers/flow-open.js.map +1 -0
- package/dist/os/flow/handlers/flow-publication-retire.d.ts +17 -0
- package/dist/os/flow/handlers/flow-publication-retire.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-publication-retire.js +132 -0
- package/dist/os/flow/handlers/flow-publication-retire.js.map +1 -0
- package/dist/os/flow/handlers/flow-push.d.ts +29 -0
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-push.js +397 -0
- package/dist/os/flow/handlers/flow-push.js.map +1 -0
- package/dist/os/flow/handlers/flow-status.d.ts +65 -0
- package/dist/os/flow/handlers/flow-status.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-status.js +193 -0
- package/dist/os/flow/handlers/flow-status.js.map +1 -0
- package/dist/os/flow/handlers/flow-unhold.d.ts +20 -0
- package/dist/os/flow/handlers/flow-unhold.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-unhold.js +158 -0
- package/dist/os/flow/handlers/flow-unhold.js.map +1 -0
- package/dist/os/flow/handlers/flow-version.d.ts +39 -0
- package/dist/os/flow/handlers/flow-version.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-version.js +122 -0
- package/dist/os/flow/handlers/flow-version.js.map +1 -0
- package/dist/os/flow/index.d.ts +30 -0
- package/dist/os/flow/index.d.ts.map +1 -0
- package/dist/os/flow/index.js +83 -0
- package/dist/os/flow/index.js.map +1 -0
- package/dist/os/flow/line-version.d.ts +23 -0
- package/dist/os/flow/line-version.d.ts.map +1 -0
- package/dist/os/flow/line-version.js +83 -0
- package/dist/os/flow/line-version.js.map +1 -0
- package/dist/os/flow/locks.d.ts +39 -0
- package/dist/os/flow/locks.d.ts.map +1 -0
- package/dist/os/flow/locks.js +177 -0
- package/dist/os/flow/locks.js.map +1 -0
- package/dist/os/flow/markers.d.ts +49 -0
- package/dist/os/flow/markers.d.ts.map +1 -0
- package/dist/os/flow/markers.js +112 -0
- package/dist/os/flow/markers.js.map +1 -0
- package/dist/os/flow/publication-order.d.ts +25 -0
- package/dist/os/flow/publication-order.d.ts.map +1 -0
- package/dist/os/flow/publication-order.js +75 -0
- package/dist/os/flow/publication-order.js.map +1 -0
- package/dist/os/flow/publish.d.ts +46 -0
- package/dist/os/flow/publish.d.ts.map +1 -0
- package/dist/os/flow/publish.js +209 -0
- package/dist/os/flow/publish.js.map +1 -0
- package/dist/os/flow/registry.d.ts +142 -0
- package/dist/os/flow/registry.d.ts.map +1 -0
- package/dist/os/flow/registry.js +199 -0
- package/dist/os/flow/registry.js.map +1 -0
- package/dist/os/flow/release-level.d.ts +23 -0
- package/dist/os/flow/release-level.d.ts.map +1 -0
- package/dist/os/flow/release-level.js +102 -0
- package/dist/os/flow/release-level.js.map +1 -0
- package/dist/os/flow/release-lines.d.ts +25 -0
- package/dist/os/flow/release-lines.d.ts.map +1 -0
- package/dist/os/flow/release-lines.js +172 -0
- package/dist/os/flow/release-lines.js.map +1 -0
- package/dist/os/flow/release-tags.d.ts +73 -0
- package/dist/os/flow/release-tags.d.ts.map +1 -0
- package/dist/os/flow/release-tags.js +167 -0
- package/dist/os/flow/release-tags.js.map +1 -0
- package/dist/os/flow/repo-kind.d.ts +41 -0
- package/dist/os/flow/repo-kind.d.ts.map +1 -0
- package/dist/os/flow/repo-kind.js +92 -0
- package/dist/os/flow/repo-kind.js.map +1 -0
- package/dist/os/flow/scripts.d.ts +20 -0
- package/dist/os/flow/scripts.d.ts.map +1 -0
- package/dist/os/flow/scripts.js +50 -0
- package/dist/os/flow/scripts.js.map +1 -0
- package/dist/os/flow/semver.d.ts +21 -0
- package/dist/os/flow/semver.d.ts.map +1 -0
- package/dist/os/flow/semver.js +73 -0
- package/dist/os/flow/semver.js.map +1 -0
- package/dist/os/flow/task-files.d.ts +11 -0
- package/dist/os/flow/task-files.d.ts.map +1 -0
- package/dist/os/flow/task-files.js +51 -0
- package/dist/os/flow/task-files.js.map +1 -0
- package/dist/os/flow/tests/helpers.d.ts +55 -0
- package/dist/os/flow/tests/helpers.d.ts.map +1 -0
- package/dist/os/flow/tests/helpers.js +193 -0
- package/dist/os/flow/tests/helpers.js.map +1 -0
- package/dist/os/flow/version-files.d.ts +21 -0
- package/dist/os/flow/version-files.d.ts.map +1 -0
- package/dist/os/flow/version-files.js +94 -0
- package/dist/os/flow/version-files.js.map +1 -0
- package/dist/os/flow/worktree-path.d.ts +31 -0
- package/dist/os/flow/worktree-path.d.ts.map +1 -0
- package/dist/os/flow/worktree-path.js +80 -0
- package/dist/os/flow/worktree-path.js.map +1 -0
- package/dist/os/mission/handlers/archive.d.ts.map +1 -1
- package/dist/os/mission/handlers/archive.js +44 -51
- package/dist/os/mission/handlers/archive.js.map +1 -1
- package/dist/os/mission/lockfile.d.ts +21 -0
- package/dist/os/mission/lockfile.d.ts.map +1 -0
- package/dist/os/mission/lockfile.js +76 -0
- package/dist/os/mission/lockfile.js.map +1 -0
- package/dist/os/mission/mission.module.d.ts.map +1 -1
- package/dist/os/mission/mission.module.js +2 -1
- package/dist/os/mission/mission.module.js.map +1 -1
- package/dist/os/program/handlers/seal.d.ts.map +1 -1
- package/dist/os/program/handlers/seal.js +1 -1
- package/dist/os/program/handlers/seal.js.map +1 -1
- package/dist/os/program/handlers/validate.d.ts.map +1 -1
- package/dist/os/program/handlers/validate.js +1 -1
- package/dist/os/program/handlers/validate.js.map +1 -1
- package/dist/os/program/program.module.d.ts.map +1 -1
- package/dist/os/program/program.module.js +2 -1
- package/dist/os/program/program.module.js.map +1 -1
- package/dist/os/program/schemas.d.ts +4 -6
- package/dist/os/program/schemas.d.ts.map +1 -1
- package/dist/os/program/schemas.js +16 -6
- package/dist/os/program/schemas.js.map +1 -1
- package/dist/os/program/state.d.ts +0 -1
- package/dist/os/program/state.d.ts.map +1 -1
- package/dist/os/program/state.js +1 -7
- package/dist/os/program/state.js.map +1 -1
- package/dist/os/rfc/acceptance.d.ts +21 -0
- package/dist/os/rfc/acceptance.d.ts.map +1 -1
- package/dist/os/rfc/acceptance.js +62 -13
- package/dist/os/rfc/acceptance.js.map +1 -1
- package/dist/os/rfc/frontmatter-io.d.ts +19 -0
- package/dist/os/rfc/frontmatter-io.d.ts.map +1 -1
- package/dist/os/rfc/frontmatter-io.js +65 -12
- package/dist/os/rfc/frontmatter-io.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts +6 -0
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +24 -19
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts +2 -5
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +10 -8
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/handlers/validate.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate.js +15 -5
- package/dist/os/rfc/handlers/validate.js.map +1 -1
- package/dist/os/rfc/index.d.ts +2 -2
- package/dist/os/rfc/index.d.ts.map +1 -1
- package/dist/os/rfc/index.js +5 -2
- package/dist/os/rfc/index.js.map +1 -1
- package/dist/os/rfc/probe-batch.d.ts +71 -0
- package/dist/os/rfc/probe-batch.d.ts.map +1 -0
- package/dist/os/rfc/probe-batch.js +251 -0
- package/dist/os/rfc/probe-batch.js.map +1 -0
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +16 -2
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +21 -10
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
- package/dist/os/rfc/verification-refresh.js +20 -13
- package/dist/os/rfc/verification-refresh.js.map +1 -1
- package/dist/os/system/handlers/outbox-validate.d.ts +8 -0
- package/dist/os/system/handlers/outbox-validate.d.ts.map +1 -0
- package/dist/os/system/handlers/outbox-validate.js +102 -0
- package/dist/os/system/handlers/outbox-validate.js.map +1 -0
- package/dist/os/system/handlers/system-map-validate.d.ts +13 -0
- package/dist/os/system/handlers/system-map-validate.d.ts.map +1 -0
- package/dist/os/system/handlers/system-map-validate.js +78 -0
- package/dist/os/system/handlers/system-map-validate.js.map +1 -0
- package/dist/os/system/handlers/system-outbox-scan.d.ts +10 -0
- package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -0
- package/dist/os/system/handlers/system-outbox-scan.js +195 -0
- package/dist/os/system/handlers/system-outbox-scan.js.map +1 -0
- package/dist/os/system/handlers/system-task-collect.d.ts +13 -0
- package/dist/os/system/handlers/system-task-collect.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-collect.js +238 -0
- package/dist/os/system/handlers/system-task-collect.js.map +1 -0
- package/dist/os/system/handlers/system-task-create.d.ts +32 -0
- package/dist/os/system/handlers/system-task-create.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-create.js +216 -0
- package/dist/os/system/handlers/system-task-create.js.map +1 -0
- package/dist/os/system/handlers/system-task-dispatch.d.ts +14 -0
- package/dist/os/system/handlers/system-task-dispatch.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-dispatch.js +290 -0
- package/dist/os/system/handlers/system-task-dispatch.js.map +1 -0
- package/dist/os/system/handlers/system-task-move.d.ts +12 -0
- package/dist/os/system/handlers/system-task-move.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-move.js +217 -0
- package/dist/os/system/handlers/system-task-move.js.map +1 -0
- package/dist/os/system/handlers/system-task-status.d.ts +20 -0
- package/dist/os/system/handlers/system-task-status.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-status.js +139 -0
- package/dist/os/system/handlers/system-task-status.js.map +1 -0
- package/dist/os/system/handlers/system-versionset-record.d.ts +12 -0
- package/dist/os/system/handlers/system-versionset-record.d.ts.map +1 -0
- package/dist/os/system/handlers/system-versionset-record.js +332 -0
- package/dist/os/system/handlers/system-versionset-record.js.map +1 -0
- package/dist/os/system/index.d.ts +6 -0
- package/dist/os/system/index.d.ts.map +1 -0
- package/dist/os/system/index.js +18 -0
- package/dist/os/system/index.js.map +1 -0
- package/dist/os/system/outbox-schema.d.ts +30 -0
- package/dist/os/system/outbox-schema.d.ts.map +1 -0
- package/dist/os/system/outbox-schema.js +29 -0
- package/dist/os/system/outbox-schema.js.map +1 -0
- package/dist/os/system/repo.d.ts +64 -0
- package/dist/os/system/repo.d.ts.map +1 -0
- package/dist/os/system/repo.js +364 -0
- package/dist/os/system/repo.js.map +1 -0
- package/dist/os/system/scenario-schemas.d.ts +26 -0
- package/dist/os/system/scenario-schemas.d.ts.map +1 -0
- package/dist/os/system/scenario-schemas.js +53 -0
- package/dist/os/system/scenario-schemas.js.map +1 -0
- package/dist/os/system/schemas.d.ts +63 -0
- package/dist/os/system/schemas.d.ts.map +1 -0
- package/dist/os/system/schemas.js +83 -0
- package/dist/os/system/schemas.js.map +1 -0
- package/dist/os/system/system.module.d.ts +3 -0
- package/dist/os/system/system.module.d.ts.map +1 -0
- package/dist/os/system/system.module.js +429 -0
- package/dist/os/system/system.module.js.map +1 -0
- package/dist/os/system/task-schemas.d.ts +108 -0
- package/dist/os/system/task-schemas.d.ts.map +1 -0
- package/dist/os/system/task-schemas.js +152 -0
- package/dist/os/system/task-schemas.js.map +1 -0
- package/dist/os/system/task-store.d.ts +41 -0
- package/dist/os/system/task-store.d.ts.map +1 -0
- package/dist/os/system/task-store.js +142 -0
- package/dist/os/system/task-store.js.map +1 -0
- package/dist/os/system/tests/helpers.d.ts +30 -0
- package/dist/os/system/tests/helpers.d.ts.map +1 -0
- package/dist/os/system/tests/helpers.js +178 -0
- package/dist/os/system/tests/helpers.js.map +1 -0
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts.map +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js +21 -7
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js.map +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +1 -1
- package/dist/os/werkstatt/werkstatt.module.d.ts.map +1 -1
- package/dist/os/werkstatt/werkstatt.module.js +2 -82
- package/dist/os/werkstatt/werkstatt.module.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +0 -3
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +2 -4
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
- package/dist/src/onboarding/agents-generate.js +49 -4
- package/dist/src/onboarding/agents-generate.js.map +1 -1
- package/dist/src/onboarding/create.d.ts +13 -0
- package/dist/src/onboarding/create.d.ts.map +1 -1
- package/dist/src/onboarding/create.js +95 -9
- package/dist/src/onboarding/create.js.map +1 -1
- package/dist/src/onboarding/doctor.d.ts.map +1 -1
- package/dist/src/onboarding/doctor.js +2 -47
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/upgrade.d.ts +5 -0
- package/dist/src/onboarding/upgrade.d.ts.map +1 -1
- package/dist/src/onboarding/upgrade.js +70 -1
- package/dist/src/onboarding/upgrade.js.map +1 -1
- package/dist/src/types.d.ts +9 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +2 -2
- package/docs/branch-model.md +98 -0
- package/docs/maintainers/publishing.md +10 -8
- package/docs/reference/cli.md +0 -3
- package/os/adr/handlers/implement-stamp-lock.test.ts +90 -0
- package/os/adr/handlers/implement-stamp.ts +29 -20
- package/os/checks/handlers/counters-journal.test.ts +10 -0
- package/os/checks/handlers/counters-journal.ts +8 -1
- package/os/core/core.module.ts +38 -39
- package/os/core/lock-holder.ts +88 -0
- package/os/core/stamp-lock.ts +142 -0
- package/os/flow/assets/flow-guard.sh +176 -0
- package/os/flow/branch-name.ts +139 -0
- package/os/flow/digest.ts +803 -0
- package/os/flow/flow.module.ts +796 -0
- package/os/flow/git.ts +342 -0
- package/os/flow/guard-files.ts +172 -0
- package/os/flow/handlers/flow-backmerge.ts +488 -0
- package/os/flow/handlers/flow-check.ts +450 -0
- package/os/flow/handlers/flow-cut.ts +1025 -0
- package/os/flow/handlers/flow-digest.ts +130 -0
- package/os/flow/handlers/flow-discard.ts +310 -0
- package/os/flow/handlers/flow-fix.ts +703 -0
- package/os/flow/handlers/flow-hold.ts +500 -0
- package/os/flow/handlers/flow-install.ts +1185 -0
- package/os/flow/handlers/flow-integrate.ts +623 -0
- package/os/flow/handlers/flow-open.ts +447 -0
- package/os/flow/handlers/flow-publication-retire.ts +156 -0
- package/os/flow/handlers/flow-push.ts +488 -0
- package/os/flow/handlers/flow-status.ts +283 -0
- package/os/flow/handlers/flow-unhold.ts +220 -0
- package/os/flow/handlers/flow-version.ts +196 -0
- package/os/flow/index.ts +102 -0
- package/os/flow/line-version.ts +113 -0
- package/os/flow/locks.ts +227 -0
- package/os/flow/markers.ts +135 -0
- package/os/flow/publication-order.ts +99 -0
- package/os/flow/publish.ts +272 -0
- package/os/flow/registry.ts +269 -0
- package/os/flow/release-level.ts +139 -0
- package/os/flow/release-lines.ts +208 -0
- package/os/flow/release-tags.ts +232 -0
- package/os/flow/repo-kind.ts +117 -0
- package/os/flow/scripts.ts +75 -0
- package/os/flow/semver.ts +82 -0
- package/os/flow/task-files.ts +59 -0
- package/os/flow/tests/branch-name.test.ts +136 -0
- package/os/flow/tests/fixtures/branch-names.yaml +56 -0
- package/os/flow/tests/flow-backmerge.test.ts +267 -0
- package/os/flow/tests/flow-check-version.test.ts +138 -0
- package/os/flow/tests/flow-check.test.ts +213 -0
- package/os/flow/tests/flow-cut-prepare.test.ts +298 -0
- package/os/flow/tests/flow-cut.rerun.test.ts +95 -0
- package/os/flow/tests/flow-cut.test.ts +323 -0
- package/os/flow/tests/flow-digest.test.ts +313 -0
- package/os/flow/tests/flow-discard.test.ts +220 -0
- package/os/flow/tests/flow-fix.test.ts +359 -0
- package/os/flow/tests/flow-guard-merge.test.ts +100 -0
- package/os/flow/tests/flow-guard-parity.test.ts +115 -0
- package/os/flow/tests/flow-guard-push.test.ts +100 -0
- package/os/flow/tests/flow-guard.test.ts +135 -0
- package/os/flow/tests/flow-hold.test.ts +465 -0
- package/os/flow/tests/flow-install-baseline.rerun.test.ts +73 -0
- package/os/flow/tests/flow-install-baseline.test.ts +164 -0
- package/os/flow/tests/flow-install-markers.test.ts +161 -0
- package/os/flow/tests/flow-install.rerun.test.ts +212 -0
- package/os/flow/tests/flow-install.test.ts +330 -0
- package/os/flow/tests/flow-integrate.rerun.test.ts +92 -0
- package/os/flow/tests/flow-integrate.test.ts +229 -0
- package/os/flow/tests/flow-open.test.ts +200 -0
- package/os/flow/tests/flow-publication-retire.test.ts +191 -0
- package/os/flow/tests/flow-push-publish.test.ts +282 -0
- package/os/flow/tests/flow-push-supersede.test.ts +221 -0
- package/os/flow/tests/flow-push.test.ts +160 -0
- package/os/flow/tests/flow-stale.test.ts +136 -0
- package/os/flow/tests/flow-status.test.ts +93 -0
- package/os/flow/tests/flow-task-files.test.ts +59 -0
- package/os/flow/tests/flow-version-level.test.ts +116 -0
- package/os/flow/tests/flow-version.test.ts +169 -0
- package/os/flow/tests/helpers.ts +239 -0
- package/os/flow/tests/is-flow-adopted.test.ts +71 -0
- package/os/flow/tests/locks.test.ts +219 -0
- package/os/flow/tests/publication-order.test.ts +102 -0
- package/os/flow/tests/registry.test.ts +150 -0
- package/os/flow/tests/repository-line-version.test.ts +100 -0
- package/os/flow/tests/scripts.test.ts +97 -0
- package/os/flow/tests/state-roots.test.ts +127 -0
- package/os/flow/tests/version-files.test.ts +145 -0
- package/os/flow/version-files.ts +115 -0
- package/os/flow/worktree-path.ts +107 -0
- package/os/mission/handlers/archive.test.ts +108 -36
- package/os/mission/handlers/archive.ts +46 -51
- package/os/mission/lockfile.ts +84 -0
- package/os/mission/mission.module.ts +2 -1
- package/os/program/handlers/seal.ts +1 -1
- package/os/program/handlers/validate.ts +1 -1
- package/os/program/program.module.ts +2 -1
- package/os/program/schemas.ts +51 -34
- package/os/program/state.ts +1 -9
- package/os/rfc/acceptance.ts +84 -19
- package/os/rfc/frontmatter-io.ts +78 -12
- package/os/rfc/handlers/implement-stamp-lock.test.ts +133 -0
- package/os/rfc/handlers/implement-stamp-stale.test.ts +22 -0
- package/os/rfc/handlers/implement-stamp.ts +30 -24
- package/os/rfc/handlers/validate-rules.test.ts +9 -6
- package/os/rfc/handlers/validate-rules.ts +12 -10
- package/os/rfc/handlers/validate.ts +17 -5
- package/os/rfc/index.ts +13 -1
- package/os/rfc/probe-batch.ts +329 -0
- package/os/rfc/rfc.module.ts +19 -2
- package/os/rfc/verification-emit-check.test.ts +22 -0
- package/os/rfc/verification-emit-freshness.test.ts +22 -0
- package/os/rfc/verification-emit.test.ts +22 -0
- package/os/rfc/verification-evidence.ts +21 -16
- package/os/rfc/verification-refresh.test.ts +22 -0
- package/os/rfc/verification-refresh.ts +20 -18
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +9 -0
- package/os/system/handlers/outbox-validate.ts +120 -0
- package/os/system/handlers/system-map-validate.ts +107 -0
- package/os/system/handlers/system-outbox-scan.ts +320 -0
- package/os/system/handlers/system-task-collect.ts +305 -0
- package/os/system/handlers/system-task-create.ts +271 -0
- package/os/system/handlers/system-task-dispatch.ts +387 -0
- package/os/system/handlers/system-task-move.ts +353 -0
- package/os/system/handlers/system-task-status.ts +176 -0
- package/os/system/handlers/system-versionset-record.ts +476 -0
- package/os/system/index.ts +47 -0
- package/os/system/outbox-schema.ts +47 -0
- package/os/system/repo.ts +451 -0
- package/os/system/scenario-schemas.ts +62 -0
- package/os/system/schemas.ts +102 -0
- package/os/system/system.module.ts +449 -0
- package/os/system/task-schemas.ts +190 -0
- package/os/system/task-store.ts +184 -0
- package/os/system/tests/helpers.ts +189 -0
- package/os/system/tests/outbox-validate.test.ts +92 -0
- package/os/system/tests/system-map-validate.test.ts +321 -0
- package/os/system/tests/system-outbox-scan.test.ts +273 -0
- package/os/system/tests/system-profile.test.ts +90 -0
- package/os/system/tests/system-task-collect.test.ts +293 -0
- package/os/system/tests/system-task-dispatch.test.ts +279 -0
- package/os/system/tests/system-task-status.test.ts +153 -0
- package/os/system/tests/system-task.test.ts +330 -0
- package/os/system/tests/system-versionset.test.ts +314 -0
- package/os/werkstatt/handlers/werkstatt-lock-recover.ts +22 -5
- package/os/werkstatt/handlers/werkstatt-operation-validate.ts +1 -1
- package/os/werkstatt/werkstatt.module.ts +2 -85
- package/package.json +49 -1
- package/profiles/forge-shell.yaml +22 -10
- package/profiles/godot-game.yaml +24 -13
- package/profiles/knowledge.yaml +19 -0
- package/profiles/phaser-game.yaml +25 -13
- package/profiles/site-workshop.yaml +27 -10
- package/profiles/system.yaml +650 -0
- package/profiles/typescript.yaml +26 -9
- package/skills/fo/fo-outbox/SKILL.md +71 -0
- package/skills/fo/fo-session-retro/SKILL.md +18 -7
- package/skills/fo/fo-step-commit/SKILL.md +2 -1
- package/skills/fo/fo-system-dispatch/SKILL.md +65 -0
- package/skills/fo/fo-task-run/SKILL.md +75 -0
- package/src/config/forge-config.ts +2 -6
- package/src/index.ts +19 -4
- package/src/onboarding/agents-generate.ts +49 -5
- package/src/onboarding/create.ts +101 -9
- package/src/onboarding/doctor.ts +2 -51
- package/src/onboarding/upgrade.ts +86 -1
- package/src/tests/agents-generate-flow.test.ts +132 -0
- package/src/tests/create-flow.test.ts +114 -0
- package/src/tests/create.test.ts +22 -21
- package/src/tests/doctor-autonomy.test.ts +2 -1
- package/src/tests/fixtures/agents-generate-business-before.txt +6 -0
- package/src/tests/implement-stamp.test.ts +26 -3
- package/src/tests/profile-flow-hooks.test.ts +77 -0
- package/src/tests/profile-schema.test.ts +2 -1
- package/src/tests/program-schemas.test.ts +66 -6
- package/src/tests/program-spec-node.test.ts +1 -5
- package/src/tests/rfc-evidence-sync.test.ts +22 -0
- package/src/tests/rfc-implement-stamp-governance.test.ts +25 -1
- package/src/tests/rfc-verification-verdict-ingest.test.ts +22 -0
- package/src/tests/upgrade-flow.test.ts +174 -0
- package/src/types.ts +11 -2
- package/dist/os/werkstatt/handlers/session-close.d.ts +0 -13
- package/dist/os/werkstatt/handlers/session-close.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/session-close.js +0 -56
- package/dist/os/werkstatt/handlers/session-close.js.map +0 -1
- package/dist/os/werkstatt/handlers/session-engine.d.ts +0 -3
- package/dist/os/werkstatt/handlers/session-engine.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/session-engine.js +0 -28
- package/dist/os/werkstatt/handlers/session-engine.js.map +0 -1
- package/dist/os/werkstatt/handlers/session-open.d.ts +0 -10
- package/dist/os/werkstatt/handlers/session-open.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/session-open.js +0 -46
- package/dist/os/werkstatt/handlers/session-open.js.map +0 -1
- package/dist/os/werkstatt/handlers/session-status.d.ts +0 -9
- package/dist/os/werkstatt/handlers/session-status.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/session-status.js +0 -34
- package/dist/os/werkstatt/handlers/session-status.js.map +0 -1
- package/os/werkstatt/handlers/session-close.ts +0 -82
- package/os/werkstatt/handlers/session-engine.ts +0 -34
- package/os/werkstatt/handlers/session-open.ts +0 -68
- package/os/werkstatt/handlers/session-status.ts +0 -55
|
@@ -0,0 +1,703 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>flow.fix (RFC-1490) — opens auto/fix-… at the main tip for a patch
|
|
4
|
+
release: FLOW-FIX-01 adoption, FLOW-FIX-02 main at the repository line's
|
|
5
|
+
last-tag commit, FLOW-FIX-03 slug grammar, FLOW-FIX-04 pending back-merge.
|
|
6
|
+
The fix worktree's flow.cut (runFixCut) rebases onto a moved main, verifies
|
|
7
|
+
version writes, releases into main through the gate with FORGE_FLOW_TARGET
|
|
8
|
+
=main, tags, tears the fix branch down and runs the back-merge — a
|
|
9
|
+
conflicted port still reports released: true (DNA-106 per step).</purpose>
|
|
10
|
+
<non-goals>
|
|
11
|
+
<item>No ordinary cuts — runOrdinaryCut handles those.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
<KEY_DECISIONS>
|
|
15
|
+
<item>Touched package lines come from `git diff --name-only baseSha..fixTip` intersected with each line's paths — the fix commits declare what they release (AC-15).</item>
|
|
16
|
+
<item>The fix cut never fast-forwards develop — it update-refs main at the fix tip, then delegates the port to backmergeFlow so the conflict path reports released + backmerge: conflict.</item>
|
|
17
|
+
<item>RFC-1502: the fix release commit uses the same `add -u` staging + FLOW-CUT-14 untracked removal as the ordinary cut, and verifies named package lines at the fix tip before any ref moves.</item>
|
|
18
|
+
<item>RFC-1502 r1: a refused fix cut rolls the branch back to its pre-release tip via `update-ref` + `read-tree --reset -u HEAD` (the session guard blocks reset --hard/restore/checkout --), so FLOW-CUT-12/13 stay rerun-safe without removing the fix worktree.</item>
|
|
19
|
+
</KEY_DECISIONS>
|
|
20
|
+
<CHANGE_SUMMARY>
|
|
21
|
+
<item>RFC-1491: step 1 — journal base/rewrites + held registry widening, W1-1 discard tip, FLOW-INT-11</item>
|
|
22
|
+
<item>RFC-1490: fix-mode cut run inside the fix worktree tears down and back-merges through the primary
|
|
23
|
+
|
|
24
|
+
Steering-session verification of wave 2 (W2-1): flow.cut run inside the fix worktree, the documented path and the one flow.fix's nextSteps print, released main and the tags, then removed that worktree and kept using it as repoRoot. branch -D failed unobserved, leaving an unregistered auto/fix branch, and the trailing back-merge crashed on the vanished directory. The primary is now resolved before the cut and used for every step after the teardown; a failed branch delete surfaces as a FLOW-07 warning. Back-merge refusals are appended to the cut diagnostics instead of replacing them.</item>
|
|
25
|
+
<item>RFC-1494: step 1 — isFlowAdopted public export</item>
|
|
26
|
+
<item>RFC-1502: steps 1-5 — release-prepare hook, pre-tag extract verification, ordered steps</item>
|
|
27
|
+
<item>RFC-1502: review r1 — fix-cut rollback on FLOW-CUT-12/13, populated steps[], hook validation, GIT_* env scrub</item>
|
|
28
|
+
<history>RFC-1490</history>
|
|
29
|
+
</CHANGE_SUMMARY>
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import { join } from "node:path";
|
|
33
|
+
|
|
34
|
+
import type {
|
|
35
|
+
Diagnostic,
|
|
36
|
+
ForgeCommandInput,
|
|
37
|
+
ForgeCommandResult,
|
|
38
|
+
ForgeRuntimeContext,
|
|
39
|
+
WorkspaceIO,
|
|
40
|
+
} from "../../../src/types.ts";
|
|
41
|
+
import { resolveIo } from "../../../src/utils/io.ts";
|
|
42
|
+
|
|
43
|
+
import {
|
|
44
|
+
git,
|
|
45
|
+
gitCommit,
|
|
46
|
+
isAncestor,
|
|
47
|
+
requireGit,
|
|
48
|
+
statusDirty,
|
|
49
|
+
topLevel,
|
|
50
|
+
worktreeList,
|
|
51
|
+
} from "../git.ts";
|
|
52
|
+
import { LockTimeoutError, withFlowLock } from "../locks.ts";
|
|
53
|
+
import { discoverReleaseLines } from "../release-lines.ts";
|
|
54
|
+
import { pendingLevel } from "../release-level.ts";
|
|
55
|
+
import { bumpVersion, formatVersion } from "../semver.ts";
|
|
56
|
+
import { listLineTags, releaseTagAnnotation, writeReleaseTag } from "../release-tags.ts";
|
|
57
|
+
import {
|
|
58
|
+
appendJournal,
|
|
59
|
+
commonGitDir,
|
|
60
|
+
INTEGRATE_LOCK_RELATIVE_PATH,
|
|
61
|
+
updateRegistry,
|
|
62
|
+
type FlowRegistryEntry,
|
|
63
|
+
} from "../registry.ts";
|
|
64
|
+
import { runFlowScript, type FlowScriptResult } from "../scripts.ts";
|
|
65
|
+
import { verifyLineAtRef } from "../publish.ts";
|
|
66
|
+
import { primaryWorktree } from "../worktree-path.ts";
|
|
67
|
+
import { VersionWriteError, writeLineVersion } from "../version-files.ts";
|
|
68
|
+
import { backmergeFlow, type FlowBackmergeData } from "./flow-backmerge.ts";
|
|
69
|
+
import type { FlowCutData } from "./flow-cut.ts";
|
|
70
|
+
import { plannedExtractVerifySteps, toFlowCutLines } from "./flow-cut.ts";
|
|
71
|
+
import { isFlowAdopted } from "../index.ts";
|
|
72
|
+
import type { CutLine } from "./flow-cut.ts";
|
|
73
|
+
import {
|
|
74
|
+
INTEGRATE_LOCK_STALE_MS,
|
|
75
|
+
INTEGRATE_LOCK_WAIT_MS,
|
|
76
|
+
} from "./flow-integrate.ts";
|
|
77
|
+
import { openFlowBranchCore } from "./flow-open.ts";
|
|
78
|
+
|
|
79
|
+
export interface FlowFixData {
|
|
80
|
+
branch: string | null;
|
|
81
|
+
worktree: string | null;
|
|
82
|
+
base: "main";
|
|
83
|
+
baseSha: string | null;
|
|
84
|
+
/** Repository line's last release tag the fix opened against (FLOW-FIX-02 proof). */
|
|
85
|
+
baseTag: string | null;
|
|
86
|
+
opened: boolean;
|
|
87
|
+
/** The worktree-setup hook result — FLOW-OPEN-07 failures surface here. */
|
|
88
|
+
setup: FlowScriptResult | null;
|
|
89
|
+
diagnostics: Diagnostic[];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function refuseFix(
|
|
93
|
+
ruleId: string,
|
|
94
|
+
message: string,
|
|
95
|
+
fixHint: string,
|
|
96
|
+
partial?: Partial<FlowFixData>,
|
|
97
|
+
): FlowFixData {
|
|
98
|
+
return {
|
|
99
|
+
branch: null,
|
|
100
|
+
worktree: null,
|
|
101
|
+
base: "main",
|
|
102
|
+
baseSha: null,
|
|
103
|
+
baseTag: null,
|
|
104
|
+
opened: false,
|
|
105
|
+
setup: null,
|
|
106
|
+
...partial,
|
|
107
|
+
diagnostics: [{ ruleId, severity: "error", message, fixHint }],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const FIX_SLUG_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
112
|
+
|
|
113
|
+
export async function fixFlow(
|
|
114
|
+
repoRoot: string,
|
|
115
|
+
io: WorkspaceIO,
|
|
116
|
+
opts: { slug: string; brief: string | null; dryRun: boolean; now?: Date },
|
|
117
|
+
): Promise<FlowFixData> {
|
|
118
|
+
if (!(await isFlowAdopted(repoRoot, io))) {
|
|
119
|
+
return refuseFix(
|
|
120
|
+
"FLOW-FIX-01",
|
|
121
|
+
"repository is not adopted into the fixed branch model",
|
|
122
|
+
"run pnpm exec forge flow.install first",
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
if (!FIX_SLUG_RE.test(opts.slug) || opts.slug.length < 3 || opts.slug.length > 48) {
|
|
126
|
+
return refuseFix(
|
|
127
|
+
"FLOW-FIX-03",
|
|
128
|
+
`invalid --slug '${opts.slug}'`,
|
|
129
|
+
"slug must match ^[a-z0-9]+(-[a-z0-9]+)*$ and be 3..48 characters",
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
const { lines } = await discoverReleaseLines(repoRoot, io);
|
|
133
|
+
const repoLine = lines.find((l) => l.paths.length === 0) ?? lines[0];
|
|
134
|
+
if (repoLine === undefined) {
|
|
135
|
+
return refuseFix("FLOW-FIX-01", "no release lines discovered", "check pnpm-workspace.yaml");
|
|
136
|
+
}
|
|
137
|
+
const mainSha = (await git(repoRoot, io, ["rev-parse", "main"])).stdout.trim();
|
|
138
|
+
const tags = await listLineTags(repoRoot, repoLine, io, "main");
|
|
139
|
+
const tagCommit =
|
|
140
|
+
tags.lastTag === null
|
|
141
|
+
? null
|
|
142
|
+
: (await git(repoRoot, io, ["rev-parse", `${tags.lastTag.name}^{}`])).stdout.trim();
|
|
143
|
+
if (tags.lastTag === null || tagCommit !== mainSha) {
|
|
144
|
+
return refuseFix(
|
|
145
|
+
"FLOW-FIX-02",
|
|
146
|
+
"main moved past its last release — the fix must start at the release baseline",
|
|
147
|
+
"cut a release first (flow.cut), then open the fix",
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
if (!(await isAncestor(repoRoot, io, "main", "develop"))) {
|
|
151
|
+
return refuseFix(
|
|
152
|
+
"FLOW-FIX-04",
|
|
153
|
+
"main carries a release not yet back-merged into develop",
|
|
154
|
+
"finish the pending back-merge first (flow.backmerge)",
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const open = await openFlowBranchCore(repoRoot, io, {
|
|
159
|
+
kind: "fix",
|
|
160
|
+
slug: opts.slug,
|
|
161
|
+
brief: opts.brief,
|
|
162
|
+
owner: { kind: "session", id: "fix" },
|
|
163
|
+
base: "main",
|
|
164
|
+
journalEvent: "fix",
|
|
165
|
+
dryRun: opts.dryRun,
|
|
166
|
+
now: opts.now,
|
|
167
|
+
});
|
|
168
|
+
// A dry-run plans the branch without opening it (opened: false, no
|
|
169
|
+
// diagnostics) — only a real open that did not happen is a refusal.
|
|
170
|
+
if (open.branch === null || (!open.opened && !opts.dryRun)) {
|
|
171
|
+
const d = open.diagnostics[0];
|
|
172
|
+
return refuseFix(
|
|
173
|
+
d?.ruleId ?? "FLOW-FIX-01",
|
|
174
|
+
d?.message ?? "fix branch did not open",
|
|
175
|
+
d?.fixHint ?? "inspect flow.status",
|
|
176
|
+
{ baseTag: tags.lastTag?.name ?? null, setup: open.setup },
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
// An opened worktree whose setup hook failed still reports opened — the
|
|
180
|
+
// FLOW-OPEN-07 diagnostic rides along (the worktree stays per DNA-106).
|
|
181
|
+
return {
|
|
182
|
+
branch: open.branch,
|
|
183
|
+
worktree: open.worktree,
|
|
184
|
+
base: "main",
|
|
185
|
+
baseSha: open.baseSha,
|
|
186
|
+
baseTag: tags.lastTag?.name ?? null,
|
|
187
|
+
opened: open.opened,
|
|
188
|
+
setup: open.setup,
|
|
189
|
+
diagnostics: open.diagnostics,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Fix-mode flow.cut — the release side of a registered fix worktree.
|
|
195
|
+
* `entry` is the fix's registry row; refusals FLOW-CUT-09/07/04/10/06/11
|
|
196
|
+
* and FLOW-INT-02/05 hold per the RFC's fix contract.
|
|
197
|
+
*/
|
|
198
|
+
export async function runFixCut(
|
|
199
|
+
repoRoot: string,
|
|
200
|
+
io: WorkspaceIO,
|
|
201
|
+
opts: {
|
|
202
|
+
entry: FlowRegistryEntry;
|
|
203
|
+
linesGiven: boolean;
|
|
204
|
+
dryRun: boolean;
|
|
205
|
+
now?: Date;
|
|
206
|
+
onProgress?: (m: string) => void;
|
|
207
|
+
},
|
|
208
|
+
): Promise<FlowCutData> {
|
|
209
|
+
const now = opts.now ?? new Date();
|
|
210
|
+
const { entry } = opts;
|
|
211
|
+
const base: FlowCutData = {
|
|
212
|
+
mode: "fix",
|
|
213
|
+
released: false,
|
|
214
|
+
resumed: false,
|
|
215
|
+
releaseBranch: entry.name,
|
|
216
|
+
releaseCommit: null,
|
|
217
|
+
mainBefore: null,
|
|
218
|
+
mainAfter: null,
|
|
219
|
+
mainGains: 0,
|
|
220
|
+
tags: [],
|
|
221
|
+
versions: {},
|
|
222
|
+
lines: [],
|
|
223
|
+
fingerprints: {},
|
|
224
|
+
gate: null,
|
|
225
|
+
backmerge: null,
|
|
226
|
+
steps: [],
|
|
227
|
+
diagnostics: [],
|
|
228
|
+
};
|
|
229
|
+
const cutRefuse = (ruleId: string, message: string, fixHint: string, p?: Partial<FlowCutData>): FlowCutData => ({
|
|
230
|
+
...base,
|
|
231
|
+
...p,
|
|
232
|
+
diagnostics: [{ ruleId, severity: "error", message, fixHint }],
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
if (opts.linesGiven) {
|
|
236
|
+
return cutRefuse("FLOW-CUT-09", "--lines is not valid for a fix release", "the fix's touched lines are derived from its commits — drop --lines");
|
|
237
|
+
}
|
|
238
|
+
const live = await worktreeList(repoRoot, io);
|
|
239
|
+
const liveFix = live.find((w) => w.branch === entry.name);
|
|
240
|
+
if (liveFix === undefined) {
|
|
241
|
+
return cutRefuse(
|
|
242
|
+
"FLOW-CUT-07",
|
|
243
|
+
`no worktree has ${entry.name} checked out — the fix must release from its own worktree`,
|
|
244
|
+
"re-open the fix with flow.fix, or inspect with flow.status",
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
const fixWt = liveFix.path;
|
|
248
|
+
if (!(await io.exists(fixWt))) {
|
|
249
|
+
return cutRefuse("FLOW-07", `fix worktree ${fixWt} does not exist`, "inspect with flow.status — a stale entry may need flow.discard");
|
|
250
|
+
}
|
|
251
|
+
// The release commit stages tracked changes only (git add -u, RFC-1502) —
|
|
252
|
+
// the dirty check still reports untracked files so the operator sees what
|
|
253
|
+
// the release deliberately leaves out, and main must be free for the CAS.
|
|
254
|
+
const dirty = await statusDirty(fixWt, io);
|
|
255
|
+
const mainCheckedOut = live.some((w) => w.branch === "main");
|
|
256
|
+
if (dirty.length > 0 || mainCheckedOut) {
|
|
257
|
+
return cutRefuse(
|
|
258
|
+
"FLOW-CUT-07",
|
|
259
|
+
mainCheckedOut
|
|
260
|
+
? "a worktree has main checked out — the fix cut must own the main ref"
|
|
261
|
+
: `fix worktree has ${dirty.length} uncommitted change(s)`,
|
|
262
|
+
mainCheckedOut
|
|
263
|
+
? "remove the worktree holding main, then re-run flow.cut"
|
|
264
|
+
: "commit or revert inside the fix worktree",
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
const baseSha = entry.baseSha;
|
|
268
|
+
const fixTip0 = (await git(repoRoot, io, ["rev-parse", entry.name])).stdout.trim();
|
|
269
|
+
const beyond = Number(
|
|
270
|
+
(await git(repoRoot, io, ["rev-list", "--count", `${baseSha}..${fixTip0}`])).stdout.trim() || 0,
|
|
271
|
+
);
|
|
272
|
+
if (beyond === 0) {
|
|
273
|
+
return cutRefuse("FLOW-CUT-04", "the fix branch carries no commits beyond its base", "commit the patch inside the fix worktree first");
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Level gate: the fix commits' X-RFC trailers must not demand minor/major.
|
|
277
|
+
const { lines } = await discoverReleaseLines(repoRoot, io);
|
|
278
|
+
const repoLine = lines.find((l) => l.paths.length === 0) ?? lines[0]!;
|
|
279
|
+
const probe = await pendingLevel(repoLine, baseSha, io, repoRoot, null, fixTip0);
|
|
280
|
+
if (probe.level === "minor" || probe.level === "major") {
|
|
281
|
+
return cutRefuse(
|
|
282
|
+
"FLOW-CUT-10",
|
|
283
|
+
`a fix releases a patch only — its commits demand ${probe.level}`,
|
|
284
|
+
"integrate the change on develop and run an ordinary flow.cut instead",
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Touched lines: repository line plus package lines whose paths the fix
|
|
289
|
+
// commits touch.
|
|
290
|
+
const touched = await git(repoRoot, io, ["diff", "--name-only", `${baseSha}..${fixTip0}`]);
|
|
291
|
+
const touchedPaths = touched.stdout.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
292
|
+
const selected = [
|
|
293
|
+
repoLine,
|
|
294
|
+
...lines.filter(
|
|
295
|
+
(l) =>
|
|
296
|
+
l.id !== repoLine.id &&
|
|
297
|
+
l.paths.some((p) => touchedPaths.some((t) => t === p || t.startsWith(`${p}/`))),
|
|
298
|
+
),
|
|
299
|
+
];
|
|
300
|
+
|
|
301
|
+
const cutLines: CutLine[] = [];
|
|
302
|
+
for (const line of selected) {
|
|
303
|
+
const tags = await listLineTags(repoRoot, line, io, fixTip0);
|
|
304
|
+
if (tags.lastTag === null) {
|
|
305
|
+
return cutRefuse("FLOW-CUT-04", `release line '${line.id}' has no baseline tag`, "cut the line's baseline via an ordinary release first");
|
|
306
|
+
}
|
|
307
|
+
const next = formatVersion(bumpVersion(tags.lastTag.version, "patch"));
|
|
308
|
+
const tagName = `${line.tagPrefix}${next}`;
|
|
309
|
+
if ((await git(repoRoot, io, ["rev-parse", "--verify", "-q", `refs/tags/${tagName}`])).exitCode === 0) {
|
|
310
|
+
return cutRefuse("FLOW-CUT-06", `target tag ${tagName} already exists`, "pick a different version or delete the stray tag");
|
|
311
|
+
}
|
|
312
|
+
cutLines.push({ line, tag: tagName, level: "patch", nextVersion: next, previousTag: tags.lastTag.name, rfcs: [] });
|
|
313
|
+
}
|
|
314
|
+
const tagList = cutLines.map((c) => c.tag);
|
|
315
|
+
const subject = `chore(release): ${tagList.join(", ")}`;
|
|
316
|
+
|
|
317
|
+
const primary = await primaryWorktree(io, repoRoot);
|
|
318
|
+
const fixSteps = async (): Promise<string[]> => {
|
|
319
|
+
const steps = ["version-writes", "release-prepare", "release-commit"];
|
|
320
|
+
steps.push(...(await plannedExtractVerifySteps(primary, io, cutLines, repoLine)));
|
|
321
|
+
steps.push("gate", "fingerprints", "main", "tags", "teardown", "backmerge");
|
|
322
|
+
return steps;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
if (opts.dryRun) {
|
|
326
|
+
return {
|
|
327
|
+
...base,
|
|
328
|
+
tags: tagList,
|
|
329
|
+
versions: Object.fromEntries(cutLines.map((c) => [c.line.id, c.nextVersion])),
|
|
330
|
+
lines: toFlowCutLines(tagList, cutLines, lines, repoLine),
|
|
331
|
+
mainBefore: (await git(repoRoot, io, ["rev-parse", "main"])).stdout.trim(),
|
|
332
|
+
steps: await fixSteps(),
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const common = await commonGitDir(io, repoRoot);
|
|
337
|
+
const lockPath = join(common, INTEGRATE_LOCK_RELATIVE_PATH);
|
|
338
|
+
|
|
339
|
+
let fixTip = fixTip0;
|
|
340
|
+
try {
|
|
341
|
+
return await withFlowLock(
|
|
342
|
+
lockPath,
|
|
343
|
+
{ waitMs: INTEGRATE_LOCK_WAIT_MS, staleMs: INTEGRATE_LOCK_STALE_MS, progressEveryMs: 60_000, onProgress: opts.onProgress },
|
|
344
|
+
async () => {
|
|
345
|
+
// Rebase onto main when main moved since the fix opened.
|
|
346
|
+
const mainNow = (await git(repoRoot, io, ["rev-parse", "main"])).stdout.trim();
|
|
347
|
+
if (mainNow !== baseSha) {
|
|
348
|
+
const rebase = await git(fixWt, io, ["rebase", "main"]);
|
|
349
|
+
if (rebase.exitCode !== 0) {
|
|
350
|
+
const conflicts = await git(fixWt, io, ["diff", "--name-only", "--diff-filter=U"]);
|
|
351
|
+
await git(fixWt, io, ["rebase", "--abort"]);
|
|
352
|
+
return cutRefuse(
|
|
353
|
+
"FLOW-INT-02",
|
|
354
|
+
`rebase onto moved main conflicts in: ${conflicts.stdout.trim().split("\n").join(", ")}`,
|
|
355
|
+
"resolve the rebase inside the fix worktree, commit, and re-run flow.cut",
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
fixTip = (await git(repoRoot, io, ["rev-parse", entry.name])).stdout.trim();
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Pre-release tip: the cut rolls the fix branch back here when the
|
|
362
|
+
// prepare hook or the extract verification refuses — the branch must
|
|
363
|
+
// stay (it carries the fix) but the cut has to be rerun-safe, which
|
|
364
|
+
// uncommitted version writes or a failed release commit break.
|
|
365
|
+
const preReleaseTip = fixTip;
|
|
366
|
+
const rollbackToTip = async (): Promise<void> => {
|
|
367
|
+
// Destructive shorthands are blocked by the session guard (reset
|
|
368
|
+
// --hard, restore, checkout --) — move the ref directly, then
|
|
369
|
+
// reset index+worktree to the (new) HEAD tree via plumbing.
|
|
370
|
+
await git(fixWt, io, ["update-ref", `refs/heads/${entry.name}`, preReleaseTip]);
|
|
371
|
+
await git(fixWt, io, ["read-tree", "--reset", "-u", "HEAD"]);
|
|
372
|
+
const leftovers = (
|
|
373
|
+
await git(fixWt, io, [
|
|
374
|
+
"-c",
|
|
375
|
+
"core.quotepath=false",
|
|
376
|
+
"ls-files",
|
|
377
|
+
"-z",
|
|
378
|
+
"--others",
|
|
379
|
+
"--exclude-standard",
|
|
380
|
+
])
|
|
381
|
+
).stdout
|
|
382
|
+
.split("\0")
|
|
383
|
+
.filter((f) => f.length > 0);
|
|
384
|
+
for (const file of leftovers) {
|
|
385
|
+
await io.rm(join(fixWt, file));
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
// Verified version writes on the fix branch.
|
|
390
|
+
try {
|
|
391
|
+
for (const c of cutLines) {
|
|
392
|
+
await writeLineVersion(fixWt, c.line, c.nextVersion, io);
|
|
393
|
+
}
|
|
394
|
+
} catch (error) {
|
|
395
|
+
if (error instanceof VersionWriteError) {
|
|
396
|
+
return cutRefuse("FLOW-CUT-11", error.message, "fix the version file so the top-level version field is the release version");
|
|
397
|
+
}
|
|
398
|
+
throw error;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// release-prepare hook (RFC-1502): same seam as the ordinary cut —
|
|
402
|
+
// version-hashed derived artifacts regenerated into the fix's
|
|
403
|
+
// release commit. Runs from the primary checkout on the fix worktree.
|
|
404
|
+
const warnings: Diagnostic[] = [];
|
|
405
|
+
const prep = await runFlowScript(io, "release-prepare", {
|
|
406
|
+
primary,
|
|
407
|
+
cwd: fixWt,
|
|
408
|
+
env: {
|
|
409
|
+
FORGE_FLOW_RELEASE_TAGS: tagList.join(" "),
|
|
410
|
+
FORGE_FLOW_RELEASE_VERSIONS: JSON.stringify(
|
|
411
|
+
Object.fromEntries(cutLines.map((c) => [c.line.id, c.nextVersion])),
|
|
412
|
+
),
|
|
413
|
+
},
|
|
414
|
+
});
|
|
415
|
+
if (prep.status === "failed") {
|
|
416
|
+
await rollbackToTip();
|
|
417
|
+
return cutRefuse(
|
|
418
|
+
"FLOW-CUT-12",
|
|
419
|
+
`hooks/release-prepare.sh failed (exit ${prep.exitCode}): ${prep.stderrTail}`,
|
|
420
|
+
"fix the release-prepare hook and re-run flow.cut — the fix branch was rolled back to its pre-release tip",
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Release commit on the fix branch — add -u folds the hook's tracked
|
|
425
|
+
// edits in; untracked leftovers stay out and are reported.
|
|
426
|
+
await git(fixWt, io, ["add", "-u"]);
|
|
427
|
+
const untrackedFiles = (
|
|
428
|
+
await git(fixWt, io, [
|
|
429
|
+
"-c",
|
|
430
|
+
"core.quotepath=false",
|
|
431
|
+
"ls-files",
|
|
432
|
+
"-z",
|
|
433
|
+
"--others",
|
|
434
|
+
"--exclude-standard",
|
|
435
|
+
])
|
|
436
|
+
).stdout
|
|
437
|
+
.split("\0")
|
|
438
|
+
.filter((f) => f.length > 0);
|
|
439
|
+
if (untrackedFiles.length > 0) {
|
|
440
|
+
warnings.push({
|
|
441
|
+
ruleId: "FLOW-CUT-14",
|
|
442
|
+
severity: "warning",
|
|
443
|
+
message: `release-prepare left untracked file(s) excluded from the release commit and removed from the release worktree: ${untrackedFiles.join(", ")}`,
|
|
444
|
+
});
|
|
445
|
+
// The cut continues — the same unignored-untracked set comes out of
|
|
446
|
+
// the worktree so the gate sees a clean tree. Removed via io.rm:
|
|
447
|
+
// `git clean -f` is blocked in agent sessions.
|
|
448
|
+
for (const file of untrackedFiles) {
|
|
449
|
+
await io.rm(join(fixWt, file));
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
const body = cutLines.map((c) => `${c.tag} patch ${c.previousTag ?? "null"}`).join("\n");
|
|
453
|
+
const commit = await gitCommit(fixWt, io, ["commit", "-m", `${subject}\n\n${body}`], "cut");
|
|
454
|
+
if (commit.exitCode !== 0) {
|
|
455
|
+
return cutRefuse("FLOW-CUT-01", `release commit failed: ${commit.stderr.trim()}`, "inspect the fix worktree state");
|
|
456
|
+
}
|
|
457
|
+
fixTip = (await git(repoRoot, io, ["rev-parse", entry.name])).stdout.trim();
|
|
458
|
+
|
|
459
|
+
// Pre-tag extract verification (RFC-1502): named package lines
|
|
460
|
+
// extract at the fix's release commit into a scratch — before any
|
|
461
|
+
// ref or tag moves.
|
|
462
|
+
for (const c of cutLines) {
|
|
463
|
+
if (c.line.id === repoLine.id) continue;
|
|
464
|
+
const verify = await verifyLineAtRef(primary, io, { line: c.line, ref: fixTip });
|
|
465
|
+
if (!verify.ok) {
|
|
466
|
+
await rollbackToTip();
|
|
467
|
+
return cutRefuse(
|
|
468
|
+
"FLOW-CUT-13",
|
|
469
|
+
`pre-tag extract verification failed for line ${c.line.id}: ${verify.detail}`,
|
|
470
|
+
"fix the extract or verify failure and re-run flow.cut — the fix branch was rolled back to its pre-release tip",
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// Gate with main as the target.
|
|
476
|
+
const gate = await runFlowScript(io, "integration-gate", {
|
|
477
|
+
primary,
|
|
478
|
+
cwd: fixWt,
|
|
479
|
+
env: {
|
|
480
|
+
FLOW_PRIMARY: primary,
|
|
481
|
+
FLOW_BRANCH: entry.name,
|
|
482
|
+
FLOW_BASE_SHA: mainNow,
|
|
483
|
+
FORGE_FLOW_TARGET: "main",
|
|
484
|
+
},
|
|
485
|
+
});
|
|
486
|
+
if (gate.status === "failed") {
|
|
487
|
+
return cutRefuse(
|
|
488
|
+
"FLOW-INT-05",
|
|
489
|
+
`hooks/integration-gate.sh refused (exit ${gate.exitCode}): ${gate.stderrTail}`,
|
|
490
|
+
"fix what the gate demands and re-run flow.cut",
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// Fingerprints (same hook, same output contract as the ordinary cut).
|
|
495
|
+
const fpResult = await runFlowScript(io, "release-fingerprints", {
|
|
496
|
+
primary,
|
|
497
|
+
cwd: primary,
|
|
498
|
+
env: { FORGE_FLOW_RELEASE_SHA: fixTip, FORGE_FLOW_RELEASE_TAGS: tagList.join(",") },
|
|
499
|
+
});
|
|
500
|
+
const fingerprints: Record<string, string> = {};
|
|
501
|
+
if (fpResult.status === "failed") {
|
|
502
|
+
return cutRefuse("FLOW-CUT-08", `hooks/release-fingerprints.sh failed (exit ${fpResult.exitCode}): ${fpResult.stderrTail}`, "fix the fingerprint hook and re-run flow.cut — main has not moved");
|
|
503
|
+
}
|
|
504
|
+
if (fpResult.status === "done") {
|
|
505
|
+
const { parse: yamlParse } = await import("yaml");
|
|
506
|
+
try {
|
|
507
|
+
const parsed: unknown = yamlParse(fpResult.stdout);
|
|
508
|
+
if (parsed !== null && (typeof parsed !== "object" || Array.isArray(parsed))) {
|
|
509
|
+
return cutRefuse("FLOW-CUT-08", "release-fingerprints stdout is not a flat YAML mapping", "emit only 'key: value' string pairs");
|
|
510
|
+
}
|
|
511
|
+
for (const [k, v] of Object.entries((parsed ?? {}) as Record<string, unknown>)) {
|
|
512
|
+
if (typeof v !== "string") {
|
|
513
|
+
return cutRefuse("FLOW-CUT-08", "release-fingerprints stdout is not a flat YAML mapping", "emit only 'key: value' string pairs");
|
|
514
|
+
}
|
|
515
|
+
fingerprints[k] = v;
|
|
516
|
+
}
|
|
517
|
+
} catch {
|
|
518
|
+
return cutRefuse("FLOW-CUT-08", "release-fingerprints stdout is not valid YAML", "emit only 'key: value' string pairs");
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// Atomic main update.
|
|
523
|
+
const upd = await git(repoRoot, io, ["update-ref", "refs/heads/main", fixTip, mainNow]);
|
|
524
|
+
if (upd.exitCode !== 0) {
|
|
525
|
+
return cutRefuse("FLOW-CUT-01", `update-ref main failed: ${upd.stderr.trim()}`, "inspect refs/heads/main");
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// Tags at the fix tip.
|
|
529
|
+
for (const c of cutLines) {
|
|
530
|
+
const wr = await writeReleaseTag(repoRoot, io, {
|
|
531
|
+
name: c.tag,
|
|
532
|
+
target: fixTip,
|
|
533
|
+
annotation: releaseTagAnnotation({
|
|
534
|
+
tag: c.tag,
|
|
535
|
+
line: c.line.id,
|
|
536
|
+
version: c.nextVersion,
|
|
537
|
+
level: "patch",
|
|
538
|
+
previous: c.previousTag,
|
|
539
|
+
rfcs: c.rfcs,
|
|
540
|
+
fingerprints: c.line.id === repoLine.id ? fingerprints : {},
|
|
541
|
+
}),
|
|
542
|
+
});
|
|
543
|
+
if (wr.exitCode !== 0) {
|
|
544
|
+
return cutRefuse("FLOW-CUT-01", `tag ${c.tag} failed: ${wr.stderr.trim()}`, "inspect the tag state");
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// Teardown: worktree, branch (contained in main), registry, journal.
|
|
549
|
+
// The cut may run from inside fixWt — after the remove every git
|
|
550
|
+
// call goes through the primary, never repoRoot.
|
|
551
|
+
await runFlowScript(io, "worktree-teardown", {
|
|
552
|
+
primary,
|
|
553
|
+
cwd: fixWt,
|
|
554
|
+
env: { FLOW_PRIMARY: primary, FLOW_BRANCH: entry.name },
|
|
555
|
+
});
|
|
556
|
+
await git(primary, io, ["worktree", "remove", "--force", fixWt]);
|
|
557
|
+
const dropped = await git(primary, io, ["branch", "-D", entry.name]);
|
|
558
|
+
const teardownWarnings: Diagnostic[] =
|
|
559
|
+
dropped.exitCode === 0
|
|
560
|
+
? []
|
|
561
|
+
: [
|
|
562
|
+
{
|
|
563
|
+
ruleId: "FLOW-07",
|
|
564
|
+
severity: "warning",
|
|
565
|
+
message: `fix branch ${entry.name} could not be deleted after the release: ${dropped.stderr.trim()}`,
|
|
566
|
+
fixHint: `delete it from the primary checkout — git branch -D ${entry.name}`,
|
|
567
|
+
},
|
|
568
|
+
];
|
|
569
|
+
try {
|
|
570
|
+
await updateRegistry(io, common, (r) => ({
|
|
571
|
+
...r,
|
|
572
|
+
branches: r.branches.filter((b) => b.name !== entry.name),
|
|
573
|
+
}));
|
|
574
|
+
await appendJournal(io, common, {
|
|
575
|
+
event: "cut",
|
|
576
|
+
branch: entry.name,
|
|
577
|
+
sha: fixTip,
|
|
578
|
+
base: entry.baseSha,
|
|
579
|
+
detail: tagList.join(", "),
|
|
580
|
+
at: now.toISOString(),
|
|
581
|
+
});
|
|
582
|
+
} catch {
|
|
583
|
+
// bookkeeping failure is non-fatal — the release already landed
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
const mainGains = Number(
|
|
587
|
+
(await git(primary, io, ["rev-list", "--count", `${mainNow}..${fixTip}`])).stdout.trim() || 0,
|
|
588
|
+
);
|
|
589
|
+
return {
|
|
590
|
+
...base,
|
|
591
|
+
released: true,
|
|
592
|
+
releaseCommit: fixTip,
|
|
593
|
+
mainBefore: mainNow,
|
|
594
|
+
mainAfter: fixTip,
|
|
595
|
+
mainGains: Number.isFinite(mainGains) ? mainGains : 0,
|
|
596
|
+
tags: tagList,
|
|
597
|
+
versions: Object.fromEntries(cutLines.map((c) => [c.line.id, c.nextVersion])),
|
|
598
|
+
lines: toFlowCutLines(tagList, cutLines, lines, repoLine),
|
|
599
|
+
fingerprints,
|
|
600
|
+
gate,
|
|
601
|
+
releaseBranch: null,
|
|
602
|
+
steps: await fixSteps(),
|
|
603
|
+
diagnostics: [...warnings, ...base.diagnostics, ...teardownWarnings],
|
|
604
|
+
} satisfies FlowCutData;
|
|
605
|
+
},
|
|
606
|
+
io,
|
|
607
|
+
);
|
|
608
|
+
} catch (error) {
|
|
609
|
+
if (error instanceof LockTimeoutError) {
|
|
610
|
+
return cutRefuse(
|
|
611
|
+
"FLOW-INT-08",
|
|
612
|
+
`integration lock ${error.lockPath} is held by another integration`,
|
|
613
|
+
"wait for the running integration to finish, or break the stale lock after 2 h automatically",
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
throw error;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Fix-mode cut then the trailing back-merge — the back-merge runs OUTSIDE
|
|
622
|
+
* the fix's lock (it takes the integration lock itself; nesting deadlocks).
|
|
623
|
+
*/
|
|
624
|
+
export async function runFixCutWithBackmerge(
|
|
625
|
+
repoRoot: string,
|
|
626
|
+
io: WorkspaceIO,
|
|
627
|
+
opts: {
|
|
628
|
+
entry: FlowRegistryEntry;
|
|
629
|
+
linesGiven: boolean;
|
|
630
|
+
dryRun: boolean;
|
|
631
|
+
now?: Date;
|
|
632
|
+
onProgress?: (m: string) => void;
|
|
633
|
+
},
|
|
634
|
+
): Promise<FlowCutData> {
|
|
635
|
+
// Resolved before the cut: runFixCut removes the fix worktree, which may
|
|
636
|
+
// be repoRoot itself (flow.cut run inside it — the documented path).
|
|
637
|
+
const primary = await primaryWorktree(io, repoRoot);
|
|
638
|
+
const cut = await runFixCut(repoRoot, io, opts);
|
|
639
|
+
if (!cut.released) return cut;
|
|
640
|
+
const bm: FlowBackmergeData = await backmergeFlow(primary, io, {
|
|
641
|
+
redo: false,
|
|
642
|
+
dryRun: false,
|
|
643
|
+
now: opts.now,
|
|
644
|
+
});
|
|
645
|
+
return {
|
|
646
|
+
...cut,
|
|
647
|
+
backmerge: bm,
|
|
648
|
+
diagnostics:
|
|
649
|
+
(bm.status === "conflict" || bm.status === "refused") && bm.diagnostics.length > 0
|
|
650
|
+
? [...cut.diagnostics, ...bm.diagnostics]
|
|
651
|
+
: cut.diagnostics,
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
export async function runFlowFix(
|
|
656
|
+
input: ForgeCommandInput,
|
|
657
|
+
context: ForgeRuntimeContext,
|
|
658
|
+
): Promise<ForgeCommandResult<FlowFixData>> {
|
|
659
|
+
const { workspaceRoot, logger, outputFormat } = context;
|
|
660
|
+
const io = resolveIo(context.io);
|
|
661
|
+
await requireGit(io);
|
|
662
|
+
|
|
663
|
+
const repoRoot = await topLevel(workspaceRoot, io);
|
|
664
|
+
if (repoRoot === null) {
|
|
665
|
+
throw new Error("flow.fix must run inside a git repository");
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
const flag = (name: string): string | null => {
|
|
669
|
+
const v = input.flags[name];
|
|
670
|
+
return typeof v === "string" ? v : null;
|
|
671
|
+
};
|
|
672
|
+
const data = await fixFlow(repoRoot, io, {
|
|
673
|
+
slug: flag("slug") ?? "",
|
|
674
|
+
brief: flag("brief"),
|
|
675
|
+
dryRun: context.dryRun || input.flags["dry-run"] === true,
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
const refused = data.diagnostics.find((d) => d.severity === "error");
|
|
679
|
+
if (outputFormat === "pretty") {
|
|
680
|
+
if (refused) {
|
|
681
|
+
logger.error(`flow.fix refused: ${refused.ruleId} ${refused.message}`);
|
|
682
|
+
} else {
|
|
683
|
+
logger.section("flow.fix");
|
|
684
|
+
logger.info(` branch: ${data.branch}`);
|
|
685
|
+
logger.info(` worktree: ${data.worktree}`);
|
|
686
|
+
logger.info(` base: main @ ${data.baseSha?.slice(0, 9)}`);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
return {
|
|
691
|
+
data,
|
|
692
|
+
exitCode: refused ? 1 : 0,
|
|
693
|
+
summary: refused
|
|
694
|
+
? `[flow.fix] refused: ${refused.ruleId} ${refused.message}`
|
|
695
|
+
: data.opened
|
|
696
|
+
? `[flow.fix] opened ${data.branch} in ${data.worktree}`
|
|
697
|
+
: `[flow.fix] dry run — would open ${data.branch} in ${data.worktree}`,
|
|
698
|
+
nextSteps:
|
|
699
|
+
refused || !data.opened
|
|
700
|
+
? []
|
|
701
|
+
: [{ action: `commit the patch inside ${data.worktree}, then run flow.cut there`, kind: "required" }],
|
|
702
|
+
};
|
|
703
|
+
}
|