diff --git a/entry b/entry index cc60738..110e56c 100755 --- a/entry +++ b/entry @@ -83328,7 +83328,7 @@ function query({ // package.json var package_default = { name: "@pullfrog/action", - version: "0.0.149", + version: "0.0.150", type: "module", files: [ "index.js", @@ -83654,7 +83654,8 @@ var log = { */ toolCall: ({ toolName, input }) => { const inputFormatted = formatJsonValue(input); - const output = inputFormatted !== "{}" ? `${toolName}(${inputFormatted})` : `${toolName}()`; + const timestamp = isDebugEnabled() ? ` [${(/* @__PURE__ */ new Date()).toISOString()}]` : ""; + const output = inputFormatted !== "{}" ? `\u2192 ${toolName}(${inputFormatted})${timestamp}` : `\u2192 ${toolName}()${timestamp}`; log.info(output.trimEnd()); } }; @@ -124502,19 +124503,10 @@ function StartReviewTool(ctx) { nodeId: reviewNodeId, id: reviewId }; + log.debug(`review session started: id=${reviewId}, nodeId=${reviewNodeId}`); return { message: `Review session started for PR #${pull_number}.`, - guidance: { - analyze: [ - "What does this PR change? Summarize in 1-2 sentences.", - "Is the approach sound? If not, stop and comment on approach first.", - "What bugs, edge cases, or security issues exist?" - ], - beforeCommenting: [ - "Skip nitpicks unless explicitly requested.", - "Would the codebase maintainer care about this feedback, based on what you can infer about the code quality standards in this repo?" - ] - } + instructions: "Analyze: What does this PR change? Is the approach sound? What bugs, edge cases, or security issues exist? Before commenting: Skip nitpicks unless requested. Only comment if the codebase maintainer would care." }; }) }); @@ -124536,7 +124528,10 @@ function AddReviewCommentTool(ctx) { if (!ctx.toolState.review) { throw new Error("No review session started. Call start_review first."); } - await ctx.octokit.graphql( + log.debug( + `adding review comment: reviewNodeId=${ctx.toolState.review.nodeId}, path=${path4}, line=${line}, side=${side || "RIGHT"}` + ); + const result = await ctx.octokit.graphql( ADD_PULL_REQUEST_REVIEW_THREAD, { pullRequestReviewId: ctx.toolState.review.nodeId, @@ -124546,9 +124541,11 @@ function AddReviewCommentTool(ctx) { side: side || "RIGHT" } ); + log.debug(`review comment added: threadId=${result.addPullRequestReviewThread.thread.id}`); return { success: true, - message: `Comment added to ${path4}:${line}` + message: `Comment added to ${path4}:${line}`, + threadId: result.addPullRequestReviewThread.thread.id }; }) }); @@ -124571,6 +124568,9 @@ function SubmitReviewTool(ctx) { throw new Error("No PR context. Call checkout_pr or start_review first."); } const reviewId = ctx.toolState.review.id; + log.debug( + `submitting review: id=${reviewId}, nodeId=${ctx.toolState.review.nodeId}, prNumber=${ctx.toolState.prNumber}` + ); const apiUrl = process.env.API_URL || "https://pullfrog.com"; const fixAllUrl = `${apiUrl}/trigger/${ctx.owner}/${ctx.name}/${ctx.toolState.prNumber}?action=fix&review_id=${reviewId}`; const fixApprovedUrl = `${apiUrl}/trigger/${ctx.owner}/${ctx.name}/${ctx.toolState.prNumber}?action=fix-approved&review_id=${reviewId}`; @@ -124587,6 +124587,7 @@ function SubmitReviewTool(ctx) { event: "COMMENT", body: bodyWithFooter }); + log.debug(`review submitted: reviewId=${result.data.id}, state=${result.data.state}`); delete ctx.toolState.review; await deleteProgressComment(ctx); return { diff --git a/mcp/review.ts b/mcp/review.ts index 0fd1eda..1dc496d 100644 --- a/mcp/review.ts +++ b/mcp/review.ts @@ -123,19 +123,13 @@ export function StartReviewTool(ctx: ToolContext) { id: reviewId, }; + log.debug(`review session started: id=${reviewId}, nodeId=${reviewNodeId}`); + return { message: `Review session started for PR #${pull_number}.`, - guidance: { - analyze: [ - "What does this PR change? Summarize in 1-2 sentences.", - "Is the approach sound? If not, stop and comment on approach first.", - "What bugs, edge cases, or security issues exist?", - ], - beforeCommenting: [ - "Skip nitpicks unless explicitly requested.", - "Would the codebase maintainer care about this feedback, based on what you can infer about the code quality standards in this repo?", - ], - }, + instructions: + "Analyze: What does this PR change? Is the approach sound? What bugs, edge cases, or security issues exist? " + + "Before commenting: Skip nitpicks unless requested. Only comment if the codebase maintainer would care.", }; }), }); @@ -166,8 +160,12 @@ export function AddReviewCommentTool(ctx: ToolContext) { throw new Error("No review session started. Call start_review first."); } + log.debug( + `adding review comment: reviewNodeId=${ctx.toolState.review.nodeId}, path=${path}, line=${line}, side=${side || "RIGHT"}` + ); + // add comment thread via GraphQL (REST doesn't support adding to existing pending review) - await ctx.octokit.graphql( + const result = await ctx.octokit.graphql( ADD_PULL_REQUEST_REVIEW_THREAD, { pullRequestReviewId: ctx.toolState.review.nodeId, @@ -178,9 +176,12 @@ export function AddReviewCommentTool(ctx: ToolContext) { } ); + log.debug(`review comment added: threadId=${result.addPullRequestReviewThread.thread.id}`); + return { success: true, message: `Comment added to ${path}:${line}`, + threadId: result.addPullRequestReviewThread.thread.id, }; }), }); @@ -211,6 +212,9 @@ export function SubmitReviewTool(ctx: ToolContext) { } const reviewId = ctx.toolState.review.id; + log.debug( + `submitting review: id=${reviewId}, nodeId=${ctx.toolState.review.nodeId}, prNumber=${ctx.toolState.prNumber}` + ); // build quick links footer const apiUrl = process.env.API_URL || "https://pullfrog.com"; @@ -234,6 +238,8 @@ export function SubmitReviewTool(ctx: ToolContext) { body: bodyWithFooter, }); + log.debug(`review submitted: reviewId=${result.data.id}, state=${result.data.state}`); + // clear review state delete ctx.toolState.review; diff --git a/package.json b/package.json index c855380..62d4b28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pullfrog/action", - "version": "0.0.149", + "version": "0.0.150", "type": "module", "files": [ "index.js", diff --git a/utils/cli.ts b/utils/cli.ts index 143da58..8aa4b53 100644 --- a/utils/cli.ts +++ b/utils/cli.ts @@ -342,12 +342,11 @@ export const log = { */ toolCall: ({ toolName, input }: { toolName: string; input: unknown }): void => { const inputFormatted = formatJsonValue(input); - // if (inputFormatted !== "{}") - const output = inputFormatted !== "{}" ? `${toolName}(${inputFormatted})` : `${toolName}()`; - - // if (inputFormatted !== "{}") { - // output += formatIndentedField("input", inputFormatted); - // } + const timestamp = isDebugEnabled() ? ` [${new Date().toISOString()}]` : ""; + const output = + inputFormatted !== "{}" + ? `→ ${toolName}(${inputFormatted})${timestamp}` + : `→ ${toolName}()${timestamp}`; log.info(output.trimEnd()); },