bumper-cli
v1.6.0
Published
π A magical release management system with beautiful changelogs and automated workflows
Maintainers
Readme
π Bumper
π A magical release management system with beautiful changelogs and automated workflows
Bumper is a modern, developer-friendly tool that automates your entire release process. From conventional commit validation to beautiful changelog generation, automated version bumping, and seamless GitHub releases - it handles everything with style.
β¨ Features
π Core Release Management
- Automated Releases - One command creates tags, changelogs, and GitHub releases
- Smart Versioning - Automatic patch/minor/major version bumping
- Beautiful Changelogs - Auto-generated with emojis and smart categorization
- NPM Publishing - Seamless package publishing with authentication
π Commit Management
- Commit Validation - Enforces conventional commit standards
- Interactive Commits - Guided commit message creation
- Commit Suggestions - AI-powered commit message improvements
- Git Hooks - Pre-commit validation with Husky
π·οΈ GitHub Integration
- Auto-Labeling - Automatically label PRs based on commit messages
- Release Readiness - Validate releases based on GitHub labels and requirements
- Enhanced Changelogs - Group changelog entries by labels for better organization
- Workflow Automation - GitHub Actions for seamless integration
π― Developer Experience
- Zero Configuration - Works out of the box with sensible defaults
- Beautiful UX - Colorful output with spinners and progress indicators
- Platform Agnostic - Works with any Git-based project
- Flexible Configuration - Customize everything via
bumper.config.json
π Quick Start
1. Install Bumper
Recommended: Per-Project Installation
npm install --save-dev bumper-cliAlternative: Global Installation
npm install -g bumper-cli2. Setup Your Project
# Initialize bumper in your project
bumper setup
# or if installed locally:
npx bumper setupThis will:
- β
Install necessary dependencies (
@commitlint/cli,husky) - β Create conventional commit validation rules
- β Set up Git hooks with Husky
- β Create GitHub Actions workflow
- β Add convenient NPM scripts to your package.json
- β Generate initial changelog
3. Make Your First Release
# Preview what your release will look like
npm run changelog:preview
# Create a patch release
npm run release:patchπ Legacy Project Migration
If you have an existing project that doesn't follow conventional commit format, bumper provides powerful tools to help you migrate. You can choose between invasive migration (rewriting history) or non-invasive migration (drawing a line in the sand).
ποΈ Non-Invasive: Line in the Sand (Recommended)
The safest approach is to draw a line in the sand and start fresh with conventional commits from a specific point forward:
# Start using conventional commits from now on
bumper line-in-sand
# Start from a specific date
bumper line-in-sand --start-date 2024-01-01
# Start from a specific commit
bumper line-in-sand --start-commit abc12345
# Start from a specific tag
bumper line-in-sand --tag v1.0.0Benefits:
- β No git history rewriting - completely safe
- β Immediate setup - start using conventional commits right away
- β Team friendly - no coordination needed
- β Gradual adoption - legacy commits remain unchanged
- β Changelog support - works with mixed commit formats
What happens:
- Sets up conventional commit infrastructure
- Creates a marker file and git tag to track the start point
- All new commits from that point forward use conventional format
- Legacy commits remain unchanged but are still included in changelogs
- Commit validation is active for new commits only
π§ Invasive: Full Migration
For projects that want to convert all existing commits to conventional format:
1. Analyze Your Current State
# Analyze commit patterns in your project
bumper analyze-legacy
# Analyze specific commit range
bumper analyze-legacy --range HEAD~100..HEAD
# Save analysis to file
bumper analyze-legacy --output analysis.jsonThis will show you:
- π Commit statistics and migration rate
- π Common commit patterns and suggested types
- π‘ Recommended migration strategy
- π― Next steps for your project
2. Migrate Your Project
# Migrate project to conventional commits
bumper migrate-legacy
# Force migration even if already set up
bumper migrate-legacy --force
# Migrate commits from a specific date
bumper migrate-legacy --start-date 2024-01-01This will:
- β Install conventional commit dependencies
- β Set up commitlint and husky hooks
- β Add convenient npm scripts
- β Configure validation rules
3. Bulk Format Legacy Commits
# Preview bulk formatting
bumper bulk-format --dry-run
# Format commits in a specific range
bumper bulk-format --range HEAD~50..HEAD
# Apply formatting (rewrites git history)
bumper bulk-formatβ οΈ Warning: Bulk formatting rewrites git history. Always backup your repository first!
4. Gradual Migration Strategy
For large projects, consider a gradual approach:
- Start with new commits using
bumper commitorbumper suggest - Format recent commits with
bumper bulk-format --range HEAD~20..HEAD - Analyze progress with
bumper analyze-legacy - Repeat until migration is complete
Migration Strategies
Bumper automatically suggests the best migration strategy:
- Line in the Sand: Recommended - Start fresh from a specific point (non-invasive)
- Bulk: For projects with < 50 legacy commits (invasive)
- Hybrid: For projects with mixed conventional/legacy commits (invasive)
- Gradual: For large projects with > 100 legacy commits (invasive)
When to Use Each Approach
| Approach | Best For | Risk Level | Team Coordination | |----------|----------|------------|-------------------| | Line in the Sand | Most projects | π’ None | None needed | | Bulk | Small projects, solo developers | π‘ Medium | Minimal | | Gradual | Large projects, teams | π‘ Medium | Moderate | | Hybrid | Mixed commit history | π‘ Medium | Moderate |
π Usage Guide
π― Installation Methods
| Method | Install Command | Usage Command | Works In | Best For |
|--------|----------------|---------------|----------|----------|
| Per-Project | npm install --save-dev bumper-cli | npm run <script> | Project directory only | Teams, production projects |
| Global | npm install -g bumper-cli | bumper <command> | Any directory | CLI tools, personal use |
π CLI Commands Reference
# Preview your next release
bumper preview
# Validate commit messages
bumper validate
# Generate changelog
bumper generate
# Create a release
bumper release <type> [--dry-run]
# Types: patch, minor, major
# Setup project (adds convenience scripts)
bumper setup
# Suggest commit format
bumper suggest "your message"
# Interactive commit creation
bumper commit
# GitHub integration
bumper setup-github
bumper check-release-readiness
bumper auto-label <pr-number>
# Legacy project migration
bumper line-in-sand [--start-date <date>] [--start-commit <commit>] [--tag <tag>] [--force]
bumper analyze-legacy [--range <range>] [--output <file>]
bumper migrate-legacy [--force] [--start-date <date>]
bumper bulk-format [--range <range>] [--dry-run]π¦ NPM Scripts (After Setup)
After running bumper setup, these convenience scripts are added to your package.json:
{
"scripts": {
"validate:commits": "bumper validate",
"changelog:preview": "bumper preview",
"changelog:generate": "bumper generate",
"release:patch": "bumper release patch",
"release:minor": "bumper release minor",
"release:major": "bumper release major",
"release:dry-run": "bumper release patch --dry-run",
"commit:suggest": "bumper suggest",
"commit:create": "bumper commit",
"github:setup": "bumper setup-github",
"github:check": "bumper check-release-readiness",
"github:label": "bumper auto-label",
"legacy:analyze": "bumper analyze-legacy",
"legacy:migrate": "bumper migrate-legacy",
"legacy:format": "bumper bulk-format",
"legacy:line-in-sand": "bumper line-in-sand"
}
}Usage:
# Convenience scripts (recommended)
npm run changelog:preview
npm run release:patch
npm run validate:commits
npm run commit:suggest "add login feature"
npm run commit:create
npm run github:check
npm run github:label 123π·οΈ GitHub Integration
Bumper's GitHub integration provides auto-labeling, release validation, and enhanced changelogs to streamline your workflow.
π Quick Setup
# Setup GitHub integration (requires GitHub CLI)
bumper setup-githubCreates:
bumper.config.json- Configuration file.github/workflows/auto-label.yml- Auto-labeling workflow- Documentation and next steps
π·οΈ Auto-Labeling PRs
Command: bumper auto-label <pr-number>
What it does: Analyzes commit messages in a PR and adds appropriate labels.
Default mappings:
featβenhancementfixβbugsecurityβsecuritydocsβdocumentation
Example:
# PR #123 has commits: "feat: add login" and "fix: auth bug"
bumper auto-label 123
# Result: Adds "enhancement" and "bug" labelsAutomation: The GitHub Actions workflow automatically labels PRs when they're opened or updated.
π Release Readiness Validation
Command: bumper check-release-readiness
What it checks:
- β No blocking labels on PRs since last release
- β Required labels present (if configured)
- β All PRs properly labeled
- β οΈ Status checks (if configured)
Example output:
π Checking release readiness...
β Release is not ready:
β’ PR #123 has blocking label: do-not-release
β’ PR #124 missing required label (ready-for-release)
π PRs since last release:
β’ #123: Add new login feature [enhancement, do-not-release]
β’ #124: Fix authentication bug [bug]π·οΈ Auto-Labeling
Automatically label PRs based on commit messages:
# Label a specific PR
bumper auto-label 123
# Or use the GitHub Actions workflow (automatic)Default mappings:
featβenhancementfixβbugsecurityβsecuritydocsβdocumentation
βοΈ Configuration
File: bumper.config.json (created by bumper setup-github)
Key sections:
Release Requirements:
{
"releaseRequirements": {
"requiredLabels": ["ready-for-release", "qa-approved"],
"blockingLabels": ["do-not-release", "wip", "block-release"],
"requiredStatusChecks": ["ci", "test"]
}
}Auto-Labeling:
{
"autoLabel": {
"enabled": true,
"mappings": {
"feat": ["enhancement"],
"fix": ["bug"],
"security": ["security"],
"docs": ["documentation"]
}
}
}Enhanced Changelogs:
{
"changelog": {
"groupByLabels": true,
"labelGroups": {
"π High Priority": ["high-priority", "critical"],
"π₯ Breaking Changes": ["breaking-change"],
"π¨ User Facing": ["user-facing", "ui", "ux"]
}
}
}Enhanced changelog example:
## [1.5.7] - 2024-01-01
### π High Priority
- feat: add critical security feature (abc123)
### π¨ User Facing
- feat: improve login UI (def456)
### π§ Internal
- refactor: optimize performance (ghi789)π― Best Practices
1. Essential Labels
gh label create "ready-for-release" --color "28a745"
gh label create "do-not-release" --color "dc3545"
gh label create "qa-approved" --color "17a2b8"
gh label create "enhancement" --color "0075ca"
gh label create "bug" --color "d73a4a"2. Team Workflow
# 1. Developer creates PR β Auto-labeling adds initial labels
# 2. QA reviews β Adds "qa-approved" label
# 3. Before release β Run "bumper check-release-readiness"
# 4. If ready β Create release
# 5. If not ready β Fix issues (remove blocking labels, add required labels)3. Always validate before releasing
bumper check-release-readiness
npm run release:patch⨠Commit Formatting & Suggestions
Bumper helps you write beautiful, conventional commit messages!
Suggest a Commit Format
Use the suggest command to get a conventional commit suggestion and improvement tips:
bumper suggest "add login button to UI"Output:
π‘ Commit Message Suggestions
Original: add login button to UI
Suggested: feat(ui): Add login button to ui
Improvements:
β’ Convert to conventional commit format
β’ Use scope for clarity
Type: feat
Scope: uiInteractive Commit Creation
Use the commit command for an interactive prompt to generate a conventional commit message:
bumper commitYou'll be guided through:
- Commit Type - feat, fix, docs, etc.
- Scope - optional component/module name
- Breaking Change - whether this is a breaking change
- Description - clear, concise description
Then copy the generated message into your git commit -m command.
π― Conventional Commits
Bumper follows the Conventional Commits specification:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]Supported Types
| Type | Emoji | Description |
| ---------- | ----- | ------------------------ |
| feat | β¨ | New features |
| fix | π | Bug fixes |
| docs | π | Documentation |
| style | π | Code style changes |
| refactor | β»οΈ | Code refactoring |
| perf | β‘ | Performance improvements |
| test | β
| Adding tests |
| build | π¦ | Build system changes |
| ci | π§ | CI/CD changes |
| chore | π¨ | Maintenance tasks |
| revert | βͺ | Reverting changes |
| security | π | Security fixes |
Examples
# Feature
git commit -m "feat: add user authentication"
# Bug fix
git commit -m "fix: resolve login timeout issue"
# Breaking change
git commit -m "feat!: change API response format"
# With scope
git commit -m "feat(auth): add OAuth2 support"π Changelog Generation
Bumper automatically generates beautiful changelogs with:
- π Smart Categorization - Groups commits by type with emojis
- β οΈ Breaking Changes - Highlights breaking changes prominently
- π₯ Contributors - Credits all contributors
- π¨ Beautiful Formatting - Clean, readable output
Example Output
## [1.2.0] - 2024-01-15 (MINOR RELEASE)
### β οΈ BREAKING CHANGES
- **auth:** change login endpoint response format (a1b2c3d4)
### β¨ Features
- **auth:** add OAuth2 support (e5f6g7h8)
- **ui:** implement dark mode toggle (i9j0k1l2)
### π Bug Fixes
- **api:** fix pagination bug (m3n4o5p6)
- **ui:** resolve mobile layout issues (q7r8s9t0)
### π₯ Contributors
Thanks to John Doe, Jane Smith for contributing to this release!π‘ Best Practices
π― Commit Message Best Practices
Use Bumper's Tools
# Always check your commit message first bumper suggest "your message" # For complex commits, use interactive mode bumper commitFollow Conventional Commits
- Use lowercase for type and scope:
feat(auth): add login - Keep description under 72 characters
- Use imperative mood: "add" not "added"
- Don't end with a period
- Use lowercase for type and scope:
Choose the Right Type
feat: New functionalityfix: Bug fixesdocs: Documentation changesstyle: Formatting, missing semicolons, etc.refactor: Code changes that neither fix bugs nor add featuresperf: Performance improvementstest: Adding or updating testschore: Maintenance tasks
Use Scopes Wisely
# Good - specific scope feat(auth): add OAuth2 support fix(api): resolve pagination bug # Avoid - too broad feat: add new feature fix: fix bugHandle Breaking Changes
# Breaking change in type feat!: change API response format # Breaking change in body feat: change API response format BREAKING CHANGE: This changes the API response format
π Release Management Best Practices
Start Small
# Always preview before releasing npm run changelog:preview # Use dry-run for testing npm run release:dry-runChoose the Right Version
patch: Bug fixes and minor improvementsminor: New features (backward compatible)major: Breaking changes
Keep a Clean History
# Validate commits before releasing npm run validate:commits # Fix any issues before proceeding git commit --amend -m "feat: correct commit message"Automate Everything
- Use the provided GitHub Actions workflow
- Let bumper handle versioning and changelog generation
- Automate NPM publishing
ποΈ Project Setup Best Practices
Install Per-Project
# Recommended for teams npm install --save-dev bumper-cliRun Setup Early
# Set up bumper at the start of your project bumper setupUse NPM Scripts
# Use the convenience scripts npm run changelog:preview npm run release:patchConfigure Your Team
- Share the conventional commits specification
- Use bumper's commit formatting tools
- Establish release workflows
π§ Development Workflow
Daily Development
# Write your code git add . # Format your commit message bumper suggest "add user authentication" # or bumper commit # Commit with the suggested message git commit -m "feat(auth): add user authentication"Before Releasing
# Validate all commits npm run validate:commits # Preview the release npm run changelog:preview # Create the release npm run release:patchAfter Releasing
- Review the generated changelog
- Check the GitHub release
- Verify NPM package is published
π¨ Common Mistakes to Avoid
Don't Skip Validation
# β Don't release without validating npm run release:patch # β Always validate first npm run validate:commits npm run release:patchDon't Ignore Commit Messages
# β Poor commit message git commit -m "fix stuff" # β Good commit message git commit -m "fix(auth): resolve login timeout issue"Don't Skip Previews
# β Don't release blind npm run release:patch # β Always preview first npm run changelog:preview npm run release:patch
π§ Configuration
Commitlint Configuration
The setup creates a commitlint.config.js file:
module.exports = {
rules: {
'type-enum': [
2,
'always',
[
'feat',
'fix',
'docs',
'style',
'refactor',
'perf',
'test',
'build',
'ci',
'chore',
'revert',
'security',
],
],
'type-case': [2, 'always', 'lowerCase'],
'type-empty': [2, 'never'],
'subject-case': [2, 'always', 'lowerCase'],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'header-max-length': [2, 'always', 72],
},
};GitHub Actions Workflow
Automatically creates .github/workflows/release.yml for automated releases.
πͺ API Reference
Programmatic Usage
import {
generateChangelog,
validateCommits,
createRelease,
formatCommitMessage,
suggestCommitFormat,
} from 'bumper-cli';
// Generate changelog
await generateChangelog({ preview: true });
// Validate commits
const result = await validateCommits();
// Create release
const release = await createRelease({
type: 'patch',
dryRun: true,
});
// Format commit message
const formatted = formatCommitMessage('add login feature', 'feat', 'auth');
// Suggest commit format
const suggestion = suggestCommitFormat('fix login bug');Types
interface Commit {
hash: string;
type: string;
scope?: string;
subject: string;
breaking?: boolean;
author: string;
date: string;
}
interface ReleaseResult {
success: boolean;
version: string;
tag: string;
changelog: string;
}
interface CommitSuggestion {
original: string;
suggested: string;
type: string;
scope?: string;
breaking: boolean;
improvements: string[];
}π€ Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feat/amazing-feature - Commit your changes:
git commit -m 'feat: add amazing feature' - Push to the branch:
git push origin feat/amazing-feature - Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Conventional Commits for the commit specification
- Keep a Changelog for the changelog format
- Husky for Git hooks
- Commitlint for commit validation
Made with β€οΈ by developers, for developers.
