@warpgogol/forge 9.1.1 → 9.2.3
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 +31 -0
- package/bin/cli.ts +3 -2
- package/dist/bin/cli.js +3 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +6 -4
- package/dist/os/core/core.module.js.map +1 -1
- 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 +73 -0
- package/dist/os/flow/digest.d.ts.map +1 -0
- package/dist/os/flow/digest.js +634 -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 +716 -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 +63 -0
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-cut.js +636 -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 +110 -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 +200 -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 +443 -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 +419 -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-push.d.ts +22 -0
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-push.js +306 -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 +34 -0
- package/dist/os/flow/locks.d.ts.map +1 -0
- package/dist/os/flow/locks.js +147 -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/publish.d.ts +28 -0
- package/dist/os/flow/publish.d.ts.map +1 -0
- package/dist/os/flow/publish.js +153 -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 +198 -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 +72 -0
- package/dist/os/flow/release-tags.d.ts.map +1 -0
- package/dist/os/flow/release-tags.js +166 -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 +49 -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/tests/helpers.d.ts +52 -0
- package/dist/os/flow/tests/helpers.d.ts.map +1 -0
- package/dist/os/flow/tests/helpers.js +189 -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 +43 -6
- package/dist/os/mission/handlers/archive.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/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/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 +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- 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/core/core.module.ts +7 -4
- package/os/flow/assets/flow-guard.sh +176 -0
- package/os/flow/branch-name.ts +139 -0
- package/os/flow/digest.ts +761 -0
- package/os/flow/flow.module.ts +740 -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 +912 -0
- package/os/flow/handlers/flow-digest.ts +124 -0
- package/os/flow/handlers/flow-discard.ts +301 -0
- package/os/flow/handlers/flow-fix.ts +597 -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 +607 -0
- package/os/flow/handlers/flow-open.ts +447 -0
- package/os/flow/handlers/flow-push.ts +373 -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 +177 -0
- package/os/flow/markers.ts +135 -0
- package/os/flow/publish.ts +201 -0
- package/os/flow/registry.ts +266 -0
- package/os/flow/release-level.ts +139 -0
- package/os/flow/release-lines.ts +208 -0
- package/os/flow/release-tags.ts +231 -0
- package/os/flow/repo-kind.ts +117 -0
- package/os/flow/scripts.ts +73 -0
- package/os/flow/semver.ts +82 -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.rerun.test.ts +95 -0
- package/os/flow/tests/flow-cut.test.ts +319 -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-push-publish.test.ts +282 -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-version-level.test.ts +116 -0
- package/os/flow/tests/flow-version.test.ts +169 -0
- package/os/flow/tests/helpers.ts +235 -0
- package/os/flow/tests/is-flow-adopted.test.ts +71 -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 +27 -0
- package/os/mission/handlers/archive.ts +46 -6
- 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-stale.test.ts +22 -0
- 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/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 +17 -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/typescript.yaml +26 -9
- package/skills/fo/fo-session-retro/SKILL.md +18 -7
- package/skills/fo/fo-step-commit/SKILL.md +2 -1
- package/src/config/forge-config.ts +2 -6
- package/src/index.ts +8 -0
- 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/implement-stamp.test.ts +26 -3
- package/src/tests/profile-flow-hooks.test.ts +77 -0
- 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,912 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>flow.cut — the ordinary release on the fixed branch model
|
|
4
|
+
(RFC-1490). Plan phase refuses before any mutation (FLOW-CUT-01..07);
|
|
5
|
+
execute runs under the integration lock: release branch via openFlowBranchCore,
|
|
6
|
+
verified version-file writes, release commit, gate+ff through
|
|
7
|
+
integrateFlowBranch(lockHeld), fingerprints hook, main compare-and-swap,
|
|
8
|
+
release tags, journal. Rerun-safe: a develop tip already carrying the
|
|
9
|
+
release subject resumes at fingerprints; a fully tagged tip reports
|
|
10
|
+
released with no mutation.</purpose>
|
|
11
|
+
<non-goals>
|
|
12
|
+
<item>No fix releases — flow.cut's fix mode lives alongside (step 6).</item>
|
|
13
|
+
<item>No pushing — outbound is the next RFC.</item>
|
|
14
|
+
</non-goals>
|
|
15
|
+
</MODULE_CONTRACT>
|
|
16
|
+
<KEY_DECISIONS>
|
|
17
|
+
<item>The integration lock spans open→main-move so no second integration can interleave between the gate and the main fast-forward.</item>
|
|
18
|
+
<item>Version writes are verified textual replacements (VersionWriteError → FLOW-CUT-11); the release branch is removed on that failure per AUDIT-RFC-1490-C3.</item>
|
|
19
|
+
<item>Resume keys on the develop tip's `chore(release):` subject — the subject is the persisted declaration of which tags the release intends.</item>
|
|
20
|
+
</KEY_DECISIONS>
|
|
21
|
+
<CHANGE_SUMMARY>
|
|
22
|
+
<item>RFC-1490: step 4 — ordinary flow.cut (release branch, verified versions, gate, main swap, tags, resume)</item>
|
|
23
|
+
<item>RFC-1490: step 6 — flow.fix + fix-mode cut (patch-only, rebase on moved main, gate target main, trailing back-merge)</item>
|
|
24
|
+
<item>RFC-1490: independent-review pass — lock-held planning, fix-branch verification, spec-shaped data, coverage</item>
|
|
25
|
+
<item>RFC-1491: step 1 — journal base/rewrites + held registry widening, W1-1 discard tip, FLOW-INT-11</item>
|
|
26
|
+
<item>RFC-1494: step 1 — isFlowAdopted public export</item>
|
|
27
|
+
<history>RFC-1490</history>
|
|
28
|
+
</CHANGE_SUMMARY>
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import { join } from "node:path";
|
|
32
|
+
|
|
33
|
+
import { parse as yamlParse } from "yaml";
|
|
34
|
+
|
|
35
|
+
import type {
|
|
36
|
+
Diagnostic,
|
|
37
|
+
ForgeCommandInput,
|
|
38
|
+
ForgeCommandResult,
|
|
39
|
+
ForgeRuntimeContext,
|
|
40
|
+
WorkspaceIO,
|
|
41
|
+
} from "../../../src/types.ts";
|
|
42
|
+
import { resolveIo } from "../../../src/utils/io.ts";
|
|
43
|
+
|
|
44
|
+
import {
|
|
45
|
+
branchExists,
|
|
46
|
+
currentBranch,
|
|
47
|
+
git,
|
|
48
|
+
gitCommit,
|
|
49
|
+
isAncestor,
|
|
50
|
+
requireGit,
|
|
51
|
+
statusTracked,
|
|
52
|
+
topLevel,
|
|
53
|
+
worktreeList,
|
|
54
|
+
} from "../git.ts";
|
|
55
|
+
import { LockTimeoutError, withFlowLock } from "../locks.ts";
|
|
56
|
+
import { isFlowAdopted } from "../index.ts";
|
|
57
|
+
import {
|
|
58
|
+
appendJournal,
|
|
59
|
+
commonGitDir,
|
|
60
|
+
FlowRegistrySchemaError,
|
|
61
|
+
INTEGRATE_LOCK_RELATIVE_PATH,
|
|
62
|
+
readRegistry,
|
|
63
|
+
registryPath,
|
|
64
|
+
} from "../registry.ts";
|
|
65
|
+
import { bumpVersion, formatVersion, type ReleaseLevel } from "../semver.ts";
|
|
66
|
+
import { discoverReleaseLines, type ReleaseLine } from "../release-lines.ts";
|
|
67
|
+
import { pendingLevel } from "../release-level.ts";
|
|
68
|
+
import {
|
|
69
|
+
listLineTags,
|
|
70
|
+
releaseTagAnnotation,
|
|
71
|
+
writeReleaseTag,
|
|
72
|
+
} from "../release-tags.ts";
|
|
73
|
+
import { runFlowScript, type FlowScriptResult } from "../scripts.ts";
|
|
74
|
+
import { VersionWriteError, writeLineVersion, writeSyncedForgeVersion } from "../version-files.ts";
|
|
75
|
+
import { primaryWorktree } from "../worktree-path.ts";
|
|
76
|
+
import { integrateFlowBranch } from "./flow-integrate.ts";
|
|
77
|
+
import { openFlowBranchCore } from "./flow-open.ts";
|
|
78
|
+
import { INTEGRATE_LOCK_STALE_MS, INTEGRATE_LOCK_WAIT_MS } from "./flow-integrate.ts";
|
|
79
|
+
import type { FlowBackmergeData } from "./flow-backmerge.ts";
|
|
80
|
+
|
|
81
|
+
/** One released line as the --json contract reports it (spec §TypeScript contracts). */
|
|
82
|
+
export interface FlowCutLine {
|
|
83
|
+
line: string;
|
|
84
|
+
tag: string;
|
|
85
|
+
previous: string | null;
|
|
86
|
+
level: ReleaseLevel;
|
|
87
|
+
version: string;
|
|
88
|
+
rfcs: string[];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface FlowCutData {
|
|
92
|
+
mode: "ordinary" | "fix";
|
|
93
|
+
released: boolean;
|
|
94
|
+
/** True when this invocation only completed a previous cut's tail. */
|
|
95
|
+
resumed: boolean;
|
|
96
|
+
releaseBranch: string | null;
|
|
97
|
+
/** SHA of the integrated `chore(release):` commit (main tip after the cut). */
|
|
98
|
+
releaseCommit: string | null;
|
|
99
|
+
mainBefore: string | null;
|
|
100
|
+
mainAfter: string | null;
|
|
101
|
+
/** Commits main gained (W1-3 — first cut includes the adoption commit). */
|
|
102
|
+
mainGains: number;
|
|
103
|
+
/** Tag names applied to the main tip, line order (repository line first). */
|
|
104
|
+
tags: string[];
|
|
105
|
+
/** Versions per line id. */
|
|
106
|
+
versions: Record<string, string>;
|
|
107
|
+
lines: FlowCutLine[];
|
|
108
|
+
fingerprints: Record<string, string>;
|
|
109
|
+
/** The integration-gate result when it ran this invocation (null on resume). */
|
|
110
|
+
gate: FlowScriptResult | null;
|
|
111
|
+
/** Fix mode only: the trailing back-merge's full data (null on ordinary cuts). */
|
|
112
|
+
backmerge: FlowBackmergeData | null;
|
|
113
|
+
diagnostics: Diagnostic[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface CutLine {
|
|
117
|
+
line: ReleaseLine;
|
|
118
|
+
tag: string;
|
|
119
|
+
level: ReleaseLevel;
|
|
120
|
+
nextVersion: string;
|
|
121
|
+
previousTag: string | null;
|
|
122
|
+
rfcs: string[];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function refuse(
|
|
126
|
+
ruleId: string,
|
|
127
|
+
message: string,
|
|
128
|
+
fixHint: string,
|
|
129
|
+
partial?: Partial<FlowCutData>,
|
|
130
|
+
): FlowCutData {
|
|
131
|
+
return {
|
|
132
|
+
mode: partial?.mode ?? "ordinary",
|
|
133
|
+
released: false,
|
|
134
|
+
resumed: false,
|
|
135
|
+
releaseBranch: null,
|
|
136
|
+
releaseCommit: null,
|
|
137
|
+
mainBefore: null,
|
|
138
|
+
mainAfter: null,
|
|
139
|
+
mainGains: 0,
|
|
140
|
+
tags: partial?.tags ?? [],
|
|
141
|
+
versions: {},
|
|
142
|
+
lines: [],
|
|
143
|
+
fingerprints: {},
|
|
144
|
+
gate: null,
|
|
145
|
+
backmerge: null,
|
|
146
|
+
diagnostics: [{ ruleId, severity: "error", message, fixHint }],
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Flat YAML mapping of string→string; anything else fails FLOW-CUT-08. */
|
|
151
|
+
function parseFingerprints(stdout: string): Record<string, string> | null {
|
|
152
|
+
try {
|
|
153
|
+
const parsed: unknown = yamlParse(stdout);
|
|
154
|
+
if (parsed === null || parsed === undefined) return {};
|
|
155
|
+
if (typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
156
|
+
const out: Record<string, string> = {};
|
|
157
|
+
for (const [k, v] of Object.entries(parsed as Record<string, unknown>)) {
|
|
158
|
+
if (typeof v !== "string") return null;
|
|
159
|
+
out[k] = v;
|
|
160
|
+
}
|
|
161
|
+
return out;
|
|
162
|
+
} catch {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface CutPlan {
|
|
168
|
+
/** develop tip resolved at plan time. */
|
|
169
|
+
ref: string;
|
|
170
|
+
/** Subject-named tags with ≥1 missing OR main behind → run the tail for them. */
|
|
171
|
+
resumeTags: string[] | null;
|
|
172
|
+
cutLines: CutLine[];
|
|
173
|
+
tagList: string[];
|
|
174
|
+
subject: string;
|
|
175
|
+
allLines: ReleaseLine[];
|
|
176
|
+
repoLine: ReleaseLine;
|
|
177
|
+
mainTip: string;
|
|
178
|
+
primary: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
type PlanOutcome =
|
|
182
|
+
| { kind: "completed"; ref: string; tags: string[]; allLines: ReleaseLine[]; mainTip: string }
|
|
183
|
+
| { kind: "plan"; plan: CutPlan }
|
|
184
|
+
| { kind: "refusal"; data: FlowCutData };
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Plan phase — every refusal before any mutation. The mutation path runs
|
|
188
|
+
* this INSIDE the integration lock so a landing integration between the
|
|
189
|
+
* dry-plan and the branch-open can never sneak unvetted commits into the
|
|
190
|
+
* release (all refs are resolved at lock time).
|
|
191
|
+
*/
|
|
192
|
+
async function planOrdinaryCut(
|
|
193
|
+
repoRoot: string,
|
|
194
|
+
io: WorkspaceIO,
|
|
195
|
+
opts: { lines: string[] },
|
|
196
|
+
): Promise<PlanOutcome> {
|
|
197
|
+
const primary = await primaryWorktree(io, repoRoot);
|
|
198
|
+
const guardInstalled = await isFlowAdopted(repoRoot, io);
|
|
199
|
+
if (!guardInstalled) {
|
|
200
|
+
return {
|
|
201
|
+
kind: "refusal",
|
|
202
|
+
data: refuse(
|
|
203
|
+
"FLOW-CUT-01",
|
|
204
|
+
"repository is not adopted into the fixed branch model (governed + guard installed + develop)",
|
|
205
|
+
"run pnpm exec forge flow.install, then re-run flow.cut",
|
|
206
|
+
),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const mainExists = await branchExists(repoRoot, io, "main");
|
|
211
|
+
if (mainExists && !(await isAncestor(repoRoot, io, "main", "develop"))) {
|
|
212
|
+
return {
|
|
213
|
+
kind: "refusal",
|
|
214
|
+
data: refuse(
|
|
215
|
+
"FLOW-CUT-02",
|
|
216
|
+
"main carries a release not yet back-merged into develop",
|
|
217
|
+
"run pnpm exec forge flow.backmerge first",
|
|
218
|
+
),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const { lines, diagnostics: discoveryDiags } = await discoverReleaseLines(repoRoot, io);
|
|
223
|
+
if (discoveryDiags.some((d) => d.severity === "error")) {
|
|
224
|
+
return {
|
|
225
|
+
kind: "refusal",
|
|
226
|
+
data: refuse(
|
|
227
|
+
"FLOW-CUT-01",
|
|
228
|
+
discoveryDiags.map((d) => d.message).join("; "),
|
|
229
|
+
"fix the release-line discovery errors",
|
|
230
|
+
),
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
const repoLine = lines.find((l) => l.paths.length === 0) ?? lines[0];
|
|
234
|
+
if (repoLine === undefined) {
|
|
235
|
+
return {
|
|
236
|
+
kind: "refusal",
|
|
237
|
+
data: refuse(
|
|
238
|
+
"FLOW-CUT-01",
|
|
239
|
+
"no release lines discovered — the repository line is mandatory",
|
|
240
|
+
"check pnpm-workspace.yaml and package.json",
|
|
241
|
+
),
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const selected: ReleaseLine[] = [repoLine];
|
|
245
|
+
for (const id of opts.lines) {
|
|
246
|
+
const found = lines.find((l) => l.id === id);
|
|
247
|
+
if (found === undefined || found.id === repoLine.id) {
|
|
248
|
+
return {
|
|
249
|
+
kind: "refusal",
|
|
250
|
+
data: refuse(
|
|
251
|
+
"FLOW-CUT-03",
|
|
252
|
+
`unknown release line '${id}' — known lines: ${lines.map((l) => l.id).join(", ")}`,
|
|
253
|
+
"pass only ids from flow.version --json",
|
|
254
|
+
),
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
selected.push(found);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const ref = (await git(repoRoot, io, ["rev-parse", "develop"])).stdout.trim();
|
|
261
|
+
const mainTip = mainExists
|
|
262
|
+
? (await git(repoRoot, io, ["rev-parse", "main"])).stdout.trim()
|
|
263
|
+
: "";
|
|
264
|
+
|
|
265
|
+
// Resume detection runs before the pending-level loop: a develop tip
|
|
266
|
+
// carrying `chore(release):` is this cut's own persisted declaration. All
|
|
267
|
+
// named tags present AND main already at the tip → the release completed
|
|
268
|
+
// (rerun reports, no mutation); any missing or a rewound main → the plan
|
|
269
|
+
// still runs but the tail completes exactly the subject's tags (and tags
|
|
270
|
+
// the subject names cannot block as FLOW-CUT-06).
|
|
271
|
+
const tipSubject = (
|
|
272
|
+
await git(repoRoot, io, ["log", "-1", "--format=%s", ref])
|
|
273
|
+
).stdout.trim();
|
|
274
|
+
let resumeTags: string[] | null = null;
|
|
275
|
+
if (tipSubject.startsWith("chore(release): ")) {
|
|
276
|
+
const named = tipSubject
|
|
277
|
+
.slice("chore(release): ".length)
|
|
278
|
+
.split(",")
|
|
279
|
+
.map((t) => t.trim())
|
|
280
|
+
.filter((t) => t.length > 0);
|
|
281
|
+
const existence = await Promise.all(
|
|
282
|
+
named.map(
|
|
283
|
+
async (t) =>
|
|
284
|
+
(await git(repoRoot, io, ["rev-parse", "--verify", "-q", `refs/tags/${t}`])).exitCode ===
|
|
285
|
+
0,
|
|
286
|
+
),
|
|
287
|
+
);
|
|
288
|
+
if (named.length > 0 && existence.every((e) => e) && mainTip === ref) {
|
|
289
|
+
return { kind: "completed", ref, tags: named, allLines: lines, mainTip };
|
|
290
|
+
}
|
|
291
|
+
if (named.length > 0) resumeTags = named;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const cutLines: CutLine[] = [];
|
|
295
|
+
const majorDemands: string[] = [];
|
|
296
|
+
for (const line of selected) {
|
|
297
|
+
const tags = await listLineTags(repoRoot, line, io, ref);
|
|
298
|
+
if (tags.lastTag === null) {
|
|
299
|
+
return {
|
|
300
|
+
kind: "refusal",
|
|
301
|
+
data: refuse(
|
|
302
|
+
"FLOW-CUT-04",
|
|
303
|
+
`release line '${line.id}' has no baseline tag`,
|
|
304
|
+
"run pnpm exec forge flow.install to create the baseline tag",
|
|
305
|
+
),
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
const pending = await pendingLevel(
|
|
309
|
+
line,
|
|
310
|
+
tags.lastTag.name,
|
|
311
|
+
io,
|
|
312
|
+
repoRoot,
|
|
313
|
+
tags.lastTag.version,
|
|
314
|
+
ref,
|
|
315
|
+
);
|
|
316
|
+
if (pending.level === "none") {
|
|
317
|
+
return {
|
|
318
|
+
kind: "refusal",
|
|
319
|
+
data: refuse(
|
|
320
|
+
"FLOW-CUT-04",
|
|
321
|
+
line.id === repoLine.id
|
|
322
|
+
? "nothing to release — the repository line has no pending commits"
|
|
323
|
+
: `release line '${line.id}' has no pending commits`,
|
|
324
|
+
"drop the line from --lines, or land work touching its paths first",
|
|
325
|
+
),
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
const next = formatVersion(bumpVersion(tags.lastTag.version, pending.level));
|
|
329
|
+
if (pending.level === "major") {
|
|
330
|
+
majorDemands.push(
|
|
331
|
+
`${line.id} (${pending.rfcs.map((r) => r.id).join(", ") || "no RFC trailer"})`,
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
const tagName = `${line.tagPrefix}${next}`;
|
|
335
|
+
const tagRef = `refs/tags/${tagName}`;
|
|
336
|
+
const namedInSubject = resumeTags !== null && resumeTags.includes(tagName);
|
|
337
|
+
if (
|
|
338
|
+
!namedInSubject &&
|
|
339
|
+
(await git(repoRoot, io, ["rev-parse", "--verify", "-q", tagRef])).exitCode === 0
|
|
340
|
+
) {
|
|
341
|
+
return {
|
|
342
|
+
kind: "refusal",
|
|
343
|
+
data: refuse(
|
|
344
|
+
"FLOW-CUT-06",
|
|
345
|
+
`target tag ${line.tagPrefix}${next} already exists`,
|
|
346
|
+
"pick a different version or delete the stray tag if it was never published",
|
|
347
|
+
),
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
cutLines.push({
|
|
351
|
+
line,
|
|
352
|
+
tag: tagName,
|
|
353
|
+
level: pending.level,
|
|
354
|
+
nextVersion: next,
|
|
355
|
+
previousTag: tags.lastTag.name,
|
|
356
|
+
rfcs: pending.rfcs.map((r) => r.id),
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (majorDemands.length > 0 && process.env["ALLOW_MAJOR_BUMP"] !== "1") {
|
|
361
|
+
return {
|
|
362
|
+
kind: "refusal",
|
|
363
|
+
data: refuse(
|
|
364
|
+
"FLOW-CUT-05",
|
|
365
|
+
`release requires a major bump on: ${majorDemands.join("; ")}`,
|
|
366
|
+
"re-run with ALLOW_MAJOR_BUMP=1 in the environment — major cuts are operator-only",
|
|
367
|
+
),
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const primaryBranch = await currentBranch(primary, io);
|
|
372
|
+
const primaryDirty = await statusTracked(primary, io);
|
|
373
|
+
const worktrees = await worktreeList(repoRoot, io);
|
|
374
|
+
const mainCheckedOut = worktrees.some((w) => w.branch === "main");
|
|
375
|
+
if (primaryBranch !== "develop" || primaryDirty.length > 0 || mainCheckedOut) {
|
|
376
|
+
return {
|
|
377
|
+
kind: "refusal",
|
|
378
|
+
data: refuse(
|
|
379
|
+
"FLOW-CUT-07",
|
|
380
|
+
primaryBranch !== "develop"
|
|
381
|
+
? `primary worktree is on ${primaryBranch ?? "detached HEAD"}, not develop`
|
|
382
|
+
: mainCheckedOut
|
|
383
|
+
? "a worktree has main checked out — the cut must own the main ref"
|
|
384
|
+
: `primary worktree has ${primaryDirty.length} tracked uncommitted change(s)`,
|
|
385
|
+
"switch the primary to develop, commit or revert its changes, and ensure no worktree holds main",
|
|
386
|
+
),
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const tagList = cutLines.map((c) => c.tag);
|
|
391
|
+
return {
|
|
392
|
+
kind: "plan",
|
|
393
|
+
plan: {
|
|
394
|
+
ref,
|
|
395
|
+
resumeTags,
|
|
396
|
+
cutLines,
|
|
397
|
+
tagList,
|
|
398
|
+
subject: `chore(release): ${tagList.join(", ")}`,
|
|
399
|
+
allLines: lines,
|
|
400
|
+
repoLine,
|
|
401
|
+
mainTip,
|
|
402
|
+
primary,
|
|
403
|
+
},
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/** The line a subject-named tag belongs to — longest matching prefix wins. */
|
|
408
|
+
function lineForTag(tag: string, allLines: ReleaseLine[], repoLine: ReleaseLine): ReleaseLine {
|
|
409
|
+
const match = allLines
|
|
410
|
+
.filter((l) => l.id !== repoLine.id && tag.startsWith(l.tagPrefix))
|
|
411
|
+
.sort((a, b) => b.tagPrefix.length - a.tagPrefix.length)[0];
|
|
412
|
+
return match ?? repoLine;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/** Spec-shape `lines[]` for the report — one entry per applied tag. */
|
|
416
|
+
export function toFlowCutLines(
|
|
417
|
+
tagNames: string[],
|
|
418
|
+
cutLines: CutLine[],
|
|
419
|
+
allLines: ReleaseLine[],
|
|
420
|
+
repoLine: ReleaseLine,
|
|
421
|
+
): FlowCutLine[] {
|
|
422
|
+
return tagNames.map((tag) => {
|
|
423
|
+
const c = cutLines.find((cl) => cl.tag === tag);
|
|
424
|
+
if (c !== undefined) {
|
|
425
|
+
return {
|
|
426
|
+
line: c.line.id,
|
|
427
|
+
tag,
|
|
428
|
+
previous: c.previousTag,
|
|
429
|
+
level: c.level,
|
|
430
|
+
version: c.nextVersion,
|
|
431
|
+
rfcs: c.rfcs,
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
const line = lineForTag(tag, allLines, repoLine);
|
|
435
|
+
return {
|
|
436
|
+
line: line.id,
|
|
437
|
+
tag,
|
|
438
|
+
previous: null,
|
|
439
|
+
level: "patch" as const,
|
|
440
|
+
version: tag.slice(line.tagPrefix.length),
|
|
441
|
+
rfcs: [],
|
|
442
|
+
};
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function completedReleaseData(outcome: {
|
|
447
|
+
ref: string;
|
|
448
|
+
tags: string[];
|
|
449
|
+
allLines: ReleaseLine[];
|
|
450
|
+
mainTip: string;
|
|
451
|
+
}): FlowCutData {
|
|
452
|
+
const repoLine = outcome.allLines.find((l) => l.paths.length === 0) ?? outcome.allLines[0]!;
|
|
453
|
+
return {
|
|
454
|
+
mode: "ordinary",
|
|
455
|
+
released: true,
|
|
456
|
+
resumed: true,
|
|
457
|
+
releaseBranch: null,
|
|
458
|
+
releaseCommit: outcome.ref,
|
|
459
|
+
mainBefore: outcome.mainTip,
|
|
460
|
+
mainAfter: outcome.ref,
|
|
461
|
+
mainGains: 0,
|
|
462
|
+
tags: outcome.tags,
|
|
463
|
+
versions: {},
|
|
464
|
+
lines: toFlowCutLines(outcome.tags, [], outcome.allLines, repoLine),
|
|
465
|
+
fingerprints: {},
|
|
466
|
+
gate: null,
|
|
467
|
+
backmerge: null,
|
|
468
|
+
diagnostics: [],
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Ordinary cut core — callable with an injected clock. Plan-phase refusals
|
|
474
|
+
* resolve inside the integration lock (the world can change while a caller
|
|
475
|
+
* waits), then the release runs open→integrate→fingerprints→main→tags→journal
|
|
476
|
+
* without ever dropping the lock. A develop tip already carrying the release
|
|
477
|
+
* subject resumes at fingerprints; a fully landed release reports released.
|
|
478
|
+
*/
|
|
479
|
+
export async function runOrdinaryCut(
|
|
480
|
+
repoRoot: string,
|
|
481
|
+
io: WorkspaceIO,
|
|
482
|
+
opts: {
|
|
483
|
+
lines: string[];
|
|
484
|
+
dryRun: boolean;
|
|
485
|
+
now?: Date;
|
|
486
|
+
onProgress?: (m: string) => void;
|
|
487
|
+
},
|
|
488
|
+
): Promise<FlowCutData> {
|
|
489
|
+
const now = opts.now ?? new Date();
|
|
490
|
+
|
|
491
|
+
if (opts.dryRun) {
|
|
492
|
+
const outcome = await planOrdinaryCut(repoRoot, io, opts);
|
|
493
|
+
if (outcome.kind === "refusal") return outcome.data;
|
|
494
|
+
if (outcome.kind === "completed") return completedReleaseData(outcome);
|
|
495
|
+
const { plan } = outcome;
|
|
496
|
+
return {
|
|
497
|
+
mode: "ordinary",
|
|
498
|
+
released: false,
|
|
499
|
+
resumed: false,
|
|
500
|
+
releaseBranch: null,
|
|
501
|
+
releaseCommit: null,
|
|
502
|
+
mainBefore: plan.mainTip.length > 0 ? plan.mainTip : null,
|
|
503
|
+
mainAfter: null,
|
|
504
|
+
mainGains: 0,
|
|
505
|
+
tags: plan.tagList,
|
|
506
|
+
versions: Object.fromEntries(plan.cutLines.map((c) => [c.line.id, c.nextVersion])),
|
|
507
|
+
lines: toFlowCutLines(plan.tagList, plan.cutLines, plan.allLines, plan.repoLine),
|
|
508
|
+
fingerprints: {},
|
|
509
|
+
gate: null,
|
|
510
|
+
backmerge: null,
|
|
511
|
+
diagnostics: [],
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
const common = await commonGitDir(io, repoRoot);
|
|
516
|
+
await io.mkdir(join(common, "forge"));
|
|
517
|
+
const lockPath = join(common, INTEGRATE_LOCK_RELATIVE_PATH);
|
|
518
|
+
|
|
519
|
+
let releaseBranch: string | null = null;
|
|
520
|
+
try {
|
|
521
|
+
return await withFlowLock(
|
|
522
|
+
lockPath,
|
|
523
|
+
{
|
|
524
|
+
waitMs: INTEGRATE_LOCK_WAIT_MS,
|
|
525
|
+
staleMs: INTEGRATE_LOCK_STALE_MS,
|
|
526
|
+
progressEveryMs: 60_000,
|
|
527
|
+
onProgress: opts.onProgress,
|
|
528
|
+
},
|
|
529
|
+
async () => {
|
|
530
|
+
// Plan at lock time — no stale-ref races against landing integrations.
|
|
531
|
+
const outcome = await planOrdinaryCut(repoRoot, io, opts);
|
|
532
|
+
if (outcome.kind === "refusal") return outcome.data;
|
|
533
|
+
if (outcome.kind === "completed") return completedReleaseData(outcome);
|
|
534
|
+
const plan = outcome.plan;
|
|
535
|
+
const { cutLines, tagList, subject, repoLine, primary } = plan;
|
|
536
|
+
|
|
537
|
+
// Resume tail: release commit integrated earlier; finish at
|
|
538
|
+
// fingerprints → main → tags with exactly the subject's named tags.
|
|
539
|
+
if (plan.resumeTags !== null) {
|
|
540
|
+
// The release branch is linear — tip^ is the develop tip the
|
|
541
|
+
// integration started from, the honest journal base on a rerun.
|
|
542
|
+
const base = (await git(repoRoot, io, ["rev-parse", `${plan.ref}^`])).stdout.trim();
|
|
543
|
+
const resume = await finishCutTail(repoRoot, io, {
|
|
544
|
+
developTip: plan.ref,
|
|
545
|
+
tagNames: plan.resumeTags,
|
|
546
|
+
cutLines,
|
|
547
|
+
allLines: plan.allLines,
|
|
548
|
+
repoLine,
|
|
549
|
+
primary,
|
|
550
|
+
now,
|
|
551
|
+
gate: null,
|
|
552
|
+
journalBranch: "release",
|
|
553
|
+
journalBase: base,
|
|
554
|
+
});
|
|
555
|
+
return { ...resume, resumed: true };
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// 1. release branch.
|
|
559
|
+
const open = await openFlowBranchCore(repoRoot, io, {
|
|
560
|
+
kind: "session",
|
|
561
|
+
slug: `release-${cutLines[0]!.nextVersion.replaceAll(".", "-")}`,
|
|
562
|
+
brief: `release ${tagList.join(", ")}`,
|
|
563
|
+
owner: { kind: "session", id: "release" },
|
|
564
|
+
dryRun: false,
|
|
565
|
+
now,
|
|
566
|
+
});
|
|
567
|
+
if (!open.opened || open.branch === null || open.worktree === null) {
|
|
568
|
+
const d = open.diagnostics[0];
|
|
569
|
+
return refuse(
|
|
570
|
+
d?.ruleId ?? "FLOW-CUT-01",
|
|
571
|
+
d?.message ?? "release branch did not open",
|
|
572
|
+
d?.fixHint ?? "inspect flow.status",
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
releaseBranch = open.branch;
|
|
576
|
+
const wt = open.worktree;
|
|
577
|
+
|
|
578
|
+
// 2. version files (verified writes).
|
|
579
|
+
try {
|
|
580
|
+
for (const c of cutLines) {
|
|
581
|
+
await writeLineVersion(wt, c.line, c.nextVersion, io);
|
|
582
|
+
if (c.line.id !== repoLine.id) {
|
|
583
|
+
const pkg = JSON.parse(
|
|
584
|
+
await io.readFile(join(wt, c.line.versionFile ?? "package.json")),
|
|
585
|
+
) as { name?: string };
|
|
586
|
+
if (pkg.name === "@warpgogol/forge") {
|
|
587
|
+
const forgeYaml = join(wt, "forge.yaml");
|
|
588
|
+
if ((await io.exists(forgeYaml)) && /syncedVersion:/.test(await io.readFile(forgeYaml))) {
|
|
589
|
+
await writeSyncedForgeVersion(wt, c.nextVersion, io);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
} catch (error) {
|
|
595
|
+
if (error instanceof VersionWriteError) {
|
|
596
|
+
await git(repoRoot, io, ["worktree", "remove", "--force", wt]);
|
|
597
|
+
await git(repoRoot, io, ["branch", "-D", releaseBranch]);
|
|
598
|
+
return refuse(
|
|
599
|
+
"FLOW-CUT-11",
|
|
600
|
+
`${error.message}`,
|
|
601
|
+
"fix the version file so the top-level version field is the release version",
|
|
602
|
+
{ releaseBranch },
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
throw error;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// 3. release commit.
|
|
609
|
+
await git(wt, io, ["add", "-A"]);
|
|
610
|
+
const body = cutLines
|
|
611
|
+
.map((c) => `${c.tag} ${c.level} ${c.previousTag ?? "null"}`)
|
|
612
|
+
.join("\n");
|
|
613
|
+
const commit = await gitCommit(wt, io, ["commit", "-m", `${subject}\n\n${body}`], "cut");
|
|
614
|
+
if (commit.exitCode !== 0) {
|
|
615
|
+
return refuse("FLOW-CUT-01", `release commit failed: ${commit.stderr.trim()}`, "inspect the release worktree state", { releaseBranch });
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// 4. integrate (gate + ff + cleanup) with the lock already held.
|
|
619
|
+
const integrated = await integrateFlowBranch(repoRoot, io, {
|
|
620
|
+
branch: releaseBranch,
|
|
621
|
+
dryRun: false,
|
|
622
|
+
now,
|
|
623
|
+
lockHeld: true,
|
|
624
|
+
target: "develop",
|
|
625
|
+
});
|
|
626
|
+
if (!integrated.integrated || integrated.diagnostics.length > 0) {
|
|
627
|
+
const d = integrated.diagnostics[0];
|
|
628
|
+
return refuse(
|
|
629
|
+
d?.ruleId ?? "FLOW-INT-05",
|
|
630
|
+
d?.message ?? "integration failed",
|
|
631
|
+
d?.fixHint ?? "inspect the gate output",
|
|
632
|
+
{ releaseBranch, gate: integrated.gate },
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
// 5–8. fingerprints → main → tags → journal.
|
|
637
|
+
return finishCutTail(repoRoot, io, {
|
|
638
|
+
developTip: integrated.developAfter ?? plan.ref,
|
|
639
|
+
tagNames: tagList,
|
|
640
|
+
cutLines,
|
|
641
|
+
allLines: plan.allLines,
|
|
642
|
+
repoLine,
|
|
643
|
+
primary,
|
|
644
|
+
now,
|
|
645
|
+
gate: integrated.gate,
|
|
646
|
+
journalBranch: releaseBranch,
|
|
647
|
+
journalBase: integrated.developBefore ?? plan.ref,
|
|
648
|
+
});
|
|
649
|
+
},
|
|
650
|
+
io,
|
|
651
|
+
);
|
|
652
|
+
} catch (error) {
|
|
653
|
+
if (error instanceof LockTimeoutError) {
|
|
654
|
+
return refuse(
|
|
655
|
+
"FLOW-INT-08",
|
|
656
|
+
`integration lock ${error.lockPath} is held by another integration`,
|
|
657
|
+
"wait for the running integration to finish, or break the stale lock after 2 h automatically",
|
|
658
|
+
{ releaseBranch },
|
|
659
|
+
);
|
|
660
|
+
}
|
|
661
|
+
if (error instanceof FlowRegistrySchemaError) {
|
|
662
|
+
return refuse("FLOW-07", error.message, `repair or remove ${registryPath(common)}`, { releaseBranch });
|
|
663
|
+
}
|
|
664
|
+
throw error;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/** Steps 5–8 shared by the fresh path and the resume path. */
|
|
669
|
+
async function finishCutTail(
|
|
670
|
+
repoRoot: string,
|
|
671
|
+
io: WorkspaceIO,
|
|
672
|
+
args: {
|
|
673
|
+
developTip: string;
|
|
674
|
+
tagNames: string[];
|
|
675
|
+
cutLines: CutLine[];
|
|
676
|
+
allLines: ReleaseLine[];
|
|
677
|
+
repoLine: ReleaseLine;
|
|
678
|
+
primary: string;
|
|
679
|
+
now: Date;
|
|
680
|
+
gate: FlowScriptResult | null;
|
|
681
|
+
/** Branch name the journal records ("release" on resume — the branch is gone). */
|
|
682
|
+
journalBranch: string;
|
|
683
|
+
/** Journal `base` — develop before the release range (W1-1). */
|
|
684
|
+
journalBase: string;
|
|
685
|
+
},
|
|
686
|
+
): Promise<FlowCutData> {
|
|
687
|
+
const { developTip, tagNames, cutLines, allLines, repoLine, primary, gate } = args;
|
|
688
|
+
|
|
689
|
+
// 5. fingerprints.
|
|
690
|
+
const fpResult = await runFlowScript(io, "release-fingerprints", {
|
|
691
|
+
primary,
|
|
692
|
+
cwd: primary,
|
|
693
|
+
env: {
|
|
694
|
+
FORGE_FLOW_RELEASE_SHA: developTip,
|
|
695
|
+
FORGE_FLOW_RELEASE_TAGS: tagNames.join(","),
|
|
696
|
+
},
|
|
697
|
+
});
|
|
698
|
+
let fingerprints: Record<string, string> = {};
|
|
699
|
+
if (fpResult.status === "failed") {
|
|
700
|
+
return refuse(
|
|
701
|
+
"FLOW-CUT-08",
|
|
702
|
+
`hooks/release-fingerprints.sh failed (exit ${fpResult.exitCode}): ${fpResult.stderrTail}`,
|
|
703
|
+
"fix the fingerprint hook and re-run flow.cut — main has not moved",
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
if (fpResult.status === "done") {
|
|
707
|
+
const parsed = parseFingerprints(fpResult.stdout);
|
|
708
|
+
if (parsed === null) {
|
|
709
|
+
return refuse(
|
|
710
|
+
"FLOW-CUT-08",
|
|
711
|
+
"hooks/release-fingerprints.sh stdout is not a flat YAML mapping of string keys to string values",
|
|
712
|
+
"emit only 'key: value' string pairs on stdout",
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
fingerprints = parsed;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
// 6. main compare-and-swap.
|
|
719
|
+
const mainTipBefore = (await git(repoRoot, io, ["rev-parse", "main"])).stdout.trim();
|
|
720
|
+
if (await branchExists(repoRoot, io, "main")) {
|
|
721
|
+
if (!(await isAncestor(repoRoot, io, "main", "develop"))) {
|
|
722
|
+
return refuse(
|
|
723
|
+
"FLOW-CUT-02",
|
|
724
|
+
"main moved past develop mid-cut",
|
|
725
|
+
"run pnpm exec forge flow.backmerge, then re-run flow.cut",
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
const upd = await git(repoRoot, io, ["update-ref", "refs/heads/main", developTip, mainTipBefore]);
|
|
729
|
+
if (upd.exitCode !== 0) {
|
|
730
|
+
return refuse("FLOW-CUT-01", `update-ref main failed: ${upd.stderr.trim()}`, "inspect refs/heads/main");
|
|
731
|
+
}
|
|
732
|
+
} else {
|
|
733
|
+
const upd = await git(repoRoot, io, ["update-ref", "refs/heads/main", developTip]);
|
|
734
|
+
if (upd.exitCode !== 0) {
|
|
735
|
+
return refuse("FLOW-CUT-01", `update-ref main failed: ${upd.stderr.trim()}`, "inspect refs/heads/main");
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// 7. tags — iterate the declared names (subject tags on resume) and look
|
|
740
|
+
// each up in the computed cut lines; a named-only tag gets a patch stub on
|
|
741
|
+
// its own line (matched by tag prefix). A tag already pointing at the tip
|
|
742
|
+
// is skipped — rerun-safe against a crash between two git tag calls; a tag
|
|
743
|
+
// pointing elsewhere refuses instead of silently moving it.
|
|
744
|
+
for (const tag of tagNames) {
|
|
745
|
+
const existing = await git(repoRoot, io, ["rev-parse", "-q", "--verify", `refs/tags/${tag}^{}`]);
|
|
746
|
+
if (existing.exitCode === 0) {
|
|
747
|
+
if (existing.stdout.trim() === developTip) continue;
|
|
748
|
+
return refuse(
|
|
749
|
+
"FLOW-CUT-06",
|
|
750
|
+
`tag ${tag} already exists at ${existing.stdout.trim().slice(0, 9)}, not the release tip`,
|
|
751
|
+
"delete the stray tag if it was never published, or pick a different version",
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
const c = cutLines.find((cl) => cl.tag === tag) ?? (() => {
|
|
755
|
+
const line = lineForTag(tag, allLines, repoLine);
|
|
756
|
+
return {
|
|
757
|
+
line,
|
|
758
|
+
tag,
|
|
759
|
+
level: "patch" as const,
|
|
760
|
+
nextVersion: tag.slice(line.tagPrefix.length),
|
|
761
|
+
previousTag: null,
|
|
762
|
+
rfcs: [] as string[],
|
|
763
|
+
};
|
|
764
|
+
})();
|
|
765
|
+
const wr = await writeReleaseTag(repoRoot, io, {
|
|
766
|
+
name: tag,
|
|
767
|
+
target: developTip,
|
|
768
|
+
annotation: releaseTagAnnotation({
|
|
769
|
+
tag,
|
|
770
|
+
line: c.line.id,
|
|
771
|
+
version: c.nextVersion,
|
|
772
|
+
level: c.level,
|
|
773
|
+
previous: c.previousTag,
|
|
774
|
+
rfcs: c.rfcs,
|
|
775
|
+
fingerprints: c.line.id === repoLine.id ? fingerprints : {},
|
|
776
|
+
}),
|
|
777
|
+
});
|
|
778
|
+
if (wr.exitCode !== 0) {
|
|
779
|
+
return refuse("FLOW-CUT-01", `tag ${tag} failed: ${wr.stderr.trim()}`, "inspect the tag state");
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
// 8. journal.
|
|
784
|
+
const common = await commonGitDir(io, repoRoot);
|
|
785
|
+
try {
|
|
786
|
+
await appendJournal(io, common, {
|
|
787
|
+
event: "cut",
|
|
788
|
+
branch: args.journalBranch,
|
|
789
|
+
sha: developTip,
|
|
790
|
+
base: args.journalBase,
|
|
791
|
+
detail: tagNames.join(", "),
|
|
792
|
+
at: args.now.toISOString(),
|
|
793
|
+
});
|
|
794
|
+
} catch {
|
|
795
|
+
// journal failure is non-fatal bookkeeping.
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
const mainGains = mainTipBefore.length > 0
|
|
799
|
+
? Number((await git(repoRoot, io, ["rev-list", "--count", `${mainTipBefore}..${developTip}`])).stdout.trim() || 0)
|
|
800
|
+
: 0;
|
|
801
|
+
|
|
802
|
+
return {
|
|
803
|
+
mode: "ordinary",
|
|
804
|
+
released: true,
|
|
805
|
+
resumed: false,
|
|
806
|
+
releaseBranch: null,
|
|
807
|
+
releaseCommit: developTip,
|
|
808
|
+
mainBefore: mainTipBefore.length > 0 ? mainTipBefore : null,
|
|
809
|
+
mainAfter: developTip,
|
|
810
|
+
mainGains: Number.isFinite(mainGains) ? mainGains : 0,
|
|
811
|
+
tags: tagNames,
|
|
812
|
+
versions: Object.fromEntries(cutLines.map((c) => [c.line.id, c.nextVersion])),
|
|
813
|
+
lines: toFlowCutLines(tagNames, cutLines, allLines, repoLine),
|
|
814
|
+
fingerprints,
|
|
815
|
+
gate,
|
|
816
|
+
backmerge: null,
|
|
817
|
+
diagnostics: [],
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
export async function runFlowCut(
|
|
822
|
+
input: ForgeCommandInput,
|
|
823
|
+
context: ForgeRuntimeContext,
|
|
824
|
+
): Promise<ForgeCommandResult<FlowCutData>> {
|
|
825
|
+
const { workspaceRoot, logger, outputFormat } = context;
|
|
826
|
+
const io = resolveIo(context.io);
|
|
827
|
+
await requireGit(io);
|
|
828
|
+
|
|
829
|
+
const repoRoot = await topLevel(workspaceRoot, io);
|
|
830
|
+
if (repoRoot === null) {
|
|
831
|
+
throw new Error("flow.cut must run inside a git repository");
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
const linesFlag = input.flags["lines"];
|
|
835
|
+
const lines =
|
|
836
|
+
typeof linesFlag === "string" && linesFlag.length > 0
|
|
837
|
+
? linesFlag.split(",").map((s) => s.trim())
|
|
838
|
+
: [];
|
|
839
|
+
const dryRun = context.dryRun || input.flags["dry-run"] === true;
|
|
840
|
+
|
|
841
|
+
// Fix mode: --branch names a registered fix branch, or the cwd worktree is
|
|
842
|
+
// itself a registered fix worktree.
|
|
843
|
+
const branchFlag = input.flags["branch"];
|
|
844
|
+
const candidate =
|
|
845
|
+
typeof branchFlag === "string" && branchFlag.length > 0
|
|
846
|
+
? branchFlag
|
|
847
|
+
: await currentBranch(repoRoot, io);
|
|
848
|
+
let data: FlowCutData;
|
|
849
|
+
if (candidate !== null) {
|
|
850
|
+
const common = await commonGitDir(io, repoRoot);
|
|
851
|
+
let entry = null;
|
|
852
|
+
try {
|
|
853
|
+
entry =
|
|
854
|
+
(await readRegistry(io, common)).branches.find((b) => b.name === candidate) ?? null;
|
|
855
|
+
} catch (error) {
|
|
856
|
+
if (error instanceof FlowRegistrySchemaError) {
|
|
857
|
+
data = refuse("FLOW-07", error.message, `repair or remove ${registryPath(common)}`);
|
|
858
|
+
return finishCutResult(data, outputFormat, logger);
|
|
859
|
+
}
|
|
860
|
+
throw error;
|
|
861
|
+
}
|
|
862
|
+
if (entry !== null && entry.kind === "fix") {
|
|
863
|
+
const { runFixCutWithBackmerge } = await import("./flow-fix.ts");
|
|
864
|
+
data = await runFixCutWithBackmerge(repoRoot, io, {
|
|
865
|
+
entry,
|
|
866
|
+
linesGiven: lines.length > 0,
|
|
867
|
+
dryRun,
|
|
868
|
+
});
|
|
869
|
+
return finishCutResult(data, outputFormat, logger);
|
|
870
|
+
}
|
|
871
|
+
if (typeof branchFlag === "string" && entry?.kind !== "fix") {
|
|
872
|
+
data = refuse(
|
|
873
|
+
"FLOW-INT-06",
|
|
874
|
+
`${candidate} is not a fix branch — --branch targets a registered fix worktree only`,
|
|
875
|
+
"run flow.cut without --branch for an ordinary release, or open a fix with flow.fix",
|
|
876
|
+
);
|
|
877
|
+
return finishCutResult(data, outputFormat, logger);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
data = await runOrdinaryCut(repoRoot, io, { lines, dryRun });
|
|
882
|
+
return finishCutResult(data, outputFormat, logger);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
function finishCutResult(
|
|
886
|
+
data: FlowCutData,
|
|
887
|
+
outputFormat: string,
|
|
888
|
+
logger: ForgeRuntimeContext["logger"],
|
|
889
|
+
): ForgeCommandResult<FlowCutData> {
|
|
890
|
+
|
|
891
|
+
const refused = data.diagnostics.find((d) => d.severity === "error");
|
|
892
|
+
if (outputFormat === "pretty") {
|
|
893
|
+
if (refused) {
|
|
894
|
+
logger.error(`flow.cut refused: ${refused.ruleId} ${refused.message}`);
|
|
895
|
+
} else if (data.released) {
|
|
896
|
+
logger.section("flow.cut");
|
|
897
|
+
logger.info(` ${data.resumed ? "resumed release" : "released"}: ${data.tags.join(", ")}`);
|
|
898
|
+
logger.info(` main gained ${data.mainGains} commit(s) — now at ${data.mainAfter?.slice(0, 9)}`);
|
|
899
|
+
if (data.mainGains > 0 && !data.resumed) {
|
|
900
|
+
logger.info(" the first cut after flow.install includes the guard-adoption commit");
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
return {
|
|
906
|
+
data,
|
|
907
|
+
exitCode: refused ? 1 : 0,
|
|
908
|
+
summary: refused
|
|
909
|
+
? `[flow.cut] refused: ${refused.ruleId} ${refused.message}`
|
|
910
|
+
: `[flow.cut] ${data.released ? `released ${data.tags.join(", ")}` : "dry-run"}`,
|
|
911
|
+
};
|
|
912
|
+
}
|