Context
Found during deep code audit of tools/autoflow/release.ts.
Problem
tools/autoflow/release.ts is 1887 lines — the single largest file in the entire repository. It handles the full AutoFlow3 release lifecycle in one module:
- Release policy resolution
- Pre-publish checks (git clean, tag exists, ancestor verification)
- npm view verification
- Build step orchestration
- Publish step orchestration (npm publish for each package)
- Evidence collection (per-step)
- Tag step orchestration (immutable tag, evidence commit)
- Documentation version anchors update (VERSION_PLAN, STATUS, ROADMAP across 10+ files)
- Release closure record writing
- Resumption logic for partial-failure recovery
All 10 phases share one module-level state object and call each other directly.
Impact
- Bus factor critical: this file is the heart of the release pipeline; one 1887-line file is unmaintainable by anyone other than the original author
- Test friction:
release.test.ts is 1013 lines and growing; testing one phase requires constructing the entire release context
- Resumption risk: if a release fails mid-pipeline, debugging which of the 10 phases failed requires reading the whole file
- Evolution blocked: adding a new release step (e.g., provenance attestation) requires touching the monolith
Proposal
- Split along the 10 phases into separate modules:
release-policy.ts — phase 1
release-pre-checks.ts — phase 2-3
release-build.ts — phase 4
release-publish.ts — phase 5
release-evidence.ts — phase 6
release-tag.ts — phase 7
release-docs-sync.ts — phase 8
release-closure.ts — phase 9-10
release.ts becomes a thin orchestrator: imports the phase modules and composes them
- Each phase has its own test file with phase-local fixtures
- Shared types (ReleaseStepEvidence, ReleaseClosureRecord) move to
release-types.ts
Priority
P3 — maintainability. Not a 0.42 blocker but blocks contributor onboarding to the release pipeline.
Audit reference
tools/autoflow/release.ts (1887 lines)
tools/autoflow/__tests__/release.test.ts (1013 lines)
Context
Found during deep code audit of
tools/autoflow/release.ts.Problem
tools/autoflow/release.tsis 1887 lines — the single largest file in the entire repository. It handles the full AutoFlow3 release lifecycle in one module:All 10 phases share one module-level state object and call each other directly.
Impact
release.test.tsis 1013 lines and growing; testing one phase requires constructing the entire release contextProposal
release-policy.ts— phase 1release-pre-checks.ts— phase 2-3release-build.ts— phase 4release-publish.ts— phase 5release-evidence.ts— phase 6release-tag.ts— phase 7release-docs-sync.ts— phase 8release-closure.ts— phase 9-10release.tsbecomes a thin orchestrator: imports the phase modules and composes themrelease-types.tsPriority
P3 — maintainability. Not a 0.42 blocker but blocks contributor onboarding to the release pipeline.
Audit reference
tools/autoflow/release.ts(1887 lines)tools/autoflow/__tests__/release.test.ts(1013 lines)