ai-changelog
AI-Driven Changelog
Set up a changelog system where AI coding agents write entries under ## [Unreleased] during development, and automation stamps version numbers at release time. No agent ever writes version numbers -- the build process handles that.
Setup Workflow
-
Detect the project: Check for Makefile, Justfile, package.json, Cargo.toml, pyproject.toml, go.mod. Note which config files contain a
"version"field. -
Ask the user:
- Versioning scheme? CalVer
YYYY.M.COMMITS(default) works for most projects. SemVer via manual--versionoverride is always available. - Include a
## Known Bugspinned section? (default: yes) - Set up GitHub Actions integration? (default: skip unless asked)
- Versioning scheme? CalVer
-
Generate CHANGELOG.md: Read
references/changelog-template.mdfor the template. If a CHANGELOG.md already exists, do NOT overwrite it -- insert the## [Unreleased]structure and HTML comment above existing entries. -
Copy
scripts/version.py: Copy from this skill'sscripts/version.pyinto the target project'sscripts/directory. Make it executable (chmod +x). -
Add build integration: Read
references/build-integration.mdfor patterns. Addstamp-versionandversiontargets to the project's existing build system. If no build system exists, create a minimal Makefile. -
Update CLAUDE.md: Read
references/claude-md-snippet.mdfor the exact text. Insert the changelog update step into the project's development workflow. If no CLAUDE.md exists, create one with a Development Workflow section. -
Verify: Run
uv run scripts/version.py versionto confirm CalVer computation works. Runuv run scripts/version.py stamp --dry-runto preview the stamp operation.
Project Detection
| Indicator | Config files to stamp | Build integration |
|---|---|---|
Makefile |
depends on project | Add make targets |
Justfile |
depends on project | Add just recipes |
package.json |
package.json |
Add npm scripts or Makefile |
Cargo.toml |
Cargo.toml |
Makefile wrapper |
pyproject.toml |
pyproject.toml |
Makefile wrapper |
go.mod |
none (use ldflags) | Makefile wrapper |
| None | none | Create minimal Makefile |
How the Script Works
scripts/version.py subcommands:
version-- prints CalVer to stdout (for piping)stamp-- replaces## [Unreleased]with## [VERSION] - DATE, re-inserts fresh## [Unreleased], and stamps version into auto-discovered config files
Flags: --version X.Y.Z (manual override), --dry-run, --changelog-only, --no-changelog
Run via uv run scripts/version.py stamp (or python3 scripts/version.py stamp if uv is unavailable -- the script has no external dependencies).
Gotchas
- Never overwrite existing changelog history. If a CHANGELOG.md exists with content, merge the
[Unreleased]structure into it rather than replacing the file. - Empty Unreleased section: The stamp script intentionally skips stamping if
[Unreleased]has no content. This prevents empty version entries. fetch-depth: 0in CI: CalVer usesgit rev-list --count HEAD. Shallow clones produce wrong commit counts. Always setfetch-depth: 0in checkout steps.- The HTML comment is the agent's instruction source. The
<!-- AI agents: ... -->comment in CHANGELOG.md tells future agents how to write entries. Do not omit it. - Known Bugs stays pinned. The stamp script preserves
## Known Bugsabove## [Unreleased]. If you add it, agents should maintain it there. - Config file stamping is first-match-only for TOML. The regex replaces only the first
version = "..."line, which is the package version. Dependency versions are unaffected. - SemVer projects: CalVer is the default, but any project can use SemVer by always passing
--version X.Y.Zexplicitly (from a VERSION file, git tag, or manual input).