Skip to content

chore: Add GitHub PR review workflow#594

Merged
JeanMertz merged 1 commit intomainfrom
prr161
May 2, 2026
Merged

chore: Add GitHub PR review workflow#594
JeanMertz merged 1 commit intomainfrom
prr161

Conversation

@JeanMertz
Copy link
Copy Markdown
Collaborator

Introduces an end-to-end AI-assisted pull request review workflow, spanning a new jp_attachment_github crate, extensions to jp_github, new project tooling, and a dedicated pr-reviewer persona.

New jp_attachment_github crate

Adds a gh:// URI attachment handler with two resource types:

  • gh:pull/N/diff — fetches a PR's title, description, and unified diff as a single text attachment. The diff is filtered through a configurable exclusion list (snapshots, lockfiles, minified JS, …) so generated noise is kept out of the LLM context. Override via ?exclude=glob1,glob2 or disable the defaults with ?no_defaults=true.

  • gh:pull/N/reviews — fetches all reviews and inline comments on a PR, rendered as structured Markdown grouped by file and anchor line. Pending (draft) reviews and comments are attributed to "you" rather than exposing the reviewer's login.

Both resource types accept a shortform (gh:pull/N/diff) that is project-rooted to dcdpr/jp, or a canonical form
(gh://owner/repo/pull/N/diff) for any repository.

jp_github extensions

Added new models (Side, ReviewState, Review, DraftReviewComment, GitRef) and new PullsHandler methods:

  • list_reviews — lists all reviews on a PR.
  • create_review — builder API that creates a draft (PENDING) review.
  • delete_review — deletes a pending review.
  • add_review_thread — appends a single inline comment to an existing pending review via the GraphQL addPullRequestReviewThread mutation, since the REST API does not support appending to an existing draft.

PullRequest gains node_id, head, and base fields required for fetching file content at the correct SHA.

github_pr_review_add_comment tool

A new project tool that queues one inline comment at a time to the authenticated user's pending review. Before each comment is posted, the tool renders a syntax-highlighted snippet from the PR's HEAD file plus the proposed comment body for user approval. The review remains in PENDING state until the user submits it from the GitHub UI.

github_read_file line range support

github_read_file now accepts start_line and end_line parameters. Files larger than 2,000 lines require an explicit range — the tool refuses to dump oversized files in one call.

pr-reviewer persona

A new persona at .jp/config/personas/pr-reviewer.toml bundles the review-specific system prompt, instructions for anchoring inline comments correctly (hunk-header arithmetic, LEFT vs RIGHT side), and evaluation criteria (correctness, failure modes, architectural fit, tests, public surface, naming, scope).

just pr-review NNN recipe

just pr-review 161 starts a review session for PR #161. It attaches both the diff and the reviews resources, uses the pr-reviewer persona, and resumes an existing conversation (or archives it and starts fresh) when one with the matching title already exists.

Introduces an end-to-end AI-assisted pull request review workflow,
spanning a new `jp_attachment_github` crate, extensions to `jp_github`,
new project tooling, and a dedicated `pr-reviewer` persona.

**New `jp_attachment_github` crate**

Adds a `gh://` URI attachment handler with two resource types:

- `gh:pull/N/diff` — fetches a PR's title, description, and unified diff
  as a single text attachment. The diff is filtered through a
  configurable exclusion list (snapshots, lockfiles, minified JS, …) so
  generated noise is kept out of the LLM context. Override via
  `?exclude=glob1,glob2` or disable the defaults with
  `?no_defaults=true`.

- `gh:pull/N/reviews` — fetches all reviews and inline comments on a PR,
  rendered as structured Markdown grouped by file and anchor line.
  Pending (draft) reviews and comments are attributed to "you" rather
  than exposing the reviewer's login.

Both resource types accept a shortform (`gh:pull/N/diff`) that is
project-rooted to `dcdpr/jp`, or a canonical form
(`gh://owner/repo/pull/N/diff`) for any repository.

**`jp_github` extensions**

Added new models (`Side`, `ReviewState`, `Review`, `DraftReviewComment`,
`GitRef`) and new `PullsHandler` methods:

- `list_reviews` — lists all reviews on a PR.
- `create_review` — builder API that creates a draft (`PENDING`) review.
- `delete_review` — deletes a pending review.
- `add_review_thread` — appends a single inline comment to an existing
  pending review via the GraphQL `addPullRequestReviewThread` mutation,
  since the REST API does not support appending to an existing draft.

`PullRequest` gains `node_id`, `head`, and `base` fields required for
fetching file content at the correct SHA.

**`github_pr_review_add_comment` tool**

A new project tool that queues one inline comment at a time to the
authenticated user's pending review. Before each comment is posted, the
tool renders a syntax-highlighted snippet from the PR's HEAD file plus
the proposed comment body for user approval. The review remains in
`PENDING` state until the user submits it from the GitHub UI.

**`github_read_file` line range support**

`github_read_file` now accepts `start_line` and `end_line` parameters.
Files larger than 2,000 lines require an explicit range — the tool
refuses to dump oversized files in one call.

**`pr-reviewer` persona**

A new persona at `.jp/config/personas/pr-reviewer.toml` bundles the
review-specific system prompt, instructions for anchoring inline
comments correctly (hunk-header arithmetic, LEFT vs RIGHT side), and
evaluation criteria (correctness, failure modes, architectural fit,
tests, public surface, naming, scope).

**`just pr-review NNN` recipe**

`just pr-review 161` starts a review session for PR #161. It attaches
both the diff and the reviews resources, uses the `pr-reviewer` persona,
and resumes an existing conversation (or archives it and starts fresh)
when one with the matching title already exists.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit 02bb4f6 into main May 2, 2026
13 checks passed
@JeanMertz JeanMertz deleted the prr161 branch May 2, 2026 19:31
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