Skip to content

Commit 35cef65

Browse files
frettclaude
andcommitted
Port inline PR comments and thread resolution from parser repo skill
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 912cd6a commit 35cef65

1 file changed

Lines changed: 75 additions & 2 deletions

File tree

.claude/skills/pr-review/SKILL.md

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,34 @@ If it fails, report as **Must Fix** before reviewing anything else.
3838

3939
7. Output a structured review (format below).
4040

41-
8. After the review output, print:
41+
8. Post inline comments to the PR for every ⚠️ and ❌ finding that references a specific file and line number. Before posting, deduplicate against all existing comments (resolved or not) to avoid re-posting anything already raised:
42+
43+
```bash
44+
# Get the head SHA, repo, and all existing review comments (resolved and unresolved)
45+
HEAD_SHA=$(gh pr view $ARGUMENTS --json headRefOid -q .headRefOid)
46+
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
47+
EXISTING=$(gh api repos/$REPO/pulls/$ARGUMENTS/comments --jq '[.[] | select(.in_reply_to_id == null) | {path:.path, line:.line, body:.body}]')
48+
```
49+
50+
For each finding, check whether any existing comment (resolved or not) already covers the same file + line (or contains substantially the same text). Skip any finding that is already covered. Then bundle the remaining new comments into a single review submission:
51+
52+
```bash
53+
gh api repos/$REPO/pulls/$ARGUMENTS/reviews \
54+
--method POST \
55+
--field commit_id="$HEAD_SHA" \
56+
--field event="COMMENT" \
57+
--field "comments[][path]=<file path>" \
58+
--field "comments[][line]=<line number>" \
59+
--field "comments[][side]=RIGHT" \
60+
--field "comments[][body]=<finding text>
61+
62+
🤖 Posted by [Claude Code](https://claude.ai/code)" \
63+
# repeat --field "comments[]..." for each new finding
64+
```
65+
66+
Use the exact file path from the diff and the line number in the current version of the file (RIGHT side). Each comment body should contain the full finding description. Always append the attribution footer `\n\n🤖 Posted by [Claude Code](https://claude.ai/code)` to each comment. If no new actionable findings exist (only ✅ items or all already commented), skip this step.
67+
68+
9. After the review output, print:
4269

4370
```
4471
---
@@ -190,4 +217,50 @@ When the user says `dismiss: <title> — <reason>` (in any form — "dismiss the
190217
**Dismissed by**: <git user.name>
191218
```
192219

193-
4. Confirm to the user what was added and that it will be suppressed in future reviews.
220+
4. If the current session reviewed a PR, find any open (unresolved) comment thread on that PR matching the dismissed issue. Use the GraphQL API to locate threads and resolve the matching one, replying with the dismissal reason first:
221+
222+
```bash
223+
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
224+
OWNER=${REPO%%/*}
225+
REPONAME=${REPO##*/}
226+
227+
# Find unresolved review threads
228+
gh api graphql -f query="
229+
{
230+
repository(owner: \"$OWNER\", name: \"$REPONAME\") {
231+
pullRequest(number: $PR_NUMBER) {
232+
reviewThreads(first: 100) {
233+
nodes {
234+
id
235+
isResolved
236+
comments(first: 1) {
237+
nodes { id body path line }
238+
}
239+
}
240+
}
241+
}
242+
}
243+
}"
244+
```
245+
246+
Match the thread by file path, line number, or substantial text overlap with the dismissed finding. Then reply to the thread and resolve it:
247+
248+
```bash
249+
# Reply to the thread's first comment explaining the dismissal
250+
gh api repos/$REPO/pulls/$PR_NUMBER/comments \
251+
--method POST \
252+
--field in_reply_to=<comment_id> \
253+
--field body="Dismissed: <reason given by user>
254+
255+
🤖 [Claude Code](https://claude.ai/code)"
256+
257+
# Resolve the thread via GraphQL
258+
gh api graphql -f query="
259+
mutation {
260+
resolveReviewThread(input: { threadId: \"<thread_node_id>\" }) {
261+
thread { id isResolved }
262+
}
263+
}"
264+
```
265+
266+
5. Confirm to the user what was added and that it will be suppressed in future reviews.

0 commit comments

Comments
 (0)