import fs from "node:fs/promises";
import { spawn } from "node:child_process";
import { createReadStream } from "node:fs";
/**
 * Default local filesystem + process operations.
 * This is what tools use when running on the local machine.
 */
export const localOperations = {
    readFile: (path) => fs.readFile(path, "utf-8"),
    writeFile: async (path, content) => {
        const { dirname } = await import("node:path");
        await fs.mkdir(dirname(path), { recursive: true });
        await fs.writeFile(path, content, "utf-8");
    },
    stat: (path) => fs.stat(path),
    lstat: (path) => fs.lstat(path),
    readdir: (path, options) => fs.readdir(path, options),
    mkdir: (path) => fs.mkdir(path, { recursive: true }).then(() => { }),
    createReadStream: (path, encoding) => createReadStream(path, { encoding }),
    spawn: (command, args, options) => spawn(command, args, {
        cwd: options.cwd,
        env: options.env,
        detached: options.detached,
        stdio: options.stdio,
    }),
};
//# sourceMappingURL=operations.js.map