@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,138 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>flow.check release-line diagnostics (RFC-1488: AC-7 plus FLOW-09):
|
|
4
|
+
a version file diverging from its line's last tag — or a never-baselined
|
|
5
|
+
line — reports FLOW-08 naming both values and pointing at flow.install when
|
|
6
|
+
the file is higher; an extract.config.yaml declaring versionBump reports
|
|
7
|
+
the FLOW-09 warning.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No FLOW-01..05 coverage — flow-check.test.ts owns the branch-model rules.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1488: step 6 — FLOW-08/FLOW-09 tests</item>
|
|
14
|
+
<item>RFC-1488: steps 5-6 — flow.install baseline tags step, flow.check FLOW-08/FLOW-09</item>
|
|
15
|
+
<item>RFC-1488: review r1 — parse guard, door/rules metadata, id-exact RFC binding, refname precision, FLOW-09 top-level anchor, test cleanup</item>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
|
|
22
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
23
|
+
|
|
24
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
25
|
+
import { collectFlowCheck } from "../handlers/flow-check.ts";
|
|
26
|
+
import { gitExec, initRepo } from "./helpers.ts";
|
|
27
|
+
|
|
28
|
+
const dirs: string[] = [];
|
|
29
|
+
|
|
30
|
+
afterEach(async () => {
|
|
31
|
+
for (const dir of dirs.splice(0)) {
|
|
32
|
+
await rm(dir, { recursive: true, force: true });
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
async function governedRepo(): Promise<string> {
|
|
37
|
+
const repo = await initRepo({ prefix: "flow-chk-ver-" });
|
|
38
|
+
dirs.push(repo);
|
|
39
|
+
await writeFile(join(repo, "forge.yaml"), "name: test\n");
|
|
40
|
+
await writeFile(join(repo, "package.json"), '{ "version": "1.0.0" }\n');
|
|
41
|
+
await gitExec(repo, ["add", "."]);
|
|
42
|
+
await gitExec(repo, ["commit", "-m", "seed governed repo"]);
|
|
43
|
+
return repo;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const flow08 = (d: { ruleId: string }) => d.ruleId === "FLOW-08";
|
|
47
|
+
const flow09 = (d: { ruleId: string }) => d.ruleId === "FLOW-09";
|
|
48
|
+
|
|
49
|
+
describe("collectFlowCheck — release lines", () => {
|
|
50
|
+
it("AC-7: version file higher than the last tag reports FLOW-08 naming both", async () => {
|
|
51
|
+
const repo = await governedRepo();
|
|
52
|
+
await gitExec(repo, ["tag", "-a", "v1.0.0", "-m", "release v1.0.0"]);
|
|
53
|
+
await writeFile(join(repo, "package.json"), '{ "version": "1.1.0" }\n');
|
|
54
|
+
await gitExec(repo, ["add", "package.json"]);
|
|
55
|
+
await gitExec(repo, ["commit", "-m", "version 1.1.0"]);
|
|
56
|
+
|
|
57
|
+
const { diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
58
|
+
const hits = diagnostics.filter(flow08);
|
|
59
|
+
expect(hits).toHaveLength(1);
|
|
60
|
+
expect(hits[0]?.severity).toBe("error");
|
|
61
|
+
expect(hits[0]?.message).toContain("1.1.0");
|
|
62
|
+
expect(hits[0]?.message).toContain("v1.0.0");
|
|
63
|
+
expect(hits[0]?.fixHint).toContain("flow.install");
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("version file lower than the last tag reports FLOW-08 without the install hint", async () => {
|
|
67
|
+
const repo = await governedRepo();
|
|
68
|
+
await gitExec(repo, ["tag", "-a", "v2.0.0", "-m", "release v2.0.0"]);
|
|
69
|
+
|
|
70
|
+
const { diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
71
|
+
const hits = diagnostics.filter(flow08);
|
|
72
|
+
expect(hits).toHaveLength(1);
|
|
73
|
+
expect(hits[0]?.message).toContain("1.0.0");
|
|
74
|
+
expect(hits[0]?.message).toContain("v2.0.0");
|
|
75
|
+
expect(hits[0]?.fixHint ?? "").not.toContain("flow.install");
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("a never-baselined line with a version file reports FLOW-08", async () => {
|
|
79
|
+
const repo = await governedRepo();
|
|
80
|
+
const { diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
81
|
+
const hits = diagnostics.filter(flow08);
|
|
82
|
+
expect(hits).toHaveLength(1);
|
|
83
|
+
expect(hits[0]?.message).toContain("1.0.0");
|
|
84
|
+
expect(hits[0]?.message).toContain("never baselined");
|
|
85
|
+
expect(hits[0]?.fixHint).toContain("flow.install");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("matching tag and version file report no FLOW-08", async () => {
|
|
89
|
+
const repo = await governedRepo();
|
|
90
|
+
await gitExec(repo, ["tag", "-a", "v1.0.0", "-m", "release v1.0.0"]);
|
|
91
|
+
|
|
92
|
+
const { diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
93
|
+
expect(diagnostics.filter(flow08)).toEqual([]);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("a version file without a version field does not fire FLOW-08", async () => {
|
|
97
|
+
const repo = await governedRepo();
|
|
98
|
+
await writeFile(join(repo, "package.json"), '{ "name": "noversion" }\n');
|
|
99
|
+
await gitExec(repo, ["add", "package.json"]);
|
|
100
|
+
await gitExec(repo, ["commit", "-m", "drop version"]);
|
|
101
|
+
|
|
102
|
+
const { diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
103
|
+
expect(diagnostics.filter(flow08)).toEqual([]);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("FLOW-09 warns when an extract.config.yaml declares versionBump", async () => {
|
|
107
|
+
const repo = await governedRepo();
|
|
108
|
+
await mkdir(join(repo, "packages/pbp"), { recursive: true });
|
|
109
|
+
await writeFile(join(repo, "pnpm-workspace.yaml"), "packages:\n - 'packages/*'\n");
|
|
110
|
+
await writeFile(join(repo, "packages/pbp/package.json"), '{ "version": "2.1.0" }\n');
|
|
111
|
+
await writeFile(
|
|
112
|
+
join(repo, "packages/pbp/extract.config.yaml"),
|
|
113
|
+
"forgePlugin: false\nversionBump: minor\n",
|
|
114
|
+
);
|
|
115
|
+
await gitExec(repo, ["add", "."]);
|
|
116
|
+
await gitExec(repo, ["commit", "-m", "pbp package"]);
|
|
117
|
+
|
|
118
|
+
const { diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
119
|
+
const hits = diagnostics.filter(flow09);
|
|
120
|
+
expect(hits).toHaveLength(1);
|
|
121
|
+
expect(hits[0]?.severity).toBe("warning");
|
|
122
|
+
expect(hits[0]?.message).toContain("pbp");
|
|
123
|
+
expect(hits[0]?.message).toContain("versionBump");
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("a package line without versionBump reports no FLOW-09", async () => {
|
|
127
|
+
const repo = await governedRepo();
|
|
128
|
+
await mkdir(join(repo, "packages/pbp"), { recursive: true });
|
|
129
|
+
await writeFile(join(repo, "pnpm-workspace.yaml"), "packages:\n - 'packages/*'\n");
|
|
130
|
+
await writeFile(join(repo, "packages/pbp/package.json"), '{ "version": "2.1.0" }\n');
|
|
131
|
+
await writeFile(join(repo, "packages/pbp/extract.config.yaml"), "forgePlugin: false\n");
|
|
132
|
+
await gitExec(repo, ["add", "."]);
|
|
133
|
+
await gitExec(repo, ["commit", "-m", "pbp package"]);
|
|
134
|
+
|
|
135
|
+
const { diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
136
|
+
expect(diagnostics.filter(flow09)).toEqual([]);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>AC-9: collectFlowCheck reports FLOW-01 (stray branch), FLOW-02
|
|
4
|
+
(missing develop), FLOW-03 (guard not installed), FLOW-04 (owed back-merge)
|
|
5
|
+
and FLOW-05 (invalid marker) in governed repositories, and returns an exempt
|
|
6
|
+
verdict with no diagnostics for a valid forge.generated.yaml — all in
|
|
7
|
+
throwaway repos.</purpose>
|
|
8
|
+
</MODULE_CONTRACT>
|
|
9
|
+
<CHANGE_SUMMARY>
|
|
10
|
+
<item>RFC-1486: step 3 — flow.check handler tests</item>
|
|
11
|
+
<item>RFC-1486: step 3 — flow.check with FLOW-01..05 + managed-block helpers</item>
|
|
12
|
+
<item>RFC-1498: step 1 — FLOW-07 for stray auto branches
|
|
13
|
+
|
|
14
|
+
collectFlowStatus exposes unregisteredBranchesWithoutWorktree — local auto/* branch names with no registry entry and no worktree checkout anywhere (primary or linked), the shape a failed branch -D leaves behind. flow.check emits one FLOW-07 warning per stray regardless of age: the 72 h rule in FLOW-06 only covered staleness, so a fresh leftover went unreported. The fix hint names flow.status for inspection and flow.discard for teardown, and flags that a branch with unique commits needs a human decision. Tests AC-1 (fresh stray branch reports FLOW-07, not FLOW-06) and AC-2 (a registered session with a live worktree reports none).</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { writeFile } from "node:fs/promises";
|
|
19
|
+
import { rm } from "node:fs/promises";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
|
|
22
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
23
|
+
|
|
24
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
25
|
+
import { formatFlowBranch } from "../branch-name.ts";
|
|
26
|
+
import { collectFlowCheck } from "../handlers/flow-check.ts";
|
|
27
|
+
import { openFlowBranch } from "../handlers/flow-open.ts";
|
|
28
|
+
import {
|
|
29
|
+
gitExec,
|
|
30
|
+
initRepo,
|
|
31
|
+
installGuard,
|
|
32
|
+
MANAGED_BLOCK,
|
|
33
|
+
} from "./helpers.ts";
|
|
34
|
+
|
|
35
|
+
const dirs: string[] = [];
|
|
36
|
+
|
|
37
|
+
afterEach(async () => {
|
|
38
|
+
for (const dir of dirs.splice(0)) {
|
|
39
|
+
await rm(dir, { recursive: true, force: true });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
async function governedRepo(): Promise<string> {
|
|
44
|
+
const dir = await initRepo({ prefix: "flow-check-" });
|
|
45
|
+
dirs.push(dir);
|
|
46
|
+
await writeFile(join(dir, "forge.yaml"), 'schema: "forge/workspace@1"\n');
|
|
47
|
+
return dir;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const VALID_MARKER =
|
|
51
|
+
'schema: "forge/generated@1"\ngenerator: "extract"\nsource: "werkstatt"\n';
|
|
52
|
+
|
|
53
|
+
describe("collectFlowCheck", () => {
|
|
54
|
+
it("reports FLOW-01 naming a stray local branch (AC-9)", async () => {
|
|
55
|
+
const repo = await governedRepo();
|
|
56
|
+
await gitExec(repo, ["branch", "develop"]);
|
|
57
|
+
await gitExec(repo, ["branch", "introduce-axiom-system"]);
|
|
58
|
+
const { diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
59
|
+
const flow01 = diagnostics.filter((d) => d.ruleId === "FLOW-01");
|
|
60
|
+
expect(flow01.length).toBe(1);
|
|
61
|
+
expect(flow01[0]!.severity).toBe("error");
|
|
62
|
+
expect(flow01[0]!.message).toContain("introduce-axiom-system");
|
|
63
|
+
expect(flow01[0]!.fixHint).toContain("git branch -d introduce-axiom-system");
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("reports FLOW-02 when develop does not exist", async () => {
|
|
67
|
+
const repo = await governedRepo();
|
|
68
|
+
const { data, diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
69
|
+
expect(diagnostics.some((d) => d.ruleId === "FLOW-02")).toBe(true);
|
|
70
|
+
expect(data.branches.protected).toEqual(["main"]);
|
|
71
|
+
expect(data.mainAheadOfDevelop).toBeNull();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("reports FLOW-03 when the guard is not installed", async () => {
|
|
75
|
+
const repo = await governedRepo();
|
|
76
|
+
await gitExec(repo, ["branch", "develop"]);
|
|
77
|
+
const { data, diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
78
|
+
const flow03 = diagnostics.filter((d) => d.ruleId === "FLOW-03");
|
|
79
|
+
expect(flow03.length).toBeGreaterThanOrEqual(2);
|
|
80
|
+
expect(flow03.some((d) => d.message.includes("core.hooksPath"))).toBe(true);
|
|
81
|
+
expect(flow03.some((d) => d.message.includes("pre-commit"))).toBe(true);
|
|
82
|
+
expect(flow03.some((d) => d.message.includes("flow-guard.sh"))).toBe(true);
|
|
83
|
+
expect(data.guardInstalled).toBe(false);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("reports FLOW-04 as a warning when main is ahead of develop", async () => {
|
|
87
|
+
const repo = await governedRepo();
|
|
88
|
+
await gitExec(repo, ["branch", "develop"]);
|
|
89
|
+
await writeFile(join(repo, "ahead.txt"), "ahead\n");
|
|
90
|
+
await gitExec(repo, ["add", "ahead.txt"]);
|
|
91
|
+
await gitExec(repo, ["commit", "-m", "on main"]);
|
|
92
|
+
const { data, diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
93
|
+
const flow04 = diagnostics.filter((d) => d.ruleId === "FLOW-04");
|
|
94
|
+
expect(flow04.length).toBe(1);
|
|
95
|
+
expect(flow04[0]!.severity).toBe("warning");
|
|
96
|
+
expect(flow04[0]!.message).toContain("1 commit");
|
|
97
|
+
expect(data.mainAheadOfDevelop).toBe(1);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("reports FLOW-05 for a marker missing source (no exemption)", async () => {
|
|
101
|
+
const repo = await governedRepo();
|
|
102
|
+
await writeFile(
|
|
103
|
+
join(repo, "forge.generated.yaml"),
|
|
104
|
+
'schema: "forge/generated@1"\ngenerator: "extract"\n',
|
|
105
|
+
);
|
|
106
|
+
const { data, diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
107
|
+
const flow05 = diagnostics.filter((d) => d.ruleId === "FLOW-05");
|
|
108
|
+
expect(flow05.length).toBe(1);
|
|
109
|
+
expect(flow05[0]!.severity).toBe("error");
|
|
110
|
+
expect(flow05[0]!.message).toContain("source");
|
|
111
|
+
expect(data.repoKind).toBe("governed");
|
|
112
|
+
expect(data.exempt).toBe(false);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("returns an exempt verdict with the parsed marker and no diagnostics", async () => {
|
|
116
|
+
const repo = await initRepo({ prefix: "flow-check-exempt-" });
|
|
117
|
+
dirs.push(repo);
|
|
118
|
+
await writeFile(join(repo, "forge.generated.yaml"), VALID_MARKER);
|
|
119
|
+
const { data, diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
120
|
+
expect(data.repoKind).toBe("exempt");
|
|
121
|
+
expect(data.exempt).toBe(true);
|
|
122
|
+
expect(data.marker).toEqual({
|
|
123
|
+
schema: "forge/generated@1",
|
|
124
|
+
generator: "extract",
|
|
125
|
+
source: "werkstatt",
|
|
126
|
+
});
|
|
127
|
+
expect(diagnostics).toEqual([]);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("reports an ungoverned repo without diagnostics", async () => {
|
|
131
|
+
const repo = await initRepo({ prefix: "flow-check-ungoverned-" });
|
|
132
|
+
dirs.push(repo);
|
|
133
|
+
const { data, diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
134
|
+
expect(data.repoKind).toBe("ungoverned");
|
|
135
|
+
expect(diagnostics).toEqual([]);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("passes clean on a fully adopted repository", async () => {
|
|
139
|
+
const repo = await governedRepo();
|
|
140
|
+
await gitExec(repo, ["branch", "develop"]);
|
|
141
|
+
await gitExec(repo, ["switch", "develop"]);
|
|
142
|
+
await installGuard(repo);
|
|
143
|
+
// Land the hook files via the adoption path (FORGE_FLOW_OP=install).
|
|
144
|
+
await gitExec(repo, ["add", "hooks/flow-guard.sh", "hooks/pre-commit"]);
|
|
145
|
+
const adopt = await gitExec(
|
|
146
|
+
repo,
|
|
147
|
+
["commit", "-m", "chore(flow): install the fixed branch model guard"],
|
|
148
|
+
{ FORGE_FLOW_OP: "install" },
|
|
149
|
+
);
|
|
150
|
+
expect(adopt.exitCode).toBe(0);
|
|
151
|
+
const { data, diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
152
|
+
expect(data.guardInstalled).toBe(true);
|
|
153
|
+
expect(diagnostics).toEqual([]);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it("RFC-1498 AC-1: a stray auto branch reports FLOW-07 while younger than 72 h", async () => {
|
|
157
|
+
const repo = await governedRepo();
|
|
158
|
+
await gitExec(repo, ["branch", "develop", "HEAD"]);
|
|
159
|
+
// No registry entry, no worktree — the shape a failed `branch -D` leaves.
|
|
160
|
+
const stray = formatFlowBranch({
|
|
161
|
+
kind: "session",
|
|
162
|
+
date: new Date(),
|
|
163
|
+
seq: 1,
|
|
164
|
+
slug: "leftover",
|
|
165
|
+
});
|
|
166
|
+
await gitExec(repo, ["branch", stray, "develop"]);
|
|
167
|
+
const { diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
168
|
+
const flow07 = diagnostics.filter(
|
|
169
|
+
(d) => d.ruleId === "FLOW-07" && d.message.includes(stray),
|
|
170
|
+
);
|
|
171
|
+
expect(flow07.length).toBe(1);
|
|
172
|
+
expect(flow07[0]!.severity).toBe("warning");
|
|
173
|
+
expect(flow07[0]!.message).toContain("no registry entry and no worktree");
|
|
174
|
+
// And it is NOT FLOW-06 — the branch is fresh.
|
|
175
|
+
expect(diagnostics.some((d) => d.ruleId === "FLOW-06")).toBe(false);
|
|
176
|
+
}, 15_000);
|
|
177
|
+
|
|
178
|
+
it("RFC-1498 AC-2: a registered session with a live worktree reports no FLOW-07", async () => {
|
|
179
|
+
const repo = await governedRepo();
|
|
180
|
+
await gitExec(repo, ["branch", "develop", "HEAD"]);
|
|
181
|
+
await gitExec(repo, ["switch", "develop"]);
|
|
182
|
+
const session = await openFlowBranch(repo, ambientIo, {
|
|
183
|
+
kind: "session",
|
|
184
|
+
slug: "adopted",
|
|
185
|
+
brief: null,
|
|
186
|
+
owner: null,
|
|
187
|
+
dryRun: false,
|
|
188
|
+
now: new Date(),
|
|
189
|
+
});
|
|
190
|
+
dirs.push(session.worktree!);
|
|
191
|
+
const { diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
192
|
+
expect(diagnostics.some((d) => d.ruleId === "FLOW-07")).toBe(false);
|
|
193
|
+
}, 15_000);
|
|
194
|
+
|
|
195
|
+
it("detects a stale managed block inside hooks/pre-commit", async () => {
|
|
196
|
+
const repo = await governedRepo();
|
|
197
|
+
await gitExec(repo, ["branch", "develop"]);
|
|
198
|
+
await installGuard(repo);
|
|
199
|
+
// Corrupt the managed block: remove the invoke line.
|
|
200
|
+
const preCommitPath = join(repo, "hooks", "pre-commit");
|
|
201
|
+
const content = await ambientIo.readFile(preCommitPath);
|
|
202
|
+
const corrupt = content.replace(
|
|
203
|
+
'sh "$(git rev-parse --show-toplevel)/hooks/flow-guard.sh" pre-commit || exit 1\n',
|
|
204
|
+
"",
|
|
205
|
+
);
|
|
206
|
+
expect(corrupt).not.toContain("flow-guard.sh");
|
|
207
|
+
await writeFile(preCommitPath, corrupt);
|
|
208
|
+
const { diagnostics } = await collectFlowCheck(repo, ambientIo);
|
|
209
|
+
expect(diagnostics.some((d) => d.ruleId === "FLOW-03")).toBe(true);
|
|
210
|
+
// Sanity for the shared constant shape.
|
|
211
|
+
expect(MANAGED_BLOCK).toContain(">>> forge flow guard");
|
|
212
|
+
});
|
|
213
|
+
});
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>flow.cut release-prepare hook + pre-tag extract verification tests
|
|
4
|
+
(RFC-1502, AC-1..6, AC-9, AC-10): a hooks/release-prepare.sh that edits a
|
|
5
|
+
tracked file folds into the release commit (ordinary and fix), a failing
|
|
6
|
+
hook refuses FLOW-CUT-12 with the release branch removed, untracked hook
|
|
7
|
+
output stays out of the commit as a FLOW-CUT-14 warning, a named package
|
|
8
|
+
line extracts at the release commit into a scratch (never the configured
|
|
9
|
+
destination) and a failing extract-verify refuses FLOW-CUT-13 leaving
|
|
10
|
+
develop and the tags untouched, --dry-run lists the steps, and a refused
|
|
11
|
+
fix cut rolls the fix branch back to its pre-release tip so the cut is
|
|
12
|
+
rerun-safe.</purpose>
|
|
13
|
+
<non-goals>
|
|
14
|
+
<item>Never touches the enclosing repository — all fixtures are mkdtemp
|
|
15
|
+
repos with their own hooks/ and a fake node_modules/.bin/repo-extract
|
|
16
|
+
honoring --dest.</item>
|
|
17
|
+
</non-goals>
|
|
18
|
+
</MODULE_CONTRACT>
|
|
19
|
+
<KEY_DECISIONS>
|
|
20
|
+
<item>Hooks are written untracked into the primary's hooks/ — runFlowScript reads the primary's copy, so no adoption commit is needed for them.</item>
|
|
21
|
+
<item>Extract failure is injected via a .fail-extract marker the fake checks in $PWD (cwd = primary); verify failure via hooks/extract-verify.sh exiting non-zero.</item>
|
|
22
|
+
</KEY_DECISIONS>
|
|
23
|
+
<CHANGE_SUMMARY>
|
|
24
|
+
<item>RFC-1502: step 1 — release-prepare + pre-tag verify tests</item>
|
|
25
|
+
<item>RFC-1502: steps 1-5 — release-prepare hook, pre-tag extract verification, ordered steps</item>
|
|
26
|
+
<item>RFC-1502: review r1 — fix-cut rollback on FLOW-CUT-12/13, populated steps[], hook validation, GIT_* env scrub</item>
|
|
27
|
+
</CHANGE_SUMMARY>
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
31
|
+
import { tmpdir } from "node:os";
|
|
32
|
+
import { join } from "node:path";
|
|
33
|
+
import { existsSync } from "node:fs";
|
|
34
|
+
|
|
35
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
36
|
+
|
|
37
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
38
|
+
import { gitExec, initRepo, installFakeRepoExtract, installGuard } from "./helpers.ts";
|
|
39
|
+
import { runOrdinaryCut } from "../handlers/flow-cut.ts";
|
|
40
|
+
import { fixFlow, runFixCut } from "../handlers/flow-fix.ts";
|
|
41
|
+
import { commonGitDir, readRegistry } from "../registry.ts";
|
|
42
|
+
|
|
43
|
+
const dirs: string[] = [];
|
|
44
|
+
afterEach(async () => {
|
|
45
|
+
for (const dir of dirs.splice(0)) await rm(dir, { recursive: true, force: true });
|
|
46
|
+
}, 30_000);
|
|
47
|
+
|
|
48
|
+
async function commitIn(repo: string, file: string, content: string): Promise<void> {
|
|
49
|
+
await writeFile(join(repo, file), content);
|
|
50
|
+
await gitExec(repo, ["add", file]);
|
|
51
|
+
const r = await gitExec(repo, ["commit", "-m", `add ${file}`]);
|
|
52
|
+
if (r.exitCode !== 0) throw new Error(`commit failed: ${r.stderr}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function sha(repo: string, ref: string): Promise<string> {
|
|
56
|
+
return (await gitExec(repo, ["rev-parse", ref])).stdout.trim();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function writeHook(repo: string, name: string, body: string): Promise<void> {
|
|
60
|
+
const path = join(repo, "hooks", `${name}.sh`);
|
|
61
|
+
await writeFile(path, body);
|
|
62
|
+
await chmod(path, 0o755);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Adopted repository: guard installed, baseline tag v0.1.0, a tracked.txt to
|
|
67
|
+
* modify, pending work on develop. packageLine adds packages/lib
|
|
68
|
+
* (extract.config.yaml + package.json v2.0.0, baseline tag lib@2.0.0).
|
|
69
|
+
*/
|
|
70
|
+
async function adoptedRepo(opts?: { packageLine?: boolean }): Promise<{
|
|
71
|
+
repo: string;
|
|
72
|
+
extractLog: string;
|
|
73
|
+
}> {
|
|
74
|
+
const repo = await initRepo({ prefix: "flow-cut-prepare-" });
|
|
75
|
+
dirs.push(repo);
|
|
76
|
+
const extractLog = join(repo, "extract.log");
|
|
77
|
+
await writeFile(join(repo, "forge.yaml"), 'schema: "forge/workspace@1"\n');
|
|
78
|
+
await writeFile(join(repo, "package.json"), '{\n "name": "fixture",\n "version": "0.1.0"\n}\n');
|
|
79
|
+
await writeFile(join(repo, "tracked.txt"), "base\n");
|
|
80
|
+
if (opts?.packageLine) {
|
|
81
|
+
await writeFile(join(repo, "pnpm-workspace.yaml"), 'packages:\n - "packages/*"\n');
|
|
82
|
+
await mkdir(join(repo, "packages/lib"), { recursive: true });
|
|
83
|
+
await writeFile(
|
|
84
|
+
join(repo, "packages/lib/package.json"),
|
|
85
|
+
'{\n "name": "lib",\n "version": "2.0.0"\n}\n',
|
|
86
|
+
);
|
|
87
|
+
await writeFile(
|
|
88
|
+
join(repo, "packages/lib/extract.config.yaml"),
|
|
89
|
+
"schema: extract\ndestName: ac-dest\n",
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
await gitExec(repo, ["add", "-A"]);
|
|
93
|
+
await gitExec(repo, ["commit", "-m", "config"]);
|
|
94
|
+
await gitExec(repo, ["switch", "-c", "develop"]);
|
|
95
|
+
await commitIn(repo, "work.txt", "work");
|
|
96
|
+
if (opts?.packageLine) {
|
|
97
|
+
// The lib line needs a pending commit touching its paths — the cut
|
|
98
|
+
// refuses FLOW-CUT-04 on a line with nothing to release. Committed
|
|
99
|
+
// before the guard installs so the pre-guard state can carry it.
|
|
100
|
+
await commitIn(repo, "packages/lib/pending.txt", "lib work");
|
|
101
|
+
}
|
|
102
|
+
await installGuard(repo);
|
|
103
|
+
await gitExec(repo, ["add", "hooks"]);
|
|
104
|
+
const adopt = await gitExec(repo, ["commit", "-m", "adopt"], { FORGE_FLOW_OP: "install" });
|
|
105
|
+
if (adopt.exitCode !== 0) throw new Error(`adoption commit failed: ${adopt.stderr}`);
|
|
106
|
+
await gitExec(repo, ["tag", "-a", "v0.1.0", "main", "-m", "release v0.1.0"]);
|
|
107
|
+
if (opts?.packageLine) {
|
|
108
|
+
await gitExec(repo, ["tag", "-a", "lib@2.0.0", "main", "-m", "release lib@2.0.0"]);
|
|
109
|
+
}
|
|
110
|
+
await installFakeRepoExtract(repo, extractLog);
|
|
111
|
+
return { repo, extractLog };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
describe("flow.cut — release-prepare hook and pre-tag verify (RFC-1502)", () => {
|
|
115
|
+
it("AC-1: a tracked change from release-prepare lands in the release commit", async () => {
|
|
116
|
+
const { repo } = await adoptedRepo();
|
|
117
|
+
await writeHook(repo, "release-prepare", "#!/bin/sh\nset -eu\necho prepared >> tracked.txt\n");
|
|
118
|
+
|
|
119
|
+
const data = await runOrdinaryCut(repo, ambientIo, { lines: [], dryRun: false });
|
|
120
|
+
|
|
121
|
+
expect(data.diagnostics.filter((d) => d.severity === "error")).toEqual([]);
|
|
122
|
+
expect(data.released).toBe(true);
|
|
123
|
+
const shown = await gitExec(repo, ["show", "main:tracked.txt"]);
|
|
124
|
+
expect(shown.stdout).toContain("prepared");
|
|
125
|
+
}, 30_000);
|
|
126
|
+
|
|
127
|
+
it("AC-2: a failing release-prepare refuses FLOW-CUT-12 and removes the branch", async () => {
|
|
128
|
+
const { repo } = await adoptedRepo();
|
|
129
|
+
await writeHook(repo, "release-prepare", "#!/bin/sh\necho boom >&2\nexit 2\n");
|
|
130
|
+
const tipBefore = await sha(repo, "develop");
|
|
131
|
+
|
|
132
|
+
const data = await runOrdinaryCut(repo, ambientIo, { lines: [], dryRun: false });
|
|
133
|
+
|
|
134
|
+
expect(data.released).toBe(false);
|
|
135
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-CUT-12");
|
|
136
|
+
expect(data.diagnostics[0]?.message).toContain("boom");
|
|
137
|
+
expect(await sha(repo, "develop")).toBe(tipBefore);
|
|
138
|
+
const branches = (await gitExec(repo, ["branch", "--list", "auto/*"])).stdout.trim();
|
|
139
|
+
expect(branches).toBe("");
|
|
140
|
+
}, 30_000);
|
|
141
|
+
|
|
142
|
+
it("AC-10: an untracked file the hook leaves stays out of the commit (FLOW-CUT-14)", async () => {
|
|
143
|
+
const { repo } = await adoptedRepo();
|
|
144
|
+
await writeHook(
|
|
145
|
+
repo,
|
|
146
|
+
"release-prepare",
|
|
147
|
+
"#!/bin/sh\nset -eu\necho prepared >> tracked.txt\necho stray > stray-new.txt\n",
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
const data = await runOrdinaryCut(repo, ambientIo, { lines: [], dryRun: false });
|
|
151
|
+
|
|
152
|
+
expect(data.released).toBe(true);
|
|
153
|
+
const warn = data.diagnostics.find((d) => d.ruleId === "FLOW-CUT-14");
|
|
154
|
+
expect(warn?.severity).toBe("warning");
|
|
155
|
+
expect(warn?.message).toContain("stray-new.txt");
|
|
156
|
+
const listed = await gitExec(repo, ["ls-tree", "-r", "--name-only", "main"]);
|
|
157
|
+
expect(listed.stdout).not.toContain("stray-new.txt");
|
|
158
|
+
expect(listed.stdout).toContain("tracked.txt");
|
|
159
|
+
}, 30_000);
|
|
160
|
+
|
|
161
|
+
it("AC-3+AC-4: a failing extract-verify refuses FLOW-CUT-13 — no tag, develop untouched", async () => {
|
|
162
|
+
const { repo } = await adoptedRepo({ packageLine: true });
|
|
163
|
+
await writeHook(repo, "extract-verify", "#!/bin/sh\necho verify-boom >&2\nexit 4\n");
|
|
164
|
+
const tipBefore = await sha(repo, "develop");
|
|
165
|
+
|
|
166
|
+
const data = await runOrdinaryCut(repo, ambientIo, { lines: ["lib"], dryRun: false });
|
|
167
|
+
|
|
168
|
+
expect(data.released).toBe(false);
|
|
169
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-CUT-13");
|
|
170
|
+
expect(data.diagnostics[0]?.message).toContain("lib");
|
|
171
|
+
expect(await sha(repo, "develop")).toBe(tipBefore);
|
|
172
|
+
expect((await gitExec(repo, ["rev-parse", "--verify", "-q", "refs/tags/lib@2.0.1"])).exitCode).not.toBe(0);
|
|
173
|
+
expect((await gitExec(repo, ["rev-parse", "--verify", "-q", "refs/tags/v0.1.1"])).exitCode).not.toBe(0);
|
|
174
|
+
const branches = (await gitExec(repo, ["branch", "--list", "auto/*"])).stdout.trim();
|
|
175
|
+
expect(branches).toBe("");
|
|
176
|
+
}, 30_000);
|
|
177
|
+
|
|
178
|
+
it("AC-3b: a failing extract step also refuses FLOW-CUT-13", async () => {
|
|
179
|
+
const { repo } = await adoptedRepo({ packageLine: true });
|
|
180
|
+
await writeFile(join(repo, ".fail-extract"), "1");
|
|
181
|
+
|
|
182
|
+
const data = await runOrdinaryCut(repo, ambientIo, { lines: ["lib"], dryRun: false });
|
|
183
|
+
|
|
184
|
+
expect(data.released).toBe(false);
|
|
185
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-CUT-13");
|
|
186
|
+
}, 30_000);
|
|
187
|
+
|
|
188
|
+
it("AC-5: the configured extract destination gains no commit — scratch only", async () => {
|
|
189
|
+
const { repo, extractLog } = await adoptedRepo({ packageLine: true });
|
|
190
|
+
const data = await runOrdinaryCut(repo, ambientIo, { lines: ["lib"], dryRun: false });
|
|
191
|
+
|
|
192
|
+
expect(data.diagnostics.filter((d) => d.severity === "error")).toEqual([]);
|
|
193
|
+
expect(data.released).toBe(true);
|
|
194
|
+
// The fake extract ran with --dest <scratch>, never the configured dest.
|
|
195
|
+
const argv = await readFile(extractLog, "utf8");
|
|
196
|
+
expect(argv).toContain("--dest");
|
|
197
|
+
expect(argv).not.toContain("ac-dest");
|
|
198
|
+
// The configured destination (anchored at dirname(repo)) does not exist.
|
|
199
|
+
const configuredDest = join(tmpdir(), "packages", "ac-dest");
|
|
200
|
+
expect(existsSync(configuredDest)).toBe(false);
|
|
201
|
+
}, 30_000);
|
|
202
|
+
|
|
203
|
+
it("AC-6: --dry-run lists release-prepare and extract-verify:<line>", async () => {
|
|
204
|
+
const { repo } = await adoptedRepo({ packageLine: true });
|
|
205
|
+
const data = await runOrdinaryCut(repo, ambientIo, { lines: ["lib"], dryRun: true });
|
|
206
|
+
|
|
207
|
+
expect(data.diagnostics.filter((d) => d.severity === "error")).toEqual([]);
|
|
208
|
+
expect(data.steps).toContain("release-prepare");
|
|
209
|
+
expect(data.steps).toContain("extract-verify:lib");
|
|
210
|
+
}, 20_000);
|
|
211
|
+
|
|
212
|
+
it("AC-9: a tracked change from release-prepare lands in a fix release commit", async () => {
|
|
213
|
+
const { repo } = await adoptedRepo();
|
|
214
|
+
// First release so a fix can open on the tagged main.
|
|
215
|
+
const first = await runOrdinaryCut(repo, ambientIo, { lines: [], dryRun: false });
|
|
216
|
+
expect(first.released).toBe(true);
|
|
217
|
+
|
|
218
|
+
const fix = await fixFlow(repo, ambientIo, { slug: "fix-prepare", brief: "t", dryRun: false });
|
|
219
|
+
expect(fix.opened).toBe(true);
|
|
220
|
+
const fixBranch = fix.branch!;
|
|
221
|
+
const wt = fix.worktree!;
|
|
222
|
+
dirs.push(wt);
|
|
223
|
+
await commitIn(wt, "hotfix.txt", "fix");
|
|
224
|
+
|
|
225
|
+
await writeHook(repo, "release-prepare", "#!/bin/sh\nset -eu\necho fix-prepared >> tracked.txt\n");
|
|
226
|
+
|
|
227
|
+
const common = await commonGitDir(ambientIo, repo);
|
|
228
|
+
const entry = (await readRegistry(ambientIo, common)).branches.find((b) => b.name === fixBranch);
|
|
229
|
+
const data = await runFixCut(repo, ambientIo, { entry: entry!, linesGiven: false, dryRun: false });
|
|
230
|
+
|
|
231
|
+
expect(data.diagnostics.filter((d) => d.severity === "error")).toEqual([]);
|
|
232
|
+
expect(data.released).toBe(true);
|
|
233
|
+
const shown = await gitExec(repo, ["show", "main:tracked.txt"]);
|
|
234
|
+
expect(shown.stdout).toContain("fix-prepared");
|
|
235
|
+
}, 60_000);
|
|
236
|
+
|
|
237
|
+
it("fix-mode FLOW-CUT-12 rolls the fix branch back — the cut re-runs cleanly", async () => {
|
|
238
|
+
const { repo } = await adoptedRepo();
|
|
239
|
+
const first = await runOrdinaryCut(repo, ambientIo, { lines: [], dryRun: false });
|
|
240
|
+
expect(first.released).toBe(true);
|
|
241
|
+
|
|
242
|
+
const fix = await fixFlow(repo, ambientIo, { slug: "fix-rollback", brief: "t", dryRun: false });
|
|
243
|
+
const fixBranch = fix.branch!;
|
|
244
|
+
const wt = fix.worktree!;
|
|
245
|
+
dirs.push(wt);
|
|
246
|
+
await commitIn(wt, "hotfix.txt", "fix");
|
|
247
|
+
|
|
248
|
+
await writeHook(repo, "release-prepare", "#!/bin/sh\necho boom >&2\nexit 2\n");
|
|
249
|
+
const common = await commonGitDir(ambientIo, repo);
|
|
250
|
+
const entry = (await readRegistry(ambientIo, common)).branches.find((b) => b.name === fixBranch);
|
|
251
|
+
const tipBefore = await sha(repo, fixBranch);
|
|
252
|
+
|
|
253
|
+
const failed = await runFixCut(repo, ambientIo, { entry: entry!, linesGiven: false, dryRun: false });
|
|
254
|
+
expect(failed.released).toBe(false);
|
|
255
|
+
expect(failed.diagnostics[0]?.ruleId).toBe("FLOW-CUT-12");
|
|
256
|
+
// Rolled back: tip unchanged, worktree clean — a re-run cannot hit
|
|
257
|
+
// FLOW-CUT-07 on the leftover version writes.
|
|
258
|
+
expect(await sha(repo, fixBranch)).toBe(tipBefore);
|
|
259
|
+
expect((await gitExec(wt, ["status", "--porcelain"])).stdout.trim()).toBe("");
|
|
260
|
+
|
|
261
|
+
// Re-run with a working hook — no manual recovery needed.
|
|
262
|
+
await writeHook(repo, "release-prepare", "#!/bin/sh\nset -eu\necho fix-prepared >> tracked.txt\n");
|
|
263
|
+
const retried = await runFixCut(repo, ambientIo, { entry: entry!, linesGiven: false, dryRun: false });
|
|
264
|
+
expect(retried.diagnostics.filter((d) => d.severity === "error")).toEqual([]);
|
|
265
|
+
expect(retried.released).toBe(true);
|
|
266
|
+
}, 60_000);
|
|
267
|
+
|
|
268
|
+
it("fix-mode FLOW-CUT-13 removes the failed release commit — the cut re-runs cleanly", async () => {
|
|
269
|
+
const { repo } = await adoptedRepo({ packageLine: true });
|
|
270
|
+
const first = await runOrdinaryCut(repo, ambientIo, { lines: [], dryRun: false });
|
|
271
|
+
expect(first.released).toBe(true);
|
|
272
|
+
|
|
273
|
+
const fix = await fixFlow(repo, ambientIo, { slug: "fix-rollback13", brief: "t", dryRun: false });
|
|
274
|
+
const fixBranch = fix.branch!;
|
|
275
|
+
const wt = fix.worktree!;
|
|
276
|
+
dirs.push(wt);
|
|
277
|
+
// Touch the lib line so the fix releases it and extract-verify runs.
|
|
278
|
+
await commitIn(wt, "packages/lib/hotfix.txt", "fix");
|
|
279
|
+
|
|
280
|
+
await writeHook(repo, "extract-verify", "#!/bin/sh\necho verify-boom >&2\nexit 4\n");
|
|
281
|
+
const common = await commonGitDir(ambientIo, repo);
|
|
282
|
+
const entry = (await readRegistry(ambientIo, common)).branches.find((b) => b.name === fixBranch);
|
|
283
|
+
const tipBefore = await sha(repo, fixBranch);
|
|
284
|
+
|
|
285
|
+
const failed = await runFixCut(repo, ambientIo, { entry: entry!, linesGiven: false, dryRun: false });
|
|
286
|
+
expect(failed.released).toBe(false);
|
|
287
|
+
expect(failed.diagnostics[0]?.ruleId).toBe("FLOW-CUT-13");
|
|
288
|
+
// The failed chore(release) commit is gone — a re-run cannot produce an
|
|
289
|
+
// empty release commit (FLOW-CUT-01) or stack a duplicate.
|
|
290
|
+
expect(await sha(repo, fixBranch)).toBe(tipBefore);
|
|
291
|
+
expect((await gitExec(wt, ["status", "--porcelain"])).stdout.trim()).toBe("");
|
|
292
|
+
|
|
293
|
+
await rm(join(repo, "hooks", "extract-verify.sh"));
|
|
294
|
+
const retried = await runFixCut(repo, ambientIo, { entry: entry!, linesGiven: false, dryRun: false });
|
|
295
|
+
expect(retried.diagnostics.filter((d) => d.severity === "error")).toEqual([]);
|
|
296
|
+
expect(retried.released).toBe(true);
|
|
297
|
+
}, 60_000);
|
|
298
|
+
});
|