Commet
Automated semantic versioning based on commit messages
Commet analyzes your git commit history and automatically updates version numbers in your project files based on conventional commit messages.
Features
- π Automatic semantic version bumping based on commit types
- π¦ Support for JSON (composer.json, package.json) and YAML (config.yaml) files
- π― Configurable commit type to version bump mapping
- π·οΈ Git tag-based and file-based version detection
- π§ Dry-run mode to preview changes
- π¨ Colored output for better readability
- π€ Optional auto-commit and auto-tag
- π Multiple version file support
- Type with scope:
Feature(log): added logger wrap
- Type without scope:
Fix: handle null responses
- Board with wrapped type:
J-123456(parser,regex): <Fix> syntax issue
- Board with unwrapped type:
U-1234(config): Feature new section
- Breaking!:
Fix!(core): Removed endpoint or Breaking: change
Installation
From Source
git clone https://github.com/yendefrr/commet.git
cd commet
go build -o commet cmd/commet/main.go
sudo mv commet /usr/local/bin/
Using Go Install
go install github.com/yendefrr/commet/cmd/commet@latest
Quick Start
- Initialize a config file in your project:
commet init
-
Edit .commet.toml to match your project structure
-
Run commet:
# Preview changes
commet --dry-run
# Apply version update
commet
# Verbose output
commet --verbose
# Commit version update (if disabled auto)
commet commit
# Commit version update with tag (if disabled auto)
commet commit --tag
Configuration
Basic Configuration
[version]
file = "config.yaml" # Path to version file
key = "app.version" # Key path (dot notation for nested)
initial = "0.1.0" # Initial version if none exists
format = "semver" # "semver" (1.2.3) or "v-prefix" (v1.2.3)
[bump_rules]
Fix = "patch" # Bug fixes
Feature = "minor" # New features
Refactor = "patch" # Code refactoring
Breaking = "major" # Breaking changes
"!" = "major" # Force major (Type!)
Docs = "none" # No version bump
Tests = "none" # No version bump
Style = "none" # No version bump
[detection]
strategies = ["git-tags", "version-file"] # Detect from git tags, then version file
tag_pattern = '^v?([0-9]+\.[0-9]+\.[0-9]+)$'
exclude_merges = true
# Git operations
[git]
auto_commit = false
commit_message = "Conf: bump version to {version}"
auto_tag = false
tag_format = "v{version}"
tag_message = "Release {version}"
# Multiple version files
[[additional_files]]
file = "package.json"
key = "version"
[[additional_files]]
file = "Chart.yaml"
key = "version"
CLI Usage
Usage:
commet [flags]
commet [command]
Available Commands:
commit Commit version changes to git
completion Generate the autocompletion script for the specified shell
help Help about any command
init Initialize a new .commet.toml configuration file
Flags:
--config string config file (default is .commet.toml)
--dry-run show what would be done without making changes
--from string start ref for commit range
-h, --help help for commet
--to string end ref for commit range (default "HEAD")
--verbose verbose output
Use "commet [command] --help" for more information about a command.
Precedence
When multiple commits are present, the highest bump type take priority:
MAJOR > MINOR > PATCH > NONE
Examples
Current version: 1.2.3
# Commits:
# - Fix(api): handle errors
# Result: 1.2.4 (PATCH)
# Commits:
# - Feature(auth): add OAuth
# - Fix(api): handle errors
# Result: 1.3.0 (MINOR - higher precedence)
# Commits:
# - Fix!(security): critical fix
# - Feature(auth): add OAuth
# Result: 2.0.0 (MAJOR - highest precedence)
Version Detection
Commet uses multiple strategies to detect the current version:
- Git tags (default): Finds the latest git tag matching the pattern
- Version file: Reads version from the configured file
- Initial version: Falls back to configured initial version (default: 0.1.0)
You can configure the detection order in .commet.yaml:
detection:
strategies:
- git-tags
- version-file
Works perfectly with meteor