gemini-commit-ai
v1.3.0
Published
AI-powered git commit message generator using Google Gemini
Maintainers
Readme
🤖 Gemini Commit AI
AI-powered git commit message generator using Google Gemini
Transform your git workflow with intelligent, context-aware commit messages generated by Google's Gemini AI.
✨ Features
- 🧠 AI-Powered: Uses Google Gemini to analyze your code changes
- 📝 Smart Suggestions: Generates 3 ranked commit message options
- 🎯 Context Aware: Considers recent commits, branch names, and file changes
- 🔧 Conventional Commits: Supports conventional commit format
- ⚡ Fast & Easy: One command to generate perfect commit messages
- 🎨 Interactive CLI: Beautiful, user-friendly interface
- ⚙️ Configurable: Customize behavior per project or globally
🚀 Quick Start
Installation
npm install -g gemini-commit-aiSetup
# Initialize configuration
gemini-commit-ai initUsage
# Stage your changes
git add .
# Generate and select commit message
gemini-commit-ai
# Or use the short alias
gca📖 Usage Examples
Basic Usage
# Generate commit message suggestions
gemini-commit-ai
# Auto-commit with best suggestion
gemini-commit-ai --commit
# Auto-commit and push
gemini-commit-ai --commit --pushAdvanced Usage
# Non-interactive mode (uses best suggestion)
gemini-commit-ai --no-interactive --commit
# Check staged changes
gemini-commit-ai status
# Manage configuration
gemini-commit-ai config --list
gemini-commit-ai config --set maxLength=100🔧 Installation & Setup
1. Install the package
npm install -g gemini-commit-ai2. Get Google Gemini API Key
- Go to Google AI Studio
- Create a new API key
- Copy the key
3. Configure the tool
gemini-commit-ai initOr set environment variable:
export GEMINI_API_KEY="your-api-key-here"⚙️ Configuration
Configuration is stored in:
- Global:
~/.gemini-commit-ai.json - Project:
.gemini-commit-ai.json(in project root)
Options
| Option | Default | Description |
|--------|---------|-------------|
| geminiApiKey | - | Your Google Gemini API key |
| conventionalCommits | true | Use conventional commits format |
| maxLength | 72 | Maximum commit message length |
| includeBody | false | Include detailed commit body |
| customPrompt | - | Additional instructions for AI |
Example Configuration
{
"geminiApiKey": "your-api-key",
"conventionalCommits": true,
"maxLength": 72,
"includeBody": false,
"customPrompt": "Always mention the ticket number from branch name"
}🎯 Commands
| Command | Alias | Description |
|---------|-------|-------------|
| gemini-commit-ai | gca | Generate commit message (default) |
| gemini-commit-ai init | - | Initialize configuration |
| gemini-commit-ai config | - | Manage configuration |
| gemini-commit-ai status | - | Show staged changes |
📋 Examples
Generated Commit Messages
Before:
Modified user authentication and added error handlingAfter (with gemini-commit-ai):
feat(auth): implement JWT token validation with error handling
- Add middleware for token verification
- Implement proper error responses for invalid tokens
- Add unit tests for authentication flow🔒 Privacy & Security
- Your code changes are sent to Google Gemini API
- API key is stored locally in config files
- No data is stored or logged by this package
- Consider using environment variables for API keys in CI/CD
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
gemini-commit-ai --commit) - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📝 License
MIT License - see LICENSE file for details.
Made with ❤️ by developers, for developers
Powered by Google Gemini AI 🤖
## **Now publish:**
```bash
npm publishAfter publishing, test it:
# Install globally
npm install -g gemini-commit-ai
# Test it
gemini-commit-ai --help
# Test in a git repo
cd /path/to/your/git/repo
git add .
gemini-commit-aiCreate GitHub repository:
git init
git add .
git commit -m "feat: initial release of gemini-commit-ai"
git remote add origin https://github.com/yourusername/gemini-commit-ai.git
git push -u origin main