š git-meld
Enhance your git commits with AI-powered commit messages!
git-meld
is a CLI tool that uses AI to analyze your changes and generate meaningful, detailed commit messages. It's like having a helpful co-pilot for your git commits! š
āØ Features
- š¤ Uses AI to analyze your git diff and generate detailed commit messages
- š Powered by OpenRouter - access to multiple AI models
- šÆ Considers both staged changes and git status
- š Adds relevant emojis to make your commits more expressive
- š Securely stores your API key in your system's keychain
- š Simple to use - just replace
git commit
with meld
- š Support for custom commit guidelines via
.meld
file
š¦ Installation
npm install -g git-meld
š ļø First Time Setup
On first run, git-meld will ask for your OpenRouter API key:
meld
# Follow the prompt to enter your OpenRouter API key
Get your API key from OpenRouter.
Your API key will be stored securely in your system's keychain.
By default, git-meld uses the openai/o1-mini-2024-09-12
model, but you can easily switch to any other model available on OpenRouter.
š” Usage
- Stage your changes as usual:
git add . # or git add <specific-files>
- Instead of
git commit
, use:
meld "brief description"
The tool will analyze your changes and generate a detailed, meaningful commit message!
Commands
meld "your message"
- Create an enhanced commit message
meld --dry "message"
- Preview the commit message without committing
meld --choose-model
- Select an AI model from available models
meld --set-model "model-id"
- Set model ID directly (e.g., "anthropic/claude-2")
meld --reset-key
- Reset the stored API key and model choice
meld --help
- Show help information
Choosing a Model
You can choose from any model available on OpenRouter:
# Interactive model selection
meld --choose-model
# Direct model setting
meld --set-model "anthropic/claude-2"
Custom Commit Guidelines
You can create a .meld
file in your repository root to provide additional instructions for commit message generation. These instructions will be included every time a commit message is generated.
Example .meld
file:
Follow conventional commits format (feat, fix, docs, etc)
Include ticket number from Jira (e.g., PROJ-123)
Keep subject line under 72 characters
The contents of this file will be added to the AI prompt, helping to maintain consistent commit message style across your project.
š Example
$ git add feature.ts
$ meld "add user auth"
# Generated commit message might look like:
āØ feat(auth): Implement user authentication system
- Add JWT token validation middleware
- Create secure password hashing functionality
- Implement session management
š¤ Why git-meld?
"Meld" is a Dutch word meaning "report" or "announce". This tool helps you announce your changes in a more meaningful way, ensuring your git history is clear and informative.
š Security
Your API key is stored securely in your system's keychain, not in plain text files.
š License
MIT Ā© 2024
š Issues
Found a bug? Please open an issue!