CLI
The PullApprove CLI provides tools for configuring, validating, and testing your code review setup. It's installed as pullapprove (or pa for short).
Installation
Install the CLI globally using uv:
uv tool install pullapprove
If you don't have uv installed:
curl -LsSf https://astral.sh/uv/install.sh | sh
Commands
Configuration Management
pullapprove init- create a starterCODEREVIEW.tomlpullapprove check- validate configuration files
File Matching and Testing
pullapprove match- show files and their matching scopespullapprove match --changed- show only changed filespullapprove match --diff- show diff content with matchespullapprove match --by-scope- organize output by scope instead of by pathpullapprove match --scope <name>- filter to show only files matching specific scopespullapprove match --base <branch>- match your branch the way PullApprove would match a pull request into<branch>pullapprove match --author <username>- apply each scope'sauthorsas if<username>opened the pull requestpullapprove match --json- output matches as JSON for scripts and other tools
Coverage Analysis
pullapprove coverage- calculate file coverage for review scopes
Examples
Validate your configuration
pullapprove check
Returns validation errors if your CODEREVIEW.toml has syntax issues or invalid settings.
Test file matching for changed files
pullapprove match --changed
Shows which review scopes would be triggered by files you've modified locally.
Check review coverage
pullapprove coverage
Displays what percentage of files in your repository are covered by review scopes.
View specific scope matches
pullapprove match --scope backend
Shows only files that match the "backend" scope, useful for testing scope patterns.
Read matches from a script
pullapprove match --diff --json
Prints the matches as JSON instead of text. Works with every other option except --by-scope and --scope, since the JSON is meant to have everything (filtering it in your script is easy).
{
"scopes": {
"backend": {"name": "backend", "reviewers": ["..."], "paths": ["api/**/*"], ...}
},
"paths": {
"api/views.py": {"path": "api/views.py", "scopes": ["backend"]},
"README.md": {"path": "README.md", "scopes": []}
},
"code": {
"<location_id>": {"path": "...", "scopes": ["..."], "start_line": 12, "end_line": 12, "start_column": 1, "end_column": 30, "location_id": "<location_id>"}
}
}
scopeshas the config of each scope that matched something, in config order.pathshas every file, with the scopes that own it by itspathspatterns. A file only acodepattern matched has emptyscopeshere, and its scope is on itscodeentries, so to get every file in a scope, check both.codehas the lines matched by a scope'scodepatterns, keyed by location.
Match a pull request in CI
# .github/workflows/pullapprove-scopes.yml
on: pull_request
jobs:
pullapprove-scopes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: astral-sh/setup-uv@v6
- run: uvx pullapprove match --json --base "$BASE_SHA" --author "$AUTHOR" > scopes.json
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
AUTHOR: ${{ github.event.pull_request.user.login }}
scopes.json has the scopes PullApprove will apply to the pull request, so you can hand them to another tool.
on: pull_requestruns it when a pull request opens, gets new commits, or reopens, drafts included. Let it run on drafts instead of skipping them with anif:. Marking a draft ready doesn't change the commit, so the draft's run still counts, and if this job's check is in a scope'sunless, a skipped run counts as not passing.--basematches everything since your branch split off the base, against theCODEREVIEW.tomlfiles on the base branch. That's what PullApprove uses too, so a pull request that edits the config is still matched against the config it's going into.fetch-depth: 0is there because--baseneeds the history back to where the branch split off. Checking out the head commit (instead of the merge commitactions/checkoutuses by default) matches the diff PullApprove sees.- If the base branch's
CODEREVIEW.tomlchanges after the job runs, PullApprove picks that up right away, butscopes.jsonwon't until the job runs again. For a pull request in a stack, PullApprove reads the configs from the bottom of the stack, which--basecan't mirror (it would diff against that branch too). --authoronly matters if your scopes useauthors. If they list a team there, it'll stop with an error, because the CLI can't look up who's on a team.pathsmatches come out the same as PullApprove's. Matches fromcodepatterns can differ now and then, because GitHub labels each hunk with a function name differently than local git does.- If a pull request is so big that GitHub won't serve its diff, PullApprove reviews it as a large-scale change instead, which the CLI has no way of knowing.
Automated Setup
For automated configuration help, see the Agents documentation which provides AI-powered assistance for setting up and migrating PullApprove configurations.