Prepare a release by analyzing commits, determining version, and generating changelog
Analyzes commits since last release to determine version bump and generate changelog entries.
/plugin marketplace add C0ntr0lledCha0s/claude-code-plugin-automations/plugin install github-workflows@claude-code-plugin-automations[version-type: major|minor|patch|auto]Analyzes commits since the last release and prepares all release artifacts.
/release-prepare auto # Auto-detect version from commits
/release-prepare minor # Force minor version bump
/release-prepare major # Force major version bump
/release-prepare patch # Force patch version bump
Find the most recent release tag and analyze commits since then:
# Get last release tag
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
echo "Last release: ${LAST_TAG:-'No previous release'}"
# Count commits since last release
if [ -n "$LAST_TAG" ]; then
COMMIT_COUNT=$(git rev-list --count $LAST_TAG..HEAD)
else
COMMIT_COUNT=$(git rev-list --count HEAD)
fi
echo "Commits since last release: $COMMIT_COUNT"
Parse commits using conventional commit format:
# Get commits since last tag
if [ -n "$LAST_TAG" ]; then
COMMITS=$(git log $LAST_TAG..HEAD --pretty=format:"%s")
else
COMMITS=$(git log --pretty=format:"%s")
fi
# Count by type
FEAT_COUNT=$(echo "$COMMITS" | grep -c "^feat" || echo "0")
FIX_COUNT=$(echo "$COMMITS" | grep -c "^fix" || echo "0")
BREAKING_COUNT=$(echo "$COMMITS" | grep -c "!" || echo "0")
BREAKING_FOOTER=$(echo "$COMMITS" | grep -c "BREAKING CHANGE" || echo "0")
echo "Features: $FEAT_COUNT"
echo "Fixes: $FIX_COUNT"
echo "Breaking changes: $((BREAKING_COUNT + BREAKING_FOOTER))"
Based on argument or auto-detection:
Auto-detection logic:
! or BREAKING CHANGE) → MAJORfeat:) → MINORGroup commits by type for the changelog:
## [VERSION] - DATE
### ⚠️ Breaking Changes
- Breaking change commits
### ✨ Features
- feat: commits
### 🐛 Bug Fixes
- fix: commits
### 📚 Documentation
- docs: commits
### 🔧 Maintenance
- chore:, refactor:, ci: commits
Generate user-friendly release notes:
# Release vVERSION
## Highlights
Summary of the key changes in this release.
## ⚠️ Breaking Changes
Details on breaking changes with migration instructions.
## ✨ New Features
Description of new features.
## 🐛 Bug Fixes
List of bug fixes.
## 📦 Upgrade
Instructions for upgrading.
Identify version files that need updating:
package.json (if exists).claude-plugin/plugin.json (if exists)CHANGELOG.mdauto (default): Auto-detect from commitsmajor: Force major version bumpminor: Force minor version bumppatch: Force patch version bumpThe command outputs:
## Release Preparation: v1.6.0
### Commit Analysis
Analyzed 15 commits since v1.5.0:
- 2 features (feat:)
- 5 fixes (fix:)
- 3 documentation (docs:)
- 5 maintenance (chore:, refactor:)
**Version Bump**: MINOR (1.5.0 → 1.6.0)
Reason: New features added, no breaking changes
### Changelog Entry
## [1.6.0] - 2025-01-15
### ✨ Features
- Add issue tracking command (#42)
- Add release preparation workflow (#45)
### 🐛 Bug Fixes
- Fix validation error in hooks (#55)
- Fix duplicate detection (#58)
...
### Files to Update
- [ ] .claude-plugin/plugin.json: 1.5.0 → 1.6.0
- [ ] CHANGELOG.md: Add new section
Ready to proceed?
This command works with: