@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,623 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>flow.integrate — land a registered auto branch on develop
|
|
4
|
+
(RFC-1487). Under the integration lock: the branch's worktree must be clean,
|
|
5
|
+
the branch rebases onto the current develop, the primary's
|
|
6
|
+
hooks/integration-gate.sh gates, the primary must sit clean on develop, and
|
|
7
|
+
git -C <primary> merge --ff-only moves develop forward — never a merge
|
|
8
|
+
commit. Afterwards the worktree, branch and registry entry are removed and
|
|
9
|
+
the journal records the integrate. A rerun after a mid-cleanup crash resumes
|
|
10
|
+
at cleanup without moving develop again.</purpose>
|
|
11
|
+
<non-goals>
|
|
12
|
+
<item>No push, no release work — the outbound wave owns remote operations.</item>
|
|
13
|
+
</non-goals>
|
|
14
|
+
</MODULE_CONTRACT>
|
|
15
|
+
<KEY_DECISIONS>
|
|
16
|
+
<item>The integration lock covers steps 1–5 only — cleanup (step 6) is idempotent and needs no serialization, so a crashed holder cannot wedge the queue (AUDIT G2).</item>
|
|
17
|
+
<item>Every git call after worktree removal runs with -C <primary> — the caller's cwd may be the removed directory (AUDIT G3/G4).</item>
|
|
18
|
+
<item>Rerun detection is `isAncestor(branchTip, develop)` on a registered entry — develop already containing the branch means the merge landed; only cleanup remains (AC-9).</item>
|
|
19
|
+
<item>FLOW-INT-07 covers develop moving between rebase and merge despite the lock — the branch stays rebased; a rerun rebases onto the new tip.</item>
|
|
20
|
+
<item>Task-file preservation runs inside the cleanup branch BEFORE the worktree-teardown hook and only for owner.kind task — a `git clean -fdx` teardown would destroy `.forge/task/` first, and a copy failure refuses cleanup (FLOW-INT-04) so the report is never lost with the worktree (RFC-1509 Q-16).</item>
|
|
21
|
+
</KEY_DECISIONS>
|
|
22
|
+
<CHANGE_SUMMARY>
|
|
23
|
+
<item>RFC-1504: steps 2-3 — holderIsDead, boot-id payload, dead-holder break in withFlowLock</item>
|
|
24
|
+
<item>RFC-1509: implement RFC-1509 — system task queue, dispatch briefs and task reports</item>
|
|
25
|
+
<item>RFC-1509: record task-file preservation decisions in flow handlers</item>
|
|
26
|
+
<item>RFC-1509: close RFC-1509 review r1 findings — mark-failed escape, open-error refusal, dry-run coverage</item>
|
|
27
|
+
<item>RFC-1509: record RFC-1509 preserve-before-teardown ordering in key decisions</item>
|
|
28
|
+
<history>RFC-1487, RFC-1490, RFC-1491</history>
|
|
29
|
+
</CHANGE_SUMMARY>
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import type {
|
|
33
|
+
Diagnostic,
|
|
34
|
+
ForgeCommandInput,
|
|
35
|
+
ForgeCommandResult,
|
|
36
|
+
ForgeRuntimeContext,
|
|
37
|
+
WorkspaceIO,
|
|
38
|
+
} from "../../../src/types.ts";
|
|
39
|
+
import { resolveIo } from "../../../src/utils/io.ts";
|
|
40
|
+
import {
|
|
41
|
+
branchExists,
|
|
42
|
+
currentBranch,
|
|
43
|
+
git,
|
|
44
|
+
isAncestor,
|
|
45
|
+
requireGit,
|
|
46
|
+
statusDirty,
|
|
47
|
+
statusTracked,
|
|
48
|
+
topLevel,
|
|
49
|
+
worktreeList,
|
|
50
|
+
} from "../git.ts";
|
|
51
|
+
import { LockTimeoutError, withFlowLock } from "../locks.ts";
|
|
52
|
+
import {
|
|
53
|
+
appendJournal,
|
|
54
|
+
commonGitDir,
|
|
55
|
+
FlowRegistrySchemaError,
|
|
56
|
+
INTEGRATE_LOCK_RELATIVE_PATH,
|
|
57
|
+
readRegistry,
|
|
58
|
+
registryPath,
|
|
59
|
+
updateRegistry,
|
|
60
|
+
type FlowRegistryEntry,
|
|
61
|
+
} from "../registry.ts";
|
|
62
|
+
import { runFlowScript, type FlowScriptResult } from "../scripts.ts";
|
|
63
|
+
import { preserveTaskFiles } from "../task-files.ts";
|
|
64
|
+
import { primaryWorktree } from "../worktree-path.ts";
|
|
65
|
+
import { join } from "node:path";
|
|
66
|
+
|
|
67
|
+
export const INTEGRATE_LOCK_WAIT_MS = 30 * 60_000;
|
|
68
|
+
export const INTEGRATE_LOCK_STALE_MS = 2 * 3_600_000;
|
|
69
|
+
|
|
70
|
+
export interface FlowIntegrateData {
|
|
71
|
+
branch: string | null;
|
|
72
|
+
integrated: boolean;
|
|
73
|
+
/** develop tip before this invocation. */
|
|
74
|
+
developBefore: string | null;
|
|
75
|
+
/** develop tip after this invocation (same as developBefore on resume/refusal). */
|
|
76
|
+
developAfter: string | null;
|
|
77
|
+
/** A rebase ran during this invocation. */
|
|
78
|
+
rebased: boolean;
|
|
79
|
+
gate: FlowScriptResult | null;
|
|
80
|
+
/** worktree-teardown script result when cleanup ran — never an integration-gate result. */
|
|
81
|
+
teardown?: FlowScriptResult | null;
|
|
82
|
+
cleanedUp: boolean;
|
|
83
|
+
diagnostics: Diagnostic[];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function refuse(
|
|
87
|
+
ruleId: string,
|
|
88
|
+
message: string,
|
|
89
|
+
fixHint: string,
|
|
90
|
+
partial?: Partial<FlowIntegrateData>,
|
|
91
|
+
): FlowIntegrateData {
|
|
92
|
+
return {
|
|
93
|
+
branch: partial?.branch ?? null,
|
|
94
|
+
integrated: partial?.integrated ?? false,
|
|
95
|
+
developBefore: partial?.developBefore ?? null,
|
|
96
|
+
developAfter: partial?.developAfter ?? partial?.developBefore ?? null,
|
|
97
|
+
rebased: partial?.rebased ?? false,
|
|
98
|
+
gate: partial?.gate ?? null,
|
|
99
|
+
cleanedUp: partial?.cleanedUp ?? false,
|
|
100
|
+
diagnostics: [{ ruleId, severity: "error", message, fixHint }],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function resolveEntry(
|
|
105
|
+
repoRoot: string,
|
|
106
|
+
io: WorkspaceIO,
|
|
107
|
+
branch: string,
|
|
108
|
+
): Promise<{ common: string; entry: FlowRegistryEntry } | { common: string; entry: null }> {
|
|
109
|
+
const common = await commonGitDir(io, repoRoot);
|
|
110
|
+
const registry = await readRegistry(io, common);
|
|
111
|
+
return { common, entry: registry.branches.find((b) => b.name === branch) ?? null };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Step 6 — teardown, worktree removal, branch delete, registry, journal. */
|
|
115
|
+
async function cleanupIntegrated(
|
|
116
|
+
primary: string,
|
|
117
|
+
worktree: string | null,
|
|
118
|
+
entry: FlowRegistryEntry,
|
|
119
|
+
common: string,
|
|
120
|
+
sha: string,
|
|
121
|
+
io: WorkspaceIO,
|
|
122
|
+
nowIso: string,
|
|
123
|
+
journalEvent: "integrate" | "backmerge" = "integrate",
|
|
124
|
+
journalBase?: string,
|
|
125
|
+
): Promise<{ cleanedUp: boolean; diagnostics: Diagnostic[]; gate: FlowScriptResult | null }> {
|
|
126
|
+
const branchExistsNow = await branchExists(primary, io, entry.name);
|
|
127
|
+
let teardownRan: FlowScriptResult | null = null;
|
|
128
|
+
if (worktree !== null && (await io.exists(worktree))) {
|
|
129
|
+
// RFC-1509 Q-16: preserve BEFORE the teardown hook — a `git clean -fdx`
|
|
130
|
+
// teardown would destroy .forge/task/ with the rest of the worktree.
|
|
131
|
+
if (entry.owner.kind === "task") {
|
|
132
|
+
try {
|
|
133
|
+
await preserveTaskFiles(common, worktree, entry.owner.id, io);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
return {
|
|
136
|
+
cleanedUp: false,
|
|
137
|
+
gate: null,
|
|
138
|
+
diagnostics: [
|
|
139
|
+
{
|
|
140
|
+
ruleId: "FLOW-INT-04",
|
|
141
|
+
severity: "error",
|
|
142
|
+
message: `could not preserve .forge/task/ for ${entry.owner.id}: ${error instanceof Error ? error.message : String(error)}`,
|
|
143
|
+
fixHint: `copy ${worktree}/.forge/task/ aside by hand, then re-run flow.integrate — develop already moved`,
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const teardown = await runFlowScript(io, "worktree-teardown", {
|
|
150
|
+
primary,
|
|
151
|
+
cwd: worktree,
|
|
152
|
+
env: { FLOW_PRIMARY: primary, FLOW_BRANCH: entry.name, FLOW_ACTION: "integrate" },
|
|
153
|
+
});
|
|
154
|
+
teardownRan = teardown;
|
|
155
|
+
if (teardown.status === "failed") {
|
|
156
|
+
return {
|
|
157
|
+
cleanedUp: false,
|
|
158
|
+
gate: teardown,
|
|
159
|
+
diagnostics: [
|
|
160
|
+
{
|
|
161
|
+
ruleId: "FLOW-INT-04",
|
|
162
|
+
severity: "error",
|
|
163
|
+
message: `hooks/worktree-teardown.sh refused cleanup (exit ${teardown.exitCode}): ${teardown.stderrTail}`,
|
|
164
|
+
fixHint: `resolve what ${primary}/hooks/worktree-teardown.sh demands, then re-run flow.integrate — develop already moved`,
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
const remove = await git(primary, io, ["worktree", "remove", worktree]);
|
|
170
|
+
if (remove.exitCode !== 0) {
|
|
171
|
+
return {
|
|
172
|
+
cleanedUp: false,
|
|
173
|
+
gate: teardown,
|
|
174
|
+
diagnostics: [
|
|
175
|
+
{
|
|
176
|
+
ruleId: "FLOW-INT-04",
|
|
177
|
+
severity: "error",
|
|
178
|
+
message: `git worktree remove ${worktree} failed: ${remove.stderr.trim()}`,
|
|
179
|
+
fixHint: `clear the blocker (dirty files, locks) and re-run flow.integrate to finish cleanup`,
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (branchExistsNow) {
|
|
186
|
+
const del = await git(primary, io, ["branch", "-d", entry.name]);
|
|
187
|
+
if (del.exitCode !== 0) {
|
|
188
|
+
return {
|
|
189
|
+
cleanedUp: false,
|
|
190
|
+
gate: teardownRan,
|
|
191
|
+
diagnostics: [
|
|
192
|
+
{
|
|
193
|
+
ruleId: "FLOW-INT-04",
|
|
194
|
+
severity: "error",
|
|
195
|
+
message: `git branch -d ${entry.name} failed: ${del.stderr.trim()}`,
|
|
196
|
+
fixHint: `verify ${entry.name} is merged into develop, then re-run flow.integrate`,
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
try {
|
|
203
|
+
await updateRegistry(io, common, (r) => ({
|
|
204
|
+
...r,
|
|
205
|
+
branches: r.branches.filter((b) => b.name !== entry.name),
|
|
206
|
+
}));
|
|
207
|
+
await appendJournal(io, common, {
|
|
208
|
+
at: nowIso,
|
|
209
|
+
event: journalEvent,
|
|
210
|
+
branch: entry.name,
|
|
211
|
+
sha,
|
|
212
|
+
detail: journalEvent === "backmerge" ? `back-merged into develop` : `integrated into develop`,
|
|
213
|
+
base: journalBase,
|
|
214
|
+
});
|
|
215
|
+
} catch (error) {
|
|
216
|
+
if (error instanceof LockTimeoutError || error instanceof FlowRegistrySchemaError) {
|
|
217
|
+
return {
|
|
218
|
+
cleanedUp: false,
|
|
219
|
+
gate: teardownRan,
|
|
220
|
+
diagnostics: [
|
|
221
|
+
{
|
|
222
|
+
ruleId: "FLOW-07",
|
|
223
|
+
severity: "error",
|
|
224
|
+
message: error.message,
|
|
225
|
+
fixHint: `repair or remove ${registryPath(common)} — develop already moved; re-run flow.integrate to finish cleanup`,
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
return { cleanedUp: true, gate: teardownRan, diagnostics: [] };
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Core of flow.integrate — callable with an injected clock. Refusal paths
|
|
237
|
+
* return diagnostics; `integrated`/`cleanedUp` report what really happened.
|
|
238
|
+
*/
|
|
239
|
+
export async function integrateFlowBranch(
|
|
240
|
+
repoRoot: string,
|
|
241
|
+
io: WorkspaceIO,
|
|
242
|
+
opts: {
|
|
243
|
+
branch: string | null;
|
|
244
|
+
dryRun: boolean;
|
|
245
|
+
now?: Date;
|
|
246
|
+
onProgress?: (m: string) => void;
|
|
247
|
+
/** Caller already holds the integration lock (flow.cut/fix releases). */
|
|
248
|
+
lockHeld?: boolean;
|
|
249
|
+
/** Gate target — passed to the integration gate as FORGE_FLOW_TARGET. */
|
|
250
|
+
target?: "develop" | "main";
|
|
251
|
+
},
|
|
252
|
+
): Promise<FlowIntegrateData> {
|
|
253
|
+
const now = opts.now ?? new Date();
|
|
254
|
+
|
|
255
|
+
const branch =
|
|
256
|
+
opts.branch ?? (await currentBranch(repoRoot, io));
|
|
257
|
+
if (branch === null) {
|
|
258
|
+
return refuse(
|
|
259
|
+
"FLOW-INT-06",
|
|
260
|
+
"no --branch given and the current worktree is not on a branch",
|
|
261
|
+
"pass --branch auto/<kind>-<YYMMDD>-<NN>-<slug> explicitly",
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
let resolved: Awaited<ReturnType<typeof resolveEntry>>;
|
|
266
|
+
try {
|
|
267
|
+
resolved = await resolveEntry(repoRoot, io, branch);
|
|
268
|
+
} catch (error) {
|
|
269
|
+
if (error instanceof FlowRegistrySchemaError) {
|
|
270
|
+
return refuse("FLOW-07", error.message, `repair or remove ${registryPath(await commonGitDir(io, repoRoot))}`);
|
|
271
|
+
}
|
|
272
|
+
throw error;
|
|
273
|
+
}
|
|
274
|
+
const { common, entry } = resolved;
|
|
275
|
+
if (entry === null) {
|
|
276
|
+
return refuse(
|
|
277
|
+
"FLOW-INT-06",
|
|
278
|
+
`${branch} is not a registered session/task branch`,
|
|
279
|
+
"register it with flow.open, or check flow.status for live entries",
|
|
280
|
+
{ branch },
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
if (entry.kind === "fix") {
|
|
284
|
+
return refuse(
|
|
285
|
+
"FLOW-INT-06",
|
|
286
|
+
`${branch} is a fix branch — fix branches integrate into main only through a fix release`,
|
|
287
|
+
"run flow.cut inside the fix worktree (or --branch <fix branch>)",
|
|
288
|
+
{ branch },
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
if (entry.held !== null) {
|
|
292
|
+
return refuse(
|
|
293
|
+
"FLOW-INT-11",
|
|
294
|
+
`${branch} is held (${entry.held.riskCategory}): ${entry.held.reason}`,
|
|
295
|
+
"run flow.unhold to return it to the normal integrate path",
|
|
296
|
+
{ branch },
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const primary = await primaryWorktree(io, repoRoot);
|
|
301
|
+
const lockPath = join(common, INTEGRATE_LOCK_RELATIVE_PATH);
|
|
302
|
+
|
|
303
|
+
if (opts.dryRun) {
|
|
304
|
+
const live = await worktreeList(primary, io);
|
|
305
|
+
const wtPath = live.find((w) => w.branch === branch)?.path ?? entry.worktree;
|
|
306
|
+
if (wtPath === null || !(await io.exists(wtPath))) {
|
|
307
|
+
return {
|
|
308
|
+
branch,
|
|
309
|
+
integrated: false,
|
|
310
|
+
developBefore: null,
|
|
311
|
+
developAfter: null,
|
|
312
|
+
rebased: false,
|
|
313
|
+
gate: null,
|
|
314
|
+
cleanedUp: false,
|
|
315
|
+
diagnostics: [
|
|
316
|
+
{
|
|
317
|
+
ruleId: "FLOW-07",
|
|
318
|
+
severity: "error",
|
|
319
|
+
message: `registry entry for ${branch} names worktree ${wtPath}, which does not exist`,
|
|
320
|
+
fixHint: "inspect with flow.status — a stale entry may need flow.discard",
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
const dirty = await statusDirty(wtPath, io);
|
|
326
|
+
return {
|
|
327
|
+
branch,
|
|
328
|
+
integrated: false,
|
|
329
|
+
developBefore: null,
|
|
330
|
+
developAfter: null,
|
|
331
|
+
rebased: false,
|
|
332
|
+
gate: null,
|
|
333
|
+
cleanedUp: false,
|
|
334
|
+
diagnostics:
|
|
335
|
+
dirty.length > 0
|
|
336
|
+
? [
|
|
337
|
+
{
|
|
338
|
+
ruleId: "FLOW-INT-01",
|
|
339
|
+
severity: "error",
|
|
340
|
+
message: `worktree ${wtPath} has ${dirty.length} uncommitted change(s)`,
|
|
341
|
+
fixHint: "commit or revert the uncommitted changes inside the session worktree",
|
|
342
|
+
},
|
|
343
|
+
]
|
|
344
|
+
: [],
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
await io.mkdir(join(common, "forge"));
|
|
349
|
+
|
|
350
|
+
// Steps 0–5 under the integration lock (or inside the caller's lock when
|
|
351
|
+
// lockHeld — flow.cut holds it across the whole release).
|
|
352
|
+
const integrateInner = async (): Promise<FlowIntegrateData> => {
|
|
353
|
+
const developBefore = (await git(primary, io, ["rev-parse", "develop"])).stdout.trim();
|
|
354
|
+
const hasBranch = await branchExists(primary, io, branch);
|
|
355
|
+
|
|
356
|
+
// Rerun/resume: develop already contains the branch tip (or the
|
|
357
|
+
// branch ref is gone) — nothing to move; clean up outside the lock.
|
|
358
|
+
let resume = !hasBranch;
|
|
359
|
+
let branchTip: string | null = null;
|
|
360
|
+
if (hasBranch) {
|
|
361
|
+
branchTip = (await git(primary, io, ["rev-parse", branch])).stdout.trim();
|
|
362
|
+
resume = await isAncestor(primary, io, branchTip, "develop");
|
|
363
|
+
}
|
|
364
|
+
if (resume) {
|
|
365
|
+
return {
|
|
366
|
+
branch,
|
|
367
|
+
integrated: true,
|
|
368
|
+
developBefore,
|
|
369
|
+
developAfter: developBefore,
|
|
370
|
+
rebased: false,
|
|
371
|
+
gate: null,
|
|
372
|
+
cleanedUp: false,
|
|
373
|
+
diagnostics: [],
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// (2) the branch worktree must exist and be clean.
|
|
378
|
+
const worktrees = await worktreeList(primary, io);
|
|
379
|
+
const branchWorktree =
|
|
380
|
+
worktrees.find((w) => w.branch === branch)?.path ?? entry.worktree;
|
|
381
|
+
if (branchWorktree === null || !(await io.exists(branchWorktree))) {
|
|
382
|
+
return refuse(
|
|
383
|
+
"FLOW-07",
|
|
384
|
+
`registry entry for ${branch} names worktree ${branchWorktree}, which does not exist`,
|
|
385
|
+
"inspect with flow.status — a stale entry may need flow.discard",
|
|
386
|
+
{ branch, developBefore },
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
const dirty = await statusDirty(branchWorktree, io);
|
|
390
|
+
if (dirty.length > 0) {
|
|
391
|
+
return refuse(
|
|
392
|
+
"FLOW-INT-01",
|
|
393
|
+
`worktree ${branchWorktree} has ${dirty.length} uncommitted change(s): ${dirty.slice(0, 10).join(", ")}`,
|
|
394
|
+
"commit or revert the uncommitted changes inside the session worktree, then re-run",
|
|
395
|
+
{ branch, developBefore },
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Port entries (RFC-1490): develop must not have moved since the port
|
|
400
|
+
// opened, and the tip must be the fixed-message merge whose second
|
|
401
|
+
// parent is port.mainSha. No rebase — that would linearize the merge.
|
|
402
|
+
if (entry.port !== null) {
|
|
403
|
+
if (developBefore !== entry.baseSha) {
|
|
404
|
+
return refuse(
|
|
405
|
+
"FLOW-INT-10",
|
|
406
|
+
`develop moved to ${developBefore.slice(0, 9)} since the port branch opened (base ${entry.baseSha.slice(0, 9)})`,
|
|
407
|
+
"run flow.backmerge --redo to reopen the port on the new develop tip",
|
|
408
|
+
{ branch, developBefore },
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
const expectedSubject = `release ${entry.port.tags.join(", ")} → develop`;
|
|
412
|
+
const parents = await git(branchWorktree, io, ["rev-list", "--parents", "-1", "HEAD"]);
|
|
413
|
+
const parts = parents.stdout.trim().split(/\s+/);
|
|
414
|
+
const subject = (await git(branchWorktree, io, ["log", "-1", "--format=%s"])).stdout.trim();
|
|
415
|
+
if (parts.length !== 3 || parts[2] !== entry.port.mainSha || subject !== expectedSubject) {
|
|
416
|
+
return refuse(
|
|
417
|
+
"FLOW-INT-09",
|
|
418
|
+
`port tip is not the back-merge commit — expected merge '${expectedSubject}' with second parent ${entry.port.mainSha.slice(0, 9)}`,
|
|
419
|
+
"commit the resolved merge inside the port worktree with git commit --no-edit, or run flow.backmerge --redo",
|
|
420
|
+
{ branch, developBefore },
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// (3) rebase onto the current develop — never for port entries.
|
|
426
|
+
const rebaseBase = (await git(primary, io, ["rev-parse", "develop"])).stdout.trim();
|
|
427
|
+
const rebase =
|
|
428
|
+
entry.port !== null
|
|
429
|
+
? { exitCode: 0, stdout: "", stderr: "" }
|
|
430
|
+
: await git(branchWorktree, io, ["rebase", "develop"]);
|
|
431
|
+
if (rebase.exitCode !== 0) {
|
|
432
|
+
const conflicts = await git(branchWorktree, io, [
|
|
433
|
+
"diff",
|
|
434
|
+
"--name-only",
|
|
435
|
+
"--diff-filter=U",
|
|
436
|
+
]);
|
|
437
|
+
const paths = conflicts.stdout
|
|
438
|
+
.split("\n")
|
|
439
|
+
.map((l) => l.trim())
|
|
440
|
+
.filter((l) => l.length > 0);
|
|
441
|
+
await git(branchWorktree, io, ["rebase", "--abort"]);
|
|
442
|
+
return refuse(
|
|
443
|
+
"FLOW-INT-02",
|
|
444
|
+
`rebase onto develop conflicts in: ${paths.join(", ") || "(unknown paths)"}`,
|
|
445
|
+
"resolve the rebase inside the session worktree, commit, and re-run flow.integrate",
|
|
446
|
+
{ branch, developBefore },
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// (4) integration gate — the primary's copy gates the branch.
|
|
451
|
+
const gate = await runFlowScript(io, "integration-gate", {
|
|
452
|
+
primary,
|
|
453
|
+
cwd: branchWorktree,
|
|
454
|
+
env: {
|
|
455
|
+
FLOW_PRIMARY: primary,
|
|
456
|
+
FLOW_BRANCH: branch,
|
|
457
|
+
FLOW_BASE_SHA: rebaseBase,
|
|
458
|
+
FORGE_FLOW_TARGET: opts.target ?? "develop",
|
|
459
|
+
},
|
|
460
|
+
});
|
|
461
|
+
if (gate.status === "failed") {
|
|
462
|
+
return refuse(
|
|
463
|
+
"FLOW-INT-05",
|
|
464
|
+
`hooks/integration-gate.sh refused the integration (exit ${gate.exitCode}): ${gate.stderrTail}`,
|
|
465
|
+
`fix what ${primary}/hooks/integration-gate.sh demands, then re-run`,
|
|
466
|
+
{ branch, developBefore, rebased: entry.port === null, gate },
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// (5) primary must sit clean on develop, then fast-forward.
|
|
471
|
+
const primaryBranch = await currentBranch(primary, io);
|
|
472
|
+
const primaryDirty = await statusTracked(primary, io);
|
|
473
|
+
if (primaryBranch !== "develop" || primaryDirty.length > 0) {
|
|
474
|
+
return refuse(
|
|
475
|
+
"FLOW-INT-03",
|
|
476
|
+
primaryBranch !== "develop"
|
|
477
|
+
? `primary worktree is on ${primaryBranch ?? "detached HEAD"}, not develop`
|
|
478
|
+
: `primary worktree has ${primaryDirty.length} uncommitted change(s)`,
|
|
479
|
+
"switch the primary to develop and commit or revert its tracked changes, then re-run — the branch stays rebased",
|
|
480
|
+
{ branch, developBefore, rebased: entry.port === null, gate },
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
const developNow = (await git(primary, io, ["rev-parse", "develop"])).stdout.trim();
|
|
484
|
+
if (!(await isAncestor(primary, io, developNow, branch))) {
|
|
485
|
+
return refuse(
|
|
486
|
+
"FLOW-INT-07",
|
|
487
|
+
`develop moved to ${developNow.slice(0, 9)} after the rebase despite the integration lock`,
|
|
488
|
+
"re-run flow.integrate — it rebases onto the new develop tip",
|
|
489
|
+
{ branch, developBefore, rebased: entry.port === null, gate },
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
const merge = await git(primary, io, ["merge", "--ff-only", branch]);
|
|
493
|
+
if (merge.exitCode !== 0) {
|
|
494
|
+
return refuse(
|
|
495
|
+
"FLOW-INT-07",
|
|
496
|
+
`git merge --ff-only ${branch} failed: ${merge.stderr.trim()}`,
|
|
497
|
+
"develop diverged from the rebased base — re-run flow.integrate to rebase again",
|
|
498
|
+
{ branch, developBefore, rebased: entry.port === null, gate },
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
const developAfter = (await git(primary, io, ["rev-parse", "develop"])).stdout.trim();
|
|
502
|
+
return {
|
|
503
|
+
branch,
|
|
504
|
+
integrated: true,
|
|
505
|
+
developBefore,
|
|
506
|
+
developAfter,
|
|
507
|
+
rebased: entry.port === null,
|
|
508
|
+
gate,
|
|
509
|
+
cleanedUp: false,
|
|
510
|
+
diagnostics: [],
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
let inner: FlowIntegrateData;
|
|
515
|
+
try {
|
|
516
|
+
inner = opts.lockHeld === true
|
|
517
|
+
? await integrateInner()
|
|
518
|
+
: await withFlowLock(
|
|
519
|
+
lockPath,
|
|
520
|
+
{
|
|
521
|
+
waitMs: INTEGRATE_LOCK_WAIT_MS,
|
|
522
|
+
staleMs: INTEGRATE_LOCK_STALE_MS,
|
|
523
|
+
progressEveryMs: 60_000,
|
|
524
|
+
onProgress: opts.onProgress,
|
|
525
|
+
onStale: (l) =>
|
|
526
|
+
opts.onProgress?.(
|
|
527
|
+
l.reason === "dead-holder"
|
|
528
|
+
? `broke dead-holder integration lock (pid ${l.pid ?? "?"} on ${l.host ?? "?"}, held since ${l.at})`
|
|
529
|
+
: `broke stale integration lock (held since ${l.at}, ${Math.round(l.ageMs / 60000)} min old)`,
|
|
530
|
+
),
|
|
531
|
+
},
|
|
532
|
+
integrateInner,
|
|
533
|
+
io,
|
|
534
|
+
);
|
|
535
|
+
} catch (error) {
|
|
536
|
+
if (error instanceof LockTimeoutError) {
|
|
537
|
+
return refuse(
|
|
538
|
+
"FLOW-INT-08",
|
|
539
|
+
`integration lock ${error.lockPath} is held by another integration`,
|
|
540
|
+
"wait for the running integration to finish, or break the stale lock after 2 h automatically",
|
|
541
|
+
{ branch },
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
if (error instanceof FlowRegistrySchemaError) {
|
|
545
|
+
return refuse("FLOW-07", error.message, `repair or remove ${registryPath(common)}`, { branch });
|
|
546
|
+
}
|
|
547
|
+
throw error;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
if (!inner.integrated || inner.diagnostics.length > 0) return inner;
|
|
551
|
+
|
|
552
|
+
// (6) cleanup — outside the lock; every git call runs with -C primary.
|
|
553
|
+
const worktrees = await worktreeList(primary, io);
|
|
554
|
+
const branchWorktree = worktrees.find((w) => w.branch === branch)?.path ?? entry.worktree;
|
|
555
|
+
const cleanup = await cleanupIntegrated(
|
|
556
|
+
primary,
|
|
557
|
+
branchWorktree,
|
|
558
|
+
entry,
|
|
559
|
+
common,
|
|
560
|
+
inner.developAfter ?? inner.developBefore ?? "",
|
|
561
|
+
io,
|
|
562
|
+
now.toISOString(),
|
|
563
|
+
entry.port !== null ? "backmerge" : "integrate",
|
|
564
|
+
inner.developBefore ?? undefined,
|
|
565
|
+
);
|
|
566
|
+
return {
|
|
567
|
+
...inner,
|
|
568
|
+
gate: inner.gate,
|
|
569
|
+
teardown: cleanup.gate,
|
|
570
|
+
cleanedUp: cleanup.cleanedUp,
|
|
571
|
+
diagnostics: cleanup.diagnostics,
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
export async function runFlowIntegrate(
|
|
576
|
+
input: ForgeCommandInput,
|
|
577
|
+
context: ForgeRuntimeContext,
|
|
578
|
+
): Promise<ForgeCommandResult<FlowIntegrateData>> {
|
|
579
|
+
const { workspaceRoot, logger, outputFormat } = context;
|
|
580
|
+
const io = resolveIo(context.io);
|
|
581
|
+
await requireGit(io);
|
|
582
|
+
|
|
583
|
+
const repoRoot = await topLevel(workspaceRoot, io);
|
|
584
|
+
if (repoRoot === null) {
|
|
585
|
+
throw new Error("flow.integrate must run inside a git repository");
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
const branchFlag = input.flags["branch"];
|
|
589
|
+
const data = await integrateFlowBranch(repoRoot, io, {
|
|
590
|
+
branch: typeof branchFlag === "string" ? branchFlag : null,
|
|
591
|
+
dryRun: context.dryRun || input.flags["dry-run"] === true,
|
|
592
|
+
onProgress: (m) => logger.info(` ${m}`),
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
const refused = data.diagnostics.find((d) => d.severity === "error");
|
|
596
|
+
if (outputFormat === "pretty") {
|
|
597
|
+
if (refused) {
|
|
598
|
+
logger.error(`flow.integrate refused: ${refused.message}`);
|
|
599
|
+
} else {
|
|
600
|
+
logger.section("flow.integrate");
|
|
601
|
+
logger.info(` branch: ${data.branch}`);
|
|
602
|
+
logger.info(` integrated: ${data.integrated}${data.rebased ? " (rebased)" : ""}`);
|
|
603
|
+
logger.info(` develop: ${data.developBefore?.slice(0, 9)} → ${data.developAfter?.slice(0, 9)}`);
|
|
604
|
+
logger.info(` cleanedUp: ${data.cleanedUp}`);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
return {
|
|
609
|
+
data,
|
|
610
|
+
exitCode: refused ? 1 : 0,
|
|
611
|
+
summary: refused
|
|
612
|
+
? `[flow.integrate] refused: ${refused.ruleId} ${refused.message}`
|
|
613
|
+
: `[flow.integrate] ${data.branch} integrated (${data.developBefore?.slice(0, 9)} → ${data.developAfter?.slice(0, 9)}), cleanup ${data.cleanedUp ? "done" : "pending"}`,
|
|
614
|
+
nextSteps: refused
|
|
615
|
+
? []
|
|
616
|
+
: [
|
|
617
|
+
{
|
|
618
|
+
action: "the session worktree is removed — continue in the primary checkout on develop",
|
|
619
|
+
kind: "required",
|
|
620
|
+
},
|
|
621
|
+
],
|
|
622
|
+
};
|
|
623
|
+
}
|