AI-assisted git diff review CLI that catches bugs before you commit.
- Smart Analysis – Uses Gemini AI to review code changes
- CI Integration – Exit codes for automated workflows
- Fast – Reviews in seconds with Gemini Flash
- Clean Output – Color-coded findings in your terminal
Install DiffAid using pip:
pip install diffaid- Python 3.10+
- Git
- Gemini API key (free tier available)
-
Get a free Gemini API key at: https://aistudio.google.com/apikey
-
Set the GEMINI_API_KEY environment variable.
Create a .env file in your project root:
GEMINI_API_KEY=your-key-here
export GEMINI_API_KEY="your-key-here"
$env:GEMINI_API_KEY="your-key-here"
Add to ~/.bashrc or ~/.zshrc:
echo 'export GEMINI_API_KEY="your-key-here"' >> ~/.bashrc
source ~/.bashrc
Add as a system environment variable through System Properties, or use PowerShell:
[System.Environment]::SetEnvironmentVariable(
'GEMINI_API_KEY',
'your-key-here',
'User'
)
Stage your changes and run DiffAid:
git add .
diffaid
DiffAid will analyze your staged changes and report:
Errors – Critical issues that should be fixed
Warnings – Potential problems worth reviewing
Notes – Suggestions for improvement
diffaid- Quick overview (default mode)diffaid --detailedordiffaid -d- Detailed line-by-line review with all suggestionsdiffaid --json- Output raw JSON instead of formatted textdiffaid --strict- Treat warnings as errors (exit code 1)diffaid --versionordiffaid -v- Show version and exit
Summary: Added user authentication with JWT tokens
ERROR: Hardcoded secret key detected
→ auth.py
WARNING: Missing error handling for database connection
→ db.py
NOTE: Consider adding rate limiting to login endpoint
→ routes.py
---
Found: 1 error, 1 warning, 1 note
DiffAid uses standard exit codes for CI/CD integration:
- 0 – No errors found (warnings are OK in normal mode)
- 1 – Errors found, OR warnings found in
--strictmode - 2 – Tool error (git/API failure)
diffaid/
├── diffaid/
│ ├── ai/ # AI engine implementations
│ ├── cli.py # Command-line interface
│ ├── git.py # Git integration
│ └── models.py # Data models
├── tests/ # Test suite
├── pyproject.toml # Project configuration
└── README.md
pip install -e ".[dev]"
pytest
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License – see the LICENSE file for details.
Powered by Google Gemini