Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ea1d95b70 | |||
| 6d0c21f0f5 |
@@ -4,7 +4,10 @@
|
|||||||
* Entry point for GitHub Action
|
* Entry point for GitHub Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { readdir } from "node:fs/promises";
|
||||||
|
import { join } from "node:path";
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
|
import { dirName } from "@ark/fs";
|
||||||
import { type Inputs, main } from "./main.ts";
|
import { type Inputs, main } from "./main.ts";
|
||||||
import { createMcpServer } from "./mcp/server.ts";
|
import { createMcpServer } from "./mcp/server.ts";
|
||||||
import { log } from "./utils/cli.ts";
|
import { log } from "./utils/cli.ts";
|
||||||
@@ -12,7 +15,41 @@ import { log } from "./utils/cli.ts";
|
|||||||
// Export createMcpServer so it can be called from the spawned MCP process
|
// Export createMcpServer so it can be called from the spawned MCP process
|
||||||
export { createMcpServer };
|
export { createMcpServer };
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
|
// Debug: Print current directory tree before changing directories
|
||||||
|
const actionDir = dirName();
|
||||||
|
log.info(`action dir: ${actionDir}`);
|
||||||
|
try {
|
||||||
|
const tree = await printDirectoryTree(actionDir);
|
||||||
|
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)
|
// 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
|
// JavaScript actions run from the action's directory, not the checked-out repo
|
||||||
if (process.env.GITHUB_WORKSPACE && process.cwd() !== process.env.GITHUB_WORKSPACE) {
|
if (process.env.GITHUB_WORKSPACE && process.cwd() !== process.env.GITHUB_WORKSPACE) {
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { readdir } from "node:fs/promises";
|
|
||||||
import { join } from "node:path";
|
|
||||||
import { type } from "arktype";
|
import { type } from "arktype";
|
||||||
import { claude } from "./agents/claude.ts";
|
import { claude } from "./agents/claude.ts";
|
||||||
import { createMcpConfigs } from "./mcp/config.ts";
|
import { createMcpConfigs } from "./mcp/config.ts";
|
||||||
@@ -23,42 +21,8 @@ export interface MainResult {
|
|||||||
|
|
||||||
export type PromptJSON = {};
|
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> {
|
export async function main(inputs: Inputs): Promise<MainResult> {
|
||||||
try {
|
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}...`);
|
log.info(`🐸 Running pullfrog/action@${packageJson.version}...`);
|
||||||
|
|
||||||
setupGitConfig();
|
setupGitConfig();
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pullfrog/action",
|
"name": "@pullfrog/action",
|
||||||
"version": "0.0.82",
|
"version": "0.0.84",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
"index.js",
|
"index.js",
|
||||||
|
|||||||
Reference in New Issue
Block a user