Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

GitHubPullRequestProvider.ts

663 lines25.1 KB

1import * as Effect from "effect/Effect";
2import type {
3 PullRequestActor,
4 PullRequestCapabilities,
5 PullRequestCheck,
6 PullRequestReaction,
7 PullRequestViewerPermissions,
8} from "@t3tools/contracts";
9​
10import * as GitHubPullRequestCli from "./GitHubPullRequestCli.ts";
11import {
12 PullRequestProviderError,
13 type PullRequestProviderFailure,
14 type ProviderChangeRequestActivity,
15 type ProviderChangeRequestDetail,
16 type PullRequestProviderApi,
17 type ProviderRepositoryRef,
18} from "./PullRequestProvider.ts";
19import type { GitHubViewerAccess, GitHubWorkflowRunApproval } from "./gitHubPullRequestJson.ts";
20​
21const CAPABILITIES: PullRequestCapabilities = {
22 diff: true,
23 comment: true,
24 actions: [
25 "merge",
26 "ready",
27 "draft",
28 "close",
29 "reopen",
30 "update-branch",
31 "enable-auto-merge",
32 "disable-auto-merge",
33 "revert",
34 "approve-workflows",
35 ],
36 mergeMethods: ["merge", "squash", "rebase"],
37 updateMethods: ["merge", "rebase"],
38 search: true,
39 reactions: true,
40 viewedFiles: "host",
41 review: {
42 inlineComment: true,
43 reply: true,
44 resolve: true,
45 verdicts: ["comment", "approve", "request-changes"],
46 },
47 reviewers: { request: true, listCandidates: true },
48 edit: { changeRequest: true, comment: true },
49 stacks: true,
50 stackActions: true,
51 labels: true,
52};
53​
54/**
55 * What the signed-in account may do here, from the three things GitHub says about it.
56 *
57 * Merging needs a role that can push, which is the one thing a stranger on an open-source
58 * repository never has. The other four actions go by `viewerCanUpdate`, because the author of a
59 * pull request may close it, reopen it and move it in and out of draft with no more than read
60 * access on the repository it was opened against.
61 *
62 * Commenting and reviewing are not gated at all: read access is enough to say something and
63 * enough to approve or ask for changes, which is what open-source review consists of. Resolving a
64 * conversation is the exception — GitHub allows it to whoever can write, and to the author of the
65 * pull request the conversation is on.
66 *
67 * Asking somebody else for a review needs write access, which is the one thing here an author
68 * cannot do on their own pull request: GitHub shows an outside contributor the reviewer control
69 * and refuses the request behind it.
70 */
71export function gitHubViewerPermissions(access: GitHubViewerAccess): PullRequestViewerPermissions {
72 return {
73 ...(access.canWrite ? { stackRebase: true } : {}),
74 actions: [
75 // Arming a merge and taking the arming back are the merge, deferred: whoever may not
76 // merge here may not leave an instruction to merge later either.
77 ...(access.canWrite
78 ? ([
79 "merge",
80 "enable-auto-merge",
81 "disable-auto-merge",
82 "revert",
83 "approve-workflows",
84 ] as const)
85 : []),
86 ...(access.canUpdate ? (["ready", "draft", "close", "reopen"] as const) : []),
87 // Whether this viewer may update the branch is GitHub's own answer, read with the
88 // comparison; without it the action is offered to nobody rather than to everybody.
89 ...(access.canUpdateBranch === true ? (["update-branch"] as const) : []),
90 ],
91 comment: true,
92 resolve: access.canWrite || access.didAuthor,
93 // Anyone may review a pull request they can see, except their own: GitHub refuses an author's
94 // approval and their request for changes ("Can not approve your own pull request"), and
95 // leaves them commenting, which is what an author has to say about their own change anyway.
96 verdicts: access.didAuthor ? (["comment"] as const) : CAPABILITIES.review.verdicts,
97 requestReviewers: access.canWrite,
98 ...(access.canUpdateBranch === true ? { updateMethods: CAPABILITIES.updateMethods } : {}),
99 // Triage is the one role that labels without writing, which is what triage is for.
100 labels: access.canTriage,
101 };
103​
104/** The CLI tags that mean the tool itself is unusable, rather than one request failing. */
105export function gitHubProviderFailure(
106 error: GitHubPullRequestCli.GitHubPullRequestCliError,
107): PullRequestProviderFailure {
108 if (error._tag === "GitHubCliUnavailableError") return { reason: "missing-tool" };
109 if (error._tag === "GitHubCliAuthenticationError") return { reason: "unauthenticated" };
110 if (error._tag === "GitHubCliRateLimitError")
111 return {
112 reason: "rate-limited",
113 ...(error.retryAt === undefined ? {} : { retryAt: error.retryAt }),
114 };
115 if (error._tag === "SourceControlRateLimitPausedError") {
116 return { reason: "rate-limited", retryAt: error.retryAt };
117 }
118 if (error._tag === "GitHubPullRequestNotFoundError") return { reason: "not-found" };
119 return { reason: "failed" };
121​
122/**
123 * `gh pr view --json` reports no avatar for anyone, so the ones the GraphQL read collected are
124 * applied here by login. An actor already carrying one keeps it.
125 *
126 * A login GitHub did not answer for falls back to the picture every GitHub install serves at
127 * `/<login>.png`. The lookup is one more request per repository and can be refused — a rate
128 * limit, a slow host — and a face that comes and goes between two loads of the same page reads
129 * as a bug in the page rather than as a request that failed quietly.
130 */
131function withAvatar(
132 actor: PullRequestActor | null,
133 avatarsByLogin: ReadonlyMap<string, string>,
134 host: string,
135 botLogins?: ReadonlySet<string>,
136): PullRequestActor | null {
137 if (actor === null) return actor;
138 if (botLogins?.has(actor.login)) actor = { ...actor, isBot: true };
139 if (actor.avatarUrl !== null) return actor;
140 const avatarUrl = avatarsByLogin.get(actor.login) ?? loginAvatarUrl(actor.login, host);
141 return avatarUrl === null ? actor : { ...actor, avatarUrl };
143​
144function withWorkflowApprovals(
145 checks: ReadonlyArray<PullRequestCheck>,
146 runs: ReadonlyArray<GitHubWorkflowRunApproval>,
147 unavailable: boolean,
148): ReadonlyArray<PullRequestCheck> {
149 const representedRunIds = new Set<number>();
150 for (const check of checks) {
151 if (check.status !== "action-required" || check.url === null) continue;
152 const id = check.url.match(/\/actions\/runs\/(\d+)(?:\/|$)/)?.[1];
153 if (id !== undefined) representedRunIds.add(Number(id));
154 }
155 const approvalChecks = runs
156 .filter((run) => !representedRunIds.has(run.id))
157 .map((run): PullRequestCheck => ({
158 name: run.name,
159 status: "action-required",
160 description: "A maintainer must approve this workflow before it can run.",
161 url: run.url,
162 }));
163 return [
164 ...checks,
165 ...approvalChecks,
166 ...(unavailable
167 ? [
168 {
169 name: "Workflow approval status",
170 status: "action-required" as const,
171 description: "GitHub could not determine whether workflows are awaiting approval.",
172 url: null,
173 },
174 ]
175 : []),
176 ];
178​
179/**
180 * Null for anything that is not a plain user login: an app posts as `dependabot[bot]`, which
181 * names no page, and a guessed URL that 404s is worse than the initials it would replace.
182 */
183export function loginAvatarUrl(login: string, host: string): string | null {
184 return /^[a-z0-9][a-z0-9-]{0,38}$/iu.test(login) ? `https://${host}/${login}.png?size=80` : null;
186​
187/** True where markdown would render nothing: whitespace, or only HTML comments. */
188const rendersEmpty = (body: string): boolean =>
189 body.replace(/<!--[\s\S]*?-->/g, "").trim().length === 0;
190​
191export const make = Effect.gen(function* () {
192 const cli = yield* GitHubPullRequestCli.GitHubPullRequestCli;
193​
194 const fail = (operation: string) => (error: GitHubPullRequestCli.GitHubPullRequestCliError) =>
195 new PullRequestProviderError({
196 provider: "github",
197 operation,
198 ...gitHubProviderFailure(error),
199 detail: error.detail,
200 cause: error,
201 });
202​
203 const readChecks = (input: ProviderRepositoryRef & { readonly number: number }) =>
204 cli.getPullRequestDetail(input).pipe(
205 Effect.flatMap((pullRequest) =>
206 (pullRequest.state !== "open" || pullRequest.isCrossRepository !== true
207 ? Effect.succeed({
208 runs: [] as ReadonlyArray<GitHubWorkflowRunApproval>,
209 unavailable: false,
210 })
211 : pullRequest.headSha == null || pullRequest.headRepositoryOwner == null
212 ? Effect.succeed({
213 runs: [] as ReadonlyArray<GitHubWorkflowRunApproval>,
214 unavailable: true,
215 })
216 : cli
217 .listWorkflowRunsRequiringApproval({
218 ...input,
219 headSha: pullRequest.headSha,
220 headBranch: pullRequest.headBranch,
221 headRepositoryOwner: pullRequest.headRepositoryOwner,
222 isCrossRepository: true,
223 })
224 .pipe(
225 Effect.matchEffect({
226 onFailure: (error) =>
227 error._tag === "GitHubCliRateLimitError" ||
228 error._tag === "SourceControlRateLimitPausedError"
229 ? Effect.fail(error)
230 : Effect.succeed({
231 runs: [] as ReadonlyArray<GitHubWorkflowRunApproval>,
232 unavailable: true,
233 }),
234 onSuccess: (runs) => Effect.succeed({ runs, unavailable: false }),
235 }),
236 )
237 ).pipe(
238 Effect.map((workflowApprovals) => ({
239 ...pullRequest,
240 author: withAvatar(pullRequest.author, new Map(), input.host),
241 checks: withWorkflowApprovals(
242 pullRequest.checks,
243 workflowApprovals.runs,
244 workflowApprovals.unavailable,
245 ),
246 ...(workflowApprovals.unavailable
247 ? {}
248 : { workflowApprovalsRequired: workflowApprovals.runs.length }),
249 })),
250 ),
251 ),
252 );
253​
254 const provider: PullRequestProviderApi = {
255 kind: "github",
256 capabilities: CAPABILITIES,
257 getRoutingIdentity: (input) =>
258 cli.getRoutingIdentity(input).pipe(Effect.mapError(fail("routeIdentity"))),
259 withVerifiedCredential: (input, use) =>
260 cli
261 .withVerifiedCredential(input, (identity) => use(identity).pipe(Effect.result))
262 .pipe(Effect.mapError(fail("routeIdentity")), Effect.flatMap(Effect.fromResult)),
263​
264 getViewer: (input) =>
265 cli
266 .getViewerLogin({ cwd: input.cwd, host: input.host ?? "github.com" })
267 .pipe(Effect.mapError(fail("getViewer"))),
268​
269 listChangeRequests: (input) =>
270 cli
271 .listPullRequests({
272 cwd: input.cwd,
273 repository: input.repository,
274 host: input.host,
275 state: input.state,
276 involvement: input.involvement,
277 viewer: input.viewer,
278 limit: input.limit,
279 query: input.query,
280 cursor: input.cursor,
281 filters: input.filters,
282 })
283 .pipe(
284 Effect.mapError(fail("listChangeRequests")),
285 Effect.flatMap((page) =>
286 cli
287 .listActorAvatars({
288 cwd: input.cwd,
289 repository: input.repository,
290 host: input.host,
291 ids: [...new Set(page.items.flatMap((item) => item.authorId ?? []))],
292 })
293 // A listing without faces is still a listing, so a failed lookup falls back to
294 // the initials rather than taking the rows down with it.
295 .pipe(
296 Effect.orElseSucceed(() => new Map<string, string>()),
297 Effect.map((avatarsByLogin) => ({
298 ...page,
299 items: page.items.map((item) => ({
300 ...item,
301 author: withAvatar(item.author, avatarsByLogin, input.host),
302 })),
303 })),
304 ),
305 ),
306 ),
307​
308 /**
309 * The same listing for a whole host in one search. The avatar lookup the per-repository read
310 * needs is not here: a search reports an author's picture itself, so a face costs no request
311 * of its own — `withAvatar` still stands behind it for the login GitHub answered nothing for.
312 */
313 listChangeRequestsAcross: (input) =>
314 cli
315 .searchPullRequests({
316 cwd: input.cwd,
317 host: input.host,
318 repositories: input.repositories,
319 state: input.state,
320 involvement: input.involvement,
321 viewer: input.viewer,
322 limit: input.limit,
323 query: input.query,
324 cursor: input.cursor,
325 filters: input.filters,
326 })
327 .pipe(
328 Effect.mapError(fail("listChangeRequestsAcross")),
329 Effect.map((batch) => ({
330 truncated: batch.truncated,
331 items: batch.items.map((item) => ({
332 ...item,
333 author: withAvatar(item.author, new Map<string, string>(), input.host),
334 })),
335 })),
336 ),
337​
338 listChangeRequestStats: (input) =>
339 cli
340 .listPullRequestStats({
341 cwd: input.cwd,
342 host: input.host,
343 changeRequests: input.changeRequests,
344 })
345 .pipe(Effect.mapError(fail("listChangeRequestStats"))),
346​
347 getChangeRequestSummary: (input) =>
348 cli.getPullRequestSummary(input).pipe(
349 // `gh pr view` names the author without an avatar; the login-shaped URL every user
350 // has stands in, without the second request the listing spends on it.
351 Effect.map((summary) => ({
352 ...summary,
353 ...(summary.author === undefined
354 ? {}
355 : { author: withAvatar(summary.author, new Map(), input.host) }),
356 })),
357 Effect.mapError(fail("getChangeRequestSummary")),
358 ),
359​
360 getChangeRequestStack: (input) =>
361 cli.getPullRequestStack(input).pipe(Effect.mapError(fail("getChangeRequestStack"))),
362​
363 getChangeRequestPreview: (input) =>
364 cli.getPullRequestPreview(input).pipe(Effect.mapError(fail("getChangeRequestPreview"))),
365​
366 getChangeRequestChecks: (input) =>
367 cli.revalidateChecks(input, readChecks(input)).pipe(
368 Effect.map(({ state, checks }) => ({ state, checks })),
369 Effect.mapError(fail("getChangeRequestChecks")),
370 ),
371​
372 getChangeRequest: (input) =>
373 readChecks(input).pipe(
374 Effect.map((pullRequest): ProviderChangeRequestDetail => ({
375 ...pullRequest,
376 author: withAvatar(pullRequest.author, new Map<string, string>(), input.host),
377 reviewers: pullRequest.reviewRequestLogins.map((login) => ({
378 login,
379 name: null,
380 avatarUrl: null,
381 })),
382 mergeCapabilities: pullRequest.viewerAccess.mergeCapabilities,
383 viewerPermissions: gitHubViewerPermissions({
384 ...pullRequest.viewerAccess,
385 canUpdateBranch: pullRequest.comparison?.viewerCanUpdate === true,
386 }),
387 baseComparison:
388 pullRequest.comparison === null || pullRequest.comparison.behindBy === null
389 ? "unknown"
390 : pullRequest.comparison.behindBy > 0
391 ? "behind"
392 : "up-to-date",
393 ...(pullRequest.comparison?.behindBy == null
394 ? {}
395 : { behindBy: pullRequest.comparison.behindBy }),
396 })),
397 Effect.mapError(fail("getChangeRequest")),
398 ),
399​
400 getChangeRequestActivity: (input) =>
401 Effect.all(
402 [
403 cli.getPullRequestActivity(input),
404 // Line comments live on review threads, which `gh pr view --json` cannot reach. A
405 // GraphQL hiccup degrades to a truncated conversation rather than blanking activity.
406 cli.listReviewThreadComments(input).pipe(
407 Effect.orElseSucceed(() => ({
408 comments: [],
409 dismissalsByReviewId: new Map<string, string>(),
410 reactions: [],
411 reactionsById: new Map<string, ReadonlyArray<PullRequestReaction>>(),
412 editedAtById: new Map<string, string>(),
413 reviewThreads: [],
414 commentCount: 0,
415 truncated: true,
416 reviewThreadsTruncated: true,
417 reviewers: [],
418 avatarsByLogin: new Map<string, string>(),
419 botLogins: new Set<string>(),
420 commitStats: new Map<
421 string,
422 { readonly additions: number; readonly deletions: number }
423 >(),
424 commits: [],
425 viewer: { canUpdate: true, didAuthor: false },
426 })),
427 ),
428 ],
429 { concurrency: 2 },
430 ).pipe(
431 Effect.mapError(fail("getChangeRequestActivity")),
432 Effect.map(([pullRequest, reviewThreads]): ProviderChangeRequestActivity => ({
433 author: withAvatar(
434 pullRequest.author,
435 reviewThreads.avatarsByLogin,
436 input.host,
437 reviewThreads.botLogins,
438 ),
439 reviewers: reviewThreads.reviewers,
440 reactions: reviewThreads.reactions,
441 commits: (reviewThreads.commits.length > 0
442 ? reviewThreads.commits
443 : pullRequest.commits
444 ).map((commit) => ({
445 ...commit,
446 ...reviewThreads.commitStats.get(commit.oid),
447 authors: commit.authors?.map(
448 (author) =>
449 withAvatar(
450 author,
451 reviewThreads.avatarsByLogin,
452 input.host,
453 reviewThreads.botLogins,
454 ) ?? author,
455 ),
456 })),
457 comments: [...pullRequest.comments, ...reviewThreads.comments]
458 .map((comment) => ({
459 ...comment,
460 // GitHub keeps the dismissal reason on the timeline event, not on the review,
461 // so a dismissed review with nothing visible of its own reads its words from
462 // there. "Visible" and not "empty": bot reviews often carry only an HTML
463 // marker comment, which markdown renders as nothing.
464 body:
465 comment.kind === "review" &&
466 comment.reviewState?.toUpperCase() === "DISMISSED" &&
467 rendersEmpty(comment.body)
468 ? (reviewThreads.dismissalsByReviewId.get(comment.id) ?? comment.body)
469 : comment.body,
470 author: withAvatar(
471 comment.author,
472 reviewThreads.avatarsByLogin,
473 input.host,
474 reviewThreads.botLogins,
475 ),
476 // A comment out of `gh pr view --json` carries none of its own: that read
477 // reports no reaction at all, so they arrive from the GraphQL page by node id.
478 reactions: comment.reactions ?? reviewThreads.reactionsById.get(comment.id) ?? [],
479 editedAt: reviewThreads.editedAtById.get(comment.id) ?? comment.editedAt ?? null,
480 }))
481 .toSorted((left, right) => left.createdAt.localeCompare(right.createdAt)),
482 // `gh pr view --json comments,reviews` follows GitHub's cursors itself, so those two
483 // are always whole and only the thread walk can stop short of the host.
484 commentCount: pullRequest.comments.length + reviewThreads.commentCount,
485 commentsTruncated: reviewThreads.truncated,
486 reviewThreadsTruncated: reviewThreads.reviewThreadsTruncated,
487 reviewThreads: reviewThreads.reviewThreads.map((thread) => ({
488 ...thread,
489 comments: thread.comments.map((comment) => ({
490 ...comment,
491 author: withAvatar(
492 comment.author,
493 reviewThreads.avatarsByLogin,
494 input.host,
495 reviewThreads.botLogins,
496 ),
497 })),
498 })),
499 })),
500 ),
501​
502 getReviewThreadComments: (input) =>
503 cli.getReviewThreadComments(input).pipe(Effect.mapError(fail("getReviewThreadComments"))),
504​
505 getViewerPermissions: (input) =>
506 Effect.all(
507 [
508 cli.getViewerAccess({ ...input, allowReserve: true }),
509 // Whether this viewer may update the branch is only on the comparison, and the
510 // comparison only resolves through the head ref the detail carries. A failure here
511 // withholds that one action rather than the whole answer, the way the detail path
512 // leaves the banner unknown.
513 input.includeUpdateBranch === false
514 ? Effect.succeed(false)
515 : cli.getPullRequestDetail(input).pipe(
516 Effect.flatMap((pullRequest) =>
517 pullRequest.state !== "open" || pullRequest.headRepositoryOwner === null
518 ? Effect.succeed(false)
519 : cli
520 .getPullRequestBaseComparison({
521 ...input,
522 headRef: `${pullRequest.headRepositoryOwner}:${pullRequest.headBranch}`,
523 allowReserve: true,
524 })
525 .pipe(Effect.map((comparison) => comparison.viewerCanUpdate === true)),
526 ),
527 Effect.orElseSucceed(() => false),
528 ),
529 ],
530 { concurrency: 2 },
531 ).pipe(
532 Effect.mapError(fail("getViewerPermissions")),
533 Effect.map(([access, canUpdateBranch]) =>
534 gitHubViewerPermissions({ ...access, canUpdateBranch }),
535 ),
536 ),
537​
538 getDiff: (input) => cli.getPullRequestDiff(input).pipe(Effect.mapError(fail("getDiff"))),
539​
540 getDiffFileContents: (input) =>
541 cli.getPullRequestDiffFileContents(input).pipe(Effect.mapError(fail("getDiffFileContents"))),
542​
543 getFilesViewed: (input) =>
544 cli.getPullRequestFilesViewed(input).pipe(Effect.mapError(fail("getFilesViewed"))),
545​
546 setFilesViewed: (input) =>
547 cli.setPullRequestFilesViewed(input).pipe(Effect.mapError(fail("setFilesViewed"))),
548​
549 listReviewerCandidates: (input) =>
550 cli.listReviewerCandidates(input).pipe(Effect.mapError(fail("listReviewerCandidates"))),
551​
552 setReviewerRequest: (input) =>
553 cli
554 .setReviewerRequest({
555 cwd: input.cwd,
556 repository: input.repository,
557 host: input.host,
558 number: input.number,
559 reviewers: input.reviewers,
560 requested: input.requested,
561 })
562 .pipe(Effect.mapError(fail("setReviewerRequest"))),
563​
564 listLabelCandidates: (input) =>
565 cli.listLabelCandidates(input).pipe(Effect.mapError(fail("listLabelCandidates"))),
566​
567 setLabels: (input) =>
568 cli
569 .setLabels({
570 cwd: input.cwd,
571 repository: input.repository,
572 host: input.host,
573 number: input.number,
574 labels: input.labels,
575 applied: input.applied,
576 })
577 .pipe(Effect.mapError(fail("setLabels"))),
578​
579 runAction: (input) =>
580 cli
581 .runPullRequestAction({
582 cwd: input.cwd,
583 repository: input.repository,
584 host: input.host,
585 number: input.number,
586 action: input.action,
587 ...(input.removeAgentCreditsOnMerge === true ? { removeAgentCreditsOnMerge: true } : {}),
588 ...(input.stackNumber === undefined ? {} : { stackNumber: input.stackNumber }),
589 ...(input.expectedStackHeads === undefined
590 ? {}
591 : { expectedStackHeads: input.expectedStackHeads }),
592 ...(input.mergeMethod === undefined ? {} : { mergeMethod: input.mergeMethod }),
593 ...(input.updateMethod === undefined ? {} : { updateMethod: input.updateMethod }),
594 })
595 .pipe(Effect.mapError(fail("runAction"))),
596​
597 updateChangeRequest: (input) =>
598 cli
599 .updatePullRequest({
600 cwd: input.cwd,
601 repository: input.repository,
602 host: input.host,
603 number: input.number,
604 ...(input.title === undefined ? {} : { title: input.title }),
605 ...(input.body === undefined ? {} : { body: input.body }),
606 })
607 .pipe(Effect.mapError(fail("updateChangeRequest"))),
608​
609 comment: (input) => cli.commentOnPullRequest(input).pipe(Effect.mapError(fail("comment"))),
610​
611 updateComment: (input) =>
612 cli
613 .updateComment({
614 cwd: input.cwd,
615 repository: input.repository,
616 host: input.host,
617 number: input.number,
618 commentId: input.commentId,
619 kind: input.kind,
620 body: input.body,
621 })
622 .pipe(Effect.mapError(fail("updateComment"))),
623​
624 submitReview: (input) => cli.submitReview(input).pipe(Effect.mapError(fail("submitReview"))),
625​
626 replyToThread: (input) =>
627 cli
628 .replyToReviewThread({
629 cwd: input.cwd,
630 repository: input.repository,
631 host: input.host,
632 threadId: input.threadId,
633 body: input.body,
634 })
635 .pipe(Effect.mapError(fail("replyToThread"))),
636​
637 setReaction: (input) =>
638 cli
639 .setReaction({
640 cwd: input.cwd,
641 repository: input.repository,
642 host: input.host,
643 number: input.number,
644 ...(input.subjectId === undefined ? {} : { subjectId: input.subjectId }),
645 content: input.content,
646 reacted: input.reacted,
647 })
648 .pipe(Effect.mapError(fail("setReaction"))),
649​
650 setThreadResolution: (input) =>
651 cli
652 .setReviewThreadResolution({
653 cwd: input.cwd,
654 repository: input.repository,
655 host: input.host,
656 threadId: input.threadId,
657 resolved: input.resolved,
658 })
659 .pipe(Effect.mapError(fail("setThreadResolution"))),
660 };
661​
662 return provider;
663});