Skip to content

fix(release): keep a published section and collect changes/ fragments - #713

Merged
leemour merged 1 commit into
mainfrom
fix/release-fold-fragments
Nov 24, 2026
Merged

leemour merged 1 commit into
mainfrom
fix/release-fold-fragments

Conversation

@leemour

@leemour leemour commented Nov 24, 2026

Copy link
Copy Markdown
Member

Fixes #706

Why

When npm already had the version in package.json, bin/release renamed that version's CHANGELOG section to the next number. The published section lost its heading, and changes/ fragments were not collected at all.

What

  • A published section keeps its heading. The new version takes ## Unreleased, or a new section the fragments fill. With neither (or an empty Unreleased), the release stops.
  • Fragments are collected with cli-dev changelog fragments --collect, and cli-dev changelog level raises the version when they need more (an Added is a minor), as in the CLIs.
  • A version npm has starts from its next patch: 1.0.0 plus a fix is 1.0.1, 0.131.0 plus a fix is 0.131.1.
  • A published pre-release with fragments stops ("raise the version first").
  • package.json and the CHANGELOG are both checked before either is written; a refusal restores the tree. --major is checked before anything lands. Fragments merged while the release PR waited are collected by a second run.
  • Docs: RELEASING.md drops the manual version PR and explains the numbering; CONVENTIONS.md and CLAUDE.md mention fragments.

Testing

  • scripts/release.test.ts runs bin/release against a local git origin with fake npm and gh: 7 of 7 pass. On the old bin/release, the earlier tests fail.
  • pnpm typecheck, pnpm docs:check pass. pnpm lint: 0 errors; the 21 warnings are in files this PR does not touch.

Not covered here: the shared release-start.yml still fails when only fragments exist on a published version (separate issue).

🤖 Generated with Claude Code

…#706)

When npm already had the version in package.json, bin/release renamed that
version's CHANGELOG section to the next number, so the published section lost
its heading. Now a published section keeps it: the new version takes the
Unreleased section, or a new section that the changes/ fragments fill. With
neither (or an empty Unreleased section), the release stops.

- Fragments are collected with `cli-dev changelog fragments --collect` and the
  version is raised with `cli-dev changelog level`, as in the CLIs.
- A version npm has starts from its next patch; the entries decide the level,
  so 1.0.0 plus a fix is 1.0.1, not 2.0.0.
- A published pre-release with fragments stops: raise the version first.
- package.json and the CHANGELOG are both checked before either is written,
  and a refusal restores the tree.
- --major is checked before any version lands on main.
- Fragments merged while the release pull request waited are collected by a
  second run.
- scripts/release.test.ts runs bin/release against a local origin with fake
  npm and gh.

Fixes #706

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leemour
leemour merged commit a3d7495 into main Nov 24, 2026
10 checks passed
@leemour
leemour deleted the fix/release-fold-fragments branch November 24, 2026 01:38
leemour added a commit that referenced this pull request Nov 25, 2026
…after a published version (#719)

## Task

Fixes #714. The shared Start release workflow failed when npm already
had the version in `package.json` and every entry was in `changes/`
fragments (no `## Unreleased` to rename). It also asked for a major
after a published `x.0.0`. #713 fixed both in `bin/release`; this brings
the workflow in line.

## What

- `.github/workflows/release-start.yml`, step "settle the version", now
follows `bin/release`:
- A published version keeps its section. The new version takes the
Unreleased section, or a new empty section that the fragments fill.
- A published `x.y.z` starts from its next patch. `cli-dev changelog
level --next` raises it only when the entries need more (1.0.0 + fix →
1.0.1, + Added → 1.1.0).
- No fragment and a missing or empty Unreleased section → the run stops
before any file changes.
- `package.json`, `src/version.ts` and `CHANGELOG.md` are all checked
before any is written.
- npm is asked once whether the version is published. `after-raise` runs
once, with the version that ships.
- The fragment and level logic stays in the existing cli-dev commands
(`fragments --collect`, `level --next`, `next-version`). Only the
renumber script and the next-patch one-liner stay inline. Callers run
their own installed cli-dev, so the workflow cannot depend on a new
cli-dev command. It now needs cli-base 0.98.0 or later for `changelog
level`; this is stated in the input and in
`docs/dev/release-workflow.md`. Callers pin the workflow by SHA, so
nothing changes for them until they bump.
- Fragment `changes/fix-release-start-fragments.md`.

## Testing

- New `scripts/release-start.test.ts` takes the step's script from the
YAML and runs it against a local git origin with a fake `npm`. It covers
8 cases: fragments only, a 1.0.0 patch, a 1.0.0 minor, a custom title
with `src/version.ts` and the hook, an empty Unreleased section, nothing
unreleased, and a major with and without `major`. Against the old
workflow, 6 of 7 cases failed (the 8th was added later).
- `scripts/release.test.ts` passes, as do `pnpm lint`, `pnpm typecheck`
and `pnpm docs:check`.
- A fresh-agent review found one compatibility risk (the cli-dev minimum
is now documented) and nits. Fixed: npm asked twice, the hook ran twice,
fragment wording, test gaps. Left as is: a changelog with no line above
its first `## ` heading fails before writing anything, the same as
`bin/release`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bin/release renames a published version's CHANGELOG section when changes/ fragments are not folded

1 participant