move directory logging

This commit is contained in:
David Blass
2025-11-06 20:34:35 -05:00
parent c31824144b
commit 6d0c21f0f5
4 changed files with 66 additions and 68 deletions
+29 -31
View File
@@ -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);