@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,127 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-1495 step 1 — resolveStateRoots distinguishes the session worktree from
|
|
5
|
+
the primary checkout, degrades on non-git dirs, and forge's own mission.archive
|
|
6
|
+
writes the archive into the primary while the mission source stays where the
|
|
7
|
+
command ran.
|
|
8
|
+
</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Not a contract source of truth — resolveStateRoots and the archive handler own the authoritative behavior.</item>
|
|
11
|
+
</non-goals>
|
|
12
|
+
</MODULE_CONTRACT>
|
|
13
|
+
<CHANGE_SUMMARY>
|
|
14
|
+
<item>RFC-1495: step 1 — state-roots + primary-archive tests</item>
|
|
15
|
+
<item>RFC-1495: step 1 - forge state roots</item>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { test, expect, describe, afterEach } from "vitest";
|
|
20
|
+
import { mkdtemp, mkdir, writeFile, rm } from "node:fs/promises";
|
|
21
|
+
import { existsSync } from "node:fs";
|
|
22
|
+
import { tmpdir } from "node:os";
|
|
23
|
+
import { basename, dirname, join } from "node:path";
|
|
24
|
+
|
|
25
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
26
|
+
import type { ForgeCommandInput, ForgeRuntimeContext } from "../../../src/types.ts";
|
|
27
|
+
|
|
28
|
+
import { resolveStateRoots } from "../worktree-path.ts";
|
|
29
|
+
import { runMissionArchive } from "../../mission/handlers/archive.ts";
|
|
30
|
+
import { gitExec, initRepo } from "./helpers.ts";
|
|
31
|
+
|
|
32
|
+
const io = ambientIo;
|
|
33
|
+
const dirs: string[] = [];
|
|
34
|
+
|
|
35
|
+
afterEach(async () => {
|
|
36
|
+
for (const d of dirs.splice(0)) await rm(d, { recursive: true, force: true });
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
function makeContext(workspaceRoot: string): ForgeRuntimeContext {
|
|
40
|
+
return {
|
|
41
|
+
workspaceRoot,
|
|
42
|
+
io,
|
|
43
|
+
logger: {
|
|
44
|
+
info: () => {},
|
|
45
|
+
success: () => {},
|
|
46
|
+
warn: () => {},
|
|
47
|
+
error: () => {},
|
|
48
|
+
debug: () => {},
|
|
49
|
+
},
|
|
50
|
+
outputFormat: "json",
|
|
51
|
+
dryRun: false,
|
|
52
|
+
} as unknown as ForgeRuntimeContext;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function makeInput(flags: Record<string, unknown> = {}): ForgeCommandInput {
|
|
56
|
+
return { commandName: "mission.archive", flags } as unknown as ForgeCommandInput;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
describe("resolveStateRoots (RFC-1495)", () => {
|
|
60
|
+
test("single-worktree repo resolves every root to itself", async () => {
|
|
61
|
+
const repo = await initRepo({ prefix: "state-roots-" });
|
|
62
|
+
dirs.push(repo);
|
|
63
|
+
const roots = await resolveStateRoots(repo, io);
|
|
64
|
+
expect(roots.worktreeRoot).toBe(repo);
|
|
65
|
+
expect(roots.primaryRoot).toBe(repo);
|
|
66
|
+
expect(roots.isPrimary).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("from a linked worktree, primary is the first worktree", async () => {
|
|
70
|
+
const repo = await initRepo({ prefix: "state-roots-" });
|
|
71
|
+
dirs.push(repo);
|
|
72
|
+
const wt = join(dirname(repo), `${basename(repo)}@session-x`);
|
|
73
|
+
const add = await gitExec(repo, ["worktree", "add", "-b", "session-x", wt]);
|
|
74
|
+
expect(add.exitCode).toBe(0);
|
|
75
|
+
// Worktree dirs land inside the tracked rm — the worktree itself is
|
|
76
|
+
// removed with the parent dir.
|
|
77
|
+
dirs.push(wt);
|
|
78
|
+
|
|
79
|
+
const roots = await resolveStateRoots(wt, io);
|
|
80
|
+
expect(roots.worktreeRoot).toBe(wt);
|
|
81
|
+
expect(roots.primaryRoot).toBe(repo);
|
|
82
|
+
expect(roots.isPrimary).toBe(false);
|
|
83
|
+
|
|
84
|
+
const primary = await resolveStateRoots(repo, io);
|
|
85
|
+
expect(primary.isPrimary).toBe(true);
|
|
86
|
+
expect(primary.worktreeRoot).toBe(repo);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("non-git directory degrades to itself", async () => {
|
|
90
|
+
const dir = await mkdtemp(join(tmpdir(), "state-roots-"));
|
|
91
|
+
dirs.push(dir);
|
|
92
|
+
const roots = await resolveStateRoots(dir, io);
|
|
93
|
+
expect(roots).toEqual({
|
|
94
|
+
worktreeRoot: dir,
|
|
95
|
+
primaryRoot: dir,
|
|
96
|
+
isPrimary: true,
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("mission.archive run in a session worktree lands in the primary archive", async () => {
|
|
101
|
+
const repo = await initRepo({ prefix: "state-roots-" });
|
|
102
|
+
dirs.push(repo);
|
|
103
|
+
const wt = join(dirname(repo), `${basename(repo)}@session-y`);
|
|
104
|
+
const add = await gitExec(repo, ["worktree", "add", "-b", "session-y", wt]);
|
|
105
|
+
expect(add.exitCode).toBe(0);
|
|
106
|
+
dirs.push(wt);
|
|
107
|
+
|
|
108
|
+
// A closed mission exists in the session worktree only.
|
|
109
|
+
const missionId = "acme-m000001";
|
|
110
|
+
const missionDir = join(wt, "missions", missionId);
|
|
111
|
+
await mkdir(missionDir, { recursive: true });
|
|
112
|
+
await writeFile(
|
|
113
|
+
join(missionDir, "mission.yaml"),
|
|
114
|
+
`missionId: ${missionId}\nstate: closed\n`,
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const result = await runMissionArchive(makeInput(), makeContext(wt));
|
|
118
|
+
expect(result.exitCode ?? 0).toBe(0);
|
|
119
|
+
|
|
120
|
+
// Durable target: the primary's missions/archive/closed/, never the wt's.
|
|
121
|
+
expect(
|
|
122
|
+
existsSync(join(repo, "missions", "archive", "closed", missionId, "mission.yaml")),
|
|
123
|
+
).toBe(true);
|
|
124
|
+
expect(existsSync(join(wt, "missions", "archive"))).toBe(false);
|
|
125
|
+
expect(existsSync(missionDir)).toBe(false);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>version-files tests (RFC-1490 step 2): verified textual writes keep
|
|
4
|
+
formatting and key order, a nested-first `"version"` key throws
|
|
5
|
+
VersionWriteError, forge.yaml syncedVersion keeps indentation, and the
|
|
6
|
+
widened registry schema accepts kind fix + base main while rejecting
|
|
7
|
+
session + main.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No cut orchestration — flow-cut tests own that.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1490: step 2 — version-files + registry-schema coverage</item>
|
|
14
|
+
<item>RFC-1490: step 2 — registry fix/port widening, FORGE_FLOW_COMMIT gitCommit helper, verified version-files writes</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
|
|
21
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
22
|
+
|
|
23
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
24
|
+
import { flowRegistryEntrySchema } from "../registry.ts";
|
|
25
|
+
import type { ReleaseLine } from "../release-lines.ts";
|
|
26
|
+
import {
|
|
27
|
+
VersionWriteError,
|
|
28
|
+
writeLineVersion,
|
|
29
|
+
writeSyncedForgeVersion,
|
|
30
|
+
} from "../version-files.ts";
|
|
31
|
+
import { initRepo } from "./helpers.ts";
|
|
32
|
+
|
|
33
|
+
const dirs: string[] = [];
|
|
34
|
+
|
|
35
|
+
afterEach(async () => {
|
|
36
|
+
for (const dir of dirs.splice(0)) {
|
|
37
|
+
await rm(dir, { recursive: true, force: true });
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
function lineWith(versionFile: string | null): ReleaseLine {
|
|
42
|
+
return {
|
|
43
|
+
id: "repo",
|
|
44
|
+
tagPrefix: "v",
|
|
45
|
+
versionFile,
|
|
46
|
+
paths: [],
|
|
47
|
+
packages: [],
|
|
48
|
+
} as ReleaseLine;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function repo(): Promise<string> {
|
|
52
|
+
const dir = await initRepo({ prefix: "ver-files-" });
|
|
53
|
+
dirs.push(dir);
|
|
54
|
+
return dir;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const ENTRY = {
|
|
58
|
+
name: "auto/fix-260102-01-x",
|
|
59
|
+
baseSha: "a".repeat(40),
|
|
60
|
+
worktree: "/tmp/wt",
|
|
61
|
+
owner: { kind: "session", id: "s1" },
|
|
62
|
+
brief: null,
|
|
63
|
+
openedAt: "2026-01-02T00:00:00.000Z",
|
|
64
|
+
updatedAt: "2026-01-02T00:00:00.000Z",
|
|
65
|
+
held: null,
|
|
66
|
+
port: null,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
describe("writeLineVersion", () => {
|
|
70
|
+
it("replaces the version field preserving formatting and key order", async () => {
|
|
71
|
+
const dir = await repo();
|
|
72
|
+
const doc = '{\n\t"name": "x",\n\t"version": "1.2.0",\n\t"license": "MIT"\n}\n';
|
|
73
|
+
await writeFile(join(dir, "package.json"), doc);
|
|
74
|
+
await writeLineVersion(dir, lineWith("package.json"), "1.3.0", ambientIo);
|
|
75
|
+
const after = await ambientIo.readFile(join(dir, "package.json"));
|
|
76
|
+
expect(after).toBe(doc.replace('"version": "1.2.0"', '"version": "1.3.0"'));
|
|
77
|
+
expect(after).toContain("\t");
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("a nested-first version key fails verification as VersionWriteError", async () => {
|
|
81
|
+
const dir = await repo();
|
|
82
|
+
await writeFile(
|
|
83
|
+
join(dir, "package.json"),
|
|
84
|
+
'{ "engines": { "version": ">=18" }, "version": "1.2.0" }\n',
|
|
85
|
+
);
|
|
86
|
+
await expect(
|
|
87
|
+
writeLineVersion(dir, lineWith("package.json"), "1.3.0", ambientIo),
|
|
88
|
+
).rejects.toBeInstanceOf(VersionWriteError);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("throws VersionWriteError when the line has no version file", async () => {
|
|
92
|
+
const dir = await repo();
|
|
93
|
+
await expect(
|
|
94
|
+
writeLineVersion(dir, lineWith(null), "1.3.0", ambientIo),
|
|
95
|
+
).rejects.toBeInstanceOf(VersionWriteError);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
describe("writeSyncedForgeVersion", () => {
|
|
100
|
+
it("replaces syncedVersion keeping indentation", async () => {
|
|
101
|
+
const dir = await repo();
|
|
102
|
+
await mkdir(join(dir, "sub"), { recursive: true });
|
|
103
|
+
const yaml = "forge:\n syncedVersion: 9.1.1\n other: keep\n";
|
|
104
|
+
await writeFile(join(dir, "forge.yaml"), yaml);
|
|
105
|
+
await writeSyncedForgeVersion(dir, "9.2.0", ambientIo);
|
|
106
|
+
expect(await ambientIo.readFile(join(dir, "forge.yaml"))).toBe(
|
|
107
|
+
"forge:\n syncedVersion: 9.2.0\n other: keep\n",
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe("flowRegistryEntrySchema (RFC-1490 widening)", () => {
|
|
113
|
+
it("accepts kind fix with base main", () => {
|
|
114
|
+
const parsed = flowRegistryEntrySchema.safeParse({ ...ENTRY, kind: "fix", base: "main" });
|
|
115
|
+
expect(parsed.success).toBe(true);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("rejects kind session with base main", () => {
|
|
119
|
+
const parsed = flowRegistryEntrySchema.safeParse({
|
|
120
|
+
...ENTRY,
|
|
121
|
+
kind: "session",
|
|
122
|
+
base: "main",
|
|
123
|
+
});
|
|
124
|
+
expect(parsed.success).toBe(false);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("rejects kind fix with base develop", () => {
|
|
128
|
+
const parsed = flowRegistryEntrySchema.safeParse({
|
|
129
|
+
...ENTRY,
|
|
130
|
+
kind: "fix",
|
|
131
|
+
base: "develop",
|
|
132
|
+
});
|
|
133
|
+
expect(parsed.success).toBe(false);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it("accepts a port object on any kind", () => {
|
|
137
|
+
const parsed = flowRegistryEntrySchema.safeParse({
|
|
138
|
+
...ENTRY,
|
|
139
|
+
kind: "session",
|
|
140
|
+
base: "develop",
|
|
141
|
+
port: { mainSha: "b".repeat(40), tags: ["v1.3.1"] },
|
|
142
|
+
});
|
|
143
|
+
expect(parsed.success).toBe(true);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Version-file writes for flow.cut (RFC-1490): replace a release
|
|
4
|
+
line's `package.json` `"version"` field and the repo's `forge.yaml`
|
|
5
|
+
`syncedVersion` textually — formatting, key order and comments are
|
|
6
|
+
preserved — then verify the JSON result deep-equals the pre-write document
|
|
7
|
+
with only `version` changed. A mismatch throws VersionWriteError (the cut
|
|
8
|
+
maps it to FLOW-CUT-11).</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>No version math — semver.ts/release-level.ts decide the next version.</item>
|
|
11
|
+
<item>No commits — callers stage and commit the written files.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
<KEY_DECISIONS>
|
|
15
|
+
<item>Textual first-`"version"`-key replacement: a JSON round-trip would reformat the file; the post-write JSON deep-equal is the safety net that catches a nested `"version"` (e.g. under engines) hit by accident.</item>
|
|
16
|
+
<item>`syncedVersion` is a YAML scalar — regex the whole line keeping leading indentation so comments elsewhere in forge.yaml survive.</item>
|
|
17
|
+
</KEY_DECISIONS>
|
|
18
|
+
<CHANGE_SUMMARY>
|
|
19
|
+
<item>RFC-1490: step 2 — verified textual version writes for flow.cut</item>
|
|
20
|
+
<item>RFC-1490: step 2 — registry fix/port widening, FORGE_FLOW_COMMIT gitCommit helper, verified version-files writes</item>
|
|
21
|
+
</CHANGE_SUMMARY>
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { join } from "node:path";
|
|
25
|
+
|
|
26
|
+
import type { WorkspaceIO } from "../../src/types.ts";
|
|
27
|
+
|
|
28
|
+
import type { ReleaseLine } from "./release-lines.ts";
|
|
29
|
+
|
|
30
|
+
/** The verified-write contract failed — flow.cut maps this to FLOW-CUT-11. */
|
|
31
|
+
export class VersionWriteError extends Error {
|
|
32
|
+
readonly file: string;
|
|
33
|
+
constructor(file: string, detail: string) {
|
|
34
|
+
super(`version write to ${file} failed verification: ${detail}`);
|
|
35
|
+
this.name = "VersionWriteError";
|
|
36
|
+
this.file = file;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Replace the FIRST `"version": "…"` key in the line's version file and
|
|
42
|
+
* verify `JSON.parse(after)` deep-equals `{ ...before, version: next }`.
|
|
43
|
+
* Absent file, absent/unparseable JSON, or a verification mismatch all
|
|
44
|
+
* throw VersionWriteError.
|
|
45
|
+
*/
|
|
46
|
+
export async function writeLineVersion(
|
|
47
|
+
worktree: string,
|
|
48
|
+
line: ReleaseLine,
|
|
49
|
+
nextVersion: string,
|
|
50
|
+
io: WorkspaceIO,
|
|
51
|
+
): Promise<void> {
|
|
52
|
+
if (line.versionFile === null) {
|
|
53
|
+
throw new VersionWriteError("(none)", `release line '${line.id}' has no version file`);
|
|
54
|
+
}
|
|
55
|
+
const file = join(worktree, line.versionFile);
|
|
56
|
+
if (!(await io.exists(file))) {
|
|
57
|
+
throw new VersionWriteError(line.versionFile, "file does not exist");
|
|
58
|
+
}
|
|
59
|
+
const before = await io.readFile(file);
|
|
60
|
+
let beforeDoc: Record<string, unknown>;
|
|
61
|
+
try {
|
|
62
|
+
beforeDoc = JSON.parse(before) as Record<string, unknown>;
|
|
63
|
+
} catch (error) {
|
|
64
|
+
throw new VersionWriteError(
|
|
65
|
+
line.versionFile,
|
|
66
|
+
`unparseable JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
const match = before.match(/"version"\s*:\s*"[^"]*"/);
|
|
70
|
+
if (match === null || match.index === undefined) {
|
|
71
|
+
throw new VersionWriteError(line.versionFile, "no top-level '\"version\"' key found");
|
|
72
|
+
}
|
|
73
|
+
const after = before.slice(0, match.index) + `"version": "${nextVersion}"` +
|
|
74
|
+
before.slice(match.index + match[0].length);
|
|
75
|
+
let afterDoc: Record<string, unknown>;
|
|
76
|
+
try {
|
|
77
|
+
afterDoc = JSON.parse(after) as Record<string, unknown>;
|
|
78
|
+
} catch {
|
|
79
|
+
throw new VersionWriteError(line.versionFile, "post-write JSON failed to parse");
|
|
80
|
+
}
|
|
81
|
+
const expected = JSON.stringify({ ...beforeDoc, version: nextVersion });
|
|
82
|
+
if (JSON.stringify(afterDoc) !== expected) {
|
|
83
|
+
throw new VersionWriteError(
|
|
84
|
+
line.versionFile,
|
|
85
|
+
`verified content differs — the replaced key was not the document's version field`,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
await io.writeFile(file, after);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Replace the `syncedVersion:` scalar in forge.yaml, keeping its
|
|
93
|
+
* indentation and any trailing comment. Absent file or key throws
|
|
94
|
+
* VersionWriteError.
|
|
95
|
+
*/
|
|
96
|
+
export async function writeSyncedForgeVersion(
|
|
97
|
+
repoRoot: string,
|
|
98
|
+
nextVersion: string,
|
|
99
|
+
io: WorkspaceIO,
|
|
100
|
+
): Promise<void> {
|
|
101
|
+
const file = join(repoRoot, "forge.yaml");
|
|
102
|
+
if (!(await io.exists(file))) {
|
|
103
|
+
throw new VersionWriteError("forge.yaml", "file does not exist");
|
|
104
|
+
}
|
|
105
|
+
const before = await io.readFile(file);
|
|
106
|
+
const match = before.match(/^([ \t]*)syncedVersion:\s*\S[^\n]*$/m);
|
|
107
|
+
if (match === null || match.index === undefined) {
|
|
108
|
+
throw new VersionWriteError("forge.yaml", "no 'syncedVersion' key found");
|
|
109
|
+
}
|
|
110
|
+
const after =
|
|
111
|
+
before.slice(0, match.index) +
|
|
112
|
+
`${match[1]}syncedVersion: ${nextVersion}` +
|
|
113
|
+
before.slice(match.index + match[0].length);
|
|
114
|
+
await io.writeFile(file, after);
|
|
115
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Worktree path contracts for the session lifecycle (RFC-1487): the
|
|
4
|
+
primary checkout is always the first entry of `git worktree list --porcelain`,
|
|
5
|
+
and a flow branch's worktree sits beside the primary as
|
|
6
|
+
<parent>/<repo>@<branch-slug> — the sibling depth keeps
|
|
7
|
+
sibling-relative paths (../systems-cache, link:../…) resolving unchanged.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No worktree creation — flow.open decides names and calls git.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<KEY_DECISIONS>
|
|
13
|
+
<item>`@` in the directory name is a fixed operator decision (resolutions #1, FI-1) — it cannot collide with a real checkout because no governed branch slug contains it.</item>
|
|
14
|
+
<item>The path derives from the branch name only — renames of the primary directory stay invisible to the registry entry.</item>
|
|
15
|
+
</KEY_DECISIONS>
|
|
16
|
+
<CHANGE_SUMMARY>
|
|
17
|
+
<item>RFC-1487: step 1 — worktree path contracts</item>
|
|
18
|
+
<item>RFC-1487: step 1 — worktree path contracts, O_EXCL locks, branch registry and journal</item>
|
|
19
|
+
<item>RFC-1487: close rfc-1487 review findings — dirty-check parity with git worktree remove, ownership-verified lock release, FLOW-07 registry-error mapping, residual RFC-1462 docs removed
|
|
20
|
+
|
|
21
|
+
The dirty gate for session worktrees now uses full porcelain status
|
|
22
|
+
(untracked files included) because it predicts 'git worktree remove';
|
|
23
|
+
the primary-clean gate keeps tracked-only semantics because it predicts
|
|
24
|
+
'merge --ff-only'. Lock release verifies the held payload before
|
|
25
|
+
unlinking. Registry/journal failures map to FLOW-07 in every handler.
|
|
26
|
+
The final branch-name collision reports FLOW-OPEN-04, flow.discard
|
|
27
|
+
propagates its teardown result and predicts FLOW-DIS-03 on --dry-run,
|
|
28
|
+
and integrate exposes teardown as its own field.</item>
|
|
29
|
+
<item>RFC-1495: step 1 - forge state roots</item>
|
|
30
|
+
<item>RFC-1495: steps 2-3 - workshop paths resolver and call-site migration</item>
|
|
31
|
+
</CHANGE_SUMMARY>
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
import { basename, dirname, join } from "node:path";
|
|
35
|
+
|
|
36
|
+
import type { WorkspaceIO } from "../../src/types.ts";
|
|
37
|
+
|
|
38
|
+
import { topLevel, worktreeList } from "./git.ts";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Absolute path of the repository's primary worktree — the first entry of
|
|
42
|
+
* `git worktree list --porcelain`, callable from any linked worktree. Throws
|
|
43
|
+
* when the output lists no worktree; when every entry is bare it falls back
|
|
44
|
+
* to the first entry.
|
|
45
|
+
*/
|
|
46
|
+
export async function primaryWorktree(
|
|
47
|
+
io: WorkspaceIO,
|
|
48
|
+
anyWorktree: string,
|
|
49
|
+
): Promise<string> {
|
|
50
|
+
const worktrees = await worktreeList(anyWorktree, io);
|
|
51
|
+
const primary = worktrees.find((w) => !w.bare) ?? worktrees[0];
|
|
52
|
+
if (!primary) {
|
|
53
|
+
throw new Error("git worktree list returned no worktree — bare repository?");
|
|
54
|
+
}
|
|
55
|
+
return primary.path;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* `<parent>/<repo>@<branch-slug>` — e.g.
|
|
60
|
+
* `/home/u/projects/warpgogol/werkstatt` + `auto/session-261101-01-forge-flow`
|
|
61
|
+
* → `/home/u/projects/warpgogol/werkstatt@auto-session-261101-01-forge-flow`.
|
|
62
|
+
*/
|
|
63
|
+
export function flowWorktreePath(primary: string, branch: string): string {
|
|
64
|
+
return join(dirname(primary), `${basename(primary)}@${branch.replaceAll("/", "-")}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* RFC-1495: the two state roots — the current worktree (per-session code and
|
|
69
|
+
* open missions) and the primary checkout (durable state). In a single
|
|
70
|
+
* worktree both are the same directory, so unadopted repositories resolve
|
|
71
|
+
* every path exactly as before. Non-git directories degrade to the passed
|
|
72
|
+
* root rather than throwing.
|
|
73
|
+
*/
|
|
74
|
+
export interface StateRoots {
|
|
75
|
+
/** `git rev-parse --show-toplevel` — the worktree this call runs in. */
|
|
76
|
+
worktreeRoot: string;
|
|
77
|
+
/** The first non-bare entry of `git worktree list` — the primary checkout. */
|
|
78
|
+
primaryRoot: string;
|
|
79
|
+
/** worktreeRoot === primaryRoot. */
|
|
80
|
+
isPrimary: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export async function resolveStateRoots(
|
|
84
|
+
repoRoot: string,
|
|
85
|
+
io: WorkspaceIO,
|
|
86
|
+
): Promise<StateRoots> {
|
|
87
|
+
const top = await topLevel(repoRoot, io);
|
|
88
|
+
// The workshop anchor is the caller's root — only when that root IS the
|
|
89
|
+
// repository worktree root does worktree topology apply. A subdirectory
|
|
90
|
+
// of a repo (or a non-git dir) has no workshop layout to resolve.
|
|
91
|
+
if (!top || top !== repoRoot.replace(/[/\\]+$/, "")) {
|
|
92
|
+
return { worktreeRoot: repoRoot, primaryRoot: repoRoot, isPrimary: true };
|
|
93
|
+
}
|
|
94
|
+
let primaryRoot: string;
|
|
95
|
+
try {
|
|
96
|
+
primaryRoot = await primaryWorktree(io, repoRoot);
|
|
97
|
+
} catch {
|
|
98
|
+
// worktree list empty or unparseable (non-git io, bare fixtures) —
|
|
99
|
+
// degrade to single-root rather than throwing.
|
|
100
|
+
return { worktreeRoot: repoRoot, primaryRoot: repoRoot, isPrimary: true };
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
worktreeRoot: repoRoot,
|
|
104
|
+
primaryRoot,
|
|
105
|
+
isPrimary: repoRoot === primaryRoot,
|
|
106
|
+
};
|
|
107
|
+
}
|