From a2f6b938dec8ac283eacfb782fcbe32535716cd2 Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Tue, 16 Dec 2025 19:01:13 -0800 Subject: [PATCH] Fix log --- agents/claude.ts | 2 +- agents/cursor.ts | 2 +- agents/gemini.ts | 2 +- agents/opencode.ts | 2 +- mcp/pr.ts | 8 +++----- utils/cli.ts | 15 ++++++++++----- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/agents/claude.ts b/agents/claude.ts index fa1c942..ee37cb4 100644 --- a/agents/claude.ts +++ b/agents/claude.ts @@ -19,7 +19,7 @@ export const claude = agent({ delete process.env.ANTHROPIC_API_KEY; const prompt = addInstructions({ payload, prepResults, repo }); - log.group("Full prompt", (log) => log.info(prompt)); + log.group("Full prompt", () => log.info(prompt)); // configure sandbox mode if enabled const sandboxOptions: Options = payload.sandbox diff --git a/agents/cursor.ts b/agents/cursor.ts index b7af0c5..86bec86 100644 --- a/agents/cursor.ts +++ b/agents/cursor.ts @@ -167,7 +167,7 @@ export const cursor = agent({ try { const fullPrompt = addInstructions({ payload, prepResults, repo }); - log.group("Full prompt", (log) => log.info(fullPrompt)); + log.group("Full prompt", () => log.info(fullPrompt)); // configure sandbox mode if enabled // in sandbox mode: remove --force flag and rely on cli-config.json sandbox settings diff --git a/agents/gemini.ts b/agents/gemini.ts index c14bc0d..89b9ee3 100644 --- a/agents/gemini.ts +++ b/agents/gemini.ts @@ -162,7 +162,7 @@ export const gemini = agent({ } const sessionPrompt = addInstructions({ payload, prepResults, repo }); - log.group("Full prompt", (log) => log.info(sessionPrompt)); + log.group("Full prompt", () => log.info(sessionPrompt)); // configure sandbox mode if enabled // --allowed-tools restricts which tools are available (removes others from registry entirely) diff --git a/agents/opencode.ts b/agents/opencode.ts index fa5f309..5c52195 100644 --- a/agents/opencode.ts +++ b/agents/opencode.ts @@ -314,7 +314,7 @@ export const opencode = agent({ configureOpenCodeSandbox({ sandbox: payload.sandbox ?? false }); const prompt = addInstructions({ payload, prepResults, repo }); - log.group("Full prompt", (log) => log.info(prompt)); + log.group("Full prompt", () => log.info(prompt)); const args = ["run", "--format", "json", prompt]; if (payload.sandbox) { diff --git a/mcp/pr.ts b/mcp/pr.ts index 7b66426..e5b2f3e 100644 --- a/mcp/pr.ts +++ b/mcp/pr.ts @@ -3,7 +3,6 @@ import { agentsManifest } from "../external.ts"; import type { Context } from "../main.ts"; import { buildPullfrogFooter, stripExistingFooter } from "../utils/buildPullfrogFooter.ts"; import { log } from "../utils/cli.ts"; -import { parseRepoContext } from "../utils/github.ts"; import { containsSecrets } from "../utils/secrets.ts"; import { $ } from "../utils/shell.ts"; import { execute, tool } from "./shared.ts"; @@ -15,16 +14,15 @@ export const PullRequest = type({ }); function buildPrBodyWithFooter(ctx: Context, body: string): string { - const repoContext = parseRepoContext(); - const runId = process.env.GITHUB_RUN_ID; - const agentName = ctx.payload.agent; const agentInfo = agentName ? agentsManifest[agentName] : null; const footer = buildPullfrogFooter({ triggeredBy: true, agent: agentInfo ? { displayName: agentInfo.displayName, url: agentInfo.url } : undefined, - workflowRun: runId ? { owner: repoContext.owner, repo: repoContext.name, runId } : undefined, + workflowRun: ctx.runId + ? { owner: ctx.owner, repo: ctx.name, runId: ctx.runId, jobId: ctx.jobId } + : undefined, }); const bodyWithoutFooter = stripExistingFooter(body); diff --git a/utils/cli.ts b/utils/cli.ts index 41f1c9f..17e22d6 100644 --- a/utils/cli.ts +++ b/utils/cli.ts @@ -32,6 +32,15 @@ function endGroup(): void { } } +/** + * Run a callback within a collapsed group + */ +function group(name: string, fn: () => void): void { + startGroup(name); + fn(); + endGroup(); +} + /** * Print a formatted box with text (for console output) */ @@ -319,11 +328,7 @@ export const log = { /** * Run a callback within a collapsed group */ - group: (name: string, fn: (log: typeof log) => void): void => { - startGroup(name); - fn(log); - endGroup(); - }, + group, /** * Log tool call information to console with formatted output