diff --git a/mcp/config.ts b/mcp/config.ts index 96ac4a8..a26e184 100644 --- a/mcp/config.ts +++ b/mcp/config.ts @@ -4,9 +4,9 @@ import type { McpStdioServerConfig } from "@anthropic-ai/claude-agent-sdk"; import { fromHere } from "@ark/fs"; +import { ghPullfrogMcpName } from "../external.ts"; import type { Mode } from "../modes.ts"; import { parseRepoContext } from "../utils/github.ts"; -import { ghPullfrogMcpName } from "../external.ts"; export type McpName = typeof ghPullfrogMcpName; @@ -16,9 +16,9 @@ export function createMcpConfigs(githubInstallationToken: string, modes: Mode[]) const repoContext = parseRepoContext(); const githubRepository = `${repoContext.owner}/${repoContext.name}`; - // In production (GitHub Actions), mcp-server.js is in same directory as entry.js (where this is bundled) + // In production (GitHub Actions), mcp-server is in same directory as entry.js (where this is bundled) // In development, server.ts is in the same directory as this file (config.ts) - const serverPath = process.env.GITHUB_ACTIONS ? fromHere("mcp-server.js") : fromHere("server.ts"); + const serverPath = process.env.GITHUB_ACTIONS ? fromHere("mcp-server") : fromHere("server.ts"); return { [ghPullfrogMcpName]: { diff --git a/utils/cli.ts b/utils/cli.ts index 5aa98a3..5b982f7 100644 --- a/utils/cli.ts +++ b/utils/cli.ts @@ -6,6 +6,7 @@ import { spawnSync } from "node:child_process"; import { appendFileSync, existsSync } from "node:fs"; import { join } from "node:path"; import * as core from "@actions/core"; +import { table } from "table"; const isGitHubActions = !!process.env.GITHUB_ACTIONS; const isDebugEnabled = process.env.LOG_LEVEL === "debug"; @@ -160,6 +161,43 @@ async function summaryTable( core.info(`\n${tableText}\n`); } +/** + * Print a formatted table using the table package + * Also logs to console and GitHub Actions summary + */ +async function printTable( + rows: Array>, + options?: { + title?: string; + } +): Promise { + const { title } = options || {}; + + // Convert rows to string arrays for the table package + const tableData = rows.map((row) => + row.map((cell) => { + if (typeof cell === "string") { + return cell; + } + return cell.data; + }) + ); + + const formatted = table(tableData); + + if (title) { + core.info(`\n${title}`); + } + core.info(`\n${formatted}\n`); + + if (isGitHubActions) { + if (title) { + core.summary.addRaw(`**${title}**\n\n`); + } + core.summary.addRaw(`\`\`\`\n${formatted}\n\`\`\`\n`); + } +} + /** * Print a separator line */ @@ -240,6 +278,11 @@ export const log = { */ summaryTable, + /** + * Print a formatted table using the table package + */ + table: printTable, + /** * Print a separator line */