Release a new version of CodeMie CLI. Use when user says "release", "create release", "publish version", "bump version and release", or wants to publish a new version to npm...
Automate the release process for CodeMie CLI following semantic versioning and conventional commits.
Before starting, verify:
main. If not, stop and ask user to switch.# Current version
grep '"version"' package.json | sed 's/.*"version": "\(.*\)".*/\1/'
# Latest tag
git describe --tags --abbrev=0 2>/dev/null
# Check if tag exists
git tag -l "v<VERSION>"
# Check if release exists
gh release view "v<VERSION>" 2>/dev/null
CRITICAL: Always analyze commits to determine the appropriate version bump based on conventional commit types.
# Get commits since last release (excluding version bump commits)
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
git log --pretty=format:"%s" ${LAST_TAG:+$LAST_TAG..HEAD} | grep -v "^chore: bump version"
Parse each commit message to identify type:
Conventional Commit Format: <type>(<scope>): <subject>
feat, fix, docs, style, refactor, perf, test, chore, ci, revertcli, agents, providers, assistants, config, proxy, workflows, ci, analytics, utils, deps, tests, skillsBreaking Changes: Check commit bodies for BREAKING CHANGE: footer
# Check for breaking changes
git log --pretty=format:"%B" ${LAST_TAG:+$LAST_TAG..HEAD} | grep -q "BREAKING CHANGE:"
Version bump rules (highest precedence wins):
BREAKING CHANGE: in bodyfeat: or feat(scope):fix:, refactor:, perf:, docs:, style:, test:, chore:, ci:, revert:# Current version from package.json
CURRENT=$(grep '"version"' package.json | sed 's/.*"version": "\(.*\)".*/\1/')
# Parse version parts (e.g., "0.0.35" β major=0, minor=0, patch=35)
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
# Apply bump based on commit analysis:
# - If BREAKING CHANGE found: MAJOR=$((MAJOR+1)), MINOR=0, PATCH=0
# - If feat: found: MINOR=$((MINOR+1)), PATCH=0
# - Otherwise: PATCH=$((PATCH+1))
TARGET_VERSION="$MAJOR.$MINOR.$PATCH"
Show the user:
0.0.350.0.36Example output:
π¦ Current version: 0.0.35
π Analyzed 3 commits since v0.0.35:
- fix(utils): auto-update PATH during Claude installation on Windows (#120)
- refactor(skills): relocate skills module to codemie-code agent (#117)
π Detected: PATCH bump (only fixes and refactors found)
π― Recommended version: 0.0.36
Confirm release version 0.0.36?
After user confirms the version, run the full test suite before any commits.
npm test
This runs unit tests, CLI integration tests, and agent tests (unit + cli + agent projects).
If tests fail: stop the release, report which suite failed, and do not proceed to the release steps. Ask the user how to proceed.
If tests pass: continue to Generate Release Notes and Release Steps.
CRITICAL: Group commits by type and generate concrete, user-focused release notes.
# Get full commit messages since last tag
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
git log --pretty=format:"%s|%b" ${LAST_TAG:+$LAST_TAG..HEAD} | grep -v "^chore: bump version"
Group commits by type:
For each commit:
feat(agents): add feature β add featureadd feature β Add feature(#123)feat(agents): β show as "[agents]"If breaking changes exist:
## β οΈ BREAKING CHANGES
- **[scope]**: Description of what broke and how to migrate
Extract from commit body after BREAKING CHANGE: line.
## What's Changed
### β¨ Features
- **[scope]**: Feature description (#PR)
### π Bug Fixes
- **[scope]**: Fix description (#PR)
### β‘ Performance Improvements
- **[scope]**: Performance improvement (#PR)
### β»οΈ Refactoring
- **[scope]**: Refactoring description (#PR)
### π Documentation
- **[scope]**: Documentation change (#PR)
### π§ Maintenance
- **[scope]**: Maintenance task (#PR)
**Full Changelog**: https://github.com/codemie-ai/codemie-code/compare/${LAST_TAG}...v<VERSION>
Example concrete release notes:
## What's Changed
### π Bug Fixes
- **[utils]**: Auto-update PATH during Claude installation on Windows (#120)
### β»οΈ Refactoring
- **[skills]**: Relocate skills module to codemie-code agent (#117)
**Full Changelog**: https://github.com/codemie-ai/codemie-code/compare/v0.0.35...v0.0.36
Execute each step, skipping if already completed:
npm version <VERSION> --no-git-tag-version
Skip if package.json already at target version.
git add package.json package-lock.json
git commit -m "chore: bump version to <VERSION>
π€ Generated with release script"
Skip if commit message chore: bump version to <VERSION> exists in HEAD.
git tag -a "v<VERSION>" -m "Release version <VERSION>"
Skip if tag v<VERSION> already exists.
git push origin main
git push origin "v<VERSION>"
# Create release with generated notes
gh release create "v<VERSION>" \
--title "Release v<VERSION>" \
--notes "<GENERATED_RELEASE_NOTES>" \
--latest
Skip if release v<VERSION> already exists.
Use the concrete, categorized release notes generated in the previous section.
After successful release, inform user:
npm install @codemieai/code@<VERSION>https://github.com/codemie-ai/codemie-code/releases/tag/v<VERSION>