@warpgogol/forge 9.1.1 → 9.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/bin/cli.ts +3 -2
- package/dist/bin/cli.js +3 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +6 -4
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/flow/branch-name.d.ts +56 -0
- package/dist/os/flow/branch-name.d.ts.map +1 -0
- package/dist/os/flow/branch-name.js +108 -0
- package/dist/os/flow/branch-name.js.map +1 -0
- package/dist/os/flow/digest.d.ts +73 -0
- package/dist/os/flow/digest.d.ts.map +1 -0
- package/dist/os/flow/digest.js +634 -0
- package/dist/os/flow/digest.js.map +1 -0
- package/dist/os/flow/flow.module.d.ts +3 -0
- package/dist/os/flow/flow.module.d.ts.map +1 -0
- package/dist/os/flow/flow.module.js +716 -0
- package/dist/os/flow/flow.module.js.map +1 -0
- package/dist/os/flow/git.d.ts +68 -0
- package/dist/os/flow/git.d.ts.map +1 -0
- package/dist/os/flow/git.js +257 -0
- package/dist/os/flow/git.js.map +1 -0
- package/dist/os/flow/guard-files.d.ts +50 -0
- package/dist/os/flow/guard-files.d.ts.map +1 -0
- package/dist/os/flow/guard-files.js +147 -0
- package/dist/os/flow/guard-files.js.map +1 -0
- package/dist/os/flow/handlers/flow-backmerge.d.ts +27 -0
- package/dist/os/flow/handlers/flow-backmerge.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-backmerge.js +332 -0
- package/dist/os/flow/handlers/flow-backmerge.js.map +1 -0
- package/dist/os/flow/handlers/flow-check.d.ts +42 -0
- package/dist/os/flow/handlers/flow-check.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-check.js +347 -0
- package/dist/os/flow/handlers/flow-check.js.map +1 -0
- package/dist/os/flow/handlers/flow-cut.d.ts +63 -0
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-cut.js +636 -0
- package/dist/os/flow/handlers/flow-cut.js.map +1 -0
- package/dist/os/flow/handlers/flow-digest.d.ts +5 -0
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-digest.js +110 -0
- package/dist/os/flow/handlers/flow-digest.js.map +1 -0
- package/dist/os/flow/handlers/flow-discard.d.ts +22 -0
- package/dist/os/flow/handlers/flow-discard.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-discard.js +200 -0
- package/dist/os/flow/handlers/flow-discard.js.map +1 -0
- package/dist/os/flow/handlers/flow-fix.d.ts +47 -0
- package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-fix.js +443 -0
- package/dist/os/flow/handlers/flow-fix.js.map +1 -0
- package/dist/os/flow/handlers/flow-hold.d.ts +32 -0
- package/dist/os/flow/handlers/flow-hold.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-hold.js +359 -0
- package/dist/os/flow/handlers/flow-hold.js.map +1 -0
- package/dist/os/flow/handlers/flow-install.d.ts +92 -0
- package/dist/os/flow/handlers/flow-install.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-install.js +883 -0
- package/dist/os/flow/handlers/flow-install.js.map +1 -0
- package/dist/os/flow/handlers/flow-integrate.d.ts +35 -0
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-integrate.js +419 -0
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -0
- package/dist/os/flow/handlers/flow-open.d.ts +63 -0
- package/dist/os/flow/handlers/flow-open.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-open.js +294 -0
- package/dist/os/flow/handlers/flow-open.js.map +1 -0
- package/dist/os/flow/handlers/flow-push.d.ts +22 -0
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-push.js +306 -0
- package/dist/os/flow/handlers/flow-push.js.map +1 -0
- package/dist/os/flow/handlers/flow-status.d.ts +65 -0
- package/dist/os/flow/handlers/flow-status.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-status.js +193 -0
- package/dist/os/flow/handlers/flow-status.js.map +1 -0
- package/dist/os/flow/handlers/flow-unhold.d.ts +20 -0
- package/dist/os/flow/handlers/flow-unhold.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-unhold.js +158 -0
- package/dist/os/flow/handlers/flow-unhold.js.map +1 -0
- package/dist/os/flow/handlers/flow-version.d.ts +39 -0
- package/dist/os/flow/handlers/flow-version.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-version.js +122 -0
- package/dist/os/flow/handlers/flow-version.js.map +1 -0
- package/dist/os/flow/index.d.ts +30 -0
- package/dist/os/flow/index.d.ts.map +1 -0
- package/dist/os/flow/index.js +83 -0
- package/dist/os/flow/index.js.map +1 -0
- package/dist/os/flow/line-version.d.ts +23 -0
- package/dist/os/flow/line-version.d.ts.map +1 -0
- package/dist/os/flow/line-version.js +83 -0
- package/dist/os/flow/line-version.js.map +1 -0
- package/dist/os/flow/locks.d.ts +34 -0
- package/dist/os/flow/locks.d.ts.map +1 -0
- package/dist/os/flow/locks.js +147 -0
- package/dist/os/flow/locks.js.map +1 -0
- package/dist/os/flow/markers.d.ts +49 -0
- package/dist/os/flow/markers.d.ts.map +1 -0
- package/dist/os/flow/markers.js +112 -0
- package/dist/os/flow/markers.js.map +1 -0
- package/dist/os/flow/publish.d.ts +28 -0
- package/dist/os/flow/publish.d.ts.map +1 -0
- package/dist/os/flow/publish.js +153 -0
- package/dist/os/flow/publish.js.map +1 -0
- package/dist/os/flow/registry.d.ts +142 -0
- package/dist/os/flow/registry.d.ts.map +1 -0
- package/dist/os/flow/registry.js +198 -0
- package/dist/os/flow/registry.js.map +1 -0
- package/dist/os/flow/release-level.d.ts +23 -0
- package/dist/os/flow/release-level.d.ts.map +1 -0
- package/dist/os/flow/release-level.js +102 -0
- package/dist/os/flow/release-level.js.map +1 -0
- package/dist/os/flow/release-lines.d.ts +25 -0
- package/dist/os/flow/release-lines.d.ts.map +1 -0
- package/dist/os/flow/release-lines.js +172 -0
- package/dist/os/flow/release-lines.js.map +1 -0
- package/dist/os/flow/release-tags.d.ts +72 -0
- package/dist/os/flow/release-tags.d.ts.map +1 -0
- package/dist/os/flow/release-tags.js +166 -0
- package/dist/os/flow/release-tags.js.map +1 -0
- package/dist/os/flow/repo-kind.d.ts +41 -0
- package/dist/os/flow/repo-kind.d.ts.map +1 -0
- package/dist/os/flow/repo-kind.js +92 -0
- package/dist/os/flow/repo-kind.js.map +1 -0
- package/dist/os/flow/scripts.d.ts +20 -0
- package/dist/os/flow/scripts.d.ts.map +1 -0
- package/dist/os/flow/scripts.js +49 -0
- package/dist/os/flow/scripts.js.map +1 -0
- package/dist/os/flow/semver.d.ts +21 -0
- package/dist/os/flow/semver.d.ts.map +1 -0
- package/dist/os/flow/semver.js +73 -0
- package/dist/os/flow/semver.js.map +1 -0
- package/dist/os/flow/tests/helpers.d.ts +52 -0
- package/dist/os/flow/tests/helpers.d.ts.map +1 -0
- package/dist/os/flow/tests/helpers.js +189 -0
- package/dist/os/flow/tests/helpers.js.map +1 -0
- package/dist/os/flow/version-files.d.ts +21 -0
- package/dist/os/flow/version-files.d.ts.map +1 -0
- package/dist/os/flow/version-files.js +94 -0
- package/dist/os/flow/version-files.js.map +1 -0
- package/dist/os/flow/worktree-path.d.ts +31 -0
- package/dist/os/flow/worktree-path.d.ts.map +1 -0
- package/dist/os/flow/worktree-path.js +80 -0
- package/dist/os/flow/worktree-path.js.map +1 -0
- package/dist/os/mission/handlers/archive.d.ts.map +1 -1
- package/dist/os/mission/handlers/archive.js +43 -6
- package/dist/os/mission/handlers/archive.js.map +1 -1
- package/dist/os/program/handlers/seal.d.ts.map +1 -1
- package/dist/os/program/handlers/seal.js +1 -1
- package/dist/os/program/handlers/seal.js.map +1 -1
- package/dist/os/program/handlers/validate.d.ts.map +1 -1
- package/dist/os/program/handlers/validate.js +1 -1
- package/dist/os/program/handlers/validate.js.map +1 -1
- package/dist/os/program/program.module.d.ts.map +1 -1
- package/dist/os/program/program.module.js +2 -1
- package/dist/os/program/program.module.js.map +1 -1
- package/dist/os/program/schemas.d.ts +4 -6
- package/dist/os/program/schemas.d.ts.map +1 -1
- package/dist/os/program/schemas.js +16 -6
- package/dist/os/program/schemas.js.map +1 -1
- package/dist/os/program/state.d.ts +0 -1
- package/dist/os/program/state.d.ts.map +1 -1
- package/dist/os/program/state.js +1 -7
- package/dist/os/program/state.js.map +1 -1
- package/dist/os/rfc/acceptance.d.ts +21 -0
- package/dist/os/rfc/acceptance.d.ts.map +1 -1
- package/dist/os/rfc/acceptance.js +62 -13
- package/dist/os/rfc/acceptance.js.map +1 -1
- package/dist/os/rfc/frontmatter-io.d.ts +19 -0
- package/dist/os/rfc/frontmatter-io.d.ts.map +1 -1
- package/dist/os/rfc/frontmatter-io.js +65 -12
- package/dist/os/rfc/frontmatter-io.js.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts +2 -5
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +10 -8
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/handlers/validate.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate.js +15 -5
- package/dist/os/rfc/handlers/validate.js.map +1 -1
- package/dist/os/rfc/index.d.ts +2 -2
- package/dist/os/rfc/index.d.ts.map +1 -1
- package/dist/os/rfc/index.js +5 -2
- package/dist/os/rfc/index.js.map +1 -1
- package/dist/os/rfc/probe-batch.d.ts +71 -0
- package/dist/os/rfc/probe-batch.d.ts.map +1 -0
- package/dist/os/rfc/probe-batch.js +251 -0
- package/dist/os/rfc/probe-batch.js.map +1 -0
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +16 -2
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +21 -10
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
- package/dist/os/rfc/verification-refresh.js +20 -13
- package/dist/os/rfc/verification-refresh.js.map +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts.map +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js +21 -7
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js.map +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +1 -1
- package/dist/os/werkstatt/werkstatt.module.d.ts.map +1 -1
- package/dist/os/werkstatt/werkstatt.module.js +2 -82
- package/dist/os/werkstatt/werkstatt.module.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +0 -3
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +2 -4
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
- package/dist/src/onboarding/agents-generate.js +49 -4
- package/dist/src/onboarding/agents-generate.js.map +1 -1
- package/dist/src/onboarding/create.d.ts +13 -0
- package/dist/src/onboarding/create.d.ts.map +1 -1
- package/dist/src/onboarding/create.js +95 -9
- package/dist/src/onboarding/create.js.map +1 -1
- package/dist/src/onboarding/doctor.d.ts.map +1 -1
- package/dist/src/onboarding/doctor.js +2 -47
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/upgrade.d.ts +5 -0
- package/dist/src/onboarding/upgrade.d.ts.map +1 -1
- package/dist/src/onboarding/upgrade.js +70 -1
- package/dist/src/onboarding/upgrade.js.map +1 -1
- package/dist/src/types.d.ts +9 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +2 -2
- package/docs/branch-model.md +98 -0
- package/docs/maintainers/publishing.md +10 -8
- package/docs/reference/cli.md +0 -3
- package/os/core/core.module.ts +7 -4
- package/os/flow/assets/flow-guard.sh +176 -0
- package/os/flow/branch-name.ts +139 -0
- package/os/flow/digest.ts +761 -0
- package/os/flow/flow.module.ts +740 -0
- package/os/flow/git.ts +342 -0
- package/os/flow/guard-files.ts +172 -0
- package/os/flow/handlers/flow-backmerge.ts +488 -0
- package/os/flow/handlers/flow-check.ts +450 -0
- package/os/flow/handlers/flow-cut.ts +912 -0
- package/os/flow/handlers/flow-digest.ts +124 -0
- package/os/flow/handlers/flow-discard.ts +301 -0
- package/os/flow/handlers/flow-fix.ts +597 -0
- package/os/flow/handlers/flow-hold.ts +500 -0
- package/os/flow/handlers/flow-install.ts +1185 -0
- package/os/flow/handlers/flow-integrate.ts +607 -0
- package/os/flow/handlers/flow-open.ts +447 -0
- package/os/flow/handlers/flow-push.ts +373 -0
- package/os/flow/handlers/flow-status.ts +283 -0
- package/os/flow/handlers/flow-unhold.ts +220 -0
- package/os/flow/handlers/flow-version.ts +196 -0
- package/os/flow/index.ts +102 -0
- package/os/flow/line-version.ts +113 -0
- package/os/flow/locks.ts +177 -0
- package/os/flow/markers.ts +135 -0
- package/os/flow/publish.ts +201 -0
- package/os/flow/registry.ts +266 -0
- package/os/flow/release-level.ts +139 -0
- package/os/flow/release-lines.ts +208 -0
- package/os/flow/release-tags.ts +231 -0
- package/os/flow/repo-kind.ts +117 -0
- package/os/flow/scripts.ts +73 -0
- package/os/flow/semver.ts +82 -0
- package/os/flow/tests/branch-name.test.ts +136 -0
- package/os/flow/tests/fixtures/branch-names.yaml +56 -0
- package/os/flow/tests/flow-backmerge.test.ts +267 -0
- package/os/flow/tests/flow-check-version.test.ts +138 -0
- package/os/flow/tests/flow-check.test.ts +213 -0
- package/os/flow/tests/flow-cut.rerun.test.ts +95 -0
- package/os/flow/tests/flow-cut.test.ts +319 -0
- package/os/flow/tests/flow-digest.test.ts +313 -0
- package/os/flow/tests/flow-discard.test.ts +220 -0
- package/os/flow/tests/flow-fix.test.ts +359 -0
- package/os/flow/tests/flow-guard-merge.test.ts +100 -0
- package/os/flow/tests/flow-guard-parity.test.ts +115 -0
- package/os/flow/tests/flow-guard-push.test.ts +100 -0
- package/os/flow/tests/flow-guard.test.ts +135 -0
- package/os/flow/tests/flow-hold.test.ts +465 -0
- package/os/flow/tests/flow-install-baseline.rerun.test.ts +73 -0
- package/os/flow/tests/flow-install-baseline.test.ts +164 -0
- package/os/flow/tests/flow-install-markers.test.ts +161 -0
- package/os/flow/tests/flow-install.rerun.test.ts +212 -0
- package/os/flow/tests/flow-install.test.ts +330 -0
- package/os/flow/tests/flow-integrate.rerun.test.ts +92 -0
- package/os/flow/tests/flow-integrate.test.ts +229 -0
- package/os/flow/tests/flow-open.test.ts +200 -0
- package/os/flow/tests/flow-push-publish.test.ts +282 -0
- package/os/flow/tests/flow-push.test.ts +160 -0
- package/os/flow/tests/flow-stale.test.ts +136 -0
- package/os/flow/tests/flow-status.test.ts +93 -0
- package/os/flow/tests/flow-version-level.test.ts +116 -0
- package/os/flow/tests/flow-version.test.ts +169 -0
- package/os/flow/tests/helpers.ts +235 -0
- package/os/flow/tests/is-flow-adopted.test.ts +71 -0
- package/os/flow/tests/registry.test.ts +150 -0
- package/os/flow/tests/repository-line-version.test.ts +100 -0
- package/os/flow/tests/scripts.test.ts +97 -0
- package/os/flow/tests/state-roots.test.ts +127 -0
- package/os/flow/tests/version-files.test.ts +145 -0
- package/os/flow/version-files.ts +115 -0
- package/os/flow/worktree-path.ts +107 -0
- package/os/mission/handlers/archive.test.ts +27 -0
- package/os/mission/handlers/archive.ts +46 -6
- package/os/program/handlers/seal.ts +1 -1
- package/os/program/handlers/validate.ts +1 -1
- package/os/program/program.module.ts +2 -1
- package/os/program/schemas.ts +51 -34
- package/os/program/state.ts +1 -9
- package/os/rfc/acceptance.ts +84 -19
- package/os/rfc/frontmatter-io.ts +78 -12
- package/os/rfc/handlers/implement-stamp-stale.test.ts +22 -0
- package/os/rfc/handlers/validate-rules.test.ts +9 -6
- package/os/rfc/handlers/validate-rules.ts +12 -10
- package/os/rfc/handlers/validate.ts +17 -5
- package/os/rfc/index.ts +13 -1
- package/os/rfc/probe-batch.ts +329 -0
- package/os/rfc/rfc.module.ts +19 -2
- package/os/rfc/verification-emit-check.test.ts +22 -0
- package/os/rfc/verification-emit-freshness.test.ts +22 -0
- package/os/rfc/verification-emit.test.ts +22 -0
- package/os/rfc/verification-evidence.ts +21 -16
- package/os/rfc/verification-refresh.test.ts +22 -0
- package/os/rfc/verification-refresh.ts +20 -18
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +9 -0
- package/os/werkstatt/handlers/werkstatt-lock-recover.ts +22 -5
- package/os/werkstatt/handlers/werkstatt-operation-validate.ts +1 -1
- package/os/werkstatt/werkstatt.module.ts +2 -85
- package/package.json +17 -1
- package/profiles/forge-shell.yaml +22 -10
- package/profiles/godot-game.yaml +24 -13
- package/profiles/knowledge.yaml +19 -0
- package/profiles/phaser-game.yaml +25 -13
- package/profiles/site-workshop.yaml +27 -10
- package/profiles/typescript.yaml +26 -9
- package/skills/fo/fo-session-retro/SKILL.md +18 -7
- package/skills/fo/fo-step-commit/SKILL.md +2 -1
- package/src/config/forge-config.ts +2 -6
- package/src/index.ts +8 -0
- package/src/onboarding/agents-generate.ts +49 -5
- package/src/onboarding/create.ts +101 -9
- package/src/onboarding/doctor.ts +2 -51
- package/src/onboarding/upgrade.ts +86 -1
- package/src/tests/agents-generate-flow.test.ts +132 -0
- package/src/tests/create-flow.test.ts +114 -0
- package/src/tests/create.test.ts +22 -21
- package/src/tests/doctor-autonomy.test.ts +2 -1
- package/src/tests/implement-stamp.test.ts +26 -3
- package/src/tests/profile-flow-hooks.test.ts +77 -0
- package/src/tests/program-schemas.test.ts +66 -6
- package/src/tests/program-spec-node.test.ts +1 -5
- package/src/tests/rfc-evidence-sync.test.ts +22 -0
- package/src/tests/rfc-implement-stamp-governance.test.ts +25 -1
- package/src/tests/rfc-verification-verdict-ingest.test.ts +22 -0
- package/src/tests/upgrade-flow.test.ts +174 -0
- package/src/types.ts +11 -2
- package/dist/os/werkstatt/handlers/session-close.d.ts +0 -13
- package/dist/os/werkstatt/handlers/session-close.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/session-close.js +0 -56
- package/dist/os/werkstatt/handlers/session-close.js.map +0 -1
- package/dist/os/werkstatt/handlers/session-engine.d.ts +0 -3
- package/dist/os/werkstatt/handlers/session-engine.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/session-engine.js +0 -28
- package/dist/os/werkstatt/handlers/session-engine.js.map +0 -1
- package/dist/os/werkstatt/handlers/session-open.d.ts +0 -10
- package/dist/os/werkstatt/handlers/session-open.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/session-open.js +0 -46
- package/dist/os/werkstatt/handlers/session-open.js.map +0 -1
- package/dist/os/werkstatt/handlers/session-status.d.ts +0 -9
- package/dist/os/werkstatt/handlers/session-status.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/session-status.js +0 -34
- package/dist/os/werkstatt/handlers/session-status.js.map +0 -1
- package/os/werkstatt/handlers/session-close.ts +0 -82
- package/os/werkstatt/handlers/session-engine.ts +0 -34
- package/os/werkstatt/handlers/session-open.ts +0 -68
- package/os/werkstatt/handlers/session-status.ts +0 -55
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>FLOW-06/07 staleness and registry-mismatch tests (RFC-1487 step 5,
|
|
4
|
+
AC-7): an unregistered auto branch whose last commit is 73 h old reports
|
|
5
|
+
FLOW-06 while a 71 h one does not; a registered entry with a stale
|
|
6
|
+
updatedAt but a fresh commit is clean; registry/git mismatches report
|
|
7
|
+
FLOW-07.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No status-shape coverage — flow-status.test.ts owns the output contract.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1487: step 5 — stale/mismatch tests</item>
|
|
14
|
+
<item>RFC-1487: step 5 — flow.discard, flow.status, flow.check FLOW-06/07</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 { formatFlowBranch } from "../branch-name.ts";
|
|
25
|
+
import { collectFlowCheck } from "../handlers/flow-check.ts";
|
|
26
|
+
import { openFlowBranch } from "../handlers/flow-open.ts";
|
|
27
|
+
import { commonGitDir, registryPath, updateRegistry } from "../registry.ts";
|
|
28
|
+
import { gitExec, initRepo } from "./helpers.ts";
|
|
29
|
+
|
|
30
|
+
const NOW = new Date("2026-11-05T12:00:00Z");
|
|
31
|
+
|
|
32
|
+
const dirs: string[] = [];
|
|
33
|
+
afterEach(async () => {
|
|
34
|
+
for (const dir of dirs.splice(0)) {
|
|
35
|
+
await rm(dir, { recursive: true, force: true });
|
|
36
|
+
}
|
|
37
|
+
}, 20_000);
|
|
38
|
+
|
|
39
|
+
async function governedRepo(): Promise<string> {
|
|
40
|
+
const dir = await initRepo({ prefix: "flow-stale-" });
|
|
41
|
+
dirs.push(dir);
|
|
42
|
+
await writeFile(join(dir, "forge.yaml"), 'schema: "forge/workspace@1"\n');
|
|
43
|
+
await gitExec(dir, ["branch", "develop", "HEAD"]);
|
|
44
|
+
await gitExec(dir, ["switch", "develop"]);
|
|
45
|
+
return dir;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Create an unregistered auto branch with a commit dated `hoursAgo` before NOW. */
|
|
49
|
+
async function staleBranch(repo: string, slug: string, hoursAgo: number): Promise<string> {
|
|
50
|
+
const date = new Date(NOW.getTime() - hoursAgo * 3_600_000);
|
|
51
|
+
const name = formatFlowBranch({ kind: "session", date, seq: 1, slug });
|
|
52
|
+
await gitExec(repo, ["branch", name, "develop"]);
|
|
53
|
+
await gitExec(repo, ["switch", name]);
|
|
54
|
+
await writeFile(join(repo, "s.txt"), slug);
|
|
55
|
+
await gitExec(repo, ["add", "s.txt"]);
|
|
56
|
+
await gitExec(repo, ["commit", "-m", `add ${slug}`], {
|
|
57
|
+
GIT_AUTHOR_DATE: date.toISOString(),
|
|
58
|
+
GIT_COMMITTER_DATE: date.toISOString(),
|
|
59
|
+
});
|
|
60
|
+
await gitExec(repo, ["switch", "develop"]);
|
|
61
|
+
return name;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
describe("flow.check FLOW-06 (stale)", () => {
|
|
65
|
+
it("reports FLOW-06 for an unregistered auto branch with a 73 h old commit (AC-7)", async () => {
|
|
66
|
+
const repo = await governedRepo();
|
|
67
|
+
const name = await staleBranch(repo, "old-one", 73);
|
|
68
|
+
const outcome = await collectFlowCheck(repo, ambientIo, { now: NOW });
|
|
69
|
+
const flow06 = outcome.diagnostics.filter((d) => d.ruleId === "FLOW-06");
|
|
70
|
+
expect(flow06.some((d) => d.message.includes(name))).toBe(true);
|
|
71
|
+
}, 15_000);
|
|
72
|
+
|
|
73
|
+
it("does not report FLOW-06 for a 71 h old branch", async () => {
|
|
74
|
+
const repo = await governedRepo();
|
|
75
|
+
const name = await staleBranch(repo, "fresh-one", 71);
|
|
76
|
+
const outcome = await collectFlowCheck(repo, ambientIo, { now: NOW });
|
|
77
|
+
expect(outcome.diagnostics.some((d) => d.ruleId === "FLOW-06" && d.message.includes(name))).toBe(false);
|
|
78
|
+
}, 15_000);
|
|
79
|
+
|
|
80
|
+
it("does not report FLOW-06 for a registered entry with fresh commit but stale updatedAt", async () => {
|
|
81
|
+
const repo = await governedRepo();
|
|
82
|
+
// The branch tip's committer date is real time, so `now` is real too —
|
|
83
|
+
// the fresh commit (not the stale updatedAt) decides.
|
|
84
|
+
const realNow = new Date();
|
|
85
|
+
const session = await openFlowBranch(repo, ambientIo, {
|
|
86
|
+
kind: "session",
|
|
87
|
+
slug: "registered",
|
|
88
|
+
brief: null,
|
|
89
|
+
owner: null,
|
|
90
|
+
dryRun: false,
|
|
91
|
+
now: realNow,
|
|
92
|
+
});
|
|
93
|
+
dirs.push(session.worktree!);
|
|
94
|
+
// backdate updatedAt past the threshold; the fresh commit keeps it alive.
|
|
95
|
+
const common = await commonGitDir(ambientIo, repo);
|
|
96
|
+
await updateRegistry(ambientIo, common, (r) => ({
|
|
97
|
+
...r,
|
|
98
|
+
branches: r.branches.map((b) =>
|
|
99
|
+
b.name === session.branch ? { ...b, updatedAt: "2026-10-01T00:00:00Z" } : b,
|
|
100
|
+
),
|
|
101
|
+
}));
|
|
102
|
+
const outcome = await collectFlowCheck(repo, ambientIo, { now: realNow });
|
|
103
|
+
expect(outcome.diagnostics.some((d) => d.ruleId === "FLOW-06" && d.message.includes(session.branch!))).toBe(false);
|
|
104
|
+
}, 15_000);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe("flow.check FLOW-07 (registry/git mismatch)", () => {
|
|
108
|
+
it("reports FLOW-07 for a registry entry whose worktree is missing", async () => {
|
|
109
|
+
const repo = await governedRepo();
|
|
110
|
+
const session = await openFlowBranch(repo, ambientIo, {
|
|
111
|
+
kind: "session",
|
|
112
|
+
slug: "vanished",
|
|
113
|
+
brief: null,
|
|
114
|
+
owner: null,
|
|
115
|
+
dryRun: false,
|
|
116
|
+
now: NOW,
|
|
117
|
+
});
|
|
118
|
+
await rm(session.worktree!, { recursive: true, force: true });
|
|
119
|
+
await gitExec(repo, ["worktree", "prune"]);
|
|
120
|
+
|
|
121
|
+
const outcome = await collectFlowCheck(repo, ambientIo, { now: NOW });
|
|
122
|
+
const flow07 = outcome.diagnostics.filter((d) => d.ruleId === "FLOW-07");
|
|
123
|
+
expect(flow07.some((d) => d.message.includes(session.branch!))).toBe(true);
|
|
124
|
+
}, 20_000);
|
|
125
|
+
|
|
126
|
+
it("reports FLOW-07 at error severity for a schema-invalid registry", async () => {
|
|
127
|
+
const repo = await governedRepo();
|
|
128
|
+
const common = await commonGitDir(ambientIo, repo);
|
|
129
|
+
await mkdir(join(common, "forge"), { recursive: true });
|
|
130
|
+
await writeFile(registryPath(common), "schema: forge/flow-registry@1\nbranches: [{name: 7}]\n");
|
|
131
|
+
|
|
132
|
+
const outcome = await collectFlowCheck(repo, ambientIo, { now: NOW });
|
|
133
|
+
const flow07 = outcome.diagnostics.filter((d) => d.ruleId === "FLOW-07");
|
|
134
|
+
expect(flow07.some((d) => d.severity === "error")).toBe(true);
|
|
135
|
+
}, 15_000);
|
|
136
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>flow.status tests (RFC-1487 step 5): the output contract — primary
|
|
4
|
+
path/branch/clean, and per-branch registered/worktree/dirty/ahead/behind/
|
|
5
|
+
lastCommitAt/stale/held fields matching the RFC's example shape.</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>No FLOW-06/07 diagnostic coverage — flow-stale.test.ts owns it.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1487: step 5 — flow.status tests</item>
|
|
12
|
+
<item>RFC-1487: step 5 — flow.discard, flow.status, flow.check FLOW-06/07</item>
|
|
13
|
+
</CHANGE_SUMMARY>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { rm, writeFile } from "node:fs/promises";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
|
|
19
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
20
|
+
|
|
21
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
22
|
+
import { openFlowBranch } from "../handlers/flow-open.ts";
|
|
23
|
+
import { collectFlowStatus } from "../handlers/flow-status.ts";
|
|
24
|
+
import { gitExec, initRepo } from "./helpers.ts";
|
|
25
|
+
|
|
26
|
+
const NOW = new Date("2026-11-02T12:00:00Z");
|
|
27
|
+
|
|
28
|
+
const dirs: string[] = [];
|
|
29
|
+
afterEach(async () => {
|
|
30
|
+
for (const dir of dirs.splice(0)) {
|
|
31
|
+
await rm(dir, { recursive: true, force: true });
|
|
32
|
+
}
|
|
33
|
+
}, 20_000);
|
|
34
|
+
|
|
35
|
+
describe("flow.status", () => {
|
|
36
|
+
it("reports primary state and the per-branch contract shape", async () => {
|
|
37
|
+
const repo = await initRepo({ prefix: "flow-status-" });
|
|
38
|
+
dirs.push(repo);
|
|
39
|
+
await writeFile(join(repo, "forge.yaml"), 'schema: "forge/workspace@1"\n');
|
|
40
|
+
await gitExec(repo, ["branch", "develop", "HEAD"]);
|
|
41
|
+
await gitExec(repo, ["switch", "develop"]);
|
|
42
|
+
|
|
43
|
+
const session = await openFlowBranch(repo, ambientIo, {
|
|
44
|
+
kind: "session",
|
|
45
|
+
slug: "shape",
|
|
46
|
+
brief: "status test",
|
|
47
|
+
owner: null,
|
|
48
|
+
dryRun: false,
|
|
49
|
+
now: NOW,
|
|
50
|
+
});
|
|
51
|
+
dirs.push(session.worktree!);
|
|
52
|
+
await writeFile(join(session.worktree!, "x.txt"), "x");
|
|
53
|
+
await gitExec(session.worktree!, ["add", "x.txt"]);
|
|
54
|
+
await gitExec(session.worktree!, ["commit", "-m", "add x.txt"]);
|
|
55
|
+
await writeFile(join(session.worktree!, "seed.txt"), "tracked edit\n"); // dirty: 1
|
|
56
|
+
await writeFile(join(repo, "d.txt"), "d");
|
|
57
|
+
await gitExec(repo, ["add", "d.txt"]);
|
|
58
|
+
await gitExec(repo, ["commit", "-m", "add d.txt"]); // develop ahead by 1
|
|
59
|
+
|
|
60
|
+
const outcome = await collectFlowStatus(repo, ambientIo, { now: NOW });
|
|
61
|
+
expect(outcome.data.primary.path).toBe(repo);
|
|
62
|
+
expect(outcome.data.primary.branch).toBe("develop");
|
|
63
|
+
expect(outcome.data.primary.clean).toBe(true);
|
|
64
|
+
|
|
65
|
+
const row = outcome.data.branches.find((b) => b.name === session.branch);
|
|
66
|
+
expect(row).toBeDefined();
|
|
67
|
+
expect(row?.registered).toBe(true);
|
|
68
|
+
expect(row?.kind).toBe("session");
|
|
69
|
+
expect(row?.worktree).toBe(session.worktree);
|
|
70
|
+
expect(row?.worktreeExists).toBe(true);
|
|
71
|
+
expect(row?.dirty).toBe(1);
|
|
72
|
+
expect(row?.aheadOfDevelop).toBe(1);
|
|
73
|
+
expect(row?.behindDevelop).toBe(1);
|
|
74
|
+
expect(row?.lastCommitAt).not.toBeNull();
|
|
75
|
+
expect(row?.stale).toBe(false);
|
|
76
|
+
expect(row?.held).toBeNull();
|
|
77
|
+
}, 20_000);
|
|
78
|
+
|
|
79
|
+
it("lists an unregistered auto branch with registered: false", async () => {
|
|
80
|
+
const repo = await initRepo({ prefix: "flow-status-unreg-" });
|
|
81
|
+
dirs.push(repo);
|
|
82
|
+
await writeFile(join(repo, "forge.yaml"), 'schema: "forge/workspace@1"\n');
|
|
83
|
+
await gitExec(repo, ["branch", "develop", "HEAD"]);
|
|
84
|
+
await gitExec(repo, ["switch", "develop"]);
|
|
85
|
+
await gitExec(repo, ["branch", "auto/session-261102-01-manual", "develop"]);
|
|
86
|
+
|
|
87
|
+
const outcome = await collectFlowStatus(repo, ambientIo, { now: NOW });
|
|
88
|
+
const row = outcome.data.branches.find((b) => b.name === "auto/session-261102-01-manual");
|
|
89
|
+
expect(row?.registered).toBe(false);
|
|
90
|
+
expect(row?.worktree).toBeNull();
|
|
91
|
+
expect(row?.worktreeExists).toBe(false);
|
|
92
|
+
}, 15_000);
|
|
93
|
+
});
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Pending-level tests (RFC-1488: AC-3): commits carrying X-RFC
|
|
4
|
+
trailers are resolved through the canonical RFC reader against the temp
|
|
5
|
+
repo's docs/rfcs, the highest declared versionBump wins, missing bumps fall
|
|
6
|
+
back to patch, and a missing RFC file reports FLOW-VER-03 while still
|
|
7
|
+
counting patch.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No tag selection — flow-version.test.ts owns the derived-version math.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1488: step 4 — pending-level tests (X-RFC + versionBump)</item>
|
|
14
|
+
<item>RFC-1488: steps 2-4 — release tags, pending level (X-RFC + versionBump), flow.version command</item>
|
|
15
|
+
<item>RFC-1488: review r1 — parse guard, door/rules metadata, id-exact RFC binding, refname precision, FLOW-09 top-level anchor, test cleanup</item>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
|
|
22
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
23
|
+
|
|
24
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
25
|
+
import { collectFlowVersion } from "../handlers/flow-version.ts";
|
|
26
|
+
import { gitExec, initRepo } from "./helpers.ts";
|
|
27
|
+
|
|
28
|
+
const dirs: string[] = [];
|
|
29
|
+
|
|
30
|
+
afterEach(async () => {
|
|
31
|
+
for (const dir of dirs.splice(0)) {
|
|
32
|
+
await rm(dir, { recursive: true, force: true });
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
async function rfc(repo: string, id: string, versionBump: string): Promise<void> {
|
|
37
|
+
const file = `docs/rfcs/${id.toLowerCase()}-test.md`;
|
|
38
|
+
await mkdir(join(repo, "docs/rfcs"), { recursive: true });
|
|
39
|
+
await writeFile(
|
|
40
|
+
join(repo, file),
|
|
41
|
+
`---\nid: ${id}\ntitle: test\nstatus: accepted\nversionBump: ${versionBump}\n---\n\n# ${id}\n`,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function commitWithTrailer(repo: string, message: string, rfcId: string | null): Promise<void> {
|
|
46
|
+
const args = ["commit", "--allow-empty", "-m", message];
|
|
47
|
+
if (rfcId !== null) args.push("--trailer", `X-RFC: ${rfcId}`);
|
|
48
|
+
const result = await gitExec(repo, args);
|
|
49
|
+
if (result.exitCode !== 0) throw new Error(`commit failed: ${result.stderr}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function repoWithTag(): Promise<string> {
|
|
53
|
+
const repo = await initRepo({ prefix: "flow-lvl-" });
|
|
54
|
+
dirs.push(repo);
|
|
55
|
+
await writeFile(join(repo, "package.json"), '{ "version": "1.0.0" }\n');
|
|
56
|
+
await gitExec(repo, ["add", "package.json"]);
|
|
57
|
+
await gitExec(repo, ["commit", "-m", "version 1.0.0"]);
|
|
58
|
+
const tag = await gitExec(repo, ["tag", "-a", "v1.0.0", "-m", "release v1.0.0"]);
|
|
59
|
+
if (tag.exitCode !== 0) throw new Error(tag.stderr);
|
|
60
|
+
return repo;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
describe("pending level via flow.version", () => {
|
|
64
|
+
it("AC-3: patch + minor trailers report level minor and the bumped nextVersion", async () => {
|
|
65
|
+
const repo = await repoWithTag();
|
|
66
|
+
await rfc(repo, "RFC-1486", "patch");
|
|
67
|
+
await rfc(repo, "RFC-1488", "minor");
|
|
68
|
+
await gitExec(repo, ["add", "docs/rfcs"]);
|
|
69
|
+
await gitExec(repo, ["commit", "-m", "rfcs"]);
|
|
70
|
+
await commitWithTrailer(repo, "patch change", "RFC-1486");
|
|
71
|
+
await commitWithTrailer(repo, "minor change", "RFC-1488");
|
|
72
|
+
|
|
73
|
+
const { data, diagnostics } = await collectFlowVersion(repo, ambientIo, "repo");
|
|
74
|
+
expect(diagnostics.filter((d) => d.severity === "error")).toEqual([]);
|
|
75
|
+
const line = data.lines[0];
|
|
76
|
+
expect(line?.level).toBe("minor");
|
|
77
|
+
expect(line?.nextVersion).toBe("1.1.0");
|
|
78
|
+
expect(line?.rfcs).toEqual([
|
|
79
|
+
{ id: "RFC-1486", versionBump: "patch" },
|
|
80
|
+
{ id: "RFC-1488", versionBump: "minor" },
|
|
81
|
+
]);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("commits without usable trailers fall back to patch", async () => {
|
|
85
|
+
const repo = await repoWithTag();
|
|
86
|
+
await commitWithTrailer(repo, "no trailer", null);
|
|
87
|
+
|
|
88
|
+
const { data } = await collectFlowVersion(repo, ambientIo, "repo");
|
|
89
|
+
expect(data.lines[0]?.level).toBe("patch");
|
|
90
|
+
expect(data.lines[0]?.nextVersion).toBe("1.0.1");
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("a major trailer beats minor and patch", async () => {
|
|
94
|
+
const repo = await repoWithTag();
|
|
95
|
+
await rfc(repo, "RFC-1400", "major");
|
|
96
|
+
await gitExec(repo, ["add", "docs/rfcs"]);
|
|
97
|
+
await gitExec(repo, ["commit", "-m", "rfcs"]);
|
|
98
|
+
await commitWithTrailer(repo, "breaking", "RFC-1400");
|
|
99
|
+
|
|
100
|
+
const { data } = await collectFlowVersion(repo, ambientIo, "repo");
|
|
101
|
+
expect(data.lines[0]?.level).toBe("major");
|
|
102
|
+
expect(data.lines[0]?.nextVersion).toBe("2.0.0");
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it("a trailer naming a missing RFC warns FLOW-VER-03 and still counts patch", async () => {
|
|
106
|
+
const repo = await repoWithTag();
|
|
107
|
+
await commitWithTrailer(repo, "ghost", "RFC-9999");
|
|
108
|
+
|
|
109
|
+
const { data, diagnostics } = await collectFlowVersion(repo, ambientIo, "repo");
|
|
110
|
+
const ver03 = diagnostics.filter((d) => d.ruleId === "FLOW-VER-03");
|
|
111
|
+
expect(ver03).toHaveLength(1);
|
|
112
|
+
expect(ver03[0]?.message).toContain("RFC-9999");
|
|
113
|
+
expect(data.lines[0]?.level).toBe("patch");
|
|
114
|
+
expect(data.lines[0]?.rfcs).toEqual([{ id: "RFC-9999", versionBump: null }]);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>flow.version behavior tests (RFC-1488: AC-1, AC-2, AC-4 plus
|
|
4
|
+
FLOW-VER-01/04): annotated baseline tags in throwaway repos anchor the
|
|
5
|
+
derived version `X.Y.Z+N.<head9>`, per-line path filtering counts
|
|
6
|
+
commits correctly, a clean line at its tag reports `none`, and the
|
|
7
|
+
diagnostics surface reports missing baselines and unknown --line ids.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No level math — flow-version-level.test.ts owns AC-3.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1488: step 4 — flow.version tests</item>
|
|
14
|
+
<item>RFC-1488: steps 2-4 — release tags, pending level (X-RFC + versionBump), flow.version command</item>
|
|
15
|
+
<item>RFC-1488: review r1 — parse guard, door/rules metadata, id-exact RFC binding, refname precision, FLOW-09 top-level anchor, test cleanup</item>
|
|
16
|
+
<item>RFC-1490: step 1 — explicit ref param on tag/level helpers + W1-2 +0.<hash>.dirty shape (AC-12)</item>
|
|
17
|
+
</CHANGE_SUMMARY>
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
21
|
+
import { join } from "node:path";
|
|
22
|
+
|
|
23
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
24
|
+
|
|
25
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
26
|
+
import { collectFlowVersion } from "../handlers/flow-version.ts";
|
|
27
|
+
import { gitExec, initRepo } from "./helpers.ts";
|
|
28
|
+
|
|
29
|
+
const dirs: string[] = [];
|
|
30
|
+
|
|
31
|
+
afterEach(async () => {
|
|
32
|
+
for (const dir of dirs.splice(0)) {
|
|
33
|
+
await rm(dir, { recursive: true, force: true });
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
async function writeAndCommit(repo: string, file: string, content: string, message = "c"): Promise<void> {
|
|
38
|
+
await mkdir(join(repo, file.split("/").slice(0, -1).join("/")), { recursive: true });
|
|
39
|
+
await writeFile(join(repo, file), content);
|
|
40
|
+
await gitExec(repo, ["add", file]);
|
|
41
|
+
const result = await gitExec(repo, ["commit", "-m", message]);
|
|
42
|
+
if (result.exitCode !== 0) throw new Error(`commit failed: ${result.stderr}`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function annotatedTag(repo: string, name: string, at?: string): Promise<void> {
|
|
46
|
+
const args = ["tag", "-a", name, "-m", `release ${name}\n\nschema: forge/release-tag@1\nline: repo\nversion: ${name.replace(/^v|^[^@]*@/, "")}\nlevel: baseline\nprevious: null\nrfcs: []\nfingerprints: {}`];
|
|
47
|
+
if (at !== undefined) args.push(at);
|
|
48
|
+
const result = await gitExec(repo, args);
|
|
49
|
+
if (result.exitCode !== 0) throw new Error(`tag ${name} failed: ${result.stderr}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function repoWithRootVersion(version: string): Promise<string> {
|
|
53
|
+
const repo = await initRepo({ prefix: "flow-ver-" });
|
|
54
|
+
dirs.push(repo);
|
|
55
|
+
await writeAndCommit(repo, "package.json", `{ "version": "${version}" }\n`, `version ${version}`);
|
|
56
|
+
return repo;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
describe("collectFlowVersion", () => {
|
|
60
|
+
it("AC-1: HEAD three commits after v1.2.0 reports derived 1.2.0+3.<head9>", async () => {
|
|
61
|
+
const repo = await repoWithRootVersion("1.2.0");
|
|
62
|
+
await annotatedTag(repo, "v1.2.0");
|
|
63
|
+
for (let i = 0; i < 3; i += 1) {
|
|
64
|
+
await writeAndCommit(repo, `file-${i}.txt`, `${i}\n`, `post ${i}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const { data, diagnostics } = await collectFlowVersion(repo, ambientIo, "repo");
|
|
68
|
+
expect(diagnostics.filter((d) => d.severity === "error")).toEqual([]);
|
|
69
|
+
const line = data.lines[0];
|
|
70
|
+
expect(line?.id).toBe("repo");
|
|
71
|
+
expect(line?.lastTag).toBe("v1.2.0");
|
|
72
|
+
expect(line?.lastVersion).toBe("1.2.0");
|
|
73
|
+
expect(line?.commitsSince).toBe(3);
|
|
74
|
+
expect(line?.dirty).toBe(false);
|
|
75
|
+
expect(line?.derived).toBe(`1.2.0+3.${line.head}`);
|
|
76
|
+
expect(line?.head).toHaveLength(9);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("AC-2: only commits under the package line's paths count toward commitsSince", async () => {
|
|
80
|
+
const repo = await repoWithRootVersion("1.0.0");
|
|
81
|
+
await mkdir(join(repo, "packages/forge"), { recursive: true });
|
|
82
|
+
await writeFile(join(repo, "pnpm-workspace.yaml"), "packages:\n - 'packages/*'\n");
|
|
83
|
+
await writeFile(join(repo, "packages/forge/package.json"), '{ "version": "9.0.0" }\n');
|
|
84
|
+
await writeFile(join(repo, "packages/forge/extract.config.yaml"), "forgePlugin: true\n");
|
|
85
|
+
await writeAndCommit(repo, "x.txt", "x\n", "workspace");
|
|
86
|
+
await annotatedTag(repo, "forge@9.0.0");
|
|
87
|
+
|
|
88
|
+
for (let i = 0; i < 5; i += 1) {
|
|
89
|
+
if (i < 2) {
|
|
90
|
+
await writeAndCommit(repo, `packages/forge/f${i}.ts`, `${i}\n`, `forge ${i}`);
|
|
91
|
+
} else {
|
|
92
|
+
await writeAndCommit(repo, `root-${i}.txt`, `${i}\n`, `root ${i}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const { data } = await collectFlowVersion(repo, ambientIo, "forge");
|
|
97
|
+
const line = data.lines[0];
|
|
98
|
+
expect(line?.id).toBe("forge");
|
|
99
|
+
expect(line?.lastTag).toBe("forge@9.0.0");
|
|
100
|
+
expect(line?.commitsSince).toBe(2);
|
|
101
|
+
expect(line?.derived).toBe(`9.0.0+2.${line.head}`);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("AC-4: a line with no commits since its tag reports none and the tag version", async () => {
|
|
105
|
+
const repo = await repoWithRootVersion("1.2.0");
|
|
106
|
+
await annotatedTag(repo, "v1.2.0");
|
|
107
|
+
|
|
108
|
+
const { data } = await collectFlowVersion(repo, ambientIo, "repo");
|
|
109
|
+
const line = data.lines[0];
|
|
110
|
+
expect(line?.commitsSince).toBe(0);
|
|
111
|
+
expect(line?.level).toBe("none");
|
|
112
|
+
expect(line?.derived).toBe("1.2.0");
|
|
113
|
+
expect(line?.nextVersion).toBeNull();
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("untagged line reports derived null and FLOW-VER-01 pointing at flow.install", async () => {
|
|
117
|
+
const repo = await repoWithRootVersion("1.0.0");
|
|
118
|
+
const { data, diagnostics } = await collectFlowVersion(repo, ambientIo, "repo");
|
|
119
|
+
const line = data.lines[0];
|
|
120
|
+
expect(line?.derived).toBeNull();
|
|
121
|
+
expect(line?.lastTag).toBeNull();
|
|
122
|
+
expect(line?.level).toBe("patch"); // commits exist on the line, nothing tagged yet
|
|
123
|
+
const ver01 = diagnostics.filter((d) => d.ruleId === "FLOW-VER-01");
|
|
124
|
+
expect(ver01).toHaveLength(1);
|
|
125
|
+
expect(ver01[0]?.message).toContain("flow.install");
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it("unknown --line id fails with FLOW-VER-04 listing known lines", async () => {
|
|
129
|
+
const repo = await repoWithRootVersion("1.0.0");
|
|
130
|
+
const { data, diagnostics } = await collectFlowVersion(repo, ambientIo, "nope");
|
|
131
|
+
expect(data.lines).toEqual([]);
|
|
132
|
+
const ver04 = diagnostics.filter((d) => d.ruleId === "FLOW-VER-04");
|
|
133
|
+
expect(ver04).toHaveLength(1);
|
|
134
|
+
expect(ver04[0]?.severity).toBe("error");
|
|
135
|
+
expect(ver04[0]?.message).toContain("repo");
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("tracked modification inside the line's paths marks the line dirty", async () => {
|
|
139
|
+
const repo = await repoWithRootVersion("1.2.0");
|
|
140
|
+
await annotatedTag(repo, "v1.2.0");
|
|
141
|
+
await writeFile(join(repo, "package.json"), '{ "version": "1.2.0" } // dirty\n');
|
|
142
|
+
|
|
143
|
+
const { data } = await collectFlowVersion(repo, ambientIo, "repo");
|
|
144
|
+
expect(data.lines[0]?.dirty).toBe(true);
|
|
145
|
+
expect(data.lines[0]?.derived).toMatch(/^1\.2\.0\+0\.[0-9a-f]{9}\.dirty$/);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("listLineTags with an explicit ref resolves tags on that ref, not HEAD", async () => {
|
|
149
|
+
const repo = await repoWithRootVersion("1.2.0");
|
|
150
|
+
await annotatedTag(repo, "v1.2.0");
|
|
151
|
+
await gitExec(repo, ["checkout", "-b", "side"]);
|
|
152
|
+
await gitExec(repo, ["commit", "--allow-empty", "-m", "side"]);
|
|
153
|
+
const { discoverReleaseLines } = await import("../release-lines.ts");
|
|
154
|
+
const { listLineTags } = await import("../release-tags.ts");
|
|
155
|
+
const { lines } = await discoverReleaseLines(repo, ambientIo);
|
|
156
|
+
const tags = await listLineTags(repo, lines[0]!, ambientIo, "main");
|
|
157
|
+
expect(tags.lastTag?.name).toBe("v1.2.0");
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it("lightweight tags never anchor a line", async () => {
|
|
161
|
+
const repo = await repoWithRootVersion("1.2.0");
|
|
162
|
+
const lw = await gitExec(repo, ["tag", "v0.9.0"]);
|
|
163
|
+
if (lw.exitCode !== 0) throw new Error(lw.stderr);
|
|
164
|
+
await annotatedTag(repo, "v1.2.0");
|
|
165
|
+
|
|
166
|
+
const { data } = await collectFlowVersion(repo, ambientIo, "repo");
|
|
167
|
+
expect(data.lines[0]?.lastTag).toBe("v1.2.0");
|
|
168
|
+
});
|
|
169
|
+
});
|