Skip to content

Commit 195eebd

Browse files
cpcloudclaude
andcommitted
chore(agents): add GraphQL scripts for PR review thread operations
Avoids recurring $ escaping issues when running GraphQL queries/mutations inline in shell commands. The /rev skill now references these files via `-F query=@.claude/graphql/...` instead of inline query strings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ad1b58f commit 195eebd

3 files changed

Lines changed: 38 additions & 23 deletions

File tree

.claude/commands/rev.md

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,12 @@ These two steps are independent -- start both in parallel.
1515

1616
### 2a. PR review feedback
1717

18-
1. Fetch unresolved review threads (use the GraphQL API for threaded context):
18+
1. Fetch unresolved review threads using the checked-in GraphQL query:
1919
```
20-
gh api graphql -f query='
21-
query($owner:String!, $repo:String!, $pr:Int!) {
22-
repository(owner:$owner, name:$repo) {
23-
pullRequest(number:$pr) {
24-
reviewThreads(first:100) {
25-
nodes {
26-
id
27-
isResolved
28-
comments(first:50) {
29-
nodes { id databaseId author{login} body path line }
30-
}
31-
}
32-
}
33-
}
34-
}
35-
}' -f owner=cpcloud -f repo=micasa \
36-
-F pr="$(gh pr view --json number --jq '.number')"
20+
gh api graphql \
21+
-F query=@.claude/graphql/review-threads.graphql \
22+
-f owner=cpcloud -f repo=micasa \
23+
-F pr="$(gh pr view --json number --jq '.number')"
3724
```
3825
2. For each **unresolved** thread:
3926
- Read the referenced file and line to understand the context
@@ -43,12 +30,11 @@ These two steps are independent -- start both in parallel.
4330
`gh api repos/cpcloud/micasa/pulls/<pr>/comments/<databaseId>/replies -f body='...'`
4431
Explain how it was addressed (commit hash, what changed).
4532
- **Resolve the thread** if you are extremely confident the feedback
46-
has been fully addressed. Use the GraphQL mutation:
33+
has been fully addressed. Use the checked-in GraphQL mutation:
4734
```
48-
gh api graphql -f query='
49-
mutation($id:ID!) { resolveReviewThread(input:{threadId:$id}) {
50-
thread { isResolved }
51-
}}' -f id=<thread_node_id>
35+
gh api graphql \
36+
-F query=@.claude/graphql/resolve-thread.graphql \
37+
-f id=<thread_node_id>
5238
```
5339
If there is any doubt the comment hasn't been fully addressed, leave
5440
the thread open for the reviewer.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
mutation($id: ID!) {
2+
resolveReviewThread(input: { threadId: $id }) {
3+
thread {
4+
isResolved
5+
}
6+
}
7+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
query($owner: String!, $repo: String!, $pr: Int!) {
2+
repository(owner: $owner, name: $repo) {
3+
pullRequest(number: $pr) {
4+
reviewThreads(first: 100) {
5+
nodes {
6+
id
7+
isResolved
8+
comments(first: 50) {
9+
nodes {
10+
id
11+
databaseId
12+
author { login }
13+
body
14+
path
15+
line
16+
}
17+
}
18+
}
19+
}
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)