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:
pip install pr-guardian
Browser Extension:
- Download from Chrome Web Store (coming soon) or load unpacked from
extension/directory - Pin the extension and configure your preferences
GitHub Action Setup
Add to .github/workflows/pr-guardian.yml:
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
# 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
- Open a GitHub PR in your browser
- The extension automatically highlights suspicious code blocks
- Click the extension icon to see detailed risk scores
- 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.
Metadata
Release files for pr-guardian 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pr_guardian-0.1.0.tar.gz | 10.5 kB | Without provenance | Details for pr_guardian-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pr_guardian-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pr_guardian-0.1.0-py3-none-any.whl |
Total release size: 21.8 kB
Release files / pr_guardian-0.1.0.tar.gz
| Download URL | pr_guardian-0.1.0.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b770343ec659d43817aa41a93f0edd3286b1466a980e1080c8d1a4cd21e27f9c
|
|
BLAKE2b-256 checksum How to use checksums |
f3b45bd27bbba3516f949adb4a34f85e14967670728fb7d98dc95de004810087
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / pr_guardian-0.1.0-py3-none-any.whl
| Download URL | pr_guardian-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bf379432efdcc17904c5824ae547db605e3f059aecf1f97e6d6303838f1c55e8
|
|
BLAKE2b-256 checksum How to use checksums |
ba25d08a5206fd24dc9c78c68443762c4b7606630b25a6a83984744f87ad2010
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for pr-guardian 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.