The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | # The review conversation: threads, their comments, and what the people on the review said. |
| 2 | |
| 3 | # A reaction group as every reactable node reports it. `reactors` is bounded rather than paged: a |
| 4 | # hover says who reacted, and a hundred and forty names is a count, not a sentence. |
| 5 | fragment Reactions on Reactable { |
| 6 | reactionGroups { |
| 7 | content |
| 8 | viewerHasReacted |
| 9 | reactors(first: 10) { |
| 10 | totalCount |
| 11 | nodes { |
| 12 | ... on User { |
| 13 | login |
| 14 | } |
| 15 | ... on Bot { |
| 16 | login |
| 17 | } |
| 18 | ... on Organization { |
| 19 | login |
| 20 | } |
| 21 | ... on Mannequin { |
| 22 | login |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | fragment ThreadComment on PullRequestReviewComment { |
| 30 | id |
| 31 | author { |
| 32 | __typename |
| 33 | login |
| 34 | avatarUrl |
| 35 | } |
| 36 | body |
| 37 | createdAt |
| 38 | lastEditedAt |
| 39 | url |
| 40 | isMinimized |
| 41 | # A review link names the review, not its comments; this lets it find the comments it posted. |
| 42 | pullRequestReview { |
| 43 | url |
| 44 | } |
| 45 | ...Reactions |
| 46 | } |
| 47 | |
| 48 | # One page of review threads. Only ten comments ride with each thread. A hundred threads times a |
| 49 | # hundred comments made GitHub reserve 10,000 nested rows and charge 104 points; unfinished threads |
| 50 | # are paged from their own cursor by `ReviewThreadComments`. |
| 51 | fragment ReviewThreadPage on PullRequestReviewThreadConnection { |
| 52 | totalCount |
| 53 | pageInfo { |
| 54 | hasNextPage |
| 55 | endCursor |
| 56 | } |
| 57 | nodes { |
| 58 | id |
| 59 | isResolved |
| 60 | isOutdated |
| 61 | path |
| 62 | # Null once the thread's line has left the diff, which `isOutdated` reports. |
| 63 | line |
| 64 | diffSide |
| 65 | comments(first: 10) { |
| 66 | totalCount |
| 67 | pageInfo { |
| 68 | hasNextPage |
| 69 | endCursor |
| 70 | } |
| 71 | nodes { |
| 72 | ...ThreadComment |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | # The first page of review threads with their comments, and the people on the review. Later pages |
| 79 | # come from `ReviewThreadPages`, so a pull request with more threads than one page holds is walked |
| 80 | # rather than cut off. |
| 81 | # |
| 82 | # `viewer` rides along: GitHub names who reacted but never says whether that is the reader, so the |
| 83 | # comparison is made locally rather than paid for with a request of its own. |
| 84 | # |
| 85 | # Reviewers come from here because `reviewRequests` holds only requests still outstanding, so |
| 86 | # anyone who has already reviewed drops off it; `latestReviews` adds them back. A reviewer can be a |
| 87 | # person or an app, and both are asked for by name because they are different GraphQL types. |
| 88 | # |
| 89 | # `viewerCanUpdate` and `viewerDidAuthor` belong to the pull request this query is already |
| 90 | # standing on, so what the reader may do with it arrives with the conversation. |
| 91 | query ReviewThreads($owner: String!, $name: String!, $number: Int!, $requestedReviewers: Int!) { |
| 92 | viewer { |
| 93 | login |
| 94 | } |
| 95 | repository(owner: $owner, name: $name) { |
| 96 | pullRequest(number: $number) { |
| 97 | reviewThreads(first: 100) { |
| 98 | ...ReviewThreadPage |
| 99 | } |
| 100 | viewerCanUpdate |
| 101 | viewerDidAuthor |
| 102 | author { |
| 103 | __typename |
| 104 | login |
| 105 | avatarUrl |
| 106 | } |
| 107 | ...Reactions |
| 108 | comments(first: 100) { |
| 109 | nodes { |
| 110 | id |
| 111 | lastEditedAt |
| 112 | author { |
| 113 | __typename |
| 114 | login |
| 115 | avatarUrl |
| 116 | } |
| 117 | ...Reactions |
| 118 | } |
| 119 | } |
| 120 | # For their reactions and edit times: the words and the verdict arrive with the activity read. |
| 121 | reviews(first: 100) { |
| 122 | nodes { |
| 123 | id |
| 124 | lastEditedAt |
| 125 | author { |
| 126 | __typename |
| 127 | login |
| 128 | avatarUrl |
| 129 | } |
| 130 | ...Reactions |
| 131 | } |
| 132 | } |
| 133 | reviewRequests(first: $requestedReviewers) { |
| 134 | nodes { |
| 135 | # Null for nobody. A team goes by its `org/slug`; a mannequin answers with neither and |
| 136 | # names nobody to show. A team's name and avatar are aliased apart from a person's, |
| 137 | # since their nullability differs. |
| 138 | requestedReviewer { |
| 139 | ... on User { |
| 140 | login |
| 141 | name |
| 142 | avatarUrl |
| 143 | } |
| 144 | ... on Bot { |
| 145 | login |
| 146 | avatarUrl |
| 147 | } |
| 148 | ... on Team { |
| 149 | combinedSlug |
| 150 | teamName: name |
| 151 | teamAvatarUrl: avatarUrl |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | latestReviews(first: 50) { |
| 157 | nodes { |
| 158 | state |
| 159 | isMinimized |
| 160 | author { |
| 161 | __typename |
| 162 | login |
| 163 | avatarUrl |
| 164 | } |
| 165 | } |
| 166 | } |
| 167 | reviewDismissals: timelineItems(itemTypes: [REVIEW_DISMISSED_EVENT], first: 100) { |
| 168 | pageInfo { |
| 169 | hasNextPage |
| 170 | endCursor |
| 171 | } |
| 172 | nodes { |
| 173 | ... on ReviewDismissedEvent { |
| 174 | dismissalMessage |
| 175 | review { |
| 176 | id |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | # `last` rather than `first`: a pull request with more than a hundred commits keeps the |
| 182 | # newest ones, which is what a reader scoping a diff wants. |
| 183 | commits(last: 100) { |
| 184 | nodes { |
| 185 | commit { |
| 186 | oid |
| 187 | messageHeadline |
| 188 | committedDate |
| 189 | authors(first: 3) { |
| 190 | nodes { |
| 191 | name |
| 192 | avatarUrl |
| 193 | user { |
| 194 | login |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | } |
| 201 | } |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | # The review threads past the first page. Everything else `ReviewThreads` asks for describes the |
| 206 | # whole pull request and arrived with that page, so later pages carry the threads alone. |
| 207 | query ReviewThreadPages($owner: String!, $name: String!, $number: Int!, $after: String!) { |
| 208 | viewer { |
| 209 | login |
| 210 | } |
| 211 | repository(owner: $owner, name: $name) { |
| 212 | pullRequest(number: $number) { |
| 213 | reviewThreads(first: 100, after: $after) { |
| 214 | ...ReviewThreadPage |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | # The rest of one thread's conversation. GraphQL pages a connection nested inside another only |
| 221 | # from the inner node itself, so a thread longer than a page is followed on its own: a request |
| 222 | # GitHub makes necessary, and one no ordinary pull request ever provokes. |
| 223 | query ReviewThreadComments( |
| 224 | $owner: String! |
| 225 | $name: String! |
| 226 | $number: Int! |
| 227 | $threadId: ID! |
| 228 | $after: String |
| 229 | ) { |
| 230 | viewer { |
| 231 | login |
| 232 | } |
| 233 | repository(owner: $owner, name: $name) { |
| 234 | pullRequest(number: $number) { |
| 235 | id |
| 236 | } |
| 237 | } |
| 238 | node(id: $threadId) { |
| 239 | ... on PullRequestReviewThread { |
| 240 | pullRequest { |
| 241 | id |
| 242 | } |
| 243 | comments(first: 100, after: $after) { |
| 244 | pageInfo { |
| 245 | hasNextPage |
| 246 | endCursor |
| 247 | } |
| 248 | nodes { |
| 249 | ...ThreadComment |
| 250 | } |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | # The dismissal events past the page the thread read carries. A pull request rarely has any: this |
| 257 | # is followed only while the embedded page reports more. |
| 258 | query ReviewDismissals($owner: String!, $name: String!, $number: Int!, $after: String) { |
| 259 | repository(owner: $owner, name: $name) { |
| 260 | pullRequest(number: $number) { |
| 261 | timelineItems(itemTypes: [REVIEW_DISMISSED_EVENT], first: 100, after: $after) { |
| 262 | pageInfo { |
| 263 | hasNextPage |
| 264 | endCursor |
| 265 | } |
| 266 | nodes { |
| 267 | ... on ReviewDismissedEvent { |
| 268 | dismissalMessage |
| 269 | review { |
| 270 | id |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | } |