Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bac3f3e9c6 | |||
| 5ea1d95b70 | |||
| 6d0c21f0f5 |
+1
-1
@@ -7,4 +7,4 @@ echo "🔨 Building action..."
|
||||
pnpm build
|
||||
|
||||
# Add the built files and lockfile to the commit
|
||||
git add entry.js pnpm-lock.yaml
|
||||
git add entry.js mcp-server.js pnpm-lock.yaml
|
||||
|
||||
@@ -6,12 +6,8 @@
|
||||
|
||||
import * as core from "@actions/core";
|
||||
import { type Inputs, main } from "./main.ts";
|
||||
import { createMcpServer } from "./mcp/server.ts";
|
||||
import { log } from "./utils/cli.ts";
|
||||
|
||||
// Export createMcpServer so it can be called from the spawned MCP process
|
||||
export { createMcpServer };
|
||||
|
||||
async function run(): Promise<void> {
|
||||
// Change to GITHUB_WORKSPACE if set (this is where actions/checkout puts the repo)
|
||||
// JavaScript actions run from the action's directory, not the checked-out repo
|
||||
|
||||
+15
-5
@@ -1,11 +1,7 @@
|
||||
import { build } from "esbuild";
|
||||
|
||||
// Build the GitHub Action bundle only
|
||||
// For npm package builds, use zshy (pnpm build:npm)
|
||||
await build({
|
||||
entryPoints: ["./entry.ts"],
|
||||
const sharedConfig = {
|
||||
bundle: true,
|
||||
outfile: "./entry.js",
|
||||
format: "esm",
|
||||
platform: "node",
|
||||
target: "node20",
|
||||
@@ -27,6 +23,20 @@ await build({
|
||||
treeShaking: true,
|
||||
// Drop console statements in production (but keep for debugging)
|
||||
drop: [],
|
||||
};
|
||||
|
||||
// Build the main entry bundle (without MCP)
|
||||
await build({
|
||||
...sharedConfig,
|
||||
entryPoints: ["./entry.ts"],
|
||||
outfile: "./entry.js",
|
||||
});
|
||||
|
||||
// Build the MCP server bundle
|
||||
await build({
|
||||
...sharedConfig,
|
||||
entryPoints: ["./mcp/server.ts"],
|
||||
outfile: "./mcp-server.js",
|
||||
});
|
||||
|
||||
console.log("✅ Build completed successfully!");
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { readdir } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { type } from "arktype";
|
||||
import { claude } from "./agents/claude.ts";
|
||||
import { createMcpConfigs } from "./mcp/config.ts";
|
||||
@@ -23,42 +21,8 @@ export interface MainResult {
|
||||
|
||||
export type PromptJSON = {};
|
||||
|
||||
async function printDirectoryTree(dir: string, prefix = "", rootDir = dir): Promise<string> {
|
||||
const entries = await readdir(dir, { withFileTypes: true });
|
||||
const lines: string[] = [];
|
||||
|
||||
for (let i = 0; i < entries.length; i++) {
|
||||
const entry = entries[i];
|
||||
const isLast = i === entries.length - 1;
|
||||
const currentPrefix = isLast ? "└── " : "├── ";
|
||||
const nextPrefix = isLast ? " " : "│ ";
|
||||
|
||||
const fullPath = join(dir, entry.name);
|
||||
lines.push(`${prefix}${currentPrefix}${entry.name}`);
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
const subTree = await printDirectoryTree(fullPath, `${prefix}${nextPrefix}`, rootDir);
|
||||
lines.push(subTree);
|
||||
}
|
||||
}
|
||||
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
||||
export async function main(inputs: Inputs): Promise<MainResult> {
|
||||
try {
|
||||
// Debug: Print current directory tree before anything runs
|
||||
const cwd = process.cwd();
|
||||
log.info(`Current working directory: ${cwd}`);
|
||||
try {
|
||||
const tree = await printDirectoryTree(cwd);
|
||||
log.info(`Directory tree:\n${tree}`);
|
||||
} catch (error) {
|
||||
log.warning(
|
||||
`Failed to print directory tree: ${error instanceof Error ? error.message : String(error)}`
|
||||
);
|
||||
}
|
||||
|
||||
log.info(`🐸 Running pullfrog/action@${packageJson.version}...`);
|
||||
|
||||
setupGitConfig();
|
||||
|
||||
Executable
+101715
File diff suppressed because one or more lines are too long
+5
-9
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
import type { McpServerConfig } from "@anthropic-ai/claude-agent-sdk";
|
||||
import { fromHere } from "@ark/fs";
|
||||
import { parseRepoContext } from "../utils/github.ts";
|
||||
|
||||
export const ghPullfrogMcpName = "gh-pullfrog";
|
||||
@@ -15,19 +16,14 @@ export function createMcpConfigs(githubInstallationToken: string): McpConfigs {
|
||||
const repoContext = parseRepoContext();
|
||||
const githubRepository = `${repoContext.owner}/${repoContext.name}`;
|
||||
|
||||
// Get absolute path to entry.js - use GITHUB_ACTION_PATH if available, otherwise current directory
|
||||
const entryPath = process.env.GITHUB_ACTION_PATH
|
||||
? `${process.env.GITHUB_ACTION_PATH}/entry.js`
|
||||
: `${process.cwd()}/entry.js`;
|
||||
const serverPath = process.env.GITHUB_ACTION_PATH
|
||||
? `${process.env.GITHUB_ACTION_PATH}/mcp-server.js`
|
||||
: fromHere("server.ts");
|
||||
|
||||
return {
|
||||
[ghPullfrogMcpName]: {
|
||||
command: "node",
|
||||
args: [
|
||||
"--input-type=module",
|
||||
"-e",
|
||||
`import('${entryPath.replace(/'/g, "\\'")}').then(m => m.createMcpServer())`,
|
||||
],
|
||||
args: [serverPath],
|
||||
env: {
|
||||
GITHUB_INSTALLATION_TOKEN: githubInstallationToken,
|
||||
GITHUB_REPOSITORY: githubRepository,
|
||||
|
||||
+13
-15
@@ -8,20 +8,18 @@ import { PullRequestInfoTool } from "./prInfo.ts";
|
||||
import { ReviewTool } from "./review.ts";
|
||||
import { addTools } from "./shared.ts";
|
||||
|
||||
export function createMcpServer(): void {
|
||||
const server = new FastMCP({
|
||||
name: "gh-pullfrog",
|
||||
version: "0.0.1",
|
||||
});
|
||||
const server = new FastMCP({
|
||||
name: "gh-pullfrog",
|
||||
version: "0.0.1",
|
||||
});
|
||||
|
||||
addTools(server, [
|
||||
CreateCommentTool,
|
||||
EditCommentTool,
|
||||
IssueTool,
|
||||
PullRequestTool,
|
||||
ReviewTool,
|
||||
PullRequestInfoTool,
|
||||
]);
|
||||
addTools(server, [
|
||||
CreateCommentTool,
|
||||
EditCommentTool,
|
||||
IssueTool,
|
||||
PullRequestTool,
|
||||
ReviewTool,
|
||||
PullRequestInfoTool,
|
||||
]);
|
||||
|
||||
server.start();
|
||||
}
|
||||
server.start();
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pullfrog/action",
|
||||
"version": "0.0.82",
|
||||
"version": "0.0.85",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"index.js",
|
||||
|
||||
Reference in New Issue
Block a user