DiffAid
AI-assisted git diff review CLI that catches bugs before you commit.
Features
- 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
Installation
Install DiffAid using pip:
pip install diffaid
Requirements
- Python 3.10+
- Git
- Gemini API key (free tier available)
Setup
-
Get a free Gemini API key at: https://aistudio.google.com/apikey
-
Set the GEMINI_API_KEY environment variable.
Option 1: Using .env file (Recommended)
Create a .env file in your project root:
GEMINI_API_KEY=your-key-here
Option 2: Environment Variable
Mac / Linux:
export GEMINI_API_KEY="your-key-here"
Windows (PowerShell):
$env:GEMINI_API_KEY="your-key-here"
Permanent Setup
Mac / Linux
Add to ~/.bashrc or ~/.zshrc:
echo 'export GEMINI_API_KEY="your-key-here"' >> ~/.bashrc
source ~/.bashrc
Windows
Add as a system environment variable through System Properties, or use PowerShell:
[System.Environment]::SetEnvironmentVariable(
'GEMINI_API_KEY',
'your-key-here',
'User'
)
Usage
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
Command Options
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
Example Output
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
Exit Codes
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)
Project Structure
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
Development
Running Tests
Install dev dependencies
pip install -e ".[dev]"
Run tests
pytest
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License – see the LICENSE file for details.
Acknowledgments
Powered by Google Gemini
Metadata
Release files for diffaid 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| diffaid-0.2.1.tar.gz | 12.4 kB | Without provenance | Details for diffaid-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| diffaid-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for diffaid-0.2.1-py3-none-any.whl |
Total release size: 23.3 kB
Release files / diffaid-0.2.1.tar.gz
| Download URL | diffaid-0.2.1.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b23e5353747fd1fb42fafa2a7581fc90bde59fd01b009e9b96ee3a15b947519b
|
|
BLAKE2b-256 checksum How to use checksums |
33269f84f673503def035667aa593dbb80eb10c9f4bf6a6bbbf71a08df87af0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / diffaid-0.2.1-py3-none-any.whl
| Download URL | diffaid-0.2.1-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37055b6cbf87d2ea7225c2e66134308954e23d571c387168e9842d5641173eae
|
|
BLAKE2b-256 checksum How to use checksums |
8f2b98f66323949a71b26981257f7c12fbe465a7259f91df629da68c018939de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for diffaid 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.