Skip to content

Commit a615861

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 6d1ad07 commit a615861

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
@@ -16,25 +16,12 @@ These two steps are independent -- start both in parallel.
1616

1717
### 2a. PR review feedback
1818

19-
1. Fetch unresolved review threads (use the GraphQL API for threaded context):
19+
1. Fetch unresolved review threads using the checked-in GraphQL query:
2020
```
21-
gh api graphql -f query='
22-
query($owner:String!, $repo:String!, $pr:Int!) {
23-
repository(owner:$owner, name:$repo) {
24-
pullRequest(number:$pr) {
25-
reviewThreads(first:100) {
26-
nodes {
27-
id
28-
isResolved
29-
comments(first:50) {
30-
nodes { id databaseId author{login} body path line }
31-
}
32-
}
33-
}
34-
}
35-
}
36-
}' -f owner=cpcloud -f repo=micasa \
37-
-F pr="$(gh pr view --json number --jq '.number')"
21+
gh api graphql \
22+
-F query=@.claude/graphql/review-threads.graphql \
23+
-f owner=cpcloud -f repo=micasa \
24+
-F pr="$(gh pr view --json number --jq '.number')"
3825
```
3926
2. For each **unresolved** thread:
4027
- Read the referenced file and line to understand the context
@@ -44,12 +31,11 @@ These two steps are independent -- start both in parallel.
4431
`gh api repos/cpcloud/micasa/pulls/<pr>/comments/<databaseId>/replies -f body='...'`
4532
Explain how it was addressed (commit hash, what changed).
4633
- **Resolve the thread** if you are extremely confident the feedback
47-
has been fully addressed. Use the GraphQL mutation:
34+
has been fully addressed. Use the checked-in GraphQL mutation:
4835
```
49-
gh api graphql -f query='
50-
mutation($id:ID!) { resolveReviewThread(input:{threadId:$id}) {
51-
thread { isResolved }
52-
}}' -f id=<thread_node_id>
36+
gh api graphql \
37+
-F query=@.claude/graphql/resolve-thread.graphql \
38+
-f id=<thread_node_id>
5339
```
5440
If there is any doubt the comment hasn't been fully addressed, leave
5541
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)