import type { DiffEntry } from '../rest/projects.js'; export type CommandClassification = { readOnly: boolean; destructive: boolean; idempotent: boolean; }; /** * The subset of oclif's parse metadata we rely on: which flags were filled in from * `default:` rather than typed by the user. Pass `metadata.flags` from `this.parse()`. */ export type FlagMetadata = Record; /** * A deploy plan in machine-readable form, next to the human-readable `changes` * lines that describe the same thing. Only `deploy` sets it. * * `planToken` is the plan's fingerprint: the `confirmCommand` passes it back so * the confirming run applies the plan that was shown here and refuses if * Checkly moved in between. */ export type CommandPlanPreview = { planToken: string; diff: DiffEntry[]; }; /** * What an interactive terminal shows instead of the flat `changes` list: a * rendered plan (an overview of every resource the command touches, with a * diff per updated one) followed by the lines that still need saying — the * options the command runs with, which no overview row carries. * * `plan` is rendered on demand because only the interactive branch prints it; * a forced, dry-run or agent run never pays for the rendering, and an error * in it cannot break an unattended run. */ export type CommandTerminalPreview = { plan: () => string; changes: string[]; /** * Things the user can choose to do instead of applying the command, offered * as further choices of the prompt. Choosing one runs it and ends the * command without applying anything. */ alternatives?: CommandAlternative[]; }; export type CommandAlternative = { /** The choice as the prompt lists it. */ title: string; run: () => Promise; }; export type CommandPreview = { command: string; description: string; changes: string[]; flags: Record; flagMetadata?: FlagMetadata; args?: Record; classification: CommandClassification; preview?: CommandPlanPreview; terminal?: CommandTerminalPreview; /** The yes/no question an interactive terminal asks. `Proceed?` when left out. */ question?: string; }; export type AgentPreviewResponse = { status: 'confirmation_required' | 'dry_run'; command: string; description: string; classification: CommandClassification; changes: string[]; confirmCommand: string; /** Present for commands that compute a structured plan; `deploy` does. */ preview?: CommandPlanPreview; }; export declare function buildConfirmCommand(command: string, flags: Record, args?: Record, flagMetadata?: FlagMetadata): string; export declare function formatPreviewForAgent(preview: CommandPreview, status: 'confirmation_required' | 'dry_run'): AgentPreviewResponse; export declare function formatPreviewForTerminal(preview: CommandPreview): string;