/** * PlatformIO CLI Executor * Wraps the PlatformIO CLI commands and provides robust typed execution. * * Provides: * - execPioCommand: Executes a raw PlatformIO CLI command. * - parsePioJsonOutput: Parses and validates command output via Zod. * - checkPlatformIOInstalled: Checks if PIO is locally available. * - getPlatformIOVersion: Retrieves PIO version. * - PlatformIOExecutor: Class encapsulating PIO CLI operations. * - platformioExecutor: Global instance of PlatformIOExecutor. * - DEFAULT_TIMEOUT: Standard timeout configuration for PIO commands. */ import { ChildProcess } from "node:child_process"; import { z } from "zod"; import type { CommandResult } from "./types.js"; /** * Executes a PlatformIO CLI command. * * @param args - CLI arguments to pass to the PlatformIO binary. * @param options - Execution configuration options (timeout, cwd, onOutput callback). * @returns Result containing standard outputs and exit code. */ export declare function execPioCommand(args: string[], options?: { cwd?: string; timeout?: number; parseJson?: boolean; onOutput?: (chunk: string) => void; }): Promise; /** * Parses JSON output from PlatformIO and validates with Zod schema. * * @param output - Raw JSON string from CLI stdout. * @param schema - Zod schema to validate against for type safety. * @returns The strongly typed validated object payload. */ export declare function parsePioJsonOutput(output: string, schema: z.ZodSchema): T; /** * Checks if PlatformIO CLI is installed and accessible. * * @returns True if PlatformIO is available in the environment path; false otherwise. */ export declare function checkPlatformIOInstalled(): Promise; /** * Gets the PlatformIO version. * * @returns The semantic version string of the local PlatformIO installation. */ export declare function getPlatformIOVersion(): Promise; /** * Class that encapsulates PlatformIO CLI operations */ export declare class PlatformIOExecutor { constructor(); /** * Executes a PlatformIO command. * * @param command - The PIO subcommand string. * @param args - Arguments array for the command. * @param options - Execution directives for the child process. * @returns Structured runtime output results. */ execute(command: string, args: string[], options?: { cwd?: string; timeout?: number; onOutput?: (c: string) => void; }): Promise; /** * Checks if PlatformIO is installed. * * @returns A boolean resolving true if PlatformIO is ready. */ checkInstallation(): Promise; /** * Gets PlatformIO version. * * @returns The resolved PIO version. */ getVersion(): Promise; /** * Executes a command and parses JSON output. * * @param command - Core PlatformIO subcommand logic. * @param args - Configuration and CLI flag values. * @param schema - Schema for JSON output validation. * @param options - Operational execution directives. * @returns Parsed and validated JSON node entity. */ executeWithJsonOutput(command: string, args: string[], schema: z.ZodSchema, options?: { cwd?: string; timeout?: number; onOutput?: (c: string) => void; }): Promise; /** * Spawns a long-running PlatformIO command (e.g., monitor). * Implements the same binary resolution logic as 'execute'. * * @param command - The PIO subcommand. * @param args - Arguments array for the PlatformIO CLI. * @param options - Execution options including working directory, environment overrides, and fake TTY bridging. * @returns The spawned ChildProcess instance. */ spawn(command: string, args: string[], options?: { cwd?: string; env?: NodeJS.ProcessEnv; useFakeTty?: boolean; detached?: boolean; stdio?: any; }): Promise; } /** * Global instance of PlatformIOExecutor for project-wide use. */ export declare const platformioExecutor: PlatformIOExecutor; //# sourceMappingURL=platformio.d.ts.map