Comet 🌠
A flexible, schema-driven CLI tool for creating structured git commit messages.
Why Comet?
Stop manually formatting git commit messages. Define your commit schema once, and Comet handles the rest with interactive prompts, validation, and consistent formatting. Whether you follow Conventional Commits or have your own commit message standards, Comet makes it easy to enforce and maintain them.
Demo
Features
- 🎯 Interactive prompts - Step-by-step guidance for creating git commits
- ⚙️ Schema-driven - Define your own git commit message format via TOML
- 📝 Conventional commits - Ships with Conventional Commits preset
- ✅ Built-in validation - Enforce message length, patterns, and required fields
- ✍️ Git integration - Uses
git commitunder the hood, respecting all your existing Git configuration - 🔍 Git-aware - Detects repository and shows staged files
Installation
The binary is named git-cmt, which allows you to invoke it as a Git subcommand:
Make sure the binary is in your PATH for Git to find it.
Quick Start
# Initialize configuration in your repository
# Create a commit (interactive mode)
# Get help
[!NOTE] Use
-hfor help, not--help. Git intercepts--helpto look for man pages.
Usage
Create a commit
This will:
- Detect and show your staged files
- Prompt for commit details based on your schema (type, scope, description, etc.)
- Preview the final git commit message
- Create the commit using
git commit(respects your existing Git config including GPG signing, hooks, etc.)
Initialize configuration
Prompts you to choose a template and creates a .comet.toml file in your git repository root. Available templates:
- Conventional Commits - Standard format with type, scope, description, body, and footer
- Minimal - Simple format with just description and optional body
You can also skip the prompt by specifying a template directly:
Once created, customize the .comet.toml schema to match your team's git commit message standards.
Configuration
Comet looks for .comet.toml in the following locations (in order):
- Git repository root (
.comet.toml) - User config directory (
~/.config/comet/.comet.toml)
If no config file is found, Comet uses the Conventional Commits preset by default.
Bypass Interactive Mode
Skip prompts by providing field values directly:
# Provide specific fields
# Use --no-prompt to commit with only provided fields
This is useful for automation or scripts while still maintaining your schema format.
Schema Reference
Example Schema
Here's the default Conventional Commits schema that ships with Comet:
[]
= """
{type}({scope}): {description}
{body}
{footer}"""
[[]]
= "type"
= "select"
= "Select commit type"
= true
= "Type of change you're committing"
= [
"feat",
"fix",
"docs",
"refactor",
"test",
"chore",
]
[[]]
= "scope"
= "text"
= "Scope (optional)"
= false
= "Component affected (e.g., api, auth, ui)"
[]
= 1
= 20
[[]]
= "description"
= "text"
= "Description"
= true
= "Brief description of changes (1-72 characters)"
[]
= 1
= 72
[[]]
= "body"
= "multiline"
= "Body (optional)"
= false
= "Detailed explanation of changes"
= 72
[[]]
= "footer"
= "text"
= "Footer (optional)"
= false
= "Breaking changes, issue references (e.g., 'Closes #42')"
[]
= "^[a-zA-Z-]+[: #].+$"
Field Types
select
Choose from a predefined list of options (dropdown).
[[]]
= "type"
= "select"
= "Select commit type"
= true
= ["feat", "fix", "docs"]
text
Single-line text input.
[[]]
= "scope"
= "text"
= "Scope (optional)"
= false
multiline
[[]]
= "body"
= "multiline"
= "Body (optional)"
= false
= 72 # Wrap text at 72 characters
confirm
Yes/no confirmation that can map to custom strings in the output.
[[]]
= "breaking"
= "confirm"
= "Breaking change?"
= true
[]
= "!"
= ""
Validation Rules
Add validation to enforce constraints on field values:
min and max
Enforce minimum and maximum length:
[]
= 1
= 72
pattern
Use regex pattern matching:
[]
= "^[a-zA-Z-]+[: #].+$"
Template System
The output.template uses placeholders like {type}, {scope}, etc. that correspond to field IDs.
Comet automatically:
- Substitutes placeholders with user input
- Removes empty optional fields and surrounding syntax (e.g.,
({scope})becomes empty if scope is blank) - Cleans up extra whitespace and blank lines
- Validates required fields are present
Custom Schemas
Example: Jira-style commits
[]
= "[{ticket}] {description}\n\n{details}"
[[]]
= "ticket"
= "text"
= "Jira ticket"
= true
= "Jira ticket number (e.g., PROJ-123)"
[]
= "^[A-Z]+-[0-9]+$"
[[]]
= "description"
= "text"
= "Description"
= true
[[]]
= "details"
= "multiline"
= "Additional details"
= false
Requirements
- Git 2.0+ - Required for commit operations
- Rust 1.85+ - Only required if building from source
Contributing
Contributions are welcome! Please feel free to:
- Report bugs or request features via GitHub Issues
- Submit pull requests
- Share your custom schemas
License
Licensed under MIT or Apache-2.0 at your option.