Changelog Generator
Generate a well-structured changelog from git history.
Workflow
- •Detect the repository root via
git rev-parse --show-toplevel. - •Determine the range:
- •If the user specifies two refs (tags, branches, SHAs), use that range.
- •Otherwise, find the latest tag with
git describe --tags --abbrev=0and use<latest-tag>..HEAD. - •If no tags exist, use the full history.
- •Collect commits with
git log --pretty=format:"%H|%s|%an|%ad" --date=short <range>. - •Categorize each commit by its conventional-commit prefix or keywords:
- •Added —
feat,add - •Fixed —
fix,bugfix,patch - •Changed —
refactor,update,change - •Deprecated —
deprecate - •Removed —
remove,delete - •Security —
security,vuln - •Performance —
perf - •Documentation —
docs - •Other — anything that doesn't match
- •Added —
- •Format output following Keep a Changelog conventions.
- •If a
CHANGELOG.mdalready exists, prepend the new section below the title. Otherwise create a new file.
Output Format
markdown
# Changelog ## [<version-or-range>] - YYYY-MM-DD ### Added - Description of feature (SHA short) ### Fixed - Description of fix (SHA short) ...
Guidelines
- •Use imperative mood in descriptions ("Add feature" not "Added feature").
- •Include short SHA (7 chars) for traceability.
- •Group by category, then sort chronologically within each group.
- •Omit empty categories.
- •If the user requests a specific format (e.g., plain text, JSON), adapt accordingly.
- •For monorepos, offer to scope by directory path using
git log -- <path>.