import type { Context } from "../context.js"; import { Resource } from "../resource.js"; /** * Properties for executing a shell command */ export interface ExecProps { /** * The command to execute (including any arguments) */ command: string; /** * Whether to memoize the command (only re-run if the command changes) * * @default false */ memoize?: boolean; /** * Working directory for the command */ cwd?: string; /** * Environment variables to set */ env?: Record; /** * Whether to inherit stdio from parent process * @default true */ inheritStdio?: boolean; } /** * Output returned after command execution */ export interface Exec extends Resource<"os::Exec">, ExecProps { /** * Unique identifier for this execution */ id: string; /** * Exit code of the command */ exitCode: number; /** * Standard output from the command (only available when inheritStdio is false) */ stdout: string; /** * Standard error from the command (only available when inheritStdio is false) */ stderr: string; /** * Time at which the command was executed */ executedAt: number; /** * Whether the command has completed execution */ completed: boolean; } /** * Execute a shell command * * @example * // Run a simple command with inherited stdio (default) * const result = await Exec("list-files", { * command: "ls -la" * }); * * @example * // Run a command and capture output instead of inheriting stdio * const result = await Exec("list-files", { * command: "ls -la", * inheritStdio: false * }); * * console.log(result.stdout); * * @example * // Run a command in a specific directory with custom environment * const build = await Exec("build-project", { * command: "npm run build", * cwd: "./my-project", * env: { NODE_ENV: "production" } * }); * * @example * // Run a memoized command that only re-executes when the command changes * const memoizedCmd = await Exec("status-check", { * command: "git status", * memoize: true * }); * * // This won't actually run the command again if nothing has changed * await Exec("status-check", { * command: "git status", * memoize: true * }); */ export declare const Exec: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context, id: string, props: ExecProps) => Promise); //# sourceMappingURL=exec.d.ts.map