Local AI code reviewer for pre-commit checks.
Project description
flagrant
CLI tool that reviews your code before you commit. Uses LLMs to catch bugs, security issues, and bad patterns the same way a senior dev would in a PR review.
$ flagrant --staged
───────────────────────────────────
flagrant | 3 issues flagged (1 high | 1 medium | 1 low)
───────────────────────────────────
● HIGH auth.py line 34
SQL query built with string concatenation
Fix: use parameterized queries
● MEDIUM utils.py line 12
Function has no error handling
Fix: wrap in try/except, handle edge cases
● LOW main.py line 5
Unused import os
Fix: remove it
───────────────────────────────────
Exits with code 1 on high-severity issues. Works as a pre-commit hook.
install
pip install flagrant
usage
flagrant . # review entire repo
flagrant --staged # only staged changes (fast, cheap)
flagrant --file app.py # single file
flagrant --strict # security-focused pass
flagrant --explain # explain why each issue matters
First run prompts for your API key. Supports Claude, OpenAI, Gemini, and DeepSeek.
flagrant config # switch provider or update key
git hook
flagrant install-hook # auto-review on every commit
flagrant remove-hook # undo
Blocks commits with high-severity issues. Skip with git commit --no-verify.
project config
Drop a .flagrant file in your repo root:
{
"ignore": ["migrations/", "tests/", "vendor/"],
"strict": true,
"explain": false,
"language": "python"
}
how it works
- Reads your files or git diff
- Chunks large files to fit context windows
- Sends to your configured LLM with a review-focused system prompt
- Parses structured JSON issues from the response
- Prints results, returns exit code 1 if anything is high severity
No telemetry. No accounts. Your code goes straight to whichever LLM provider you pick and nowhere else.
providers
| Provider | Default model | Env var |
|---|---|---|
| Claude | claude-sonnet-4-20250514 | ANTHROPIC_API_KEY |
| OpenAI | gpt-4o | OPENAI_API_KEY |
| Gemini | gemini-2.5-flash | GEMINI_API_KEY |
| DeepSeek | deepseek-chat | DEEPSEEK_API_KEY |
license
MIT
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 flagrant-0.1.0.tar.gz.
File metadata
- Download URL: flagrant-0.1.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46ffc302800b2a0eca93bc504934d379dbd76c0da1dced56a394b3b2a33906c2
|
|
| MD5 |
c34a26e3038554514ebee1e39ba904f1
|
|
| BLAKE2b-256 |
a2598105a8d22f8ef133e280864c45eea2a5003a11ade4f8db965ce3cb1771a7
|
File details
Details for the file flagrant-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flagrant-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50fc7a66062d2586295f84191cf4b5b5baffc5dc3fdce3dbb80c88cbf9bae26e
|
|
| MD5 |
36165aae0d5e7bc7489c8645adb0d07b
|
|
| BLAKE2b-256 |
b4521182ce0b733ca5956e00698a48623a8da0d6f6dc65edd0d92172dadf80ac
|