Skip to main content

🤖 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.

PyPI Python Groq Publish


✨ Key Features

  • Reviews staged changes automatically — parses git diff --staged down 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

ai_code_reviewer_cli-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_code_reviewer_cli-0.1.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

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

Hashes for ai_code_reviewer_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8bc9a551de2c154b900dddede43b07b054221d29c75ad89dd874271e4f82e586
MD5 430a23d56b23e64ce10e6d28c12897ab
BLAKE2b-256 10debe56ac214470ec37defd53ded66d17fb7da03fa437627e82acf57bb1da70

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_code_reviewer_cli-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_code_reviewer_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a0b47ef2bd6d136955bdbdf4af049e100fb6d3ef984891ab30bfad2f3ed2893
MD5 8db7bad9265b64ede3198a4635ff129c
BLAKE2b-256 093894c078fa701982e5de6854f61afd55cc2ebc3b97ba82bee588ca769525cb

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page