AI-powered GitHub PR code reviewer for teams
Project description
lens
AI-powered GitHub PR code reviewer for teams. Fetches a pull request, reviews each changed file against your coding guidelines using Claude or GPT-4o, and posts inline comments directly on GitHub.
Features
- Reviews only added/modified files — skips deleted files and binary assets
- Supports Anthropic Claude and OpenAI GPT-4o as AI backends
- Bring your own guidelines via a simple YAML config file
- Posts inline review comments on the diff using the GitHub Review API
- Runs as a CLI tool locally or as a GitHub Action automatically on every PR
- Prevents duplicate comments across repeated runs
- Filters known AI false positives (hallucinated suggestions)
Installation
pip install prlens
Quick Start (CLI)
export GITHUB_TOKEN=ghp_...
export ANTHROPIC_API_KEY=sk-ant-...
prlens --repo owner/repo --pr 42 --model anthropic
Omit --pr to list open PRs and pick one interactively.
GitHub Action
Add this workflow to your repository to automatically review every pull request:
# .github/workflows/code-review.yml
name: Code Review
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: jodohq/prlens/.github/actions/review@main
with:
model: anthropic
github-token: ${{ secrets.GITHUB_TOKEN }}
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
Configuration
Copy .prlens.example.yml to .prlens.yml in your repository root:
# .prlens.yml
model: anthropic # anthropic | openai
max_chars_per_file: 20000
batch_limit: 60
# Path to your team's coding guidelines (relative to repo root)
# guidelines: ./docs/guidelines.md
# Files/directories to skip — fnmatch globs or directory names
# exclude:
# - migrations/
# - "*.min.js"
# Set to true to review draft PRs (skipped by default)
review_draft_prs: false
The --model and --guidelines CLI flags override the config file. The config file overrides built-in defaults.
Custom Guidelines
Point guidelines in .prlens.yml to any Markdown file containing your team's coding standards:
guidelines: ./docs/guidelines.md
When not set, built-in generic guidelines are used as a starting point. Copy them from prlens/guidelines/ and customize.
Environment Variables
| Variable | Required | Description |
|---|---|---|
GITHUB_TOKEN |
Yes | GitHub personal access token with pull_requests: write |
ANTHROPIC_API_KEY |
When using Claude | Anthropic API key |
OPENAI_API_KEY |
When using GPT-4o | OpenAI API key |
CLI Reference
Usage: prlens [OPTIONS]
AI-powered GitHub PR code reviewer.
Options:
--repo TEXT GitHub repository in owner/name format. [required]
--pr INTEGER Pull request number. Omit to list open PRs interactively.
--model [anthropic|openai] AI model provider. Overrides config file.
--config TEXT Path to the configuration file. [default: .prlens.yml]
-y, --yes Skip confirmation prompts and post comments automatically.
--guidelines PATH Path to a Markdown guidelines file. Overrides config file.
-s, --shadow Dry-run mode: print review comments to the terminal without posting to GitHub.
--help Show this message and exit.
Contributing
See CONTRIBUTING.md for how to set up a development environment, run tests, and add new AI providers.
License
Project details
Release history Release notifications | RSS feed
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 prlens-0.1.0.tar.gz.
File metadata
- Download URL: prlens-0.1.0.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea1eddaff8527e13c1f7e7f93d285bfc2b06de6ee5c2a26e4bc650a39d494a9c
|
|
| MD5 |
fe3ec581d3943009e6c7133cb36f60ad
|
|
| BLAKE2b-256 |
c30389b15e29c9f9b9320b41d992d022b808da2e944b2130c3a03d99db704378
|
File details
Details for the file prlens-0.1.0-py3-none-any.whl.
File metadata
- Download URL: prlens-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b413239761abcbd5d3758a596753b24d6dcd78283fdefc7fe2bfe9f78c7b25e
|
|
| MD5 |
d4dca436ca7745b2898b15daffb2f711
|
|
| BLAKE2b-256 |
f643d1960c412777f4dacd082f7b1fd8918ff50cad8da7b9a5987038d5d3c99a
|