Raw view: Update CHANGELOG from recent commits

No invisible, zero-width, or bidi-control characters detected.

---
description: Add a CHANGELOG.md section for everything since the last tag, grouped by user impact
argument-hint: [version, e.g. 1.4.0; default: Unreleased]
allowed-tools: Bash(git describe *), Bash(git log *), Bash(git tag *), Bash(gh pr list *), Read, Edit, Write
---

Update the changelog. Version for the new section: $ARGUMENTS (empty means `Unreleased`).

Last tag:
!`git describe --tags --abbrev=0 2>/dev/null || echo "(no tags)"`

Commits since it (or all, if no tag):
!`git log --oneline --no-merges $(git describe --tags --abbrev=0 2>/dev/null)..HEAD 2>/dev/null || git log --oneline --no-merges -50`

Existing changelog head:
!`head -40 CHANGELOG.md 2>/dev/null || echo "(no CHANGELOG.md)"`

Procedure:
1. Detect the existing format. If `CHANGELOG.md` follows Keep a Changelog (`## [x.y.z] - date`, `### Added/Changed/Fixed`), match it exactly. If it uses another structure, match that. If absent, create it with a Keep a Changelog header.
2. Classify every commit by user impact into: Breaking, Added, Changed, Deprecated, Removed, Fixed, Security. Drop pure noise (`wip`, `fix lint`, `bump`, merge commits) or fold dependency bumps into one line under Changed. Use the commit body and, when `gh` is available, the PR title for commits whose subject is unclear.
3. Rewrite each entry for the user, present tense, naming the visible surface (flag, API field, screen) rather than the file. Append the PR or issue number in parentheses when present in the subject or body.
4. If a version was given: insert `## [<version>] - <today YYYY-MM-DD>` under any existing `## [Unreleased]` heading, moving Unreleased entries into it, and add the compare link at the bottom if the file uses them. If no version was given, add or extend `## [Unreleased]`.
5. Show the new section and the `git diff --stat CHANGELOG.md`. Do not commit.

Omit empty groups. Keep every line to one sentence.