https://github.com/surajahasarinda/lazzy-commit
AI-powered Git commit message generator with security validation (API key checking, sensitive data detection)
https://github.com/surajahasarinda/lazzy-commit
ai api-keys commit git
Last synced: 6 days ago
JSON representation
AI-powered Git commit message generator with security validation (API key checking, sensitive data detection)
- Host: GitHub
- URL: https://github.com/surajahasarinda/lazzy-commit
- Owner: SurajaHasarinda
- License: mit
- Created: 2025-12-05T20:17:47.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-12-05T20:24:42.000Z (5 months ago)
- Last Synced: 2025-12-09T09:38:55.797Z (5 months ago)
- Topics: ai, api-keys, commit, git
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lazzy Commit 😪💤
AI-powered commit message generator for git with built-in security validation and conventional commit format enforcement.
## ✨ Features
- 🤖 **AI-Generated Messages**: Uses Google Gemini to analyze git diffs and generate meaningful commit messages
- 🔒 **Security Validation**: Automatically detects `API keys`, `tokens`, and `sensitive data` in 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
## 📋 Requirements
- Python 3.7+
- Git
- Google Gemini API Key ([Get one here](https://makersuite.google.com/app/apikey))
## 🚀 Quick Start
### Windows
1. **Clone and setup**:
```powershell
git clone
cd lazzy-commit
.\setup-path.bat
```
2. **Add to PATH**:
```powershell
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";", "User")
```
example:
```powershell
$ [Environment]::SetEnvironmentVariable("Path", $env:Path + ";D:\Repositories\lazzy-commit", "User")
```
⚠️ Restart your pc after adding to PATH for changes to take effect.
3. **Configure API Key**:
- Edit `.env` file
- 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
```
4. **Run from any git repository**:
```powershell
lazzycommit
```
## 📖 Usage
### Basic Usage
Stage your changes and run:
```bash
lazzycommit
```
The tool will:
1. 🔍 Analyze your staged changes
2. 🤖 Generate a commit message using AI
3. 📝 Display the message for review
4. ✅ Prompt you to confirm, edit, or cancel
### Auto-Push
Commit and push in one command:
```bash
lazzycommit --push
# or
lazzycommit -p
```
### Interactive Prompts
After message generation, you can:
- `y` (yes) - Accept and commit
- `n` (no) - Cancel
- `e` (edit) - Edit the message before committing
## ⚙️ Configuration
Edit `.env` to customize behavior:
```env
# 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=true
```
### Validation Rules
**Security 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)
## 🔧 Development
### Install Dependencies
```bash
pip install -r requirements.txt
```
### Run Locally
```bash
python main.py
```
## 📄 License
MIT License - Feel free to use and modify
## 🤝 Contributing
Contributions are welcome! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
---
**Made with ❤️ and a bit of laziness** 😪💤