Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pr-review-toolkit/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pr-review-toolkit",
"version": "1.8.1",
"version": "1.9.0",
"description": "Comprehensive PR review board using shared workflow context",
"author": {
"name": "cblecker",
Expand Down
34 changes: 34 additions & 0 deletions pr-review-toolkit/skills/review-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,40 @@ Choose the proposed review event from the selected findings:
- `APPROVE` when the user selected "Leave an approving review" from the
nothing-postable menu and no findings are being posted.

## Translate Line Numbers for Posting

Skip this section if MCP fallback was used (no local checkout) — findings
already use PR HEAD line numbers.

Findings use merge-result line numbers. GitHub requires PR HEAD (`HEAD^2`)
line numbers. Translate before posting.

### Quick check

```bash
git diff --name-only HEAD^2 HEAD
```

No output → lines are identical, skip translation.

### Per-file translation

For each finding on a file listed above:

1. Run `git diff HEAD^2 HEAD -- <path>`.
2. If the finding's line falls on a `+`-only line (no PR HEAD equivalent),
move the finding to the review body.
3. If the line falls within a hunk on a context line, find the PR HEAD line
by counting context and `-` lines from the hunk's PR HEAD start (`a` in
`@@ -a,b +c,d @@`).
4. If the line falls between hunks, accumulate the offset from preceding
hunks: `offset += (b - d)` per `@@ -a,b +c,d @@`.
`PR_HEAD_line = merge_line + offset`.
5. Validate the translated line falls within a PR diff hunk (from
`pull_request_read get_files`). If not, move to review body.

Files absent from the diff output have identical line numbers — use as-is.

## Preview And Confirm

Before posting, show an exact preview.
Expand Down
2 changes: 2 additions & 0 deletions pr-review-toolkit/skills/review-pr/review-pr.js
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,7 @@ function patchInstructions(prContext) {
if (sources.fullDiffIncluded && prContext.fullDiff) {
return '## Diff context\n\n'
+ 'The full merge diff is included below. Use it as your primary source for understanding what changed. '
+ 'Line numbers in your findings will correspond to the merge-result checkout and will be translated to PR HEAD line numbers before posting. '
+ 'You may also use Read and Grep on the merged checkout to inspect unchanged context, trace cross-file effects, or verify assumptions.\n\n'
+ 'Do not run Bash commands. Do not call GitHub write tools.\n\n'
+ '<full-merge-diff>\n' + prContext.fullDiff + '\n</full-merge-diff>'
Expand All @@ -1373,6 +1374,7 @@ function patchInstructions(prContext) {
if (sources.manifestSource === 'local-git') {
return '## Diff context\n\n'
+ 'The working tree is checked out to the merge result for this PR. Full diff text was omitted because it exceeded the size cap. '
+ 'Line numbers in your findings will correspond to the merge-result checkout and will be translated to PR HEAD line numbers before posting. '
+ 'Use the file manifest for whole-PR awareness, then use Read and Grep on the merged checkout to inspect changed files and trace cross-file effects.\n\n'
+ 'Do not run Bash commands. Do not call GitHub write tools.'
}
Expand Down
Loading