# PR Checker AI 💚

An intelligent pull request review tool that leverages both OpenAI and Anthropic AI models to provide comprehensive code reviews directly on your GitHub pull requests.

## Features

- **Dual AI Analysis**: Get reviews from both OpenAI GPT and Anthropic Claude models for comprehensive feedback
- **Automated PR Comments**: Automatically posts review results as comments on your GitHub pull requests
- **Rich Console Output**: Beautiful terminal output with tables and markdown rendering
- **Flexible Model Selection**: Choose specific models from OpenAI and Anthropic
- **GitHub CLI Integration**: Uses GitHub CLI for seamless PR interaction

## Prerequisites

Before using PR Checker AI, ensure you have:

1. **GitHub CLI (`gh`)** installed and authenticated
2. **OpenAI API Key** - Set as `OPENAI_API_KEY` environment variable
3. **Anthropic API Key** - Set as `ANTHROPIC_API_KEY` environment variable

## Installation

1. Install `pr-checker-ai`:

```bash
pip install pr-checker-ai
```

2. Set up your API keys:

```bash
export OPENAI_API_KEY="your-openai-api-key"
export ANTHROPIC_API_KEY="your-anthropic-api-key"
```

3. Ensure GitHub CLI is authenticated:

```bash
gh auth login
```

## Usage

### Basic Usage

Review a pull request (flag `-p`, `--pr`) using default models (`gpt-4.1` for OpenAI and `claude-sonnet-4-0` for Anthropic):

```bash
pr-checker-cli -p 123
```

### Advanced Usage

Specify custom models for both providers using the flags:

- `-o, --openai`: OpenAI model to use (default: "gpt-4.1")
- `-a, --anthropic`: Anthropic model to use (default: "claude-sonnet-4-0")

```bash
pr-checker-cli -p 456 -o "gpt-5" -a "claude-3-7-sonnet-latest"
```

## How It Works

1. **Fetches PR Details**: Uses GitHub CLI to collect general PR information and diff changes
2. **AI Analysis**: Sends PR details to both OpenAI and Anthropic models for review
3. **Processes Responses**: Filters and formats responses from both AI providers
4. **Posts Comment**: Creates a formatted comment on the PR with both reviews
5. **Console Output**: Displays results in a beautiful table format in your terminal

## Output Format

The tool generates a structured comment on your PR containing:

- **OpenAI Review**: Analysis from the specified OpenAI model
- **Anthropic Review**: Analysis from the specified Anthropic model
- **Approval Status**: Each AI provides an approve/not approve recommendation
- **Automated Footer**: Indicates the comment was generated by PR Checker AI

## Contributing

We welcome contributions! Please read our [Contributing Guide](CONTRIBUTING.md) to get started.

## License

This project is licensed under the [MIT License](./LICENSE)
