
Changelog Generator
- 82 installs
- 451 repo stars
- Updated July 21, 2026
- borghei/claude-skills
changelog-generator is a skill that generates changelogs and release notes from Conventional Commits and detects semantic version bumps.
About
This skill generates changelogs and release notes from Conventional Commits. It parses commit messages, detects the semantic version bump, renders Keep a Changelog and GitHub release-note formats, and enforces commit standards with a linter. Teams use it before publishing a release tag, in CI, or in PR checks to standardize release notes.
- Generates changelogs and release notes from Conventional Commits
- Detects semantic version bumps (major/minor/patch) from commit types
- Renders Keep a Changelog, GitHub release notes, and JSON output with CI and monorepo support
Changelog Generator by the numbers
- 82 all-time installs (skills.sh)
- Ranked #123 of 248 Release Management skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
changelog-generator capabilities & compatibility
- Capabilities
- changelog generation · semver detection · commit linting
- Works with
- github
- Use cases
- documentation · ci cd
- Pricing
- Free
What changelog-generator says it does
Generate consistent, auditable changelogs and release notes from Conventional Commits.
Breaking changes always trigger a **major** version bump regardless of type:
Commit message linter for CI and pre-commit hooks
npx skills add https://github.com/borghei/claude-skills --skill changelog-generatorAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 82 |
|---|---|
| repo stars | ★ 451 |
| Last updated | July 21, 2026 |
| Repository | borghei/claude-skills ↗ |
What it does
Turn Conventional Commit history into standardized changelogs and detect the correct semantic version bump.
Who is it for?
Teams standardizing release notes, enforcing commit conventions, or generating scoped monorepo changelogs.
Skip if: Repositories that do not follow Conventional Commits.
When should I use this skill?
You are preparing a release, automating release notes in CI, or enforcing commit message standards.
What you get
A Keep a Changelog or GitHub-format changelog with the correct semantic version bump derived from commits.
- changelog
- release notes
- commit lint results
By the numbers
- 3 output formats plus JSON
- 12-row type-to-section mapping table
Files
Changelog Generator
Tier: POWERFUL Category: Engineering / Release Management Maintainer: Claude Skills Team
Overview
Generate consistent, auditable changelogs and release notes from Conventional Commits. Parses commit messages, detects semantic version bumps (major/minor/patch), renders Keep a Changelog sections, supports monorepo scoped changelogs, integrates with CI for automated release notes, and enforces commit format with linting. Separates commit parsing, bump logic, and rendering so teams can automate releases without losing editorial control.
Keywords
changelog, release notes, conventional commits, semantic versioning, semver, Keep a Changelog, commit linting, release automation, monorepo changelog
Core Capabilities
1. Commit Parsing
- Parse Conventional Commit messages into structured data
- Extract type, scope, description, body, and footer
- Detect breaking changes from
!suffix andBREAKING CHANGE:footer - Handle multi-line commit bodies and co-author trailers
2. Semantic Version Detection
- Map commit types to version bump levels
- Breaking changes trigger major bumps
feattriggers minor bumps- All other types trigger patch bumps
- Support for pre-release versions (alpha, beta, rc)
3. Changelog Rendering
- Keep a Changelog format with semantic sections
- GitHub release notes format
- Plain markdown for documentation
- JSON output for automation pipelines
- Grouped by type with user-readable descriptions
4. Quality Enforcement
- Commit message linter for CI and pre-commit hooks
- Strict mode that blocks non-conforming commits
- Scope validation against allowed values
- Breaking change documentation requirements
When to Use
- Before publishing a release tag
- During CI to generate release notes automatically
- In PR checks to enforce commit message standards
- In monorepos where package changelogs need scoped filtering
- When converting raw git history into user-facing notes
- As a pre-release checklist step
Conventional Commit Format
<type>(<scope>)<!>: <description>
[optional body]
[optional footer(s)]Type to Section Mapping
| Commit Type | Changelog Section | SemVer Bump | User-Facing? |
|---|---|---|---|
feat | Added | minor | Yes |
fix | Fixed | patch | Yes |
perf | Performance | patch | Yes |
security | Security | patch | Yes |
deprecated | Deprecated | minor | Yes |
remove | Removed | major | Yes |
refactor | Changed | patch | Sometimes |
docs | — | patch | No |
test | — | — | No |
build | — | — | No |
ci | — | — | No |
chore | — | — | No |
Breaking Change Rules
Breaking changes always trigger a major version bump regardless of type:
feat(api)!: remove deprecated v1 endpoints
BREAKING CHANGE: The /api/v1/* endpoints have been removed.
Migrate to /api/v2/* before upgrading. See migration guide at docs/v2-migration.md.Changelog Rendering
Keep a Changelog Format
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.4.0] - 2026-03-09
### Added
- User can now export projects as CSV ([#234](https://github.com/org/repo/pull/234))
- Dark mode support for dashboard ([#228](https://github.com/org/repo/pull/228))
### Fixed
- Pagination returning duplicate items on page boundaries ([#231](https://github.com/org/repo/pull/231))
- Login form not showing validation errors on mobile ([#229](https://github.com/org/repo/pull/229))
### Performance
- Reduced dashboard load time by 40% with query optimization ([#232](https://github.com/org/repo/pull/232))
### Security
- Updated jsonwebtoken to 9.0.2 to fix CVE-2024-XXXX ([#233](https://github.com/org/repo/pull/233))
## [1.3.2] - 2026-02-28
### Fixed
- API rate limiter not resetting after window expiry ([#227](https://github.com/org/repo/pull/227))
[1.4.0]: https://github.com/org/repo/compare/v1.3.2...v1.4.0
[1.3.2]: https://github.com/org/repo/compare/v1.3.1...v1.3.2GitHub Release Notes Format
## What's New
- **CSV Export**: Users can now export project data as CSV files (#234)
- **Dark Mode**: Dashboard fully supports dark mode (#228)
## Bug Fixes
- Fixed pagination returning duplicate items on page boundaries (#231)
- Fixed login form validation on mobile devices (#229)
## Performance
- Dashboard load time reduced by 40% through query optimization (#232)
## Security
- Updated jsonwebtoken to patch CVE-2024-XXXX (#233)
**Full Changelog**: https://github.com/org/repo/compare/v1.3.2...v1.4.0Generation Workflow
Step 1: Collect Commits
# Get commits between two tags
git log v1.3.2..HEAD --pretty=format:'%H %s' --no-merges
# Get commits with full body (for breaking change detection)
git log v1.3.2..HEAD --pretty=format:'%H%n%s%n%b%n---COMMIT_END---' --no-mergesStep 2: Parse and Classify
import re
from dataclasses import dataclass
from typing import Optional
@dataclass
class ParsedCommit:
hash: str
type: str
scope: Optional[str]
description: str
body: Optional[str]
breaking: bool
breaking_description: Optional[str]
COMMIT_PATTERN = re.compile(
r'^(?P<type>feat|fix|perf|refactor|docs|test|build|ci|chore|security|deprecated|remove)'
r'(?:\((?P<scope>[^)]+)\))?'
r'(?P<breaking>!)?'
r':\s*(?P<description>.+)$'
)
def parse_commit(hash: str, message: str) -> Optional[ParsedCommit]:
lines = message.strip().split('\n')
subject = lines[0]
body = '\n'.join(lines[1:]).strip() if len(lines) > 1 else None
match = COMMIT_PATTERN.match(subject)
if not match:
return None # Non-conventional commit
breaking = bool(match.group('breaking'))
breaking_desc = None
if body and 'BREAKING CHANGE:' in body:
breaking = True
bc_match = re.search(r'BREAKING CHANGE:\s*(.+)', body, re.DOTALL)
if bc_match:
breaking_desc = bc_match.group(1).strip()
return ParsedCommit(
hash=hash,
type=match.group('type'),
scope=match.group('scope'),
description=match.group('description'),
body=body,
breaking=breaking,
breaking_description=breaking_desc,
)Step 3: Determine Version Bump
def determine_bump(commits: list[ParsedCommit]) -> str:
"""Determine semver bump from parsed commits."""
if any(c.breaking for c in commits):
return 'major'
if any(c.type == 'feat' for c in commits):
return 'minor'
if any(c.type in ('fix', 'perf', 'security', 'refactor') for c in commits):
return 'patch'
return 'none'
def bump_version(current: str, bump: str) -> str:
"""Apply bump to a semver string."""
major, minor, patch = map(int, current.lstrip('v').split('.'))
if bump == 'major':
return f"{major + 1}.0.0"
elif bump == 'minor':
return f"{major}.{minor + 1}.0"
elif bump == 'patch':
return f"{major}.{minor}.{patch + 1}"
return currentStep 4: Render Changelog
SECTION_MAP = {
'feat': 'Added',
'fix': 'Fixed',
'perf': 'Performance',
'security': 'Security',
'deprecated': 'Deprecated',
'remove': 'Removed',
'refactor': 'Changed',
}
def render_changelog(version: str, date: str, commits: list[ParsedCommit], repo_url: str) -> str:
sections: dict[str, list[str]] = {}
# Breaking changes get their own section
breaking = [c for c in commits if c.breaking]
if breaking:
sections['BREAKING CHANGES'] = []
for c in breaking:
desc = c.breaking_description or c.description
scope = f"**{c.scope}**: " if c.scope else ""
sections['BREAKING CHANGES'].append(f"- {scope}{desc}")
# Group remaining by section
for commit in commits:
section = SECTION_MAP.get(commit.type)
if not section:
continue
if section not in sections:
sections[section] = []
scope = f"**{commit.scope}**: " if commit.scope else ""
link = f"([{commit.hash[:7]}]({repo_url}/commit/{commit.hash}))"
sections[section].append(f"- {scope}{commit.description} {link}")
# Render
lines = [f"## [{version}] - {date}", ""]
for section_name in ['BREAKING CHANGES', 'Added', 'Changed', 'Deprecated', 'Removed', 'Fixed', 'Performance', 'Security']:
if section_name in sections:
lines.append(f"### {section_name}")
lines.extend(sections[section_name])
lines.append("")
return '\n'.join(lines)Commit Linting
Pre-Commit Hook
#!/bin/bash
# .git/hooks/commit-msg
# Validates commit message follows Conventional Commit format
COMMIT_MSG_FILE=$1
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
FIRST_LINE=$(head -1 "$COMMIT_MSG_FILE")
PATTERN='^(feat|fix|perf|refactor|docs|test|build|ci|chore|security|deprecated|remove)(\([a-z0-9-]+\))?!?:\s.{1,72}$'
if ! echo "$FIRST_LINE" | grep -qE "$PATTERN"; then
echo "ERROR: Commit message does not follow Conventional Commits format."
echo ""
echo "Expected: <type>(<scope>): <description>"
echo "Example: feat(auth): add OAuth2 login flow"
echo ""
echo "Valid types: feat, fix, perf, refactor, docs, test, build, ci, chore, security"
echo ""
echo "Your message: $FIRST_LINE"
exit 1
fi
# Check description length
DESC_LENGTH=$(echo "$FIRST_LINE" | sed 's/^[^:]*: //' | wc -c)
if [ "$DESC_LENGTH" -gt 72 ]; then
echo "ERROR: Commit description exceeds 72 characters ($DESC_LENGTH chars)."
exit 1
fiCI Linting
# .github/workflows/lint-commits.yml
name: Lint Commits
on:
pull_request:
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install -g @commitlint/cli @commitlint/config-conventional
- run: |
npx commitlint --from ${{ github.event.pull_request.base.sha }} \
--to ${{ github.event.pull_request.head.sha }}Monorepo Strategy
Scoped Changelogs
In a monorepo, each package maintains its own changelog filtered by scope:
# Get commits scoped to a specific package
git log v1.3.0..HEAD --pretty=format:'%H %s' --no-merges | \
grep -E '^\w+ (feat|fix|perf|refactor)\(ui\):'
# Example output:
# abc1234 feat(ui): add date picker component
# def5678 fix(ui): button alignment on mobilePer-Package Changelog Location
packages/
ui/
CHANGELOG.md ← @repo/ui changes only
package.json
api/
CHANGELOG.md ← @repo/api changes only
package.json
CHANGELOG.md ← infrastructure / cross-cutting changesRelease Workflow Integration
PR merges to main
│
v
CI detects new commits since last tag
│
v
Parse commits → determine bump → generate changelog
│
v
Create draft GitHub Release with generated notes
│
v
Human reviews and edits release notes
│
v
Publish release → triggers deployment pipelineOutput Quality Checklist
Before publishing generated changelog:
1. Each bullet is user-meaningful, not implementation noise 2. Breaking changes include migration instructions 3. Security fixes are in their own section (not mixed with bug fixes) 4. Duplicate bullets across sections are removed 5. Scope prefixes are consistent and meaningful 6. Empty sections are omitted 7. Links to PRs/commits are correct
Common Pitfalls
- Merge commit messages polluting the changelog — exclude merge commits with
--no-merges - Vague commit messages — "fix stuff" cannot become a useful release note; enforce linting
- Missing migration guidance for breaking changes — require
BREAKING CHANGE:footer with instructions - Docs/chore commits in user-facing changelog — filter to only user-facing types
- Overwriting historical entries — always prepend new entries, never modify existing ones
- Manual version bumps in monorepos — use Changesets for coordinated versioning
Best Practices
1. Enforce conventional commits in CI — block merges with non-conforming messages 2. Scope commits in monorepos — feat(ui): not just feat: for package-specific changes 3. Review generated changelog before publishing — automation gets you 90%, human editing adds polish 4. Tag releases after changelog is finalized — changelog is part of the release, not an afterthought 5. Keep an [Unreleased] section — for manual curation between releases 6. Link to PRs, not commits — PRs have context and discussion that commits lack 7. Separate internal and external changelogs — users do not need to know about CI config changes
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
| Changelog is empty after generation | All commits use non-user-facing types (docs, chore, ci, test) | Ensure feature and fix commits use feat: or fix: types; review type-to-section mapping |
Version bump detected as none | No commits match bump-triggering types | Verify commits follow Conventional Commit format; check regex pattern matches your type list |
| Breaking changes missing from output | BREAKING CHANGE: footer has wrong casing or whitespace | Use exact string BREAKING CHANGE: (uppercase, with colon and space) in commit footer |
| Monorepo changelog includes unrelated packages | Scope filter not applied or scope names inconsistent | Standardize scope names across teams; filter commits with grep -E 'type\(your-scope\):' |
| Merge commits polluting release notes | --no-merges flag omitted from git log | Always pass --no-merges when collecting commits for changelog generation |
| Commit linter rejects valid messages | Regex pattern missing a valid type or scope contains uppercase | Update the PATTERN regex to include all custom types; enforce lowercase scopes |
| Duplicate entries across changelog sections | A breaking change commit also matches its original type section | Deduplicate by checking if a commit already appears in BREAKING CHANGES before adding to type section |
Success Criteria
- Commit parse rate above 95% — fewer than 5% of commits in a release range fail to parse as valid Conventional Commits
- Zero manual version bump errors — semantic version is always determined automatically from commit types, never hand-edited
- Changelog generation under 10 seconds — full parse-classify-render cycle completes in under 10 seconds for repositories with up to 500 commits per release
- 100% of breaking changes documented — every commit with
!suffix orBREAKING CHANGE:footer appears in the BREAKING CHANGES section with migration guidance - Release notes review time under 15 minutes — generated changelog requires minimal human editing before publication
- Commit lint failure rate below 2% — after team onboarding, fewer than 2% of commits are rejected by the pre-commit hook or CI linter
- Monorepo scope accuracy at 100% — scoped changelogs contain only commits relevant to their package with no cross-contamination
Scope & Limitations
This skill covers:
- Parsing Conventional Commit messages into structured data for changelog generation
- Determining semantic version bumps (major/minor/patch) from commit history
- Rendering changelogs in Keep a Changelog, GitHub Release Notes, plain markdown, and JSON formats
- Enforcing commit message standards via pre-commit hooks and CI linting
This skill does NOT cover:
- Actual release publishing or deployment pipeline execution — see
engineering/ci-cd-pipeline-design - Git tag management, branch strategies, or merge workflows — see
engineering/git-workflow-automation - Writing or improving commit messages themselves — see
standards/git/git-workflow-standards.md - Coordinated multi-package versioning with tools like Changesets or Lerna — referenced in monorepo strategy but not implemented here
Integration Points
| Skill | Integration | Data Flow |
|---|---|---|
engineering/ci-cd-pipeline-design | Changelog generation runs as a CI stage before release publishing | Parsed commits and rendered changelog feed into the release pipeline as artifacts |
engineering/git-workflow-automation | Commit linting hooks enforce format before commits reach the changelog generator | Pre-commit validation ensures only parseable commits enter the git history |
engineering/code-review-automation | PR checks verify commit messages conform to Conventional Commits before merge | Linting results gate PR approval, preventing unparseable commits from reaching main |
engineering/api-versioning-strategy | Breaking change detection aligns API version bumps with changelog major releases | BREAKING CHANGE commits trigger both changelog entries and API version increments |
project-management/release-management | Release planning uses generated changelogs for stakeholder communication | Rendered release notes flow into release checklists and stakeholder announcements |
standards/git/git-workflow-standards.md | Commit format standards define the grammar this skill parses | Standard definitions are the source of truth for the commit regex pattern |
#!/usr/bin/env python3
"""Scan commit messages and diff summaries for breaking change indicators.
Analyzes git log output and optional diff stat summaries to detect breaking
changes through multiple heuristic signals: the conventional commit ! suffix,
BREAKING CHANGE footers, removal of public APIs, renamed/deleted files, and
keyword patterns in commit messages and diffs.
Usage:
git log v1.0.0..HEAD --pretty=format:'%H%n%s%n%b%n---COMMIT_END---' --no-merges | python breaking_change_detector.py
python breaking_change_detector.py --file git-log.txt
python breaking_change_detector.py --file git-log.txt --diff-file diff-stat.txt
python breaking_change_detector.py --file git-log.txt --json
python breaking_change_detector.py --file git-log.txt --severity high
"""
import argparse
import json
import re
import sys
from collections import OrderedDict
COMMIT_DELIMITER = "---COMMIT_END---"
COMMIT_PATTERN = re.compile(
r"^(?P<type>feat|fix|perf|refactor|docs|test|build|ci|chore|security|deprecated|remove)"
r"(?:\((?P<scope>[^)]+)\))?"
r"(?P<breaking>!)?"
r":\s*(?P<description>.+)$"
)
BREAKING_FOOTER_PATTERN = re.compile(
r"BREAKING CHANGE:\s*(.+)", re.DOTALL
)
# Keyword patterns that suggest breaking changes in commit messages
BREAKING_KEYWORDS = [
(r"\bremov(?:e|ed|ing|es)\b.*\b(?:api|endpoint|field|column|method|function|class|param|argument|route)\b", "high"),
(r"\brenam(?:e|ed|ing|es)\b.*\b(?:api|endpoint|field|column|method|function|class|param|argument|route)\b", "high"),
(r"\bdelet(?:e|ed|ing|es)\b.*\b(?:api|endpoint|field|column|table|method|function|class|route)\b", "high"),
(r"\bdeprecate[ds]?\b", "medium"),
(r"\bdrop(?:ped|ping|s)?\b.*\bsupport\b", "high"),
(r"\bmigrat(?:e|ion|ing)\b", "medium"),
(r"\bincompatible\b", "high"),
(r"\bbreaking\b", "high"),
(r"\bnon[- ]?backward[s]?\b", "high"),
(r"\bbackward[s]?[- ]incompatible\b", "high"),
(r"\brequire[ds]?\b.*\bmigration\b", "high"),
(r"\bchanged?\b.*\b(?:signature|return type|schema|contract|interface)\b", "medium"),
(r"\breplac(?:e|ed|ing)\b.*\b(?:api|endpoint|method|function)\b", "medium"),
(r"\bmajor\b.*\b(?:version|upgrade|update)\b", "medium"),
(r"\bv\d+\b.*\b(?:removed|dropped|deleted)\b", "high"),
]
# Patterns in diff stats suggesting breaking changes
DIFF_BREAKING_PATTERNS = [
(r"(?:^|\s)(?:delete mode|rename)\s.*(?:api|schema|model|migration|interface|proto)", "high"),
(r"\b\d+\s+files?\s+changed.*\d+\s+deletions", "low"),
(r"(?:\.proto|schema\.\w+|openapi\.\w+|swagger\.\w+)\s.*\|.*[-]+", "medium"),
(r"(?:routes|endpoints|api)\.\w+\s.*\|.*[-]+", "medium"),
(r"migration.*\|", "low"),
]
SEVERITY_LEVELS = {"high": 3, "medium": 2, "low": 1}
def parse_raw_log(text):
"""Split raw git log text into individual commit blocks."""
blocks = text.split(COMMIT_DELIMITER)
commits = []
for block in blocks:
block = block.strip()
if not block:
continue
lines = block.split("\n")
if len(lines) < 2:
continue
commit_hash = lines[0].strip()
subject = lines[1].strip()
body = "\n".join(lines[2:]).strip() if len(lines) > 2 else ""
if commit_hash and subject:
commits.append({
"hash": commit_hash,
"short_hash": commit_hash[:7],
"subject": subject,
"body": body,
})
return commits
def detect_conventional_breaking(commit):
"""Detect breaking changes from conventional commit markers."""
indicators = []
subject = commit["subject"]
body = commit["body"]
match = COMMIT_PATTERN.match(subject)
if match and match.group("breaking"):
indicators.append({
"source": "conventional_commit_bang",
"severity": "high",
"detail": f"Commit type has '!' breaking change marker: {subject}",
"evidence": subject,
})
if body:
footer_match = BREAKING_FOOTER_PATTERN.search(body)
if footer_match:
description = footer_match.group(1).strip()
# Truncate long descriptions for display
if len(description) > 200:
description = description[:200] + "..."
indicators.append({
"source": "breaking_change_footer",
"severity": "high",
"detail": f"BREAKING CHANGE footer found",
"evidence": description,
})
return indicators
def detect_keyword_breaking(commit):
"""Detect potential breaking changes from keyword patterns."""
indicators = []
full_text = f"{commit['subject']} {commit['body']}".lower()
for pattern, severity in BREAKING_KEYWORDS:
if re.search(pattern, full_text, re.IGNORECASE):
# Find the matching line for evidence
evidence_line = None
for line in f"{commit['subject']}\n{commit['body']}".split("\n"):
if re.search(pattern, line, re.IGNORECASE):
evidence_line = line.strip()
break
indicators.append({
"source": "keyword_heuristic",
"severity": severity,
"detail": f"Keyword pattern matched: {pattern}",
"evidence": evidence_line or full_text[:100],
})
# Only report the first keyword match per pattern category
break
return indicators
def detect_diff_breaking(diff_text):
"""Detect breaking changes from diff stat output."""
indicators = []
if not diff_text:
return indicators
for line in diff_text.split("\n"):
line = line.strip()
if not line:
continue
for pattern, severity in DIFF_BREAKING_PATTERNS:
if re.search(pattern, line, re.IGNORECASE):
indicators.append({
"source": "diff_heuristic",
"severity": severity,
"detail": f"Diff pattern matched: {pattern}",
"evidence": line[:150],
})
break
return indicators
def analyze_commit(commit, diff_text=None):
"""Run all detection methods on a single commit."""
indicators = []
indicators.extend(detect_conventional_breaking(commit))
indicators.extend(detect_keyword_breaking(commit))
if diff_text:
indicators.extend(detect_diff_breaking(diff_text))
if not indicators:
return None
# Determine overall severity (highest found)
max_severity = max(
(SEVERITY_LEVELS.get(i["severity"], 0) for i in indicators),
default=0,
)
severity_name = {v: k for k, v in SEVERITY_LEVELS.items()}.get(max_severity, "low")
return {
"hash": commit["hash"],
"short_hash": commit["short_hash"],
"subject": commit["subject"],
"severity": severity_name,
"indicator_count": len(indicators),
"indicators": indicators,
"confirmed": any(
i["source"] in ("conventional_commit_bang", "breaking_change_footer")
for i in indicators
),
}
def filter_by_severity(results, min_severity):
"""Filter results to only include entries at or above the minimum severity."""
min_level = SEVERITY_LEVELS.get(min_severity, 0)
return [r for r in results if SEVERITY_LEVELS.get(r["severity"], 0) >= min_level]
def format_human_readable(results, stats):
"""Render detection results as human-readable text."""
lines = []
lines.append("=" * 65)
lines.append("BREAKING CHANGE DETECTION REPORT")
lines.append("=" * 65)
lines.append("")
lines.append(f"Commits scanned: {stats['total_scanned']}")
lines.append(f"Breaking changes found: {stats['breaking_found']}")
lines.append(f" Confirmed (explicit): {stats['confirmed']}")
lines.append(f" Suspected (heuristic): {stats['suspected']}")
lines.append(f"Severity breakdown:")
lines.append(f" High: {stats['severity_high']}")
lines.append(f" Medium: {stats['severity_medium']}")
lines.append(f" Low: {stats['severity_low']}")
lines.append(f"Recommended bump: {stats['recommended_bump']}")
lines.append("")
if not results:
lines.append("No breaking changes detected.")
return "\n".join(lines)
for result in results:
confirmed_tag = "CONFIRMED" if result["confirmed"] else "SUSPECTED"
severity_tag = result["severity"].upper()
lines.append("-" * 65)
lines.append(f"[{severity_tag}] [{confirmed_tag}] {result['short_hash']} {result['subject']}")
lines.append("")
for indicator in result["indicators"]:
source_label = indicator["source"].replace("_", " ").title()
lines.append(f" Source: {source_label}")
lines.append(f" Severity: {indicator['severity']}")
if indicator.get("evidence"):
evidence = indicator["evidence"]
if len(evidence) > 120:
evidence = evidence[:120] + "..."
lines.append(f" Evidence: {evidence}")
lines.append("")
# Migration guidance reminder
lines.append("=" * 65)
lines.append("RECOMMENDED ACTIONS")
lines.append("=" * 65)
lines.append("")
confirmed_results = [r for r in results if r["confirmed"]]
suspected_results = [r for r in results if not r["confirmed"]]
if confirmed_results:
lines.append("Confirmed breaking changes require:")
lines.append(" 1. Major version bump (semver)")
lines.append(" 2. Migration guide in release notes")
lines.append(" 3. Deprecation notice for removed features")
lines.append("")
if suspected_results:
lines.append("Suspected breaking changes should be reviewed:")
lines.append(" 1. Verify if the change affects the public API")
lines.append(" 2. If confirmed, add BREAKING CHANGE footer to commit")
lines.append(" 3. Document migration path for affected users")
lines.append("")
return "\n".join(lines)
def read_input(args):
"""Read git log text from file or stdin."""
if args.file:
with open(args.file, "r", encoding="utf-8") as f:
return f.read()
if not sys.stdin.isatty():
return sys.stdin.read()
print("Error: No input provided. Pipe git log output or use --file.", file=sys.stderr)
print("Example: git log v1.0.0..HEAD --pretty=format:'%H%n%s%n%b%n---COMMIT_END---' "
"--no-merges | python breaking_change_detector.py", file=sys.stderr)
sys.exit(1)
def main():
parser = argparse.ArgumentParser(
description="Scan commit messages and diffs for breaking change indicators.",
epilog="Reads git log output formatted with ---COMMIT_END--- delimiters. "
"Detects breaking changes via conventional commit markers, keyword "
"heuristics, and optional diff analysis.",
)
parser.add_argument(
"--file", "-f",
help="Path to file containing git log output (default: read from stdin)",
)
parser.add_argument(
"--diff-file",
help="Path to file containing diff stat output for additional analysis",
)
parser.add_argument(
"--json", "-j",
action="store_true",
dest="json_output",
help="Output as JSON instead of human-readable text",
)
parser.add_argument(
"--severity", "-s",
choices=["low", "medium", "high"],
default="low",
help="Minimum severity level to report (default: low)",
)
parser.add_argument(
"--confirmed-only", "-c",
action="store_true",
help="Only show confirmed breaking changes (conventional commit markers)",
)
parser.add_argument(
"--indent",
type=int,
default=2,
help="JSON indentation level (default: 2)",
)
args = parser.parse_args()
raw_text = read_input(args)
commits = parse_raw_log(raw_text)
diff_text = None
if args.diff_file:
with open(args.diff_file, "r", encoding="utf-8") as f:
diff_text = f.read()
# Analyze each commit
results = []
for commit in commits:
result = analyze_commit(commit, diff_text=diff_text)
if result:
results.append(result)
# Apply filters
results = filter_by_severity(results, args.severity)
if args.confirmed_only:
results = [r for r in results if r["confirmed"]]
# Compute stats
confirmed_count = sum(1 for r in results if r["confirmed"])
stats = {
"total_scanned": len(commits),
"breaking_found": len(results),
"confirmed": confirmed_count,
"suspected": len(results) - confirmed_count,
"severity_high": sum(1 for r in results if r["severity"] == "high"),
"severity_medium": sum(1 for r in results if r["severity"] == "medium"),
"severity_low": sum(1 for r in results if r["severity"] == "low"),
"recommended_bump": "major" if results else "see commit types",
}
if args.json_output:
output = {
"stats": stats,
"results": results,
}
print(json.dumps(output, indent=args.indent, default=str))
else:
print(format_human_readable(results, stats))
if __name__ == "__main__":
main()
#!/usr/bin/env python3
"""Format parsed commits into Keep a Changelog markdown.
Accepts JSON from commit_parser.py (via stdin or --file) and renders a
complete changelog entry in Keep a Changelog format. Supports version
headers, comparison links, breaking change sections, and the Unreleased
section pattern.
Usage:
python commit_parser.py --json | python changelog_formatter.py --version 1.4.0
python changelog_formatter.py --file parsed.json --version 2.0.0 --repo-url https://github.com/org/repo
python changelog_formatter.py --file parsed.json --version 2.0.0 --json
python changelog_formatter.py --file parsed.json --unreleased
"""
import argparse
import json
import sys
from collections import OrderedDict
from datetime import date
SECTION_ORDER = [
"BREAKING CHANGES",
"Added",
"Changed",
"Deprecated",
"Removed",
"Fixed",
"Performance",
"Security",
]
TYPE_TO_SECTION = OrderedDict([
("feat", "Added"),
("fix", "Fixed"),
("perf", "Performance"),
("security", "Security"),
("deprecated", "Deprecated"),
("remove", "Removed"),
("refactor", "Changed"),
])
CHANGELOG_HEADER = """# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
"""
def read_input(args):
"""Read parsed commit JSON from file or stdin."""
if args.file:
with open(args.file, "r", encoding="utf-8") as f:
return json.load(f)
if not sys.stdin.isatty():
return json.load(sys.stdin)
print("Error: No input provided. Pipe commit_parser.py --json output or use --file.",
file=sys.stderr)
sys.exit(1)
def extract_commits(data):
"""Extract the flat list of commits from parser output."""
if "commits" in data:
return data["commits"]
if "groups" in data:
commits = []
for group in data["groups"].values():
if isinstance(group, dict) and "commits" in group:
commits.extend(group["commits"])
return commits
if isinstance(data, list):
return data
return []
def build_sections(commits, repo_url=None, link_style="commit"):
"""Group commits into changelog sections."""
sections = OrderedDict()
# Collect breaking changes into their own section first
breaking_commits = [c for c in commits if c.get("breaking")]
if breaking_commits:
entries = []
for c in breaking_commits:
desc = c.get("breaking_description") or c["description"]
scope_prefix = f"**{c['scope']}**: " if c.get("scope") else ""
entries.append(f"- {scope_prefix}{desc}")
sections["BREAKING CHANGES"] = entries
# Group remaining commits by section
for commit in commits:
section_name = TYPE_TO_SECTION.get(commit.get("type"))
if not section_name:
continue
if section_name not in sections:
sections[section_name] = []
scope_prefix = f"**{commit['scope']}**: " if commit.get("scope") else ""
description = commit["description"]
# Build link suffix
link = ""
if repo_url and commit.get("hash"):
short = commit.get("short_hash", commit["hash"][:7])
if link_style == "commit":
link = f" ([{short}]({repo_url}/commit/{commit['hash']}))"
elif link_style == "none":
link = ""
sections[section_name].append(f"- {scope_prefix}{description}{link}")
return sections
def render_keep_a_changelog(version, release_date, sections, repo_url=None,
previous_version=None, include_header=False):
"""Render sections in Keep a Changelog markdown format."""
lines = []
if include_header:
lines.append(CHANGELOG_HEADER.strip())
lines.append("")
# Version heading
if version.lower() == "unreleased":
if repo_url and previous_version:
lines.append(f"## [Unreleased]")
else:
lines.append("## [Unreleased]")
else:
lines.append(f"## [{version}] - {release_date}")
lines.append("")
# Render sections in defined order
rendered_any = False
for section_name in SECTION_ORDER:
if section_name in sections:
lines.append(f"### {section_name}")
lines.append("")
for entry in sections[section_name]:
lines.append(entry)
lines.append("")
rendered_any = True
# Handle any custom sections not in the standard order
for section_name, entries in sections.items():
if section_name not in SECTION_ORDER:
lines.append(f"### {section_name}")
lines.append("")
for entry in entries:
lines.append(entry)
lines.append("")
rendered_any = True
if not rendered_any:
lines.append("No notable changes in this release.")
lines.append("")
# Comparison link footer
if repo_url and version.lower() != "unreleased" and previous_version:
lines.append(
f"[{version}]: {repo_url}/compare/v{previous_version}...v{version}"
)
lines.append("")
return "\n".join(lines)
def render_github_release(version, sections, repo_url=None, previous_version=None):
"""Render sections in GitHub Release Notes format."""
github_section_names = {
"BREAKING CHANGES": "Breaking Changes",
"Added": "What's New",
"Changed": "Changes",
"Deprecated": "Deprecations",
"Removed": "Removals",
"Fixed": "Bug Fixes",
"Performance": "Performance",
"Security": "Security",
}
lines = []
for section_name in SECTION_ORDER:
if section_name in sections:
heading = github_section_names.get(section_name, section_name)
lines.append(f"## {heading}")
lines.append("")
for entry in sections[section_name]:
lines.append(entry)
lines.append("")
if repo_url and previous_version:
lines.append(
f"**Full Changelog**: {repo_url}/compare/v{previous_version}...v{version}"
)
lines.append("")
return "\n".join(lines)
def build_json_output(version, release_date, sections, stats=None):
"""Build structured JSON output for automation pipelines."""
return {
"version": version,
"date": release_date,
"sections": dict(sections),
"section_count": len(sections),
"entry_count": sum(len(v) for v in sections.values()),
"has_breaking_changes": "BREAKING CHANGES" in sections,
"stats": stats,
}
def determine_bump(commits):
"""Determine the semver bump level from commits."""
if any(c.get("breaking") for c in commits):
return "major"
if any(c.get("type") == "feat" for c in commits):
return "minor"
if any(c.get("type") in ("fix", "perf", "security", "refactor") for c in commits):
return "patch"
return "none"
def bump_version(current, bump_level):
"""Apply a semver bump to a version string."""
clean = current.lstrip("v")
parts = clean.split(".")
if len(parts) != 3:
return current
try:
major, minor, patch = int(parts[0]), int(parts[1]), int(parts[2])
except ValueError:
return current
if bump_level == "major":
return f"{major + 1}.0.0"
elif bump_level == "minor":
return f"{major}.{minor + 1}.0"
elif bump_level == "patch":
return f"{major}.{minor}.{patch + 1}"
return current
def main():
parser = argparse.ArgumentParser(
description="Format parsed conventional commits into Keep a Changelog markdown.",
epilog="Reads JSON output from commit_parser.py via stdin or --file.",
)
parser.add_argument(
"--file", "-f",
help="Path to JSON file from commit_parser.py (default: read from stdin)",
)
parser.add_argument(
"--version", "-v",
help="Version number for the release header (e.g. 1.4.0)",
)
parser.add_argument(
"--date", "-d",
default=None,
help="Release date in YYYY-MM-DD format (default: today)",
)
parser.add_argument(
"--previous-version", "-p",
help="Previous version for comparison link (e.g. 1.3.2)",
)
parser.add_argument(
"--repo-url", "-r",
help="Repository URL for commit/comparison links (e.g. https://github.com/org/repo)",
)
parser.add_argument(
"--format",
choices=["keepachangelog", "github"],
default="keepachangelog",
help="Output format (default: keepachangelog)",
)
parser.add_argument(
"--unreleased",
action="store_true",
help="Use [Unreleased] as the version header",
)
parser.add_argument(
"--include-header",
action="store_true",
help="Include the full Keep a Changelog file header",
)
parser.add_argument(
"--link-style",
choices=["commit", "none"],
default="commit",
help="Style for commit links in entries (default: commit)",
)
parser.add_argument(
"--auto-version",
help="Auto-determine next version from BASE version (e.g. 1.3.2 -> computed bump)",
)
parser.add_argument(
"--json", "-j",
action="store_true",
dest="json_output",
help="Output as JSON instead of markdown",
)
parser.add_argument(
"--indent",
type=int,
default=2,
help="JSON indentation level (default: 2)",
)
args = parser.parse_args()
data = read_input(args)
commits = extract_commits(data)
if not commits:
print("Warning: No commits found in input.", file=sys.stderr)
# Determine version
release_date = args.date or date.today().isoformat()
if args.unreleased:
version = "Unreleased"
elif args.auto_version:
bump_level = determine_bump(commits)
version = bump_version(args.auto_version, bump_level)
if not args.previous_version:
args.previous_version = args.auto_version.lstrip("v")
elif args.version:
version = args.version
else:
version = "Unreleased"
repo_url = args.repo_url.rstrip("/") if args.repo_url else None
# Build sections
sections = build_sections(commits, repo_url=repo_url, link_style=args.link_style)
stats = data.get("stats") if isinstance(data, dict) else None
if args.json_output:
output = build_json_output(version, release_date, sections, stats)
if args.auto_version:
output["bump_level"] = determine_bump(commits)
output["previous_version"] = args.auto_version
print(json.dumps(output, indent=args.indent, default=str))
elif args.format == "github":
print(render_github_release(
version, sections,
repo_url=repo_url,
previous_version=args.previous_version,
))
else:
print(render_keep_a_changelog(
version, release_date, sections,
repo_url=repo_url,
previous_version=args.previous_version,
include_header=args.include_header,
))
if __name__ == "__main__":
main()
#!/usr/bin/env python3
"""Parse git log output (conventional commits) into structured changelog entries.
Reads git log output from stdin or a file and extracts structured data from
Conventional Commit messages. Groups commits by type (feat, fix, docs, etc.)
and detects breaking changes from both the ! suffix and BREAKING CHANGE footer.
Usage:
git log v1.0.0..HEAD --pretty=format:'%H%n%s%n%b%n---COMMIT_END---' --no-merges | python commit_parser.py
python commit_parser.py --file git-log-output.txt
python commit_parser.py --file git-log-output.txt --json
python commit_parser.py --file git-log-output.txt --scope api
python commit_parser.py --file git-log-output.txt --types feat,fix
"""
import argparse
import json
import re
import sys
from collections import OrderedDict
COMMIT_DELIMITER = "---COMMIT_END---"
COMMIT_PATTERN = re.compile(
r"^(?P<type>feat|fix|perf|refactor|docs|test|build|ci|chore|security|deprecated|remove)"
r"(?:\((?P<scope>[^)]+)\))?"
r"(?P<breaking>!)?"
r":\s*(?P<description>.+)$"
)
BREAKING_CHANGE_PATTERN = re.compile(
r"BREAKING CHANGE:\s*(.+)", re.DOTALL
)
TYPE_LABELS = OrderedDict([
("feat", "Features"),
("fix", "Bug Fixes"),
("perf", "Performance Improvements"),
("security", "Security"),
("deprecated", "Deprecations"),
("remove", "Removals"),
("refactor", "Refactoring"),
("docs", "Documentation"),
("test", "Tests"),
("build", "Build System"),
("ci", "Continuous Integration"),
("chore", "Chores"),
])
USER_FACING_TYPES = {"feat", "fix", "perf", "security", "deprecated", "remove", "refactor"}
def parse_raw_log(text):
"""Split raw git log text into individual commit blocks."""
blocks = text.split(COMMIT_DELIMITER)
commits_raw = []
for block in blocks:
block = block.strip()
if not block:
continue
lines = block.split("\n")
if len(lines) < 2:
continue
commit_hash = lines[0].strip()
subject = lines[1].strip()
body = "\n".join(lines[2:]).strip() if len(lines) > 2 else ""
if commit_hash and subject:
commits_raw.append({
"hash": commit_hash,
"subject": subject,
"body": body,
})
return commits_raw
def parse_commit(raw):
"""Parse a single raw commit dict into a structured commit entry.
Returns None if the subject does not match conventional commit format.
"""
subject = raw["subject"]
body = raw["body"]
commit_hash = raw["hash"]
match = COMMIT_PATTERN.match(subject)
if not match:
return None
commit_type = match.group("type")
scope = match.group("scope")
is_breaking = bool(match.group("breaking"))
description = match.group("description").strip()
breaking_description = None
if body:
bc_match = BREAKING_CHANGE_PATTERN.search(body)
if bc_match:
is_breaking = True
breaking_description = bc_match.group(1).strip()
# Extract co-authors from trailers
co_authors = []
if body:
for line in body.split("\n"):
line = line.strip()
if line.lower().startswith("co-authored-by:"):
co_authors.append(line.split(":", 1)[1].strip())
return {
"hash": commit_hash,
"short_hash": commit_hash[:7],
"type": commit_type,
"scope": scope,
"description": description,
"body": body if body else None,
"breaking": is_breaking,
"breaking_description": breaking_description,
"co_authors": co_authors if co_authors else None,
}
def group_by_type(commits):
"""Group parsed commits by their type, maintaining defined order."""
groups = OrderedDict()
for type_key in TYPE_LABELS:
matching = [c for c in commits if c["type"] == type_key]
if matching:
groups[type_key] = {
"label": TYPE_LABELS[type_key],
"count": len(matching),
"commits": matching,
}
return groups
def filter_commits(commits, scope_filter=None, type_filter=None, user_facing_only=False):
"""Apply optional filters to the parsed commit list."""
result = commits
if scope_filter:
scopes = {s.strip().lower() for s in scope_filter.split(",")}
result = [c for c in result if c["scope"] and c["scope"].lower() in scopes]
if type_filter:
types = {t.strip().lower() for t in type_filter.split(",")}
result = [c for c in result if c["type"] in types]
if user_facing_only:
result = [c for c in result if c["type"] in USER_FACING_TYPES]
return result
def format_human_readable(grouped, stats):
"""Render grouped commits as human-readable text output."""
lines = []
lines.append("=" * 60)
lines.append("PARSED COMMITS")
lines.append("=" * 60)
lines.append("")
lines.append(f"Total parsed: {stats['parsed']}")
lines.append(f"Skipped (invalid): {stats['skipped']}")
lines.append(f"Breaking changes: {stats['breaking']}")
lines.append(f"User-facing: {stats['user_facing']}")
lines.append("")
if not grouped:
lines.append("No commits matched the given filters.")
return "\n".join(lines)
for type_key, group in grouped.items():
lines.append("-" * 60)
lines.append(f"{group['label']} ({group['count']})")
lines.append("-" * 60)
for commit in group["commits"]:
scope_prefix = f"({commit['scope']}) " if commit["scope"] else ""
breaking_marker = " [BREAKING]" if commit["breaking"] else ""
lines.append(f" {commit['short_hash']} {scope_prefix}{commit['description']}{breaking_marker}")
if commit["breaking_description"]:
# Indent breaking change description
for bd_line in commit["breaking_description"].split("\n"):
lines.append(f" BREAKING: {bd_line}")
lines.append("")
return "\n".join(lines)
def build_output(grouped, stats, all_commits):
"""Build the JSON-serializable output structure."""
return {
"stats": stats,
"groups": grouped,
"commits": all_commits,
}
def read_input(args):
"""Read git log text from file or stdin."""
if args.file:
with open(args.file, "r", encoding="utf-8") as f:
return f.read()
if not sys.stdin.isatty():
return sys.stdin.read()
print("Error: No input provided. Pipe git log output or use --file.", file=sys.stderr)
print("Example: git log v1.0.0..HEAD --pretty=format:'%H%n%s%n%b%n---COMMIT_END---' "
"--no-merges | python commit_parser.py", file=sys.stderr)
sys.exit(1)
def main():
parser = argparse.ArgumentParser(
description="Parse git log output with conventional commits into structured changelog entries.",
epilog="Reads git log output formatted with ---COMMIT_END--- delimiters. "
"Use: git log --pretty=format:'%%H%%n%%s%%n%%b%%n---COMMIT_END---' --no-merges",
)
parser.add_argument(
"--file", "-f",
help="Path to a file containing git log output (default: read from stdin)",
)
parser.add_argument(
"--json", "-j",
action="store_true",
dest="json_output",
help="Output as JSON instead of human-readable text",
)
parser.add_argument(
"--scope", "-s",
help="Filter commits by scope (comma-separated, e.g. 'api,ui')",
)
parser.add_argument(
"--types", "-t",
help="Filter commits by type (comma-separated, e.g. 'feat,fix')",
)
parser.add_argument(
"--user-facing", "-u",
action="store_true",
help="Show only user-facing commit types (feat, fix, perf, security, deprecated, remove, refactor)",
)
parser.add_argument(
"--indent",
type=int,
default=2,
help="JSON indentation level (default: 2)",
)
args = parser.parse_args()
raw_text = read_input(args)
raw_commits = parse_raw_log(raw_text)
parsed = []
skipped = 0
for raw in raw_commits:
result = parse_commit(raw)
if result:
parsed.append(result)
else:
skipped += 1
filtered = filter_commits(
parsed,
scope_filter=args.scope,
type_filter=args.types,
user_facing_only=args.user_facing,
)
grouped = group_by_type(filtered)
stats = {
"total_raw": len(raw_commits),
"parsed": len(parsed),
"skipped": skipped,
"filtered": len(filtered),
"breaking": sum(1 for c in filtered if c["breaking"]),
"user_facing": sum(1 for c in filtered if c["type"] in USER_FACING_TYPES),
"types_found": list(grouped.keys()),
"scopes_found": sorted(set(
c["scope"] for c in filtered if c["scope"]
)),
}
if args.json_output:
output = build_output(grouped, stats, filtered)
print(json.dumps(output, indent=args.indent, default=str))
else:
print(format_human_readable(grouped, stats))
if __name__ == "__main__":
main()
Related skills
FAQ
How does it decide the version bump?
Breaking changes trigger major bumps, feat triggers minor, and all other types trigger patch bumps.
What output formats does it support?
Keep a Changelog format, GitHub release notes, plain markdown, and JSON for automation pipelines.