AI-powered PR review CLI using OpenAI
Project description
PR Review CLI
An AI-powered code review tool that analyzes your git diff and routes it through the right level of LLM scrutiny.
How it works
git diff → LLM classifies change size
│
├── Small change ──→ Focused review (old vs new code)
│
└── Big change ──→ AST analysis finds all callers
└──→ Deep review (diff + impacted files)
Install
# Install the OpenAI client
pip install openai python-dotenv
# Run directly
python reviewer.py
# Or install as a CLI command
pip install -e .
pr-review
Usage
# Set your API key
export OPENAI_API_KEY=sk-... # macOS / Linux
setx OPENAI_API_KEY "sk-..." # Windows (PowerShell)
# Review changes vs HEAD (default — unstaged/staged changes)
pr-review
# Review feature branch against main
pr-review --base main
# Review against remote main
pr-review --base origin/main
# Review against a specific commit
pr-review --base abc1234
Output
- Prints the review to stdout
- Saves a
pr_review_output.mdfile in the current directory
What the LLM looks for
Small change review:
- Summary of what changed
- Bugs & edge cases
- Code quality & naming
- Concrete improvement suggestions
- Final verdict (approve / approve with suggestions / request changes)
Big change review (+ AST impact analysis):
- Everything above, plus:
- Breaking change detection (are callers still compatible?)
- Per-file impact analysis of all call sites found via AST
- Migration notes — what else needs updating
Notes
- AST analysis is Python-only (uses the
aststdlib module) - Skips
.venvandnode_modulesdirectories - The diff-size LLM call uses OpenAI (model example:
gpt-4o-mini) - The codebase was refactored: core modules now include
llm/openai.py,ast_analyzer.py,diff_parser.py,git.py, andcli.pywithreviewer.pyacting as the orchestrator - Reviews are also saved to
pr_review_output.md
Project details
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 git_ai_pr_review-0.1.1.tar.gz.
File metadata
- Download URL: git_ai_pr_review-0.1.1.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b75318fbaa9ee0dc2d98ae3d54a480057f3e95ce6151d506ebbc865b64736dd3
|
|
| MD5 |
7daa6860958d912f48d75ab28d4d0ccd
|
|
| BLAKE2b-256 |
dbef008941d1c0d57af2ad8a12f60fc9a50f1039b9a927b623c4e18bd3ace17e
|
File details
Details for the file git_ai_pr_review-0.1.1-py3-none-any.whl.
File metadata
- Download URL: git_ai_pr_review-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
608e174adf821a17b620ac306fb41b7b314eed982e27d18e4b6ae2d31578df36
|
|
| MD5 |
53fe52f3a2dd33834552fe1bb86a3929
|
|
| BLAKE2b-256 |
c09aaca66031cc02d50aaeb1daffa96c945fd40977b0739a634fe58dfbb89f21
|