🤖 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
👤 Author
Muhil (@muhilvannan16)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_code_reviewer_cli-0.1.1.tar.gz.
File metadata
- Download URL: ai_code_reviewer_cli-0.1.1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bc9a551de2c154b900dddede43b07b054221d29c75ad89dd874271e4f82e586
|
|
| MD5 |
430a23d56b23e64ce10e6d28c12897ab
|
|
| BLAKE2b-256 |
10debe56ac214470ec37defd53ded66d17fb7da03fa437627e82acf57bb1da70
|
Provenance
The following attestation bundles were made for ai_code_reviewer_cli-0.1.1.tar.gz:
Publisher:
publish.yml on muhilvannan16/ai-code-reviewer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_code_reviewer_cli-0.1.1.tar.gz -
Subject digest:
8bc9a551de2c154b900dddede43b07b054221d29c75ad89dd874271e4f82e586 - Sigstore transparency entry: 2457254463
- Sigstore integration time:
-
Permalink:
muhilvannan16/ai-code-reviewer@e099d194778a1bf78b7101959a35b7a311674bc2 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/muhilvannan16
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e099d194778a1bf78b7101959a35b7a311674bc2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ai_code_reviewer_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ai_code_reviewer_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a0b47ef2bd6d136955bdbdf4af049e100fb6d3ef984891ab30bfad2f3ed2893
|
|
| MD5 |
8db7bad9265b64ede3198a4635ff129c
|
|
| BLAKE2b-256 |
093894c078fa701982e5de6854f61afd55cc2ebc3b97ba82bee588ca769525cb
|
Provenance
The following attestation bundles were made for ai_code_reviewer_cli-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on muhilvannan16/ai-code-reviewer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_code_reviewer_cli-0.1.1-py3-none-any.whl -
Subject digest:
4a0b47ef2bd6d136955bdbdf4af049e100fb6d3ef984891ab30bfad2f3ed2893 - Sigstore transparency entry: 2457254675
- Sigstore integration time:
-
Permalink:
muhilvannan16/ai-code-reviewer@e099d194778a1bf78b7101959a35b7a311674bc2 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/muhilvannan16
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e099d194778a1bf78b7101959a35b7a311674bc2 -
Trigger Event:
push
-
Statement type: