diff --git a/entry.js b/entry.js index 062ee29..3a62c43 100755 --- a/entry.js +++ b/entry.js @@ -65139,8 +65139,6 @@ var require_fast_content_type_parse = __commonJS({ // entry.ts var core3 = __toESM(require_core(), 1); - -// main.ts import { readdir } from "node:fs/promises"; import { join as join5 } from "node:path"; @@ -85807,7 +85805,7 @@ function query({ // package.json var package_default = { name: "@pullfrog/action", - version: "0.0.82", + version: "0.0.83", type: "module", files: [ "index.js", @@ -86514,36 +86512,8 @@ var Inputs = type({ prompt: "string", "anthropic_api_key?": "string | undefined" }); -async function printDirectoryTree(dir, prefix = "", rootDir = dir) { - const entries = await readdir(dir, { withFileTypes: true }); - const lines = []; - for (let i = 0; i < entries.length; i++) { - const entry = entries[i]; - const isLast = i === entries.length - 1; - const currentPrefix = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 "; - const nextPrefix = isLast ? " " : "\u2502 "; - const fullPath = join5(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"); -} async function main(inputs) { try { - const cwd2 = process.cwd(); - log.info(`Current working directory: ${cwd2}`); - try { - const tree = await printDirectoryTree(cwd2); - log.info(`Directory tree: -${tree}`); - } catch (error41) { - log.warning( - `Failed to print directory tree: ${error41 instanceof Error ? error41.message : String(error41)}` - ); - } log.info(`\u{1F438} Running pullfrog/action@${package_default.version}...`); setupGitConfig(); const githubInstallationToken = await setupGitHubInstallationToken(); @@ -114568,7 +114538,35 @@ function createMcpServer() { } // entry.ts +async function printDirectoryTree(dir, prefix = "", rootDir = dir) { + const entries = await readdir(dir, { withFileTypes: true }); + const lines = []; + for (let i = 0; i < entries.length; i++) { + const entry = entries[i]; + const isLast = i === entries.length - 1; + const currentPrefix = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 "; + const nextPrefix = isLast ? " " : "\u2502 "; + const fullPath = join5(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"); +} async function run() { + const cwd2 = process.cwd(); + log.info(`Current working directory: ${cwd2}`); + try { + const tree = await printDirectoryTree(cwd2); + log.info(`Directory tree: +${tree}`); + } catch (error41) { + log.warning( + `Failed to print directory tree: ${error41 instanceof Error ? error41.message : String(error41)}` + ); + } if (process.env.GITHUB_WORKSPACE && process.cwd() !== process.env.GITHUB_WORKSPACE) { log.debug(`Changing to GITHUB_WORKSPACE: ${process.env.GITHUB_WORKSPACE}`); process.chdir(process.env.GITHUB_WORKSPACE); diff --git a/entry.ts b/entry.ts index 092f54d..d791029 100644 --- a/entry.ts +++ b/entry.ts @@ -4,6 +4,8 @@ * Entry point for GitHub Action */ +import { readdir } from "node:fs/promises"; +import { join } from "node:path"; import * as core from "@actions/core"; import { type Inputs, main } from "./main.ts"; import { createMcpServer } from "./mcp/server.ts"; @@ -12,7 +14,41 @@ import { log } from "./utils/cli.ts"; // Export createMcpServer so it can be called from the spawned MCP process export { createMcpServer }; +async function printDirectoryTree(dir: string, prefix = "", rootDir = dir): Promise { + 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"); +} + async function run(): Promise { + // Debug: Print current directory tree before changing directories + 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)}` + ); + } + // 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 if (process.env.GITHUB_WORKSPACE && process.cwd() !== process.env.GITHUB_WORKSPACE) { diff --git a/main.ts b/main.ts index 8c903de..d167ae6 100644 --- a/main.ts +++ b/main.ts @@ -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 { - 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 { 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(); diff --git a/package.json b/package.json index 03835ab..dad0204 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pullfrog/action", - "version": "0.0.82", + "version": "0.0.83", "type": "module", "files": [ "index.js",