Metadata-Version: 2.4
Name: prcat
Version: 0.1.0
Summary: AI-powered PR reviewer — understand any pull request in seconds
License: MIT
Keywords: ai,cli,code-review,developer-tools,git,github,llm,pull-request
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Version Control :: Git
Requires-Python: >=3.9
Requires-Dist: anthropic>=0.20.0
Requires-Dist: click>=8.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: openai>=1.0.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: rich>=13.0
Provides-Extra: dev
Requires-Dist: click>=8.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Description-Content-Type: text/markdown

# prcat

**AI-powered PR reviewer — understand any pull request in seconds.**

```
$ prcat https://github.com/django/django/pull/17842

PR #17842: Fix queryset annotation with complex expressions
django/django  feature/fix-annotation → main  +85/-12  6 file(s)

Verdict: Needs minor changes ⚠️

## Summary
This PR fixes a bug where annotating a queryset with complex F() expressions
containing subqueries would fail under certain database backends...

## Concerns
- [WARNING] src/db/models/sql/compiler.py L342
  The fallback path for non-standard backends isn't covered by tests.

## Questions for author
- Does this fix apply to GROUP BY queries with aggregates?

## Suggested review comment
The fix looks correct. I'd like to see a test for the SQLite fallback path
before merging. Otherwise LGTM.
```

## Install

```bash
pip install prcat
```

Set an API key (or use Ollama for local, free review):

```bash
export ANTHROPIC_API_KEY=your-key     # Claude (default)
export OPENAI_API_KEY=your-key        # or OpenAI
# or use --provider ollama             # local, no API key needed
```

Authenticate with GitHub (required to fetch private PRs):

```bash
gh auth login   # uses gh CLI — recommended
# or: export GITHUB_TOKEN=your-token
```

## Usage

```bash
# Review by PR number (auto-detects repo from git remote)
prcat 42

# Explicit repo
prcat owner/repo#42

# Full URL
prcat https://github.com/owner/repo/pull/42

# Review styles
prcat 42 --style summary    # just summarize the PR
prcat 42 --style risks      # focus on risks only
prcat 42 --style review     # full review (default)

# Use different AI providers
prcat 42 --provider openai
prcat 42 --provider ollama --model qwen2.5:7b

# Copy review to clipboard
prcat 42 --copy

# Save to file
prcat 42 --output review.md

# Compact mode (for CI / scripts)
prcat 42 --compact          # exits 1 if CRITICAL issues found
```

## Options

| Flag | Description |
|------|-------------|
| `--style` | `review` (default), `summary`, or `risks` |
| `--provider` | `claude` (default), `openai`, `ollama` |
| `--model` | Override default model |
| `--no-comments` | Skip fetching existing PR comments |
| `--compact` | One-line output, exit 1 on CRITICAL |
| `--copy` | Copy review to clipboard |
| `--output FILE` | Save review to file |

## Use in CI

Exit code `1` when the AI finds CRITICAL issues — perfect for CI gates:

```yaml
# .github/workflows/pr-review.yml
- name: AI PR review
  run: prcat ${{ github.event.pull_request.number }} --compact
  env:
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

## Developer workflow

prcat fills the missing piece in the git-workflow toolkit:

```bash
# Start the day
standup-ai                          # generate standup from git commits

# Before you push
critiq                              # review YOUR own changes before pushing

# When you submit a PR
gpr                                 # generate PR description + commit message

# When you review a teammate's PR  ← prcat fits here
prcat 42                            # AI-assisted review of their changes

# After merging
gitbrief --changed-only             # pack context for LLM
changelog-ai v1.0.0 v1.1.0         # generate CHANGELOG
chronicle repo                      # understand the story behind changes
```

| Tool | When | What it does |
|------|------|-------------|
| [standup-ai](https://github.com/faw21/standup-ai) | Morning | Generate daily standup from commits |
| [critiq](https://github.com/faw21/critiq) | Before push | Review YOUR own code |
| [gpr](https://github.com/faw21/gpr) | Commit/PR | Generate PR descriptions + commit messages |
| **prcat** | PR review | Review TEAMMATES' pull requests |
| [gitbrief](https://github.com/faw21/gitbrief) | PR prep | Pack codebase context for LLMs |
| [changelog-ai](https://github.com/faw21/changelog-ai) | Release | Generate CHANGELOG from git history |
| [chronicle](https://github.com/faw21/chronicle) | Explore | Understand stories behind git history |

## Default models

| Provider | Default model |
|----------|--------------|
| Claude | `claude-haiku-4-5` |
| OpenAI | `gpt-4o-mini` |
| Ollama | `qwen2.5:1.5b` |

Override with `--model`:
```bash
prcat 42 --provider claude --model claude-sonnet-4-5   # deeper review
prcat 42 --provider openai --model gpt-4o               # OpenAI GPT-4o
prcat 42 --provider ollama --model qwen2.5:7b           # larger local model
```

## License

MIT — free for personal and commercial use.
