ai-commit-message
v1.2.9
Published
AI-powered git commit message generator using Gemini API
Downloads
774
Maintainers
Keywords
Readme
🤖 AI Commit Message Generator
Let AI craft the perfect conventional commit messages for your git repositories using Google's Gemini Pro API! 🎯
🎥 Demo
✨ Features
- 🧠 Generates meaningful commit messages based on staged changes
- 🎯 Follows Conventional Commits format
- 🚀 Auto-commit option available
- ⚡ Fast and lightweight
- 🔐 Secure API key management
- 🎨 Beautiful CLI with colored output
🚀 Installation
npm install -g ai-commit-message
🔑 Setup
Get your Gemini API key from Get a Gemini API key
Configure the API key:
ai-commit-message config <your-api-key>
Alternatively, set the GEMINI_API_KEY
environment variable.
export GEMINI_API_KEY=<your-api-key>
💫 Usage
Generate a Commit Message
# Stage your changes first
git add .
# NOW, Generate a commit message
ai-commit-message
Generate and auto-commit
ai-commit-message -c
CLI Options
Commands:
config <key> Configure Gemini API key
generate [options] Generate commit message
help [command] display help for command
🛠️ How It Works
- Verifies you're in a git repository
- Checks for staged changes
- Sends the diff to Gemini Pro API
- Generates a conventional commit message
- Either displays the message or auto-commits (with -c flag)
🧩 Technical Details
- Uses Gemini 1.5 Pro for advanced code understanding and long-context understanding.
- Implements Conventional Commits specification
- Built with modern ES modules
- Handles errors gracefully with user-friendly messages
- Secure configuration management using
conf
📦 Dependencies
@google/generative-ai
- Google's Gemini AI APIcommander
- CLI frameworksimple-git
- Git operationsconf
- Configuration managementchalk
- Terminal styling
🔧 Requirements
- Node.js >= 18.0.0
- Git installed and configured
- Gemini API key
🤝 Contributing
Contributions are welcome! Feel free to:
- 🐛 Report bugs
- 💡 Suggest features
- 🔧 Submit PRs
📝 License
MIT License - feel free to use this in your projects!