This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.0 instead.
pr-preflight
Check a repository's contribution rules before you open a pull request.
More and more projects publish rules for contributors: disclose AI use, open an issue
first, sign the CLA, use Conventional Commits, fill in the template. AI agents now
have their own rules too, in AGENTS.md. These rules are spread across
CONTRIBUTING.md, AI_POLICY.md, AGENTS.md and PR templates, and they differ
from project to project. Most contributors find out they missed one only after a
maintainer closes the PR.
pr-preflight reads those files, turns them into a short list of rules with the
exact line each comes from, and checks your branch or PR against them.
$ pr-preflight rules ml-explore/mlx-lm
ml-explore/mlx-lm: 6 contribution rules
required Disclose AI tool use
└ CONTRIBUTING.md:8 "You are 100% responsible for every line, however it was
produced, and must explicitly disclose the manner in which AI was employed."
required AI agents may not act on their own
└ AGENTS.md:10 "- Do NOT write PR descriptions and commit messages for the user"
...
$ cd mlx-lm && pr-preflight check --pr 2116 --ai
pr-preflight · ml-explore/mlx-lm · tool-choice-none → main (1 commits, 2 files)
✖ Disclose AI tool use [required]
The PR description doesn't mention AI use.
└ CONTRIBUTING.md:8 "You are 100% responsible for every line, however it was produced, and
must explicitly disclose the manner in which AI was employed."
? Understand and review any AI-assisted change yourself [required]
Confirm this yourself.
...
✔ Include tests [recommended]
Touches 1 test file(s).
✔ Fill in the PR template [recommended]
All template sections are present.
1 blocking · 0 warnings · 3 to confirm yourself · 2 passed
Every rule cites a file, line and verbatim quote, so you can verify it yourself.
Install
pipx install pr-preflight # or: pip install pr-preflight
Python 3.10+. No runtime dependencies. gh (logged in) or GH_TOKEN is used for
GitHub API access when available.
Usage
# List the rules of any GitHub repository (or a local path)
pr-preflight rules ghostty-org/ghostty
# Inside your clone, on your feature branch: check commits, files and a planned PR
pr-preflight check --title "fix: handle empty input" --body-file pr.md --ai
# Check a PR that is already open
pr-preflight check --pr 1234
# You are an AI agent: also apply rules written for agents
pr-preflight check --agent
# Machine-readable output (exit code 1 if a required rule fails)
pr-preflight check --json
check finds the target repository from your upstream remote (else origin),
reads its policy files from the default branch, and compares them with the commits
and files on your branch since the merge-base. Each rule gets pass, fail,
warn or manual (something only you can confirm, such as a signed CLA).
Optional LLM extraction
Pattern matching is the default. With --llm, an OpenAI-compatible model also reads
the documents. It can only pick numbered paragraphs from the files, so it cannot
invent quotes. Local models work:
# Ollama
PR_PREFLIGHT_LLM_MODEL=qwen3:14b pr-preflight rules astral-sh/uv --llm
# mlx-lm server
PR_PREFLIGHT_LLM_URL=http://localhost:8080/v1 \
PR_PREFLIGHT_LLM_MODEL=mlx-community/Qwen3-14B-4bit pr-preflight rules astral-sh/uv --llm
Responses are cached in ~/.cache/pr-preflight/llm/.
For AI agents (MCP server)
pr-preflight includes an MCP server, so coding
agents can read a project's rules before they work on it and check a branch before
opening a PR. It exposes two read-only tools:
get_rules(repo, ref?): the rules ofowner/nameor a local path, with quotes.check_branch(path, pr?, title?, body?, used_ai?, base?, repo?): checks the branch in a local clone. Rules written for agents (such as "do not open PRs" inAGENTS.md) are applied, andblockingis true if a required rule fails.
Install it with the mcp extra and add it to your client:
# GitHub Copilot CLI
copilot mcp add pr-preflight -- uvx --from 'pr-preflight[mcp]' pr-preflight mcp
# Claude Code
claude mcp add pr-preflight -- uvx --from 'pr-preflight[mcp]' pr-preflight mcp
Other clients (VS Code, Cursor, ...) use the same command in their JSON config:
{
"mcpServers": {
"pr-preflight": {
"command": "uvx",
"args": ["--from", "pr-preflight[mcp]", "pr-preflight", "mcp"]
}
}
}
Without uvx: pip install 'pr-preflight[mcp]' and use the command pr-preflight mcp.
What it detects
18 rule types: AI ban, AI disclosure, AI accountability, agent restrictions, issue first, issue approval, CLA, DCO, commit format, PR title format, tests, changelog, docs, PR template, local checks, focused PRs, target branch and commit hygiene. See docs/rules.md.
How accurate is it?
Measured on 50 popular repositories (pytorch, react, rust, kubernetes, ghostty, uv,
pandas, ...). Their policy files are pinned to exact commits in
corpus/snapshot.json. Each repository's rules were labeled
by hand with verbatim quotes, independently from the extractor
(corpus/labels/). The repositories are split into a dev half,
used for tuning, and a test half that was not looked at while tuning.
Rule detection on the held-out test half:
| Mode | Precision | Recall | F1 |
|---|---|---|---|
| Patterns (default) | 0.74 | 0.81 | 0.77 |
--llm (patterns + Qwen3-14B 4-bit) |
0.65 | 0.88 | 0.75 |
| LLM only (not exposed) | 0.70 | 0.69 | 0.70 |
The default is the most balanced. --llm finds more of the real rules but also
reports more that are not there. Rule levels (required vs recommended) match the
labels about 60% of the time; treat them as a hint and read the quote.
Precision means a reported rule really exists. Recall means an existing rule was
found. Errors are listed with -v. Reproduce:
python corpus/fetch.py # downloads the pinned files
python corpus/evaluate.py test -v
Limits
- It reports what documents say. It does not prove a PR is acceptable, and a passing check is not a promise that maintainers will merge it.
- Some facts are not visible from outside, such as whether you signed a CLA. Those checks are reported as manual.
- Rules that only live in issue comments, wikis or CI configuration are not seen.
Development
python -m venv .venv && .venv/bin/pip install -e '.[dev]'
.venv/bin/pytest && .venv/bin/ruff check .
License
MIT
Metadata
Release files for pr-preflight 0.2.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_preflight-0.2.0.tar.gz | 47.6 kB | With provenance | Details for pr_preflight-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pr_preflight-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pr_preflight-0.2.0-py3-none-any.whl |
Total release size: 76.4 kB
Release files / pr_preflight-0.2.0.tar.gz
| Download URL | pr_preflight-0.2.0.tar.gz |
|---|---|
| Size | 47.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fdd1890fc6386686886e4c931bbfd5febba1783fa7a6a96fca229ae71ddd8eae
|
|
BLAKE2b-256 checksum How to use checksums |
c55f16b706e6cea3f14d4de312d74ab3ac6d657866fa4862f7df66a4ad96ae0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / pr_preflight-0.2.0-py3-none-any.whl
| Download URL | pr_preflight-0.2.0-py3-none-any.whl |
|---|---|
| Size | 28.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5cc6b46551d2150da925bf5c49d48219f013b36ed39b17747198fa16a84daceb
|
|
BLAKE2b-256 checksum How to use checksums |
71b6200d2ce11d657c42987d151de7ed5cb4b423289e8c8e3c4d1609fc6c7063
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for pr-preflight 0.2.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pr_preflight-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA 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.