/** * Shared JSON output utilities for CLI commands * * Provides consistent structured output for agent consumption. * All commands use the same envelope format. * * @module cli/shared/json-output */ export declare function setJsonMode(enabled: boolean): void; export declare function isJsonMode(): boolean; export declare function setOutputPath(path: string | null): void; export declare function getOutputPath(): string | null; export interface SuccessEnvelope { success: true; command: string; data: T; timing?: { duration_ms: number; }; } export interface ErrorEnvelope { success: false; command: string; error: { code: string; /** Stable classification consumers have keyed on since the first JSON release. */ slug: string; /** Additive: the error registry slug, for consumers that need finer classification. */ registrySlug?: string; message: string; context?: Record; }; } export type JsonEnvelope = SuccessEnvelope | ErrorEnvelope; export interface StreamErrorDetails { code: string; slug: string; message: string; } export type StreamErrorResult = Record & { type: "result"; success: false; /** Legacy field kept as a string for existing NDJSON consumers. */ error: string; /** Additive structured metadata for consumers that need stable error classification. */ errorDetails: StreamErrorDetails; }; export declare function createStreamErrorResult(error: StreamErrorDetails): StreamErrorResult; export declare function createSuccessEnvelope(command: string, data: T, timing?: { duration_ms: number; }): SuccessEnvelope; export declare function createErrorEnvelope(command: string, error: ErrorEnvelope["error"]): ErrorEnvelope; export declare function formatJsonOutput(envelope: JsonEnvelope): string; /** * Print JSON envelope to stdout. * If --output was specified, also write to file. */ export declare function outputJson(envelope: JsonEnvelope): Promise; /** * Write a single NDJSON line to stdout. * Used for streaming output from long-running commands. */ export declare function streamJsonLine(event: Record): void; /** * Pretty-print any value as indented JSON to stdout. */ export declare function printJson(value: unknown): void; //# sourceMappingURL=json-output.d.ts.map