diff --git a/src/github/operations/comments/update-claude-comment.ts b/src/github/operations/comments/update-claude-comment.ts index 683febb..d6f4bd1 100644 --- a/src/github/operations/comments/update-claude-comment.ts +++ b/src/github/operations/comments/update-claude-comment.ts @@ -16,7 +16,7 @@ export type UpdateClaudeCommentResult = { /** * Updates a Claude comment on GitHub (either an issue/PR comment or a PR review comment) - * + * * @param octokit - Authenticated Octokit instance * @param params - Parameters for updating the comment * @returns The updated comment details @@ -67,4 +67,4 @@ export async function updateClaudeComment( html_url: response.data.html_url, updated_at: response.data.updated_at, }; -} \ No newline at end of file +} diff --git a/src/github/operations/comments/update-with-branch.ts b/src/github/operations/comments/update-with-branch.ts index f54aa4c..766a56a 100644 --- a/src/github/operations/comments/update-with-branch.ts +++ b/src/github/operations/comments/update-with-branch.ts @@ -38,7 +38,7 @@ export async function updateTrackingComment( // Update the existing comment with the branch link try { const isPRReviewComment = isPullRequestReviewCommentEvent(context); - + await updateClaudeComment(octokit, { owner, repo, @@ -46,7 +46,7 @@ export async function updateTrackingComment( body: updatedBody, isPullRequestReviewComment: isPRReviewComment, }); - + console.log( `✅ Updated ${isPRReviewComment ? "PR review" : "issue"} comment ${commentId} with branch link`, ); diff --git a/src/mcp/install-mcp-server.ts b/src/mcp/install-mcp-server.ts index d31c343..251d2a0 100644 --- a/src/mcp/install-mcp-server.ts +++ b/src/mcp/install-mcp-server.ts @@ -9,8 +9,17 @@ type PrepareConfigParams = { claudeCommentId?: string; }; -export async function prepareMcpConfig(params: PrepareConfigParams): Promise { - const { githubToken, owner, repo, branch, additionalMcpConfig, claudeCommentId } = params; +export async function prepareMcpConfig( + params: PrepareConfigParams, +): Promise { + const { + githubToken, + owner, + repo, + branch, + additionalMcpConfig, + claudeCommentId, + } = params; try { const baseMcpConfig = { mcpServers: { diff --git a/test/update-claude-comment.test.ts b/test/update-claude-comment.test.ts index dcf8af3..e56c039 100644 --- a/test/update-claude-comment.test.ts +++ b/test/update-claude-comment.test.ts @@ -3,7 +3,6 @@ import { Octokit } from "@octokit/rest"; import { updateClaudeComment, type UpdateClaudeCommentParams, - type UpdateClaudeCommentResult, } from "../src/github/operations/comments/update-claude-comment"; describe("updateClaudeComment", () => { @@ -33,7 +32,9 @@ describe("updateClaudeComment", () => { }; // @ts-expect-error Mock implementation doesn't match full type signature - mockOctokit.rest.issues.updateComment = jest.fn().mockResolvedValue(mockResponse); + mockOctokit.rest.issues.updateComment = jest + .fn() + .mockResolvedValue(mockResponse); const params: UpdateClaudeCommentParams = { owner: "testowner", @@ -70,7 +71,9 @@ describe("updateClaudeComment", () => { }; // @ts-expect-error Mock implementation doesn't match full type signature - mockOctokit.rest.issues.updateComment = jest.fn().mockResolvedValue(mockResponse); + mockOctokit.rest.issues.updateComment = jest + .fn() + .mockResolvedValue(mockResponse); const params: UpdateClaudeCommentParams = { owner: "testowner", @@ -107,7 +110,9 @@ describe("updateClaudeComment", () => { }; // @ts-expect-error Mock implementation doesn't match full type signature - mockOctokit.rest.pulls.updateReviewComment = jest.fn().mockResolvedValue(mockResponse); + mockOctokit.rest.pulls.updateReviewComment = jest + .fn() + .mockResolvedValue(mockResponse); const params: UpdateClaudeCommentParams = { owner: "testowner", @@ -147,9 +152,13 @@ describe("updateClaudeComment", () => { }; // @ts-expect-error Mock implementation doesn't match full type signature - mockOctokit.rest.pulls.updateReviewComment = jest.fn().mockRejectedValue(mockError); + mockOctokit.rest.pulls.updateReviewComment = jest + .fn() + .mockRejectedValue(mockError); // @ts-expect-error Mock implementation doesn't match full type signature - mockOctokit.rest.issues.updateComment = jest.fn().mockResolvedValue(mockResponse); + mockOctokit.rest.issues.updateComment = jest + .fn() + .mockResolvedValue(mockResponse); const params: UpdateClaudeCommentParams = { owner: "testowner", @@ -187,7 +196,9 @@ describe("updateClaudeComment", () => { mockError.status = 500; // @ts-expect-error Mock implementation doesn't match full type signature - mockOctokit.rest.pulls.updateReviewComment = jest.fn().mockRejectedValue(mockError); + mockOctokit.rest.pulls.updateReviewComment = jest + .fn() + .mockRejectedValue(mockError); const params: UpdateClaudeCommentParams = { owner: "testowner", @@ -197,7 +208,9 @@ describe("updateClaudeComment", () => { isPullRequestReviewComment: true, }; - await expect(updateClaudeComment(mockOctokit, params)).rejects.toEqual(mockError); + await expect(updateClaudeComment(mockOctokit, params)).rejects.toEqual( + mockError, + ); expect(mockOctokit.rest.pulls.updateReviewComment).toHaveBeenCalledWith({ owner: "testowner", @@ -214,7 +227,9 @@ describe("updateClaudeComment", () => { const mockError = new Error("Forbidden"); // @ts-expect-error Mock implementation doesn't match full type signature - mockOctokit.rest.issues.updateComment = jest.fn().mockRejectedValue(mockError); + mockOctokit.rest.issues.updateComment = jest + .fn() + .mockRejectedValue(mockError); const params: UpdateClaudeCommentParams = { owner: "testowner", @@ -224,7 +239,9 @@ describe("updateClaudeComment", () => { isPullRequestReviewComment: false, }; - await expect(updateClaudeComment(mockOctokit, params)).rejects.toEqual(mockError); + await expect(updateClaudeComment(mockOctokit, params)).rejects.toEqual( + mockError, + ); expect(mockOctokit.rest.issues.updateComment).toHaveBeenCalledWith({ owner: "testowner", @@ -245,7 +262,9 @@ describe("updateClaudeComment", () => { }; // @ts-expect-error Mock implementation doesn't match full type signature - mockOctokit.rest.issues.updateComment = jest.fn().mockResolvedValue(mockResponse); + mockOctokit.rest.issues.updateComment = jest + .fn() + .mockResolvedValue(mockResponse); const params: UpdateClaudeCommentParams = { owner: "testowner", @@ -276,7 +295,9 @@ describe("updateClaudeComment", () => { }; // @ts-expect-error Mock implementation doesn't match full type signature - mockOctokit.rest.issues.updateComment = jest.fn().mockResolvedValue(mockResponse); + mockOctokit.rest.issues.updateComment = jest + .fn() + .mockResolvedValue(mockResponse); const params: UpdateClaudeCommentParams = { owner: "testowner", @@ -325,7 +346,9 @@ const code = "example"; }; // @ts-expect-error Mock implementation doesn't match full type signature - mockOctokit.rest.issues.updateComment = jest.fn().mockResolvedValue(mockResponse); + mockOctokit.rest.issues.updateComment = jest + .fn() + .mockResolvedValue(mockResponse); const params: UpdateClaudeCommentParams = { owner: "testowner", @@ -366,7 +389,9 @@ const code = "example"; }; // @ts-expect-error Mock implementation doesn't match full type signature - mockOctokit.rest.pulls.updateReviewComment = jest.fn().mockResolvedValue(mockResponse); + mockOctokit.rest.pulls.updateReviewComment = jest + .fn() + .mockResolvedValue(mockResponse); const params: UpdateClaudeCommentParams = { owner: "testowner", @@ -385,4 +410,4 @@ const code = "example"; updated_at: "2024-01-08T12:30:45Z", }); }); -}); \ No newline at end of file +});