try download claude

This commit is contained in:
David Blass
2025-11-06 20:28:58 -05:00
parent 42b023cc86
commit 0a63f3da9d
8 changed files with 114619 additions and 256 deletions
+39 -8
View File
@@ -1,3 +1,5 @@
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";
@@ -21,18 +23,44 @@ 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 {
log.info(`🐸 Running pullfrog/action@${packageJson.version}...`);
// 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) {
log.debug(`Changing to GITHUB_WORKSPACE: ${process.env.GITHUB_WORKSPACE}`);
process.chdir(process.env.GITHUB_WORKSPACE);
log.debug(`New working directory: ${process.cwd()}`);
// 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();
const githubInstallationToken = await setupGitHubInstallationToken();
@@ -44,6 +72,9 @@ export async function main(inputs: Inputs): Promise<MainResult> {
log.debug(`📋 MCP Config: ${JSON.stringify(mcpServers, null, 2)}`);
// Install Claude CLI before running
await claude.install();
log.info("Running Claude Agent SDK...");
log.box(inputs.prompt, { title: "Prompt" });