Open History to see the last commit
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 };
102}
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" };
120}
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 };
142}
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 ];
177}
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;
185}
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 getChangeRequestWatchFingerprint: (input) =>
364 cli
365 .getPullRequestWatchFingerprint(input)
366 .pipe(Effect.mapError(fail("getChangeRequestWatchFingerprint"))),
367
368 getChangeRequestPreview: (input) =>
369 cli.getPullRequestPreview(input).pipe(Effect.mapError(fail("getChangeRequestPreview"))),
370
371 getChangeRequestChecks: (input) =>
372 cli.revalidateChecks(input, readChecks(input)).pipe(
373 Effect.map(({ state, checks }) => ({ state, checks })),
374 Effect.mapError(fail("getChangeRequestChecks")),
375 ),
376
377 getChangeRequest: (input) =>
378 readChecks(input).pipe(
379 Effect.map((pullRequest): ProviderChangeRequestDetail => ({
380 ...pullRequest,
381 author: withAvatar(pullRequest.author, new Map<string, string>(), input.host),
382 reviewers: pullRequest.reviewRequestLogins.map((login) => ({
383 login,
384 name: null,
385 avatarUrl: null,
386 })),
387 mergeCapabilities: pullRequest.viewerAccess.mergeCapabilities,
388 viewerPermissions: gitHubViewerPermissions({
389 ...pullRequest.viewerAccess,
390 canUpdateBranch: pullRequest.comparison?.viewerCanUpdate === true,
391 }),
392 baseComparison:
393 pullRequest.comparison === null || pullRequest.comparison.behindBy === null
394 ? "unknown"
395 : pullRequest.comparison.behindBy > 0
396 ? "behind"
397 : "up-to-date",
398 ...(pullRequest.comparison?.behindBy == null
399 ? {}
400 : { behindBy: pullRequest.comparison.behindBy }),
401 })),
402 Effect.mapError(fail("getChangeRequest")),
403 ),
404
405 getChangeRequestActivity: (input) =>
406 Effect.all(
407 [
408 cli.getPullRequestActivity(input),
409 // Line comments live on review threads, which `gh pr view --json` cannot reach. A
410 // GraphQL hiccup degrades to a truncated conversation rather than blanking activity.
411 cli.listReviewThreadComments(input).pipe(
412 Effect.orElseSucceed(() => ({
413 comments: [],
414 dismissalsByReviewId: new Map<string, string>(),
415 reactions: [],
416 reactionsById: new Map<string, ReadonlyArray<PullRequestReaction>>(),
417 editedAtById: new Map<string, string>(),
418 reviewThreads: [],
419 commentCount: 0,
420 truncated: true,
421 reviewThreadsTruncated: true,
422 reviewers: [],
423 avatarsByLogin: new Map<string, string>(),
424 botLogins: new Set<string>(),
425 commitStats: new Map<
426 string,
427 { readonly additions: number; readonly deletions: number }
428 >(),
429 commits: [],
430 viewer: { canUpdate: true, didAuthor: false },
431 })),
432 ),
433 ],
434 { concurrency: 2 },
435 ).pipe(
436 Effect.mapError(fail("getChangeRequestActivity")),
437 Effect.map(([pullRequest, reviewThreads]): ProviderChangeRequestActivity => ({
438 author: withAvatar(
439 pullRequest.author,
440 reviewThreads.avatarsByLogin,
441 input.host,
442 reviewThreads.botLogins,
443 ),
444 reviewers: reviewThreads.reviewers,
445 reactions: reviewThreads.reactions,
446 commits: (reviewThreads.commits.length > 0
447 ? reviewThreads.commits
448 : pullRequest.commits
449 ).map((commit) => ({
450 ...commit,
451 ...reviewThreads.commitStats.get(commit.oid),
452 authors: commit.authors?.map(
453 (author) =>
454 withAvatar(
455 author,
456 reviewThreads.avatarsByLogin,
457 input.host,
458 reviewThreads.botLogins,
459 ) ?? author,
460 ),
461 })),
462 comments: [...pullRequest.comments, ...reviewThreads.comments]
463 .map((comment) => ({
464 ...comment,
465 // GitHub keeps the dismissal reason on the timeline event, not on the review,
466 // so a dismissed review with nothing visible of its own reads its words from
467 // there. "Visible" and not "empty": bot reviews often carry only an HTML
468 // marker comment, which markdown renders as nothing.
469 body:
470 comment.kind === "review" &&
471 comment.reviewState?.toUpperCase() === "DISMISSED" &&
472 rendersEmpty(comment.body)
473 ? (reviewThreads.dismissalsByReviewId.get(comment.id) ?? comment.body)
474 : comment.body,
475 author: withAvatar(
476 comment.author,
477 reviewThreads.avatarsByLogin,
478 input.host,
479 reviewThreads.botLogins,
480 ),
481 // A comment out of `gh pr view --json` carries none of its own: that read
482 // reports no reaction at all, so they arrive from the GraphQL page by node id.
483 reactions: comment.reactions ?? reviewThreads.reactionsById.get(comment.id) ?? [],
484 editedAt: reviewThreads.editedAtById.get(comment.id) ?? comment.editedAt ?? null,
485 }))
486 .toSorted((left, right) => left.createdAt.localeCompare(right.createdAt)),
487 // `gh pr view --json comments,reviews` follows GitHub's cursors itself, so those two
488 // are always whole and only the thread walk can stop short of the host.
489 commentCount: pullRequest.comments.length + reviewThreads.commentCount,
490 commentsTruncated: reviewThreads.truncated,
491 reviewThreadsTruncated: reviewThreads.reviewThreadsTruncated,
492 reviewThreads: reviewThreads.reviewThreads.map((thread) => ({
493 ...thread,
494 comments: thread.comments.map((comment) => ({
495 ...comment,
496 author: withAvatar(
497 comment.author,
498 reviewThreads.avatarsByLogin,
499 input.host,
500 reviewThreads.botLogins,
501 ),
502 })),
503 })),
504 })),
505 ),
506
507 getReviewThreadComments: (input) =>
508 cli.getReviewThreadComments(input).pipe(Effect.mapError(fail("getReviewThreadComments"))),
509
510 getViewerPermissions: (input) =>
511 Effect.all(
512 [
513 cli.getViewerAccess({ ...input, allowReserve: true }),
514 // Whether this viewer may update the branch is only on the comparison, and the
515 // comparison only resolves through the head ref the detail carries. A failure here
516 // withholds that one action rather than the whole answer, the way the detail path
517 // leaves the banner unknown.
518 input.includeUpdateBranch === false
519 ? Effect.succeed(false)
520 : cli.getPullRequestDetail(input).pipe(
521 Effect.flatMap((pullRequest) =>
522 pullRequest.state !== "open" || pullRequest.headRepositoryOwner === null
523 ? Effect.succeed(false)
524 : cli
525 .getPullRequestBaseComparison({
526 ...input,
527 headRef: `${pullRequest.headRepositoryOwner}:${pullRequest.headBranch}`,
528 allowReserve: true,
529 })
530 .pipe(Effect.map((comparison) => comparison.viewerCanUpdate === true)),
531 ),
532 Effect.orElseSucceed(() => false),
533 ),
534 ],
535 { concurrency: 2 },
536 ).pipe(
537 Effect.mapError(fail("getViewerPermissions")),
538 Effect.map(([access, canUpdateBranch]) =>
539 gitHubViewerPermissions({ ...access, canUpdateBranch }),
540 ),
541 ),
542
543 getDiff: (input) => cli.getPullRequestDiff(input).pipe(Effect.mapError(fail("getDiff"))),
544
545 getDiffFileContents: (input) =>
546 cli.getPullRequestDiffFileContents(input).pipe(Effect.mapError(fail("getDiffFileContents"))),
547
548 getFilesViewed: (input) =>
549 cli.getPullRequestFilesViewed(input).pipe(Effect.mapError(fail("getFilesViewed"))),
550
551 setFilesViewed: (input) =>
552 cli.setPullRequestFilesViewed(input).pipe(Effect.mapError(fail("setFilesViewed"))),
553
554 listReviewerCandidates: (input) =>
555 cli.listReviewerCandidates(input).pipe(Effect.mapError(fail("listReviewerCandidates"))),
556
557 setReviewerRequest: (input) =>
558 cli
559 .setReviewerRequest({
560 cwd: input.cwd,
561 repository: input.repository,
562 host: input.host,
563 number: input.number,
564 reviewers: input.reviewers,
565 requested: input.requested,
566 })
567 .pipe(Effect.mapError(fail("setReviewerRequest"))),
568
569 listLabelCandidates: (input) =>
570 cli.listLabelCandidates(input).pipe(Effect.mapError(fail("listLabelCandidates"))),
571
572 setLabels: (input) =>
573 cli
574 .setLabels({
575 cwd: input.cwd,
576 repository: input.repository,
577 host: input.host,
578 number: input.number,
579 labels: input.labels,
580 applied: input.applied,
581 })
582 .pipe(Effect.mapError(fail("setLabels"))),
583
584 runAction: (input) =>
585 cli
586 .runPullRequestAction({
587 cwd: input.cwd,
588 repository: input.repository,
589 host: input.host,
590 number: input.number,
591 action: input.action,
592 ...(input.removeAgentCreditsOnMerge === true ? { removeAgentCreditsOnMerge: true } : {}),
593 ...(input.stackNumber === undefined ? {} : { stackNumber: input.stackNumber }),
594 ...(input.expectedStackHeads === undefined
595 ? {}
596 : { expectedStackHeads: input.expectedStackHeads }),
597 ...(input.mergeMethod === undefined ? {} : { mergeMethod: input.mergeMethod }),
598 ...(input.updateMethod === undefined ? {} : { updateMethod: input.updateMethod }),
599 })
600 .pipe(Effect.mapError(fail("runAction"))),
601
602 updateChangeRequest: (input) =>
603 cli
604 .updatePullRequest({
605 cwd: input.cwd,
606 repository: input.repository,
607 host: input.host,
608 number: input.number,
609 ...(input.title === undefined ? {} : { title: input.title }),
610 ...(input.body === undefined ? {} : { body: input.body }),
611 })
612 .pipe(Effect.mapError(fail("updateChangeRequest"))),
613
614 comment: (input) => cli.commentOnPullRequest(input).pipe(Effect.mapError(fail("comment"))),
615
616 updateComment: (input) =>
617 cli
618 .updateComment({
619 cwd: input.cwd,
620 repository: input.repository,
621 host: input.host,
622 number: input.number,
623 commentId: input.commentId,
624 kind: input.kind,
625 body: input.body,
626 })
627 .pipe(Effect.mapError(fail("updateComment"))),
628
629 submitReview: (input) => cli.submitReview(input).pipe(Effect.mapError(fail("submitReview"))),
630
631 replyToThread: (input) =>
632 cli
633 .replyToReviewThread({
634 cwd: input.cwd,
635 repository: input.repository,
636 host: input.host,
637 threadId: input.threadId,
638 body: input.body,
639 })
640 .pipe(Effect.mapError(fail("replyToThread"))),
641
642 setReaction: (input) =>
643 cli
644 .setReaction({
645 cwd: input.cwd,
646 repository: input.repository,
647 host: input.host,
648 number: input.number,
649 ...(input.subjectId === undefined ? {} : { subjectId: input.subjectId }),
650 content: input.content,
651 reacted: input.reacted,
652 })
653 .pipe(Effect.mapError(fail("setReaction"))),
654
655 setThreadResolution: (input) =>
656 cli
657 .setReviewThreadResolution({
658 cwd: input.cwd,
659 repository: input.repository,
660 host: input.host,
661 threadId: input.threadId,
662 resolved: input.resolved,
663 })
664 .pipe(Effect.mapError(fail("setThreadResolution"))),
665 };
666
667 return provider;
668});