From c0f31415a3636e2efd3ce5e8a4df5778cfca5e5f Mon Sep 17 00:00:00 2001 From: David Blass Date: Thu, 23 Oct 2025 15:43:50 -0400 Subject: [PATCH] try setting cwd --- agents/claude.ts | 1 + package.json | 2 +- utils/subprocess.ts | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/agents/claude.ts b/agents/claude.ts index 0c47e49..9ff463f 100644 --- a/agents/claude.ts +++ b/agents/claude.ts @@ -114,6 +114,7 @@ export class ClaudeAgent implements Agent { env, input: `${instructions} ${prompt}`, timeout: 10 * 60 * 1000, // 10 minutes + cwd: process.env.GITHUB_WORKSPACE || process.cwd(), onStdout: (_chunk) => { processJSONChunk(_chunk, this); }, diff --git a/package.json b/package.json index 234ac15..0b93949 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pullfrog/action", - "version": "0.0.55", + "version": "0.0.56", "type": "module", "files": [ "index.js", diff --git a/utils/subprocess.ts b/utils/subprocess.ts index 4432b3f..b9ed639 100644 --- a/utils/subprocess.ts +++ b/utils/subprocess.ts @@ -6,6 +6,7 @@ export interface SpawnOptions { env?: Record; input?: string; timeout?: number; + cwd?: string; onStdout?: (chunk: string) => void; onStderr?: (chunk: string) => void; } @@ -21,7 +22,7 @@ export interface SpawnResult { * Spawn a subprocess with streaming callbacks and buffered results */ export async function spawn(options: SpawnOptions): Promise { - const { cmd, args, env, input, timeout, onStdout, onStderr } = options; + const { cmd, args, env, input, timeout, cwd, onStdout, onStderr } = options; const startTime = Date.now(); let stdoutBuffer = ""; @@ -31,6 +32,7 @@ export async function spawn(options: SpawnOptions): Promise { const child = nodeSpawn(cmd, args, { env: env ? { ...process.env, ...env } : process.env, stdio: ["pipe", "pipe", "pipe"], + cwd: cwd || process.cwd(), }); let timeoutId: NodeJS.Timeout | undefined;