/** * Executor interfaces for running CLI commands in different environments */ import { Readable } from 'stream'; /** * Options for executing a command */ export interface ExecuteOptions { /** Working directory */ cwd?: string; /** Environment variables */ env?: Record; /** Timeout in milliseconds */ timeout?: number; /** Maximum buffer size for stdout/stderr */ maxBuffer?: number; /** Encoding for output (default: utf8) */ encoding?: BufferEncoding; /** Whether to capture stderr separately */ captureStderr?: boolean; /** Shell to use for execution */ shell?: boolean | string; } /** * Result from executing a command */ export interface ExecuteResult { /** Standard output */ stdout: string; /** Standard error */ stderr: string; /** Exit code (0 = success) */ exitCode: number; /** Execution duration in milliseconds */ duration: number; /** Whether the process was killed due to timeout */ timedOut?: boolean; /** Error if execution failed */ error?: Error; /** The command that was executed */ command?: string; /** The arguments that were passed */ args?: string[]; } /** * Options for streaming command output */ export interface StreamOptions extends ExecuteOptions { /** Callback for stdout chunks */ onStdout?: (chunk: string) => void; /** Callback for stderr chunks */ onStderr?: (chunk: string) => void; } /** * Stream result with readable streams */ export interface StreamResult { /** Stdout stream */ stdout: Readable; /** Stderr stream */ stderr: Readable; /** Promise that resolves when process exits */ exitPromise: Promise; /** Function to kill the process */ kill: () => void; } /** * Base interface for command executors */ export interface Executor { /** Type identifier for this executor */ readonly type: 'node' | 'electron' | 'mock'; /** * Execute a command and wait for completion */ execute(command: string, args?: string[], options?: ExecuteOptions): Promise; /** * Execute a command and stream output */ stream(command: string, args?: string[], options?: StreamOptions): StreamResult; /** * Check if a command is available */ isAvailable(command: string): Promise; /** * Kill a running process by ID */ kill?(processId: number | string): Promise; } /** * Environment detection result */ export interface Environment { /** Whether running in Node.js */ isNode: boolean; /** Whether running in Electron main process */ isElectron: boolean; /** Whether running in browser */ isBrowser: boolean; /** Platform (darwin, win32, linux, etc.) */ platform: NodeJS.Platform; /** Node.js version */ nodeVersion?: string; /** Electron version */ electronVersion?: string; } //# sourceMappingURL=executors.d.ts.map