Metadata-Version: 2.4
Name: pr-guardian
Version: 0.1.0
Summary: Lightweight AI code validation for GitHub PRs - catch hallucinated imports and suspicious patterns locally
Project-URL: Homepage, https://github.com/prguardian/pr-guardian
Project-URL: Documentation, https://github.com/prguardian/pr-guardian#readme
Project-URL: Repository, https://github.com/prguardian/pr-guardian
Project-URL: Issues, https://github.com/prguardian/pr-guardian/issues
Author-email: PR Guardian <hello@prguardian.dev>
License: MIT
Keywords: ai,code-review,github,pull-request,validation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Requires-Dist: click>=8.1.7
Requires-Dist: gitpython>=3.1.40
Requires-Dist: pydantic-settings>=2.1.0
Requires-Dist: pydantic>=2.5.0
Requires-Dist: pygithub>=2.1.1
Requires-Dist: rich>=13.7.0
Requires-Dist: tree-sitter-javascript>=0.20.3
Requires-Dist: tree-sitter-python>=0.20.4
Requires-Dist: tree-sitter-typescript>=0.20.5
Requires-Dist: tree-sitter>=0.20.4
Provides-Extra: dev
Requires-Dist: black>=23.12.1; extra == 'dev'
Requires-Dist: mypy>=1.8.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest>=7.4.3; extra == 'dev'
Requires-Dist: ruff>=0.1.9; extra == 'dev'
Description-Content-Type: text/markdown

# pr-guardian

> Local AI code validation for GitHub PRs—catch hallucinated imports and suspicious patterns before you ship.

## What is this?

**pr-guardian** is a developer-focused tool that validates AI-generated code changes before they reach production. It runs entirely locally (no enterprise contracts required), scanning your PRs for hallucinated imports, suspicious patterns, and generating confidence scores for AI-assisted changes. Works as both a GitHub Action and browser extension to provide protection at every stage of your workflow.

## Features

- **Local AI validation** – Runs on your machine, no cloud dependencies
- **GitHub Action integration** – Automatically comments on PRs with risk scores
- **Browser extension** – Real-time validation as you edit in GitHub's web interface
- **CLI tool** – Scan files and directories from your terminal
- **Pattern detection** – Catches hallucinated imports, non-existent APIs, and suspicious code patterns
- **AI confidence scoring** – Per-file risk assessment for changed code
- **Privacy-first** – Your code never leaves your infrastructure

## Quick Start

### Installation

**Python CLI & GitHub Action:**

```bash
pip install pr-guardian
```

**Browser Extension:**

1. Download from Chrome Web Store (coming soon) or load unpacked from `extension/` directory
2. Pin the extension and configure your preferences

### GitHub Action Setup

Add to `.github/workflows/pr-guardian.yml`:

```yaml
name: PR Guardian
on: [pull_request]

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.11'
      - name: Install pr-guardian
        run: pip install pr-guardian
      - name: Scan PR
        run: pr-guardian scan --github-pr ${{ github.event.pull_request.number }}
```

## Usage

### CLI

```bash
# Scan a single file
pr-guardian scan path/to/file.py

# Scan entire directory
pr-guardian scan src/

# Analyze specific patterns
pr-guardian analyze --file code.py --patterns imports,apis
```

### Browser Extension

1. Open a GitHub PR in your browser
2. The extension automatically highlights suspicious code blocks
3. Click the extension icon to see detailed risk scores
4. Review confidence metrics before submitting your PR

### GitHub Action

Once configured, pr-guardian automatically:
- Scans all changed files in pull requests
- Posts inline comments on suspicious code
- Adds a summary comment with overall risk assessment
- Blocks merging if critical issues are detected (configurable)

## Tech Stack

- **Python 3.11+** – Core validation engine and CLI
- **JavaScript/TypeScript** – Browser extension
- **GitHub Actions** – CI/CD integration
- **SQLite** – Local scan history (optional)

## License

MIT License - see LICENSE file for details

---

**Built for developers navigating the AI-assisted coding era.** Protect your work, maintain transparency, and ship with confidence.