@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,488 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>flow.backmerge (RFC-1490) — brings main into develop through a
|
|
4
|
+
gated port branch. Every release tag pointing at a commit of develop..main
|
|
5
|
+
(oldest commit first, line order within a commit) names the port; the port
|
|
6
|
+
worktree merges main with the fixed message `release <tags> → develop`.
|
|
7
|
+
A clean merge integrates through the normal lock-held path; a conflict
|
|
8
|
+
leaves the merge in progress and reports the conflicted paths plus recovery
|
|
9
|
+
steps. --redo discards an existing port for the same mainSha first.</purpose>
|
|
10
|
+
<non-goals>
|
|
11
|
+
<item>No rebase of the port — flow.integrate handles the FLOW-INT-09/10 checks.</item>
|
|
12
|
+
<item>No fix releases — that is flow.cut's fix mode.</item>
|
|
13
|
+
</non-goals>
|
|
14
|
+
</MODULE_CONTRACT>
|
|
15
|
+
<KEY_DECISIONS>
|
|
16
|
+
<item>The port branch is kind `session` with a `port` registry payload — flow.integrate already owns the gate, ff, cleanup and backmerge journal event for port entries, so the clean path delegates to integrateFlowBranch under the lock.</item>
|
|
17
|
+
<item>main ahead of develop without release tags refuses FLOW-BM-01 — the port message and registry payload both require ≥1 tag (main only advances through cuts, which always tag).</item>
|
|
18
|
+
</KEY_DECISIONS>
|
|
19
|
+
<CHANGE_SUMMARY>
|
|
20
|
+
<item>RFC-1490: step 5 — flow.backmerge with port branch, conflict reporting, --redo</item>
|
|
21
|
+
<item>RFC-1490: step 5 — flow.backmerge (port branch, fixed merge message, conflict + --redo paths)</item>
|
|
22
|
+
<item>RFC-1490: independent-review pass — lock-held planning, fix-branch verification, spec-shaped data, coverage</item>
|
|
23
|
+
</CHANGE_SUMMARY>
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { join } from "node:path";
|
|
27
|
+
|
|
28
|
+
import type {
|
|
29
|
+
Diagnostic,
|
|
30
|
+
ForgeCommandInput,
|
|
31
|
+
ForgeCommandResult,
|
|
32
|
+
ForgeRuntimeContext,
|
|
33
|
+
WorkspaceIO,
|
|
34
|
+
} from "../../../src/types.ts";
|
|
35
|
+
import { resolveIo } from "../../../src/utils/io.ts";
|
|
36
|
+
|
|
37
|
+
import {
|
|
38
|
+
branchExists,
|
|
39
|
+
currentBranch,
|
|
40
|
+
git,
|
|
41
|
+
isAncestor,
|
|
42
|
+
requireGit,
|
|
43
|
+
statusTracked,
|
|
44
|
+
topLevel,
|
|
45
|
+
} from "../git.ts";
|
|
46
|
+
import { LockTimeoutError, withFlowLock } from "../locks.ts";
|
|
47
|
+
import { discoverReleaseLines } from "../release-lines.ts";
|
|
48
|
+
import {
|
|
49
|
+
commonGitDir,
|
|
50
|
+
FlowRegistrySchemaError,
|
|
51
|
+
INTEGRATE_LOCK_RELATIVE_PATH,
|
|
52
|
+
readRegistry,
|
|
53
|
+
registryPath,
|
|
54
|
+
type FlowRegistryEntry,
|
|
55
|
+
} from "../registry.ts";
|
|
56
|
+
import { primaryWorktree } from "../worktree-path.ts";
|
|
57
|
+
import { discardFlowBranch } from "./flow-discard.ts";
|
|
58
|
+
import {
|
|
59
|
+
INTEGRATE_LOCK_STALE_MS,
|
|
60
|
+
INTEGRATE_LOCK_WAIT_MS,
|
|
61
|
+
integrateFlowBranch,
|
|
62
|
+
} from "./flow-integrate.ts";
|
|
63
|
+
import { openFlowBranchCore } from "./flow-open.ts";
|
|
64
|
+
import type { FlowScriptResult } from "../scripts.ts";
|
|
65
|
+
|
|
66
|
+
export interface FlowBackmergeData {
|
|
67
|
+
status: "not-needed" | "dry-run" | "merged" | "conflict" | "refused";
|
|
68
|
+
/** Release tags the port carries, oldest commit first, line order within a commit. */
|
|
69
|
+
tags: string[];
|
|
70
|
+
/** Fixed merge message `release <tags> → develop`; null before the plan resolves. */
|
|
71
|
+
message: string | null;
|
|
72
|
+
mainSha: string | null;
|
|
73
|
+
portBranch: string | null;
|
|
74
|
+
portWorktree: string | null;
|
|
75
|
+
/** Conflicted paths when status is "conflict". */
|
|
76
|
+
conflicts: string[];
|
|
77
|
+
developBefore: string | null;
|
|
78
|
+
developAfter: string | null;
|
|
79
|
+
/** The integration-gate result when the clean path ran it. */
|
|
80
|
+
gate: FlowScriptResult | null;
|
|
81
|
+
diagnostics: Diagnostic[];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function result(partial: Partial<FlowBackmergeData>): FlowBackmergeData {
|
|
85
|
+
return {
|
|
86
|
+
status: "refused",
|
|
87
|
+
tags: [],
|
|
88
|
+
message: null,
|
|
89
|
+
mainSha: null,
|
|
90
|
+
portBranch: null,
|
|
91
|
+
portWorktree: null,
|
|
92
|
+
conflicts: [],
|
|
93
|
+
developBefore: null,
|
|
94
|
+
developAfter: null,
|
|
95
|
+
gate: null,
|
|
96
|
+
diagnostics: [],
|
|
97
|
+
...partial,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function refuse(
|
|
102
|
+
ruleId: string,
|
|
103
|
+
message: string,
|
|
104
|
+
fixHint: string,
|
|
105
|
+
partial?: Partial<FlowBackmergeData>,
|
|
106
|
+
): FlowBackmergeData {
|
|
107
|
+
return result({
|
|
108
|
+
...partial,
|
|
109
|
+
status: "refused",
|
|
110
|
+
diagnostics: [{ ruleId, severity: "error", message, fixHint }],
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** `v0.1.1` → `port-v0-1-1`, `forge@2.0.0` → `port-forge-2-0-0`. */
|
|
115
|
+
function portSlug(tag: string): string {
|
|
116
|
+
return `port-${tag.replace(/[.@]/g, "-")}`.replace(/-+/g, "-").replace(/-$/, "");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* ANNOTATED release tags pointing at commits of `develop..main` — oldest
|
|
121
|
+
* commit first, the discovered line order within a single commit. Lightweight
|
|
122
|
+
* tags are ignored (for-each-ref objecttype filter): only forge's annotated
|
|
123
|
+
* `forge/release-tag@1` tags name a port.
|
|
124
|
+
*/
|
|
125
|
+
async function pendingReleaseTags(
|
|
126
|
+
repoRoot: string,
|
|
127
|
+
io: WorkspaceIO,
|
|
128
|
+
): Promise<string[]> {
|
|
129
|
+
const revs = await git(repoRoot, io, ["rev-list", "--reverse", "develop..main"]);
|
|
130
|
+
if (revs.exitCode !== 0 || revs.stdout.trim() === "") return [];
|
|
131
|
+
const { lines } = await discoverReleaseLines(repoRoot, io);
|
|
132
|
+
const prefixOf = new Map<string, number>(
|
|
133
|
+
lines.map((l, i) => [l.tagPrefix, i] as const),
|
|
134
|
+
);
|
|
135
|
+
const ordered: string[] = [];
|
|
136
|
+
for (const sha of revs.stdout.trim().split("\n")) {
|
|
137
|
+
const pointing = await git(repoRoot, io, [
|
|
138
|
+
"for-each-ref",
|
|
139
|
+
"--points-at",
|
|
140
|
+
sha.trim(),
|
|
141
|
+
"--format=%(objecttype)%09%(refname:short)",
|
|
142
|
+
"refs/tags",
|
|
143
|
+
]);
|
|
144
|
+
if (pointing.exitCode !== 0) continue;
|
|
145
|
+
const names = pointing.stdout
|
|
146
|
+
.split("\n")
|
|
147
|
+
.map((t) => t.trim())
|
|
148
|
+
.filter((t) => t.startsWith("tag\t"))
|
|
149
|
+
.map((t) => t.slice("tag\t".length))
|
|
150
|
+
.filter((t) => t.length > 0 && [...prefixOf.keys()].some((p) => t.startsWith(p)));
|
|
151
|
+
names.sort(
|
|
152
|
+
(a, b) =>
|
|
153
|
+
Math.min(
|
|
154
|
+
...[...prefixOf.entries()].filter(([p]) => a.startsWith(p)).map(([, i]) => i),
|
|
155
|
+
) -
|
|
156
|
+
Math.min(
|
|
157
|
+
...[...prefixOf.entries()].filter(([p]) => b.startsWith(p)).map(([, i]) => i),
|
|
158
|
+
),
|
|
159
|
+
);
|
|
160
|
+
ordered.push(...names);
|
|
161
|
+
}
|
|
162
|
+
return ordered;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
interface BackmergePlan {
|
|
166
|
+
tags: string[];
|
|
167
|
+
mainSha: string;
|
|
168
|
+
message: string;
|
|
169
|
+
primary: string;
|
|
170
|
+
common: string;
|
|
171
|
+
duplicates: FlowRegistryEntry[];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
type BackmergePlanOutcome =
|
|
175
|
+
| { kind: "not-needed" }
|
|
176
|
+
| { kind: "refusal"; data: FlowBackmergeData }
|
|
177
|
+
| { kind: "plan"; plan: BackmergePlan };
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Plan phase — resolved INSIDE the integration lock on the mutation path so
|
|
181
|
+
* a fix landing during the lock wait cannot make the merge's second parent
|
|
182
|
+
* drift from the recorded port.mainSha (the INT-09 invariant depends on it).
|
|
183
|
+
*/
|
|
184
|
+
async function planBackmerge(
|
|
185
|
+
repoRoot: string,
|
|
186
|
+
io: WorkspaceIO,
|
|
187
|
+
opts: { redo: boolean },
|
|
188
|
+
): Promise<BackmergePlanOutcome> {
|
|
189
|
+
if (!(await branchExists(repoRoot, io, "develop"))) {
|
|
190
|
+
return {
|
|
191
|
+
kind: "refusal",
|
|
192
|
+
data: refuse(
|
|
193
|
+
"FLOW-BM-01",
|
|
194
|
+
"repository is not adopted into the fixed branch model — no develop branch",
|
|
195
|
+
"run pnpm exec forge flow.install first",
|
|
196
|
+
),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
if (
|
|
200
|
+
!(await branchExists(repoRoot, io, "main")) ||
|
|
201
|
+
(await isAncestor(repoRoot, io, "main", "develop"))
|
|
202
|
+
) {
|
|
203
|
+
return { kind: "not-needed" };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const tags = await pendingReleaseTags(repoRoot, io);
|
|
207
|
+
const mainSha = (await git(repoRoot, io, ["rev-parse", "main"])).stdout.trim();
|
|
208
|
+
if (tags.length === 0) {
|
|
209
|
+
return {
|
|
210
|
+
kind: "refusal",
|
|
211
|
+
data: refuse(
|
|
212
|
+
"FLOW-BM-01",
|
|
213
|
+
"main is ahead of develop but no release tags point at develop..main — nothing to port",
|
|
214
|
+
"main should only advance through flow.cut/flow.fix releases; inspect refs/heads/main",
|
|
215
|
+
{ mainSha },
|
|
216
|
+
),
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const primary = await primaryWorktree(io, repoRoot);
|
|
221
|
+
const primaryBranch = await currentBranch(primary, io);
|
|
222
|
+
const primaryDirty = await statusTracked(primary, io);
|
|
223
|
+
if (primaryBranch !== "develop" || primaryDirty.length > 0) {
|
|
224
|
+
return {
|
|
225
|
+
kind: "refusal",
|
|
226
|
+
data: refuse(
|
|
227
|
+
"FLOW-BM-01",
|
|
228
|
+
primaryBranch !== "develop"
|
|
229
|
+
? `primary worktree is on ${primaryBranch ?? "detached HEAD"}, not develop`
|
|
230
|
+
: `primary worktree has ${primaryDirty.length} tracked uncommitted change(s)`,
|
|
231
|
+
"switch the primary to develop and commit or revert its changes",
|
|
232
|
+
{ tags, mainSha },
|
|
233
|
+
),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const common = await commonGitDir(io, repoRoot);
|
|
238
|
+
let registry;
|
|
239
|
+
try {
|
|
240
|
+
registry = await readRegistry(io, common);
|
|
241
|
+
} catch (error) {
|
|
242
|
+
if (error instanceof FlowRegistrySchemaError) {
|
|
243
|
+
return {
|
|
244
|
+
kind: "refusal",
|
|
245
|
+
data: refuse("FLOW-07", error.message, `repair or remove ${registryPath(common)}`),
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
throw error;
|
|
249
|
+
}
|
|
250
|
+
const duplicates = registry.branches.filter(
|
|
251
|
+
(b) => b.port !== null && b.port.mainSha === mainSha,
|
|
252
|
+
);
|
|
253
|
+
if (duplicates.length > 0 && !opts.redo) {
|
|
254
|
+
return {
|
|
255
|
+
kind: "refusal",
|
|
256
|
+
data: refuse(
|
|
257
|
+
"FLOW-BM-02",
|
|
258
|
+
`a port for main@${mainSha.slice(0, 9)} already exists: ${duplicates.map((b) => b.name).join(", ")}`,
|
|
259
|
+
"finish it with flow.integrate, or re-run with --redo to reopen the port",
|
|
260
|
+
{ tags, mainSha },
|
|
261
|
+
),
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return {
|
|
266
|
+
kind: "plan",
|
|
267
|
+
plan: {
|
|
268
|
+
tags,
|
|
269
|
+
mainSha,
|
|
270
|
+
message: `release ${tags.join(", ")} → develop`,
|
|
271
|
+
primary,
|
|
272
|
+
common,
|
|
273
|
+
duplicates,
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export async function backmergeFlow(
|
|
279
|
+
repoRoot: string,
|
|
280
|
+
io: WorkspaceIO,
|
|
281
|
+
opts: {
|
|
282
|
+
redo: boolean;
|
|
283
|
+
dryRun: boolean;
|
|
284
|
+
now?: Date;
|
|
285
|
+
onProgress?: (m: string) => void;
|
|
286
|
+
},
|
|
287
|
+
): Promise<FlowBackmergeData> {
|
|
288
|
+
const now = opts.now ?? new Date();
|
|
289
|
+
|
|
290
|
+
if (opts.dryRun) {
|
|
291
|
+
const outcome = await planBackmerge(repoRoot, io, opts);
|
|
292
|
+
if (outcome.kind === "refusal") return outcome.data;
|
|
293
|
+
if (outcome.kind === "not-needed") return result({ status: "not-needed" });
|
|
294
|
+
return result({
|
|
295
|
+
status: "dry-run",
|
|
296
|
+
tags: outcome.plan.tags,
|
|
297
|
+
message: outcome.plan.message,
|
|
298
|
+
mainSha: outcome.plan.mainSha,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Resolve the lock path before planning — planning itself runs inside.
|
|
303
|
+
const common = await commonGitDir(io, repoRoot);
|
|
304
|
+
await io.mkdir(join(common, "forge"));
|
|
305
|
+
const lockPath = join(common, INTEGRATE_LOCK_RELATIVE_PATH);
|
|
306
|
+
let portBranch: string | null = null;
|
|
307
|
+
try {
|
|
308
|
+
return await withFlowLock(
|
|
309
|
+
lockPath,
|
|
310
|
+
{
|
|
311
|
+
waitMs: INTEGRATE_LOCK_WAIT_MS,
|
|
312
|
+
staleMs: INTEGRATE_LOCK_STALE_MS,
|
|
313
|
+
progressEveryMs: 60_000,
|
|
314
|
+
onProgress: opts.onProgress,
|
|
315
|
+
},
|
|
316
|
+
async () => {
|
|
317
|
+
const outcome = await planBackmerge(repoRoot, io, opts);
|
|
318
|
+
if (outcome.kind === "refusal") return outcome.data;
|
|
319
|
+
if (outcome.kind === "not-needed") return result({ status: "not-needed" });
|
|
320
|
+
const { tags, mainSha, message } = outcome.plan;
|
|
321
|
+
|
|
322
|
+
for (const dup of outcome.plan.duplicates) {
|
|
323
|
+
const discarded = await discardFlowBranch(repoRoot, io, {
|
|
324
|
+
branch: dup.name,
|
|
325
|
+
reason: "backmerge redo",
|
|
326
|
+
dirty: true,
|
|
327
|
+
dryRun: false,
|
|
328
|
+
now,
|
|
329
|
+
});
|
|
330
|
+
if (discarded.diagnostics.some((d) => d.severity === "error")) {
|
|
331
|
+
const d = discarded.diagnostics[0]!;
|
|
332
|
+
return refuse(d.ruleId, d.message, d.fixHint ?? "inspect flow.status", {
|
|
333
|
+
tags,
|
|
334
|
+
mainSha,
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const developBefore = (
|
|
340
|
+
await git(repoRoot, io, ["rev-parse", "develop"])
|
|
341
|
+
).stdout.trim();
|
|
342
|
+
const open = await openFlowBranchCore(repoRoot, io, {
|
|
343
|
+
kind: "session",
|
|
344
|
+
slug: portSlug(tags[0]!),
|
|
345
|
+
brief: `back-merge ${message}`,
|
|
346
|
+
owner: { kind: "session", id: "backmerge" },
|
|
347
|
+
port: { mainSha, tags },
|
|
348
|
+
dryRun: false,
|
|
349
|
+
now,
|
|
350
|
+
});
|
|
351
|
+
if (!open.opened || open.branch === null || open.worktree === null) {
|
|
352
|
+
const d = open.diagnostics[0];
|
|
353
|
+
return refuse(
|
|
354
|
+
d?.ruleId ?? "FLOW-BM-01",
|
|
355
|
+
d?.message ?? "port branch did not open",
|
|
356
|
+
d?.fixHint ?? "inspect flow.status",
|
|
357
|
+
{ tags, message, mainSha },
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
portBranch = open.branch;
|
|
361
|
+
const wt = open.worktree;
|
|
362
|
+
|
|
363
|
+
const merge = await git(wt, io, ["merge", "--no-ff", "-m", message, "main"], {
|
|
364
|
+
env: { FORGE_FLOW_COMMIT: "backmerge" },
|
|
365
|
+
});
|
|
366
|
+
if (merge.exitCode !== 0) {
|
|
367
|
+
const mergeHead = await git(wt, io, ["rev-parse", "-q", "--verify", "MERGE_HEAD"]);
|
|
368
|
+
if (mergeHead.exitCode !== 0) {
|
|
369
|
+
return refuse(
|
|
370
|
+
"FLOW-BM-01",
|
|
371
|
+
`git merge --no-ff main failed without starting a merge (exit ${merge.exitCode}): ${merge.stderr.trim()}`,
|
|
372
|
+
"inspect the port worktree state — the merge never began, so no resolution is pending",
|
|
373
|
+
{ tags, message, mainSha, portBranch, portWorktree: wt, developBefore },
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
const conflicted = await git(wt, io, ["diff", "--name-only", "--diff-filter=U"]);
|
|
377
|
+
const paths = conflicted.stdout
|
|
378
|
+
.split("\n")
|
|
379
|
+
.map((l) => l.trim())
|
|
380
|
+
.filter((l) => l.length > 0);
|
|
381
|
+
return result({
|
|
382
|
+
status: "conflict",
|
|
383
|
+
tags,
|
|
384
|
+
message,
|
|
385
|
+
mainSha,
|
|
386
|
+
portBranch,
|
|
387
|
+
portWorktree: wt,
|
|
388
|
+
conflicts: paths,
|
|
389
|
+
developBefore,
|
|
390
|
+
developAfter: developBefore,
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const integrated = await integrateFlowBranch(repoRoot, io, {
|
|
395
|
+
branch: portBranch,
|
|
396
|
+
dryRun: false,
|
|
397
|
+
now,
|
|
398
|
+
lockHeld: true,
|
|
399
|
+
target: "develop",
|
|
400
|
+
});
|
|
401
|
+
if (!integrated.integrated || integrated.diagnostics.length > 0) {
|
|
402
|
+
const d = integrated.diagnostics[0];
|
|
403
|
+
return refuse(
|
|
404
|
+
d?.ruleId ?? "FLOW-INT-05",
|
|
405
|
+
d?.message ?? "port integration failed",
|
|
406
|
+
d?.fixHint ?? "inspect the gate output",
|
|
407
|
+
{
|
|
408
|
+
tags,
|
|
409
|
+
message,
|
|
410
|
+
mainSha,
|
|
411
|
+
portBranch,
|
|
412
|
+
portWorktree: wt,
|
|
413
|
+
developBefore,
|
|
414
|
+
developAfter: integrated.developAfter ?? developBefore,
|
|
415
|
+
gate: integrated.gate,
|
|
416
|
+
},
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
return result({
|
|
420
|
+
status: "merged",
|
|
421
|
+
tags,
|
|
422
|
+
message,
|
|
423
|
+
mainSha,
|
|
424
|
+
portBranch,
|
|
425
|
+
portWorktree: wt,
|
|
426
|
+
developBefore,
|
|
427
|
+
developAfter: integrated.developAfter ?? developBefore,
|
|
428
|
+
gate: integrated.gate,
|
|
429
|
+
});
|
|
430
|
+
},
|
|
431
|
+
io,
|
|
432
|
+
);
|
|
433
|
+
} catch (error) {
|
|
434
|
+
if (error instanceof LockTimeoutError) {
|
|
435
|
+
return refuse(
|
|
436
|
+
"FLOW-INT-08",
|
|
437
|
+
`integration lock ${error.lockPath} is held by another integration`,
|
|
438
|
+
"wait for the running integration to finish, or break the stale lock after 2 h automatically",
|
|
439
|
+
{ portBranch },
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
throw error;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export async function runFlowBackmerge(
|
|
447
|
+
input: ForgeCommandInput,
|
|
448
|
+
context: ForgeRuntimeContext,
|
|
449
|
+
): Promise<ForgeCommandResult<FlowBackmergeData>> {
|
|
450
|
+
const { workspaceRoot, logger, outputFormat } = context;
|
|
451
|
+
const io = resolveIo(context.io);
|
|
452
|
+
await requireGit(io);
|
|
453
|
+
|
|
454
|
+
const repoRoot = await topLevel(workspaceRoot, io);
|
|
455
|
+
if (repoRoot === null) {
|
|
456
|
+
throw new Error("flow.backmerge must run inside a git repository");
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const data = await backmergeFlow(repoRoot, io, {
|
|
460
|
+
redo: input.flags["redo"] === true,
|
|
461
|
+
dryRun: context.dryRun || input.flags["dry-run"] === true,
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
const refused = data.diagnostics.find((d) => d.severity === "error");
|
|
465
|
+
if (outputFormat === "pretty") {
|
|
466
|
+
if (refused) {
|
|
467
|
+
logger.error(`flow.backmerge refused: ${refused.ruleId} ${refused.message}`);
|
|
468
|
+
} else if (data.status === "conflict") {
|
|
469
|
+
logger.section("flow.backmerge");
|
|
470
|
+
logger.info(` conflict: ${data.conflicts.join(", ")}`);
|
|
471
|
+
logger.info(` worktree: ${data.portWorktree}`);
|
|
472
|
+
logger.info(` next: resolve, git commit --no-edit, flow.integrate --branch ${data.portBranch}`);
|
|
473
|
+
} else {
|
|
474
|
+
logger.info(`flow.backmerge ${data.status}: ${data.tags.join(", ")}`);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return {
|
|
479
|
+
data,
|
|
480
|
+
exitCode: refused ? 1 : 0,
|
|
481
|
+
summary:
|
|
482
|
+
data.status === "conflict"
|
|
483
|
+
? `[flow.backmerge] conflict in ${data.conflicts.join(", ")} — resolve in ${data.portWorktree}, commit --no-edit, flow.integrate`
|
|
484
|
+
: refused
|
|
485
|
+
? `[flow.backmerge] refused: ${refused.ruleId} ${refused.message}`
|
|
486
|
+
: `[flow.backmerge] ${data.status}${data.tags.length > 0 ? ` ${data.tags.join(", ")}` : ""}`,
|
|
487
|
+
};
|
|
488
|
+
}
|