chore: add release prepare command#1165
Conversation
dfe4e04 to
9572e07
Compare
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
miguel-heygen
left a comment
There was a problem hiding this comment.
LGTM. Clean follow-up to #1164.
The two-run model (first run drafts + exits non-zero, second run validates reviewed artifacts + delegates to set-version) is the right UX pattern — the enforced pause is the whole point, and exiting non-zero stops any chained commands without needing a flag.
Solid:
- TODO marker check in both release:prepare AND set-version closes the 'engineer skips prepare and uses set-version directly' gap.
- cli-options.ts extraction means argument parsing is in one place — draft-changelog and release-prepare won't drift.
- 22 focused script tests covering parser, action selection, command forwarding, and TODO detection.
- Docs updated consistently across CONTRIBUTING.md, changelog-process.mdx, and release-channels.mdx.
No issues.
vanceingalls
left a comment
There was a problem hiding this comment.
Additive review — the two-run UX model, TODO-marker check at both layers, cli-options extraction, and test coverage are all solid. Below are gaps not yet in the review.
Strengths
readNextArgguarding--flagas the next arg value is a subtle footgun that was correctly ported during the refactor. ✓docsChangelogEntryHasGeneratedTodoscopes the TODO check to the matching<Update>entry, not the whole file — a reviewed entry and an unreviewed sibling don't cross-contaminate. ✓prependDocsUpdateidempotency (label=guard) makes thewriteReleaseNotesearly-return on EEXIST safe — rerunningchangelog:draft --writedoesn't produce duplicate docs entries. The behavior change (exit-1 → log+return) is correct. ✓
Important nit
draft-changelog.ts:433, release-prepare.ts:744, and the pre-existing set-version.ts all call validateCliVersion with their own regex, and they diverge:
draft-changelog.ts:[0-9A-Za-z.-]— explicit charset, no underscorerelease-prepare.ts:[\w.]—\wincludes underscoreset-version.ts:[\w.]— same as release-prepare
A version like 1.2.3-my_build passes release-prepare and set-version but fails draft-changelog. Unlikely to bite in practice (semver prereleases don't use underscores), but the extraction was the natural moment to align them. Worth a one-liner fix on release-prepare.ts:744 to use [0-9A-Za-z.-], or better, export a shared SEMVER_PRERELEASE_PATTERN from cli-options.ts.
Nit
The --force flag on release:prepare is only consumed in the "draft" action path, which fires only when the release file is missing — and a missing file never needs --force. The flag is reachable in the rare split-state (release file exists, docs entry absent), but that's non-obvious. A short comment would help the next maintainer.
CI: baseRefName is main — not stacked. All required checks green. ✓
LGTM.
— Vai
9572e07 to
8e4370f
Compare
|
Addressed the semver regex nit in the latest push: |
vanceingalls
left a comment
There was a problem hiding this comment.
Nit addressed — CLI_SEMVER_PATTERN exported from cli-options.ts and used by all three scripts (draft-changelog, release-prepare, set-version). Test confirms 1.2.3-alpha_1 (underscore) is correctly rejected by the shared pattern. LGTM.
— Vai
Merge activity
|

What
bun run release:prepare <version>as the maintainer-facing stable release entrypoint.set-version.set-versionguard so stable releases also fail when generated TODO changelog copy is still present.release:preparewhile keepingchangelog:draftas the lower-level regeneration tool.Why
Stable releases should be hard to run without reviewed GitHub release notes and Mintlify changelog copy. This keeps the existing manual rewrite step, but makes the expected path one command that engineers can rerun after review.
How
scripts/release-prepare.tswith parsing, draft/review/set-version action selection, and command forwarding.changelog:draftandrelease:prepareuse the same option handling.changelog:draft --writeso an existing release file is left unchanged unless--forceis passed, while still allowing a missing docs entry to be added.Test plan
bun run test:scriptsbun run format:checkbun run lintbun run --filter '*' typecheckbunx fallow audit --base origin/main --fail-on-issuesbun run release:prepare --help;bun run set-version 9.9.9fails before mutation when changelog artifacts are missing