Secure AI-powered Git commit message generator with enterprise-grade security. Automatically creates conventional commit messages using Groq, OpenRouter, or Cohere APIs. Source: https://github.com/Joshi-e8/ai-commit-generator.git
Project description
๐ค Smart Commits AI - Universal Git Commit Generator
AI-powered commit messages for ANY project - React, Flutter, Go, Python, and more!
Transform your Git workflow with AI that understands your code changes and generates perfect conventional commit messages. Works with any programming language and any project type.
This tool works as a Git pre-commit hook that analyzes your staged changes and generates professional commit messages using AI APIs (Groq, OpenRouter, Cohere).
๐ Quick Start (2 minutes)
๐ Universal Installation (Works with ANY Project)
Method 1: One-Line Install (Recommended)
# Universal installer - works on macOS, Linux, Windows
curl -fsSL https://raw.githubusercontent.com/Joshi-e8/ai-commit-generator/main/install.sh | bash
Method 2: NPM (Perfect for JavaScript/React/Next.js)
# Install via NPM (no Python knowledge required)
npm install -g smart-commits-ai
# Or use without global install
npx smart-commits-ai install
Method 3: Docker (Zero Dependencies)
# Works everywhere, no local setup needed
docker run --rm -v $(pwd):/workspace joshi/smart-commits-ai install
Method 4: Python Package (Traditional)
# For Python developers
pip install smart-commits-ai
๐ Choose Your Installation Method
| Method | Best For | Setup Time | Dependencies |
|---|---|---|---|
| One-Line Script | Any team | 30 seconds | Auto-detected |
| NPM Package | JS/React/Node teams | 15 seconds | Node.js |
| Docker | DevOps/Containerized | 20 seconds | Docker only |
| Python Package | Python developers | 10 seconds | Python 3.8+ |
โก Quick Setup (2 Minutes)
Step 1: Get Free API Key
Choose your preferred AI provider:
- ๐ Groq (Recommended - Free): https://console.groq.com/keys
- ๐ฏ OpenRouter (Premium models): https://openrouter.ai/keys
- ๐ข Cohere (Enterprise): https://dashboard.cohere.ai/api-keys
Step 2: Setup in Your Project
# Navigate to ANY Git repository (React, Flutter, Go, Python, etc.)
cd your-awesome-project
# Install Git hook
smart-commits-ai install
# Add your API key
echo "GROQ_API_KEY=your_key_here" >> .env
Step 3: Start Using AI Commits
# Normal Git workflow - AI handles the message!
git add src/components/Button.js
git commit # โจ AI generates: "feat(ui): add Button component with hover effects"
That's it! Every git commit now uses AI. ๐
๐ Works with ANY Project Type
React/Next.js Projects
# Install via NPM (feels native to JS developers)
npm install smart-commits-ai
npx smart-commits-ai install
# Example AI-generated commits:
# feat(components): add responsive navigation bar with mobile menu
# fix(api): resolve authentication token refresh issue
# style(ui): update button hover animations and color scheme
Flutter/Mobile Projects
# One-line install
curl -fsSL https://raw.githubusercontent.com/Joshi-e8/ai-commit-generator/main/install.sh | bash
# Example AI-generated commits:
# feat(widgets): implement custom date picker with theme support
# fix(navigation): resolve back button behavior on Android
# perf(images): optimize asset loading and caching strategy
Backend Projects (Go, Rust, Java, etc.)
# Docker approach (no dependencies)
docker run --rm -v $(pwd):/workspace joshi/smart-commits-ai install
# Example AI-generated commits:
# feat(api): add user authentication middleware with JWT
# fix(db): resolve connection pool timeout issues
# refactor(handlers): improve error handling and logging
Any Git Repository
# Universal installer
bash <(curl -fsSL https://raw.githubusercontent.com/Joshi-e8/ai-commit-generator/main/install.sh)
# Works with: Python, C++, C#, PHP, Ruby, Swift, Kotlin, and more!
โจ Features
- ๐ Universal: Works with ANY programming language and project type
- ๐ค AI-Powered: Uses Groq, OpenRouter, or Cohere APIs
- ๐ Conventional Commits: Automatic
type(scope): descriptionformat - โก Fast: < 2 second response time with Groq
- ๐ฆ Multiple Install Methods: NPM, Docker, Python, or standalone
- ๐ง Configurable: Customize prompts, models, and scopes
- ๐ก๏ธ Secure: Only staged changes sent to AI, no data storage
- ๐ Fallback: Works even if AI fails
- ๐ฏ Team-Friendly: No Python knowledge required for team adoption
- ๐งช Testable: Comprehensive test suite and type hints
- ๐จ Rich CLI: Beautiful command-line interface with colors
๐ฏ Real-World Examples
React Component Changes
# Your changes: Added a new Button component with TypeScript
git add src/components/Button.tsx
git commit
# ๐ค AI generates: "feat(components): add Button component with TypeScript and hover animations"
Flutter Widget Updates
# Your changes: Fixed navigation issue on Android
git add lib/screens/home_screen.dart
git commit
# ๐ค AI generates: "fix(navigation): resolve back button behavior on Android devices"
API Endpoint Development
# Your changes: Added user authentication middleware
git add src/middleware/auth.go
git commit
# ๐ค AI generates: "feat(auth): implement JWT middleware with role-based access control"
Database Schema Updates
# Your changes: Added indexes for better performance
git add migrations/add_user_indexes.sql
git commit
# ๐ค AI generates: "perf(db): add indexes on user table for faster queries"
๐ข Team Adoption
For JavaScript/TypeScript Teams
{
"devDependencies": {
"smart-commits-ai": "^1.0.4"
},
"scripts": {
"postinstall": "smart-commits-ai install",
"commit": "git commit"
}
}
For Any Team (Docker)
# Add to team setup docs
echo 'alias smart-commits="docker run --rm -v $(pwd):/workspace joshi/smart-commits-ai"' >> ~/.bashrc
For CI/CD Pipelines
# .github/workflows/commits.yml
- uses: joshi-e8/smart-commits-ai-action@v1
with:
api_key: ${{ secrets.GROQ_API_KEY }}
๐ Project Structure
ai-commit-generator/
โโโ README.md # This file
โโโ TEAM_SETUP_GUIDE.md # Detailed team documentation
โโโ pyproject.toml # Python package configuration
โโโ src/
โ โโโ ai_commit_generator/
โ โโโ __init__.py # Package initialization
โ โโโ cli.py # Command-line interface
โ โโโ core.py # Main commit generation logic
โ โโโ config.py # Configuration management
โ โโโ api_clients.py # AI API clients
โ โโโ git_hook.py # Git hook management
โโโ templates/
โ โโโ .commitgen.yml # Configuration template
โ โโโ .env.example # Environment template
โโโ tests/ # Test suite
โโโ examples/ # Usage examples
โโโ legacy/ # Original bash scripts
โโโ install_hook.sh # Legacy installer
โโโ hooks/
โโโ prepare-commit-msg # Legacy hook script
๐ฅ๏ธ CLI Commands
Install Hook
# Install Git hook in current repository
smart-commits-ai install
# Install with configuration files
smart-commits-ai install --config
# Force overwrite existing hook
smart-commits-ai install --force
Manage Installation
# Check installation status
smart-commits-ai status
# Test with current staged changes
smart-commits-ai test
# Uninstall hook
smart-commits-ai uninstall
Generate Messages
# Generate message for staged changes
smart-commits-ai generate
# Generate without writing to file (dry run)
smart-commits-ai generate --dry-run
# Generate and save to specific file
smart-commits-ai generate --output commit-msg.txt
Configuration
# Show current configuration
smart-commits-ai config --show
# Validate configuration
smart-commits-ai config --validate
๐ง Configuration
Basic Setup (.env)
# Choose one provider
GROQ_API_KEY=gsk_your_key_here
# OPENROUTER_API_KEY=sk-or-your_key_here
# COHERE_API_KEY=your_cohere_key_here
Advanced Setup (.commitgen.yml)
api:
provider: groq
commit:
max_chars: 72
types: [feat, fix, docs, style, refactor, test, chore]
scopes: [api, ui, auth, db, config]
prompt:
template: |
Generate a conventional commit message for:
{{diff}}
๐ข Team Deployment
Option 1: Shared Network Drive
# Copy to shared location
cp -r ai-commit-generator /shared/tools/
# Team members install from shared location
/shared/tools/ai-commit-generator/install_hook.sh
Option 2: Internal Git Repository
# Create internal repo
git init ai-commit-generator
git add .
git commit -m "feat: add AI commit message generator"
git remote add origin https://github.com/your-org/ai-commit-generator.git
git push -u origin main
# Team members clone and install
git clone https://github.com/your-org/ai-commit-generator.git
cd your-project
../ai-commit-generator/install_hook.sh
Option 3: Package Distribution
# Create distributable package
tar -czf ai-commit-generator.tar.gz ai-commit-generator/
# Team members download and extract
curl -sSL https://your-server/ai-commit-generator.tar.gz | tar -xz
./ai-commit-generator/install_hook.sh
๐ ๏ธ Advanced Usage
Custom Prompts
prompt:
template: |
You are a senior developer. Generate a commit message for:
{{diff}}
Requirements:
- Use conventional commits
- Be specific about business impact
- Maximum {{max_chars}} characters
Multiple Models
# Fast and efficient
GROQ_MODEL=llama3-8b-8192
# More detailed
GROQ_MODEL=llama3-70b-8192
# Creative
GROQ_MODEL=mixtral-8x7b-32768
Debug Mode
DEBUG_ENABLED=true
tail -f .commitgen.log
๐จ Troubleshooting
| Issue | Solution |
|---|---|
| "API key not found" | Check .env file, ensure correct variable is set |
| "jq: command not found" | Install jq: brew install jq or apt install jq |
| "Rate limit exceeded" | Wait 1 minute or switch to different provider |
| "Hook not working" | Reinstall: ./install_hook.sh |
๐ Provider Comparison
| Provider | Speed | Cost | Models | Best For |
|---|---|---|---|---|
| Groq | โก Very Fast | ๐ Free | Llama 3, Mixtral | Teams, Daily Use |
| OpenRouter | ๐ Medium | ๐ฐ Paid | Claude, GPT-4 | Premium Quality |
| Cohere | โ๏ธ Fast | ๐ Free Tier | Command-R | Enterprise |
๐ค Contributing
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'feat: add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
๐ License
MIT License - see LICENSE file for details.
๐ Acknowledgments
- Conventional Commits specification
- Groq for fast AI inference
- OpenRouter for model diversity
- Cohere for enterprise AI
๐ Success Stories
"We migrated our entire React team (12 developers) to Smart Commits AI in one day. Now our commit history is consistent and descriptive!" โ Frontend Team Lead
"Works perfectly with our Flutter CI/CD pipeline. No Python knowledge required for the mobile team." โ Mobile Developer
"The Docker approach was perfect for our polyglot microservices architecture." โ DevOps Engineer
๐ Why Teams Choose Smart Commits AI
| Team Type | Traditional Approach | With Smart Commits AI |
|---|---|---|
| React/Next.js | Inconsistent messages | Professional conventional commits |
| Flutter/Mobile | "fix", "update" messages | Descriptive widget/feature commits |
| Backend APIs | Generic descriptions | Specific endpoint/middleware commits |
| Full-Stack | Mixed commit styles | Unified team standards |
๐ Links
- ๐ฆ PyPI Package: https://pypi.org/project/smart-commits-ai/
- ๐ฆ NPM Package: https://www.npmjs.com/package/smart-commits-ai
- ๐ณ Docker Hub: https://hub.docker.com/r/joshi/smart-commits-ai
- ๐ Universal Installation Guide: UNIVERSAL_INSTALLATION.md
- ๐ข Team Setup Guide: TEAM_SETUP_GUIDE.md
Transform ANY team's commit messages today! ๐
Works with React, Flutter, Go, Python, Java, C++, and every other language.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smart_commits_ai-1.1.1.tar.gz.
File metadata
- Download URL: smart_commits_ai-1.1.1.tar.gz
- Upload date:
- Size: 29.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82ca7bf1c631f627f47ed853162eef3860f57593cf4703b2cc765088215e4449
|
|
| MD5 |
5a82d618aa4e4f5cbdfc97e1d55b077b
|
|
| BLAKE2b-256 |
f1fe98055825f68cad3b76c2697798aa105038e17d54edc0be1cc1e94c57def4
|
File details
Details for the file smart_commits_ai-1.1.1-py3-none-any.whl.
File metadata
- Download URL: smart_commits_ai-1.1.1-py3-none-any.whl
- Upload date:
- Size: 25.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16c436961e24c4242875b9d122f9d6b1f8e33467d2791a521b172b08f3ca8cda
|
|
| MD5 |
b450fbda44a255fd8f9d85867771d76d
|
|
| BLAKE2b-256 |
dee50e3d11b25fd5db75e01caa0aecd0262102277f8cdb3fc8c5fea7d2401242
|