🤖 AI Code Reviewer — AI-Powered Git Diff Analysis
AI Code Reviewer is a CLI tool that reviews your staged git changes before you commit — catching bugs, unsafe patterns, and logic errors using an LLM, with built-in hallucination filtering so you only see findings that actually correspond to real lines in your diff.
✨ Key Features
- Reviews staged changes automatically — parses
git diff --stageddown to exact added lines and line numbers, not just raw diff text - Hallucination-checked output — every AI-generated comment is cross-validated against the real diff before being shown, so you never get a "bug" pointing at a line that doesn't exist
- Severity-ranked, color-coded terminal output — critical issues in red, warnings in yellow, info in cyan, powered by
rich - Pre-commit hook integration — can block a commit outright when a critical issue is found, enforced at the git level regardless of whether you commit from the terminal, VS Code, or any other tool
- Fails safe — network errors or malformed AI responses never crash your workflow or silently block a commit
📦 Installation
pip install ai-code-reviewer-cli
You'll need a free Groq API key. Set it as a persistent environment variable (not a .env file — this needs to work from any project directory, not just one folder):
Windows:
setx GROQ_API_KEY "your-key-here"
macOS/Linux:
echo 'export GROQ_API_KEY="your-key-here"' >> ~/.zshrc # or ~/.bashrc
🚀 Usage
git add your_file.py
ai-review
Example output:
[app.py:12] CRITICAL: Mutable default argument 'items=[]' can retain state across calls. [app.py:24] WARNING: Using 'is' for string comparison instead of '=='.
🔒 Pre-commit Hook (optional)
To block commits automatically when a critical issue is found, add a pre-commit hook to any repo that calls this tool's review pipeline and exits non-zero on critical findings. See hooks/pre_commit_check.py in this repo for a working example.
🛠️ Built With
- Python — core CLI and diff-parsing logic
- Groq (
openai/gpt-oss-120b) — LLM-powered review generation - Rich — colored terminal output
- python-dotenv — local development configuration
- GitHub Actions + PyPI Trusted Publishing — fully automated, secretless release pipeline
📄 License
MIT
⭐ Support
If you find this project useful or interesting, consider giving it a star — it helps others discover it too.
👤 Author
Muhil (@muhilvannan16)
Metadata
Release files for ai-code-reviewer-cli 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ai_code_reviewer_cli-0.1.2.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ai_code_reviewer_cli-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.6 kB
Release files / ai_code_reviewer_cli-0.1.2.tar.gz
| Download URL | ai_code_reviewer_cli-0.1.2.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9f2d5d37ae3f02f808a333f9133382c0b0500007befd2880889fd62ed64cbd8
|
|
BLAKE2b-256 checksum How to use checksums |
58bc5b8782d41b4cf37c7b339f6db4bd0b3d7d1eaba1c7b6cfd7e29e5dced4b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 17, 2026.
Transparency logRelease files / ai_code_reviewer_cli-0.1.2-py3-none-any.whl
| Download URL | ai_code_reviewer_cli-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca9d283692c185ab30b12b3880b3373991b6d199630209c0875791cfa435010d
|
|
BLAKE2b-256 checksum How to use checksums |
5119a1238de5be05b0af085525457b3c45e74a9a7050cc1792e81b40a0bf0470
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 17, 2026.
Transparency log