import { createNuBashOperations } from "../index.js"; export interface RunNuResult { output: string; exitCode: number | undefined; cancelled: boolean; } /** Run Nu source through the same BashOperations the `user_bash` hook hands to Pi. */ export async function runNu( command: string, cwd: string, signal?: AbortSignal, ): Promise { let output = ""; const result = await createNuBashOperations().exec(command, cwd, { onData(chunk) { output += chunk.toString("utf8"); }, ...(signal ? { signal } : {}), }); return { output, exitCode: result.exitCode ?? undefined, cancelled: signal?.aborted ?? false, }; }