/** * exec() resource — run arbitrary commands on target hosts. * * This is the foundational resource that other resources build upon. * `check()` is read-only during the normal check phase and does not execute * user commands unless explicitly opted into unsafe check guards. * `apply()` executes the command via SSH and may evaluate apply-time preconditions. */ import type { ExecutionContext, ResourceCallMeta, ResourceDefinition, ResourceSchema } from "../core/types.ts"; /** Input options for the exec resource. */ export type ExecInput = { /** The command to execute. */ command: string; /** Run the command with sudo. */ sudo?: boolean | undefined; /** Working directory for command execution. */ cwd?: string | undefined; /** Environment variables to set. */ env?: Record | undefined; /** If false, non-zero exit codes are not treated as failures. Default: true. */ check?: boolean | undefined; /** Skip apply if this precondition command exits 0. Evaluated during apply(), not check(). */ unless?: string | undefined; /** Only apply if this precondition command exits 0. Evaluated during apply(), not check(). */ onlyIf?: string | undefined; /** Unsafe escape hatch: skip apply if this command exits 0 during check(), including --check. */ unsafeCheckUnless?: string | undefined; /** Unsafe escape hatch: only apply if this command exits 0 during check(), including --check. */ unsafeCheckOnlyIf?: string | undefined; }; /** Output of a successful exec resource. */ export type ExecOutput = { exitCode: number; stdout: string; stderr: string; }; /** Schema for the exec resource. */ export declare const execSchema: ResourceSchema; /** ResourceDefinition for exec. */ export declare const execDefinition: ResourceDefinition; /** * Create a bound `exec()` function for a given execution context. * * Usage in recipes: * ```ts * const exec = createExec(ctx) * await exec({ command: 'apt-get update', sudo: true }) * ``` */ export declare function createExec(ctx: ExecutionContext): (input: ExecInput, meta?: ResourceCallMeta) => Promise>; //# sourceMappingURL=exec.d.ts.map