AI-powered commit message generator for git with built-in security validation and conventional commit format enforcement.
- 🤖 AI-Generated Messages: Uses Google Gemini to analyze git diffs and generate meaningful commit messages
- 🔒 Security Validation: Automatically detects
API keys,tokens, andsensitive datain commits - 📝 Conventional Commits: Enforces conventional commit format (feat, fix, docs, etc.)
- ✅ Smart Validation: Validates message length, content quality, and format
- ✏️ Interactive Editing: Review, edit, or regenerate commit messages before committing
- 🚀 Auto-Push: Optional flag to push changes immediately after commit
- Python 3.7+
- Git
- Google Gemini API Key (Get one here)
-
Clone and setup:
git clone <repository-url> cd lazzy-commit .\setup-path.bat
-
Add to PATH:
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";<repository-path>", "User")
example:
$ [Environment]::SetEnvironmentVariable("Path", $env:Path + ";D:\Repositories\lazzy-commit", "User")
⚠️ Restart your pc after adding to PATH for changes to take effect. -
Configure API Key:
- Edit
.envfile - Add your Gemini API key and the model you want to use:
GEMINI_API_KEY=your_api_key_here GEMINI_MODEL=gemini-2.0-flash-exp
- Edit
-
Run from any git repository:
lazzycommit
Stage your changes and run:
lazzycommitThe tool will:
- 🔍 Analyze your staged changes
- 🤖 Generate a commit message using AI
- 📝 Display the message for review
- ✅ Prompt you to confirm, edit, or cancel
Commit and push in one command:
lazzycommit --push
# or
lazzycommit -pAfter message generation, you can:
y(yes) - Accept and commitn(no) - Cancele(edit) - Edit the message before committing
Edit .env to customize behavior:
# Gemini API Configuration
GEMINI_API_KEY=your_api_key_here
GEMINI_MODEL=gemini-2.0-flash-exp
# Validation Settings
MAX_SUBJECT_LENGTH=100
# Security Checks
CHECK_API_KEYS=true
CHECK_SENSITIVE_DATA=true
# Format Enforcement
ENFORCE_CONVENTIONAL_COMMITS=true
ENFORCE_LENGTH_LIMIT=trueSecurity Validators:
- ✋ Blocks commits containing API keys, tokens, passwords
- ✋ Detects sensitive patterns (AWS keys, private keys, etc.)
Format Validators:
- ✅ Enforces conventional commit format:
type: description - ✅ Supported types:
feat,fix,docs,style,refactor,test,build,ci,modify,revert - ✅ Subject line length limit (default: 100 characters)
Content Validators:
- ✋ Blocks WIP/TODO/FIXME commits
- ✅ Ensures minimum message length (10 characters)
pip install -r requirements.txtpython main.pyMIT License - Feel free to use and modify
Contributions are welcome! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
Made with ❤️ and a bit of laziness 😪💤