Metadata-Version: 2.4
Name: flagrant
Version: 0.1.0
Summary: Local AI code reviewer for pre-commit checks.
Project-URL: Homepage, https://github.com/flagrant/flagrant
Project-URL: Repository, https://github.com/flagrant/flagrant
Author: Flagrant
License-Expression: MIT
License-File: LICENSE
Keywords: ai,cli,code-review,developer-tools,linting
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Requires-Dist: anthropic>=0.40.0
Requires-Dist: gitpython>=3.1.0
Requires-Dist: google-genai>=1.0.0
Requires-Dist: openai>=1.0.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typer[all]>=0.9.0
Description-Content-Type: text/markdown

# 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

```bash
pip install flagrant
```

## usage

```bash
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**.

```bash
flagrant config             # switch provider or update key
```

## git hook

```bash
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:

```json
{
  "ignore": ["migrations/", "tests/", "vendor/"],
  "strict": true,
  "explain": false,
  "language": "python"
}
```

## how it works

1. Reads your files or git diff
2. Chunks large files to fit context windows
3. Sends to your configured LLM with a review-focused system prompt
4. Parses structured JSON issues from the response
5. 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
