import { type Config } from '../../../config/schema.js'; import { type SetupAction, type SetupError, type SetupTask, type SetupRunOptions } from './types.js'; /** Thrown by a {@link SetupMutator.mutate} to fail the run with a clean message. */ export declare class SetupValidationError extends Error { readonly errors: SetupError[]; constructor(errors: SetupError[] | SetupError | string); } export interface SetupMutator { /** Logical domain — `providers`, `channels.`, etc. */ domain: string; /** Target id within the domain (provider id, account id, …). */ target?: string; /** What the operation is conceptually doing. */ action: SetupAction; /** Mutates `config` in place (or returns a replacement) and returns it. */ mutate(config: Config): Config | Promise; /** Optional masked value to surface in the task (for agents / UI). */ resultValue?(config: Config): unknown; /** Optional human-readable notes appended to the task. */ notes?(config: Config): string[]; } export interface RunSetupArgs { configPath: string; mutator: SetupMutator; options: SetupRunOptions; } /** * Headless setup pipeline — load → clone → mutate → validate(zod) → diff → * (write | dry-run) → task. Returns the {@link SetupTask} without any * I/O side effects (no stdout, no `process.exitCode`). * * Used by CLI setup commands via {@link runSetup}. Keep this side-effect-free * so it stays safe to call from tests and other programmatic callers. * * Custom errors thrown by the mutator surface as `errors[]` on the task: * - `SetupValidationError` — explicit `{path?, message}[]` entries * - `ExitPromptError` (from `@inquirer/prompts`) — surfaced as "Cancelled by user" * - any other `Error` — the message is used verbatim */ export declare function runSetupHeadless(args: RunSetupArgs): Promise; /** * CLI wrapper around {@link runSetupHeadless}: emits the task to stdout * (text or single-line JSON) and sets `process.exitCode` to the standard * setup exit codes (0 ok / 1 error / 2 cancelled). * * Use this from CLI command actions; use {@link runSetupHeadless} from any * non-CLI caller (HTTP routes, library code, tests). */ export declare function runSetup(args: RunSetupArgs): Promise;