Skip to content

Commit 98e58f4

Browse files
authored
chore: comments ui and gh cli calls (#235)
1 parent d35ac96 commit 98e58f4

File tree

14 files changed

+777
-151
lines changed

14 files changed

+777
-151
lines changed

apps/array/src/main/preload.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ contextBridge.exposeInMainWorld("electronAPI", {
282282
}> => ipcRenderer.invoke("get-diff-stats", repoPath),
283283
getCurrentBranch: (repoPath: string): Promise<string | undefined> =>
284284
ipcRenderer.invoke("get-current-branch", repoPath),
285+
getHeadCommitSha: (repoPath: string): Promise<string> =>
286+
ipcRenderer.invoke("get-head-commit-sha", repoPath),
285287
discardFileChanges: (
286288
repoPath: string,
287289
filePath: string,
@@ -508,4 +510,59 @@ contextBridge.exposeInMainWorld("electronAPI", {
508510
setTerminalLayout: (mode: "split" | "tabbed"): Promise<void> =>
509511
ipcRenderer.invoke("settings:set-terminal-layout", mode),
510512
},
513+
// PR Comments API
514+
prComments: {
515+
getReviewComments: (
516+
directoryPath: string,
517+
prNumber: number,
518+
): Promise<unknown[]> =>
519+
ipcRenderer.invoke("get-pr-review-comments", directoryPath, prNumber),
520+
addComment: (
521+
directoryPath: string,
522+
prNumber: number,
523+
params: {
524+
body: string;
525+
commitId: string;
526+
path: string;
527+
line: number;
528+
side: "LEFT" | "RIGHT";
529+
},
530+
): Promise<unknown> =>
531+
ipcRenderer.invoke("add-pr-comment", directoryPath, prNumber, params),
532+
replyToReview: (
533+
directoryPath: string,
534+
prNumber: number,
535+
params: { body: string; inReplyTo: number },
536+
): Promise<unknown> =>
537+
ipcRenderer.invoke("reply-pr-review", directoryPath, prNumber, params),
538+
updateComment: (
539+
directoryPath: string,
540+
commentId: number,
541+
body: string,
542+
): Promise<unknown> =>
543+
ipcRenderer.invoke("update-pr-comment", directoryPath, commentId, body),
544+
deleteComment: (directoryPath: string, commentId: number): Promise<void> =>
545+
ipcRenderer.invoke("delete-pr-comment", directoryPath, commentId),
546+
resolveComment: (
547+
directoryPath: string,
548+
prNumber: number,
549+
commentId: number,
550+
resolved: boolean,
551+
): Promise<unknown> =>
552+
ipcRenderer.invoke(
553+
"resolve-pr-comment",
554+
directoryPath,
555+
prNumber,
556+
commentId,
557+
resolved,
558+
),
559+
getPrForBranch: (
560+
directoryPath: string,
561+
): Promise<{
562+
number: number;
563+
url: string;
564+
title: string;
565+
state: string;
566+
} | null> => ipcRenderer.invoke("get-pr-for-branch", directoryPath),
567+
},
511568
});

0 commit comments

Comments
 (0)