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 to PyPI Stars Downloads


✨ 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


⭐ Support

If you find this project useful or interesting, consider giving it a star — it helps others discover it too.


👤 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.2.tar.gz (6.1 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.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file ai_code_reviewer_cli-0.1.2.tar.gz.

File metadata

  • Download URL: ai_code_reviewer_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 6.1 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.2.tar.gz
Algorithm Hash digest
SHA256 a9f2d5d37ae3f02f808a333f9133382c0b0500007befd2880889fd62ed64cbd8
MD5 e24b928ce782bb04848ddf8547e1f36f
BLAKE2b-256 58bc5b8782d41b4cf37c7b339f6db4bd0b3d7d1eaba1c7b6cfd7e29e5dced4b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_code_reviewer_cli-0.1.2.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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_code_reviewer_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ca9d283692c185ab30b12b3880b3373991b6d199630209c0875791cfa435010d
MD5 d844a9244f8e1ee6d24dffdc60114eae
BLAKE2b-256 5119a1238de5be05b0af085525457b3c45e74a9a7050cc1792e81b40a0bf0470

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_code_reviewer_cli-0.1.2-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