@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,272 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Generated-artifact publication for one release tag (RFC-1491):
|
|
4
|
+
repo-extract the package line's extract repo at the tag, run the
|
|
5
|
+
extract-verify hook, push the destination once — reconciling with a single
|
|
6
|
+
ours-merge only on a non-fast-forward rejection, never force-pushing —
|
|
7
|
+
and return the RFC publications[] row for the journal.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No push orchestration — handlers/flow-push.ts owns preflight and the atomic push.</item>
|
|
10
|
+
<item>No real repo-extract in tests — fixtures install a fake node_modules/.bin/repo-extract.</item>
|
|
11
|
+
</non-goals>
|
|
12
|
+
</MODULE_CONTRACT>
|
|
13
|
+
<KEY_DECISIONS>
|
|
14
|
+
<item>Destination resolution mirrors the retired publish-forge.mjs (RFC-1499) resolveDest(): destBase/destName parsed from extract.config.yaml, anchored at dirname(primary), destBase default "packages".</item>
|
|
15
|
+
<item>Reconcile only on non-fast-forward (the same regex as the retired publish-forge.mjs, RFC-1499) — auth, hook and transient failures never trigger an ours-merge.</item>
|
|
16
|
+
<item>verifyLineAtRef (RFC-1502) extracts into an mkdtemp scratch via `--dest` — the configured destination is never touched — and a spawn failure of the repo-extract binary reports as a verification failure, not a crash.</item>
|
|
17
|
+
</KEY_DECISIONS>
|
|
18
|
+
<CHANGE_SUMMARY>
|
|
19
|
+
<item>RFC-1491: independent-review pass — shared lock constants, publishable pending filter, declared rules, hold ordering, sha-pinned refspecs</item>
|
|
20
|
+
<item>RFC-1499: step 2 — retire publish-forge/bump-forge scripts, add extract-verify hook</item>
|
|
21
|
+
<item>RFC-1502: steps 1-5 — release-prepare hook, pre-tag extract verification, ordered steps</item>
|
|
22
|
+
<item>RFC-1502: step 7 — remediation entries, docs, deviations, generated indexes</item>
|
|
23
|
+
<item>RFC-1502: review r1 — fix-cut rollback on FLOW-CUT-12/13, populated steps[], hook validation, GIT_* env scrub</item>
|
|
24
|
+
<history>RFC-1491</history>
|
|
25
|
+
</CHANGE_SUMMARY>
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { mkdtemp, rm } from "node:fs/promises";
|
|
29
|
+
import { tmpdir } from "node:os";
|
|
30
|
+
import { dirname, join, resolve } from "node:path";
|
|
31
|
+
|
|
32
|
+
import type { WorkspaceIO } from "../../src/types.ts";
|
|
33
|
+
import { git, gitCommit } from "./git.ts";
|
|
34
|
+
import { runFlowScript, type FlowScriptResult } from "./scripts.ts";
|
|
35
|
+
import type { ReleaseLine } from "./release-lines.ts";
|
|
36
|
+
|
|
37
|
+
export interface PublicationRow {
|
|
38
|
+
tag: string;
|
|
39
|
+
line: string;
|
|
40
|
+
status: "published" | "failed" | "skipped-baseline" | "pending";
|
|
41
|
+
dest: string | null;
|
|
42
|
+
verify: FlowScriptResult | null;
|
|
43
|
+
reconciled: boolean;
|
|
44
|
+
destHead: string | null;
|
|
45
|
+
/** FLOW-PUSH-05 detail when status === "failed". */
|
|
46
|
+
error?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** `destBase`/`destName` from extract.config.yaml, anchored at dirname(primary) (resolveDest parity). */
|
|
50
|
+
export async function resolveExtractDest(
|
|
51
|
+
primary: string,
|
|
52
|
+
io: WorkspaceIO,
|
|
53
|
+
line: ReleaseLine,
|
|
54
|
+
): Promise<string | null> {
|
|
55
|
+
const dir = line.paths[0];
|
|
56
|
+
if (dir === undefined) return null;
|
|
57
|
+
const configPath = join(primary, dir, "extract.config.yaml");
|
|
58
|
+
if (!(await io.exists(configPath))) return null;
|
|
59
|
+
const raw = await io.readFile(configPath);
|
|
60
|
+
const unquote = (v: string | undefined): string | undefined =>
|
|
61
|
+
v?.replace(/^["']|["']$/g, "");
|
|
62
|
+
const destBase = unquote(raw.match(/^destBase:\s*(\S+)\s*$/m)?.[1]);
|
|
63
|
+
const destName = unquote(raw.match(/^destName:\s*(\S+)\s*$/m)?.[1]);
|
|
64
|
+
if (destName === undefined) return null;
|
|
65
|
+
return resolve(
|
|
66
|
+
dirname(primary),
|
|
67
|
+
destBase ?? "packages",
|
|
68
|
+
destName,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** The annotation's `level:` field — baseline tags are never published. */
|
|
73
|
+
export async function tagAnnotationLevel(
|
|
74
|
+
repoRoot: string,
|
|
75
|
+
io: WorkspaceIO,
|
|
76
|
+
tag: string,
|
|
77
|
+
): Promise<string | null> {
|
|
78
|
+
const result = await git(repoRoot, io, [
|
|
79
|
+
"for-each-ref",
|
|
80
|
+
`refs/tags/${tag}`,
|
|
81
|
+
"--format=%(contents)",
|
|
82
|
+
]);
|
|
83
|
+
if (result.exitCode !== 0) return null;
|
|
84
|
+
return result.stdout.match(/^level:\s*(\S+)\s*$/m)?.[1] ?? null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Publish one package-line tag: extract at the tag ref, verify via the hook,
|
|
89
|
+
* push the destination. A non-fast-forward rejection reconciles once with
|
|
90
|
+
* fetch + ours-merge (local tree is the authoritative export), never force.
|
|
91
|
+
*/
|
|
92
|
+
export async function publishTag(
|
|
93
|
+
primary: string,
|
|
94
|
+
io: WorkspaceIO,
|
|
95
|
+
opts: { line: ReleaseLine; tag: string },
|
|
96
|
+
): Promise<PublicationRow> {
|
|
97
|
+
const { line, tag } = opts;
|
|
98
|
+
const row: PublicationRow = {
|
|
99
|
+
tag,
|
|
100
|
+
line: line.id,
|
|
101
|
+
status: "published",
|
|
102
|
+
dest: null,
|
|
103
|
+
verify: null,
|
|
104
|
+
reconciled: false,
|
|
105
|
+
destHead: null,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const dir = line.paths[0];
|
|
109
|
+
if (dir === undefined) {
|
|
110
|
+
row.status = "failed";
|
|
111
|
+
row.error = `line ${line.id} has no package directory`;
|
|
112
|
+
return row;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const level = await tagAnnotationLevel(primary, io, tag);
|
|
116
|
+
if (level === "baseline") {
|
|
117
|
+
row.status = "skipped-baseline";
|
|
118
|
+
return row;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// 1. Extract — the binary lives in the adopting repository's own install.
|
|
122
|
+
const extract = await io.exec(
|
|
123
|
+
join(primary, "node_modules", ".bin", "repo-extract"),
|
|
124
|
+
["--config", `${dir}/extract.config.yaml`, "--ref", tag, "--no-push"],
|
|
125
|
+
{ cwd: primary },
|
|
126
|
+
);
|
|
127
|
+
if (extract.exitCode !== 0) {
|
|
128
|
+
row.status = "failed";
|
|
129
|
+
row.error = `repo-extract failed (exit ${extract.exitCode}): ${extract.stderr.trim().split("\n").slice(-1)[0] ?? ""}`;
|
|
130
|
+
return row;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// 2. Destination — same resolution as the retired publish-forge.mjs (RFC-1499).
|
|
134
|
+
const dest = await resolveExtractDest(primary, io, line);
|
|
135
|
+
row.dest = dest;
|
|
136
|
+
if (dest === null || !(await io.exists(join(dest, ".git")))) {
|
|
137
|
+
row.status = "failed";
|
|
138
|
+
row.error = `extract destination could not be resolved for ${tag} (destName in ${dir}/extract.config.yaml)`;
|
|
139
|
+
return row;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 3. Verify hook — absent script reports skipped, a failure stops here.
|
|
143
|
+
const verify = await runFlowScript(io, "extract-verify", {
|
|
144
|
+
primary,
|
|
145
|
+
cwd: primary,
|
|
146
|
+
env: {
|
|
147
|
+
FORGE_FLOW_EXTRACT_DEST: dest,
|
|
148
|
+
FORGE_FLOW_TAG: tag,
|
|
149
|
+
FORGE_FLOW_LINE: line.id,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
row.verify = verify;
|
|
153
|
+
if (verify.status === "failed") {
|
|
154
|
+
row.status = "failed";
|
|
155
|
+
row.error = `extract-verify failed (exit ${verify.exitCode}): ${verify.stderrTail}`;
|
|
156
|
+
return row;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// 4. Push the extract destination — `branch --show-current` first, the
|
|
160
|
+
// rev-parse fallback keeps a detached export HEAD pushable.
|
|
161
|
+
const branchShown = await git(dest, io, ["branch", "--show-current"]);
|
|
162
|
+
const branch =
|
|
163
|
+
branchShown.stdout.trim() ||
|
|
164
|
+
(await git(dest, io, ["rev-parse", "--abbrev-ref", "HEAD"])).stdout.trim();
|
|
165
|
+
const firstPush = await git(dest, io, ["push", "-u", "origin", branch]);
|
|
166
|
+
if (firstPush.exitCode !== 0) {
|
|
167
|
+
const out = `${firstPush.stdout}\n${firstPush.stderr}`;
|
|
168
|
+
if (!/non-fast-forward|\(fetch first\)/i.test(out)) {
|
|
169
|
+
row.status = "failed";
|
|
170
|
+
row.error = `destination push failed: ${out.trim().split("\n").slice(-1)[0] ?? ""}`;
|
|
171
|
+
return row;
|
|
172
|
+
}
|
|
173
|
+
// Reconcile once — the exported tree is authoritative; remote history
|
|
174
|
+
// is preserved. Never force-push.
|
|
175
|
+
row.reconciled = true;
|
|
176
|
+
await git(dest, io, ["fetch", "origin"]);
|
|
177
|
+
const merge = await gitCommit(
|
|
178
|
+
dest,
|
|
179
|
+
io,
|
|
180
|
+
[
|
|
181
|
+
"merge",
|
|
182
|
+
"-s",
|
|
183
|
+
"ours",
|
|
184
|
+
"--allow-unrelated-histories",
|
|
185
|
+
"-m",
|
|
186
|
+
"merge: reconcile remote export history (local tree is authoritative export)",
|
|
187
|
+
`origin/${branch}`,
|
|
188
|
+
],
|
|
189
|
+
"publish",
|
|
190
|
+
);
|
|
191
|
+
if (merge.exitCode !== 0) {
|
|
192
|
+
row.status = "failed";
|
|
193
|
+
row.error = `reconcile merge failed: ${merge.stderr.trim().split("\n").slice(-1)[0] ?? ""}`;
|
|
194
|
+
return row;
|
|
195
|
+
}
|
|
196
|
+
const retry = await git(dest, io, ["push", "-u", "origin", branch]);
|
|
197
|
+
if (retry.exitCode !== 0) {
|
|
198
|
+
row.status = "failed";
|
|
199
|
+
row.error = `destination push failed after reconcile: ${retry.stderr.trim().split("\n").slice(-1)[0] ?? ""}`;
|
|
200
|
+
return row;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
row.destHead = (await git(dest, io, ["rev-parse", "HEAD"])).stdout.trim();
|
|
205
|
+
return row;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface LineVerifyResult {
|
|
209
|
+
ok: boolean;
|
|
210
|
+
/** True when the line carries no extract.config.yaml — nothing to verify. */
|
|
211
|
+
skipped: boolean;
|
|
212
|
+
/** FLOW-CUT-13 detail when ok === false. */
|
|
213
|
+
detail: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Pre-tag extract verification (RFC-1502): extract the line at `ref` into a
|
|
218
|
+
* scratch directory under os.tmpdir() — `--dest` redirects the output, the
|
|
219
|
+
* configured destination is never written — then run the extract-verify
|
|
220
|
+
* hook against the scratch. The scratch is always removed. A line without
|
|
221
|
+
* an extract.config.yaml is skipped (nothing publishable to verify).
|
|
222
|
+
*/
|
|
223
|
+
export async function verifyLineAtRef(
|
|
224
|
+
primary: string,
|
|
225
|
+
io: WorkspaceIO,
|
|
226
|
+
opts: { line: ReleaseLine; ref: string },
|
|
227
|
+
): Promise<LineVerifyResult> {
|
|
228
|
+
const { line, ref } = opts;
|
|
229
|
+
const dir = line.paths[0];
|
|
230
|
+
if (dir === undefined || !(await io.exists(join(primary, dir, "extract.config.yaml")))) {
|
|
231
|
+
return { ok: true, skipped: true, detail: "" };
|
|
232
|
+
}
|
|
233
|
+
const scratch = await mkdtemp(join(tmpdir(), "flow-extract-"));
|
|
234
|
+
try {
|
|
235
|
+
const extractBin = join(primary, "node_modules", ".bin", "repo-extract");
|
|
236
|
+
let extract;
|
|
237
|
+
try {
|
|
238
|
+
extract = await io.exec(
|
|
239
|
+
extractBin,
|
|
240
|
+
["--config", `${dir}/extract.config.yaml`, "--ref", ref, "--dest", scratch, "--no-push"],
|
|
241
|
+
{ cwd: primary },
|
|
242
|
+
);
|
|
243
|
+
} catch (error) {
|
|
244
|
+
return {
|
|
245
|
+
ok: false,
|
|
246
|
+
skipped: false,
|
|
247
|
+
detail: `repo-extract could not run at ${extractBin}: ${error instanceof Error ? error.message : String(error)}`,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
if (extract.exitCode !== 0) {
|
|
251
|
+
const last = extract.stderr.trim().split("\n").filter((l) => l.length > 0).slice(-1)[0] ?? "";
|
|
252
|
+
return { ok: false, skipped: false, detail: `repo-extract failed (exit ${extract.exitCode}): ${last}` };
|
|
253
|
+
}
|
|
254
|
+
const verify = await runFlowScript(io, "extract-verify", {
|
|
255
|
+
primary,
|
|
256
|
+
cwd: primary,
|
|
257
|
+
env: {
|
|
258
|
+
FORGE_FLOW_EXTRACT_DEST: scratch,
|
|
259
|
+
FORGE_FLOW_REF: ref,
|
|
260
|
+
FORGE_FLOW_LINE: line.id,
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
if (verify.status === "failed") {
|
|
264
|
+
return { ok: false, skipped: false, detail: `extract-verify failed (exit ${verify.exitCode}): ${verify.stderrTail}` };
|
|
265
|
+
}
|
|
266
|
+
return { ok: true, skipped: false, detail: "" };
|
|
267
|
+
} finally {
|
|
268
|
+
// Scratch removal is best-effort — a removal failure must not mask a
|
|
269
|
+
// computed verification result (nor crash the cut after ok was decided).
|
|
270
|
+
await rm(scratch, { recursive: true, force: true }).catch(() => {});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Local branch registry and event journal for the session lifecycle
|
|
4
|
+
(RFC-1487). The registry lives at <common-gitdir>/forge/registry.yaml —
|
|
5
|
+
the same file from every worktree — and records every live auto branch with
|
|
6
|
+
its owner, base sha, worktree, opened/updated times and the reserved held
|
|
7
|
+
field. The journal appends one JSON line per lifecycle event to
|
|
8
|
+
forge/journal.jsonl.</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>No lifecycle policy — handlers decide when entries open, update or close.</item>
|
|
11
|
+
<item>No commits — the registry lives under the common git dir, never in a tree.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
<KEY_DECISIONS>
|
|
15
|
+
<item>A schema-invalid registry throws FlowRegistrySchemaError — every flow command surfaces it as FLOW-07 naming the file; a damaged registry is never silently rewritten.</item>
|
|
16
|
+
<item>Registry updates hold a 10 s O_EXCL lock and write via temp file + rename — parallel sessions never observe a torn file (AC-8).</item>
|
|
17
|
+
<item>`held` is typed null now — the wave-2 outbound RFC widens it to { heldAt, riskCategory, reason }.</item>
|
|
18
|
+
</KEY_DECISIONS>
|
|
19
|
+
<CHANGE_SUMMARY>
|
|
20
|
+
<item>RFC-1487: step 1 — worktree path contracts, O_EXCL locks, branch registry and journal</item>
|
|
21
|
+
<item>RFC-1490: step 2 — registry fix/port widening, FORGE_FLOW_COMMIT gitCommit helper, verified version-files writes</item>
|
|
22
|
+
<item>RFC-1491: step 1 — journal base/rewrites + held registry widening, W1-1 discard tip, FLOW-INT-11</item>
|
|
23
|
+
<item>RFC-1491: step 3 — flow.digest risk digest with journal-attributed items, categories, digestId</item>
|
|
24
|
+
<item>RFC-1503: steps 1-5 — highest-per-line pending selection, publish-superseded/publish-retired journal events, flow.publication.retire</item>
|
|
25
|
+
<history>RFC-1487</history>
|
|
26
|
+
</CHANGE_SUMMARY>
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
30
|
+
|
|
31
|
+
import { parse as yamlParse, stringify as yamlStringify } from "yaml";
|
|
32
|
+
import { z } from "zod";
|
|
33
|
+
|
|
34
|
+
import type { WorkspaceIO } from "../../src/types.ts";
|
|
35
|
+
|
|
36
|
+
import { git } from "./git.ts";
|
|
37
|
+
import { withFlowLock } from "./locks.ts";
|
|
38
|
+
|
|
39
|
+
export const STALE_AFTER_HOURS = 72;
|
|
40
|
+
export const REGISTRY_RELATIVE_PATH = "forge/registry.yaml";
|
|
41
|
+
export const REGISTRY_LOCK_RELATIVE_PATH = "forge/registry.lock";
|
|
42
|
+
export const INTEGRATE_LOCK_RELATIVE_PATH = "forge/integrate.lock";
|
|
43
|
+
export const JOURNAL_RELATIVE_PATH = "forge/journal.jsonl";
|
|
44
|
+
|
|
45
|
+
export const REGISTRY_LOCK_WAIT_MS = 10_000;
|
|
46
|
+
export const REGISTRY_LOCK_STALE_MS = 60_000;
|
|
47
|
+
|
|
48
|
+
/** Fixed risk categories for digest items and held entries (RFC-1491). */
|
|
49
|
+
export const RISK_CATEGORIES = [
|
|
50
|
+
"contract",
|
|
51
|
+
"migration",
|
|
52
|
+
"invariant",
|
|
53
|
+
"capability-removal",
|
|
54
|
+
"major-dependency",
|
|
55
|
+
"other",
|
|
56
|
+
] as const;
|
|
57
|
+
export type RiskCategory = (typeof RISK_CATEGORIES)[number];
|
|
58
|
+
|
|
59
|
+
export const flowRegistryEntrySchema = z
|
|
60
|
+
.object({
|
|
61
|
+
name: z.string().min(1),
|
|
62
|
+
kind: z.enum(["task", "session", "fix"]),
|
|
63
|
+
base: z.enum(["develop", "main"]),
|
|
64
|
+
baseSha: z.string().regex(/^[0-9a-f]{40}$/),
|
|
65
|
+
worktree: z.string().min(1).nullable(),
|
|
66
|
+
owner: z
|
|
67
|
+
.object({
|
|
68
|
+
kind: z.enum(["session", "task"]),
|
|
69
|
+
id: z.string().min(1),
|
|
70
|
+
})
|
|
71
|
+
.strict(),
|
|
72
|
+
brief: z.string().nullable(),
|
|
73
|
+
openedAt: z.string().min(1),
|
|
74
|
+
updatedAt: z.string().min(1),
|
|
75
|
+
held: z
|
|
76
|
+
.object({
|
|
77
|
+
heldAt: z.string().min(1),
|
|
78
|
+
riskCategory: z.enum(RISK_CATEGORIES),
|
|
79
|
+
reason: z.string().min(1),
|
|
80
|
+
tip: z.string().regex(/^[0-9a-f]{40}$/),
|
|
81
|
+
})
|
|
82
|
+
.strict()
|
|
83
|
+
.nullable(),
|
|
84
|
+
port: z
|
|
85
|
+
.object({
|
|
86
|
+
mainSha: z.string().regex(/^[0-9a-f]{40}$/),
|
|
87
|
+
tags: z.array(z.string().min(1)).min(1),
|
|
88
|
+
})
|
|
89
|
+
.strict()
|
|
90
|
+
.nullable()
|
|
91
|
+
.default(null),
|
|
92
|
+
})
|
|
93
|
+
.strict()
|
|
94
|
+
.refine((e) => (e.base === "main") === (e.kind === "fix"), {
|
|
95
|
+
message: "base 'main' ⇔ kind 'fix' — task/session branches always base on develop (RFC-1490)",
|
|
96
|
+
})
|
|
97
|
+
.refine((e) => (e.worktree === null) === (e.held !== null), {
|
|
98
|
+
message: "worktree null ⇔ held — a held branch keeps no worktree, an unheld one always has one (RFC-1491)",
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export const flowRegistrySchema = z
|
|
102
|
+
.object({
|
|
103
|
+
schema: z.literal("forge/flow-registry@1"),
|
|
104
|
+
branches: z.array(flowRegistryEntrySchema),
|
|
105
|
+
})
|
|
106
|
+
.strict();
|
|
107
|
+
|
|
108
|
+
export type FlowRegistryEntry = z.infer<typeof flowRegistryEntrySchema>;
|
|
109
|
+
export type FlowRegistryV1 = z.infer<typeof flowRegistrySchema>;
|
|
110
|
+
|
|
111
|
+
export class FlowRegistrySchemaError extends Error {
|
|
112
|
+
readonly file: string;
|
|
113
|
+
readonly detail: string;
|
|
114
|
+
constructor(file: string, detail: string) {
|
|
115
|
+
super(`registry ${file} fails the forge/flow-registry@1 schema: ${detail}`);
|
|
116
|
+
this.name = "FlowRegistrySchemaError";
|
|
117
|
+
this.file = file;
|
|
118
|
+
this.detail = detail;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface FlowJournalEvent {
|
|
123
|
+
at: string;
|
|
124
|
+
event:
|
|
125
|
+
| "open"
|
|
126
|
+
| "integrate"
|
|
127
|
+
| "discard"
|
|
128
|
+
| "cut"
|
|
129
|
+
| "fix"
|
|
130
|
+
| "backmerge"
|
|
131
|
+
| "hold"
|
|
132
|
+
| "unhold"
|
|
133
|
+
| "push"
|
|
134
|
+
| "publish"
|
|
135
|
+
| "publish-superseded"
|
|
136
|
+
| "publish-retired";
|
|
137
|
+
branch: string;
|
|
138
|
+
sha: string;
|
|
139
|
+
detail: string;
|
|
140
|
+
/** develop before (integrate/backmerge/cut/hold); branch base (discard) — W1-1. */
|
|
141
|
+
base?: string;
|
|
142
|
+
/** hold only — the new (base, sha] range of every replayed item. */
|
|
143
|
+
rewrites?: Array<{
|
|
144
|
+
branch: string;
|
|
145
|
+
kind: "integration" | "backmerge" | "release";
|
|
146
|
+
base: string;
|
|
147
|
+
sha: string;
|
|
148
|
+
}>;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function emptyRegistry(): FlowRegistryV1 {
|
|
152
|
+
return { schema: "forge/flow-registry@1", branches: [] };
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function registryPath(commonGitDir: string): string {
|
|
156
|
+
return join(commonGitDir, REGISTRY_RELATIVE_PATH);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Absolute path of the repository's common git dir — shared across all
|
|
161
|
+
* worktrees. `git rev-parse --git-common-dir` may answer relative to cwd.
|
|
162
|
+
*/
|
|
163
|
+
export async function commonGitDir(io: WorkspaceIO, cwd: string): Promise<string> {
|
|
164
|
+
const result = await git(cwd, io, ["rev-parse", "--git-common-dir"]);
|
|
165
|
+
if (result.exitCode !== 0) {
|
|
166
|
+
throw new Error(
|
|
167
|
+
`git rev-parse --git-common-dir failed (exit ${result.exitCode}): ${result.stderr.trim()}`,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
const dir = result.stdout.trim();
|
|
171
|
+
return isAbsolute(dir) ? dir : resolve(cwd, dir);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Read the registry; a missing file yields the empty registry. */
|
|
175
|
+
export async function readRegistry(
|
|
176
|
+
io: WorkspaceIO,
|
|
177
|
+
commonGitDir: string,
|
|
178
|
+
): Promise<FlowRegistryV1> {
|
|
179
|
+
const file = registryPath(commonGitDir);
|
|
180
|
+
if (!(await io.exists(file))) return emptyRegistry();
|
|
181
|
+
let raw: unknown;
|
|
182
|
+
try {
|
|
183
|
+
raw = yamlParse(await io.readFile(file));
|
|
184
|
+
} catch (error) {
|
|
185
|
+
throw new FlowRegistrySchemaError(
|
|
186
|
+
file,
|
|
187
|
+
`unparseable YAML: ${error instanceof Error ? error.message : String(error)}`,
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
const parsed = flowRegistrySchema.safeParse(raw);
|
|
191
|
+
if (!parsed.success) {
|
|
192
|
+
throw new FlowRegistrySchemaError(
|
|
193
|
+
file,
|
|
194
|
+
parsed.error.issues
|
|
195
|
+
.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`)
|
|
196
|
+
.join("; "),
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
return parsed.data;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Read-mutate-write under the registry lock (10 s wait, 60 s stale).
|
|
204
|
+
* Branches are stored sorted by name; the write is temp file + rename so a
|
|
205
|
+
* reader never sees a torn document.
|
|
206
|
+
*/
|
|
207
|
+
export async function updateRegistry(
|
|
208
|
+
io: WorkspaceIO,
|
|
209
|
+
commonGitDir: string,
|
|
210
|
+
mutate: (r: FlowRegistryV1) => FlowRegistryV1,
|
|
211
|
+
): Promise<FlowRegistryV1> {
|
|
212
|
+
const lockPath = join(commonGitDir, REGISTRY_LOCK_RELATIVE_PATH);
|
|
213
|
+
await io.mkdir(join(commonGitDir, "forge"));
|
|
214
|
+
return withFlowLock(
|
|
215
|
+
lockPath,
|
|
216
|
+
{ waitMs: REGISTRY_LOCK_WAIT_MS, staleMs: REGISTRY_LOCK_STALE_MS },
|
|
217
|
+
async () => {
|
|
218
|
+
const current = await readRegistry(io, commonGitDir);
|
|
219
|
+
const next = mutate(current);
|
|
220
|
+
next.branches = [...next.branches].sort((a, b) => a.name.localeCompare(b.name));
|
|
221
|
+
const file = registryPath(commonGitDir);
|
|
222
|
+
const tmp = `${file}.tmp-${process.pid}`;
|
|
223
|
+
await io.writeFile(tmp, yamlStringify(next));
|
|
224
|
+
await io.rename(tmp, file);
|
|
225
|
+
return next;
|
|
226
|
+
},
|
|
227
|
+
io,
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Append one journal line — best-effort bookkeeping, append-only. */
|
|
232
|
+
export async function appendJournal(
|
|
233
|
+
io: WorkspaceIO,
|
|
234
|
+
commonGitDir: string,
|
|
235
|
+
event: Omit<FlowJournalEvent, "at"> & { at?: string },
|
|
236
|
+
): Promise<void> {
|
|
237
|
+
const file = join(commonGitDir, JOURNAL_RELATIVE_PATH);
|
|
238
|
+
await io.mkdir(dirname(file));
|
|
239
|
+
const line: FlowJournalEvent = {
|
|
240
|
+
at: event.at ?? new Date().toISOString(),
|
|
241
|
+
event: event.event,
|
|
242
|
+
branch: event.branch,
|
|
243
|
+
sha: event.sha,
|
|
244
|
+
detail: event.detail,
|
|
245
|
+
};
|
|
246
|
+
if (event.base !== undefined) line.base = event.base;
|
|
247
|
+
if (event.rewrites !== undefined) line.rewrites = event.rewrites;
|
|
248
|
+
await io.appendFile(file, `${JSON.stringify(line)}\n`);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** Read every journal line in append order; a missing file yields []. */
|
|
252
|
+
export async function readJournal(
|
|
253
|
+
io: WorkspaceIO,
|
|
254
|
+
commonGitDir: string,
|
|
255
|
+
): Promise<FlowJournalEvent[]> {
|
|
256
|
+
const file = join(commonGitDir, JOURNAL_RELATIVE_PATH);
|
|
257
|
+
if (!(await io.exists(file))) return [];
|
|
258
|
+
const events: FlowJournalEvent[] = [];
|
|
259
|
+
for (const line of (await io.readFile(file)).split("\n")) {
|
|
260
|
+
const trimmed = line.trim();
|
|
261
|
+
if (trimmed.length === 0) continue;
|
|
262
|
+
try {
|
|
263
|
+
events.push(JSON.parse(trimmed) as FlowJournalEvent);
|
|
264
|
+
} catch {
|
|
265
|
+
// A torn append is skipped — the journal is bookkeeping, never a gate.
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return events;
|
|
269
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Pending release level for a line (RFC-1488): count the commits in
|
|
4
|
+
`<since>..HEAD` touching the line's paths, read their `X-RFC` trailers,
|
|
5
|
+
resolve each RFC's `versionBump` through the canonical RFC reader named by
|
|
6
|
+
forge.yaml resolverDoors.rfc, and report the highest pending level plus the
|
|
7
|
+
next release version it implies.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No tag listing or version-file reading — release-tags.ts and the handler own those.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<KEY_DECISIONS>
|
|
13
|
+
<item>`patch` is the floor for any commit — a change merged without an X-RFC trailer still levels the line; `none` only when zero commits touched the line.</item>
|
|
14
|
+
<item>Missing/unreadable RFC file counts as `patch` plus a FLOW-VER-03 warning — the RFC contract, and a safer under- than over-statement.</item>
|
|
15
|
+
<item>RFC frontmatter is read only via `listRfcFiles`/`readAndParseRfc` (RFC-1465) — never re-parsed locally.</item>
|
|
16
|
+
</KEY_DECISIONS>
|
|
17
|
+
<CHANGE_SUMMARY>
|
|
18
|
+
<item>RFC-1488: step 3 — pending level from X-RFC trailers + versionBump</item>
|
|
19
|
+
<item>RFC-1488: steps 2-4 — release tags, pending level (X-RFC + versionBump), flow.version command</item>
|
|
20
|
+
<item>RFC-1488: review r1 — parse guard, door/rules metadata, id-exact RFC binding, refname precision, FLOW-09 top-level anchor, test cleanup</item>
|
|
21
|
+
<item>RFC-1490: step 1 — explicit ref param on tag/level helpers + W1-2 +0.<hash>.dirty shape (AC-12)</item>
|
|
22
|
+
</CHANGE_SUMMARY>
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { join } from "node:path";
|
|
26
|
+
|
|
27
|
+
import { listRfcFiles, readAndParseRfc, rfcFileMatchesId } from "../rfc/frontmatter-io.ts";
|
|
28
|
+
import type { Diagnostic, WorkspaceIO } from "../../src/types.ts";
|
|
29
|
+
import { git } from "./git.ts";
|
|
30
|
+
import type { ReleaseLine } from "./release-lines.ts";
|
|
31
|
+
import {
|
|
32
|
+
bumpVersion,
|
|
33
|
+
formatVersion,
|
|
34
|
+
maxLevel,
|
|
35
|
+
type ReleaseLevel,
|
|
36
|
+
type SemVer,
|
|
37
|
+
} from "./semver.ts";
|
|
38
|
+
|
|
39
|
+
export interface PendingLevel {
|
|
40
|
+
line: string;
|
|
41
|
+
level: ReleaseLevel;
|
|
42
|
+
/** Distinct X-RFC trailer ids and each RFC's declared versionBump (null when absent/unreadable). */
|
|
43
|
+
rfcs: Array<{ id: string; versionBump: string | null }>;
|
|
44
|
+
/** lastVersion with `level` applied; null when `none` or no baseline tag. */
|
|
45
|
+
nextVersion: string | null;
|
|
46
|
+
/** FLOW-VER-03 entries for RFC files that could not be read. */
|
|
47
|
+
diagnostics: Diagnostic[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const RFC_DIR = "docs/rfcs";
|
|
51
|
+
const VALID_BUMPS = new Set(["patch", "minor", "major"]);
|
|
52
|
+
|
|
53
|
+
/** Distinct `X-RFC:` trailer values in the commits of `range` touching `paths`. */
|
|
54
|
+
async function xRfcTrailers(
|
|
55
|
+
repoRoot: string,
|
|
56
|
+
range: string,
|
|
57
|
+
paths: string[],
|
|
58
|
+
io: WorkspaceIO,
|
|
59
|
+
): Promise<string[]> {
|
|
60
|
+
const args = ["log", "--format=%(trailers:key=X-RFC,valueonly,separator=%x20)", range];
|
|
61
|
+
if (paths.length > 0) args.push("--", ...paths);
|
|
62
|
+
const result = await git(repoRoot, io, args);
|
|
63
|
+
if (result.exitCode !== 0) return [];
|
|
64
|
+
const ids = new Set<string>();
|
|
65
|
+
for (const token of result.stdout.split(/[\s]+/)) {
|
|
66
|
+
if (/^RFC-\d+$/i.test(token)) ids.add(token.toUpperCase());
|
|
67
|
+
}
|
|
68
|
+
return [...ids].sort();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Pending level of `line` over `since..HEAD` (`since` = "" → all of HEAD).
|
|
73
|
+
* `lastVersion` (the line's last tag version) anchors `nextVersion`; null
|
|
74
|
+
* keeps `nextVersion` null.
|
|
75
|
+
*/
|
|
76
|
+
export async function pendingLevel(
|
|
77
|
+
line: ReleaseLine,
|
|
78
|
+
since: string,
|
|
79
|
+
io: WorkspaceIO,
|
|
80
|
+
repoRoot: string,
|
|
81
|
+
lastVersion: SemVer | null,
|
|
82
|
+
ref = "HEAD",
|
|
83
|
+
): Promise<PendingLevel> {
|
|
84
|
+
const range = since === "" ? ref : `${since}..${ref}`;
|
|
85
|
+
const countArgs = ["rev-list", "--count", range];
|
|
86
|
+
if (line.paths.length > 0) countArgs.push("--", ...line.paths);
|
|
87
|
+
const count = await git(repoRoot, io, countArgs);
|
|
88
|
+
const commitsSince = count.exitCode === 0 ? Number.parseInt(count.stdout.trim(), 10) : 0;
|
|
89
|
+
|
|
90
|
+
const diagnostics: Diagnostic[] = [];
|
|
91
|
+
const rfcs: PendingLevel["rfcs"] = [];
|
|
92
|
+
let level: ReleaseLevel = Number.isFinite(commitsSince) && commitsSince > 0 ? "patch" : "none";
|
|
93
|
+
|
|
94
|
+
if (commitsSince > 0) {
|
|
95
|
+
const rfcDirPath = join(repoRoot, RFC_DIR);
|
|
96
|
+
const rfcFiles = await listRfcFiles(rfcDirPath);
|
|
97
|
+
for (const id of await xRfcTrailers(repoRoot, range, line.paths, io)) {
|
|
98
|
+
const fileName = rfcFiles.find((f) => rfcFileMatchesId(f, id));
|
|
99
|
+
if (fileName === undefined) {
|
|
100
|
+
diagnostics.push({
|
|
101
|
+
ruleId: "FLOW-VER-03",
|
|
102
|
+
severity: "warning",
|
|
103
|
+
message: `X-RFC trailer names ${id} but no RFC file under ${RFC_DIR} matches — counted as patch`,
|
|
104
|
+
});
|
|
105
|
+
rfcs.push({ id, versionBump: null });
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const parsed = await readAndParseRfc(rfcDirPath, fileName);
|
|
109
|
+
// The filename match is a prefix heuristic — a trailer like RFC-148
|
|
110
|
+
// would otherwise bind rfc-1488-*'s bump. The frontmatter id is
|
|
111
|
+
// authoritative; a mismatch counts as missing.
|
|
112
|
+
const frontmatterId =
|
|
113
|
+
parsed && "parsed" in parsed
|
|
114
|
+
? String(parsed.parsed.frontmatter["id"] ?? "").trim().toUpperCase()
|
|
115
|
+
: "";
|
|
116
|
+
if (!parsed || !("parsed" in parsed) || frontmatterId !== id) {
|
|
117
|
+
diagnostics.push({
|
|
118
|
+
ruleId: "FLOW-VER-03",
|
|
119
|
+
severity: "warning",
|
|
120
|
+
message: `could not read ${id} (${fileName}) — counted as patch`,
|
|
121
|
+
});
|
|
122
|
+
rfcs.push({ id, versionBump: null });
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
const raw = parsed.parsed.frontmatter["versionBump"];
|
|
126
|
+
const bump = typeof raw === "string" && VALID_BUMPS.has(raw) ? (raw as ReleaseLevel) : null;
|
|
127
|
+
if (bump !== null) level = maxLevel(level, bump);
|
|
128
|
+
rfcs.push({ id, versionBump: typeof raw === "string" ? raw : null });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const nextVersion =
|
|
133
|
+
level !== "none" && lastVersion !== null
|
|
134
|
+
? formatVersion(bumpVersion(lastVersion, level as Exclude<ReleaseLevel, "none">))
|
|
135
|
+
: null;
|
|
136
|
+
|
|
137
|
+
return { line: line.id, level, rfcs, nextVersion, diagnostics };
|
|
138
|
+
}
|
|
139
|
+
|