Skip to content

Specify PRs via --pr and --pr-file in addition to the DB - #9

Merged
ghinks merged 1 commit into
mainfrom
feat/specify-prs-cli-and-file
Jun 16, 2026
Merged

ghinks merged 1 commit into
mainfrom
feat/specify-prs-cli-and-file

Conversation

@ghinks

@ghinks ghinks commented Jun 16, 2026

Copy link
Copy Markdown
Owner

What

Lets analyze take PRs from any combination of three sources instead of only the outlier database:

  • --db-path — outlier PRs from the SQLite DB (now optional)
  • --pr — a specific PR number, repeatable (--pr 1234 --pr 1240)
  • --pr-file — a file of PR numbers (one per line; leading # and comma/space separated values also accepted)

At least one source is required; the command errors clearly if none is given. Sources are merged and deduplicated by PR number, with DB records taking precedence so they keep their statistical metadata.

How

  • New pr_sources.py: parse_pr_numbers / load_pr_numbers_from_file, manual_pr_record (same key shape as get_outliers), and merge_records.
  • main.py: new options, source validation, record merging. Manual PRs have no z-score, so the console/report output tolerates a missing max_abs_z_score (renamed the loop var to avoid shadowing the new --pr option).
  • prompts.py: generalized the system prompt and per-PR prompt so they read naturally for both statistically-flagged outliers and hand-picked PRs.
  • README updated (usage, options table, project structure).

Tests

New tests/test_pr_sources.py covers parsing (one-per-line, # prefix, comma/space separated, blank lines, invalid-token error), file loading, manual record shape, and merge/dedup/precedence/order. Full suite: 20 passed, ruff clean, mypy clean.

Notes

  • --from-date continues to apply only to the DB source.
  • Example: uv run review-agent --repo owner/repo --pr 1234 --pr-file ./prs.txt

🤖 Generated with Claude Code

The analyze command now accepts PRs from any combination of three
sources: the outlier database (--db-path, now optional), specific PR
numbers (--pr, repeatable), and a file of PR numbers (--pr-file). At
least one source is required. Sources are merged and deduplicated by
number, with DB records keeping their statistical metadata.

Manually selected PRs have no z-score, so the report/console output and
the prompt are generalized to read naturally for both flagged outliers
and hand-picked PRs.

Adds pr_sources.py with tests and updates the README.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ghinks
ghinks merged commit 956811c into main Jun 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant