/**
 * Machine-readable output helper for interactive prompts
 *
 * Provides utilities for outputting prompt configurations as JSON
 * instead of rendering interactive UI, enabling AI agents and scripts
 * to interact with the CLI programmatically.
 *
 * Design notes:
 * - Stateless functions for easy unit testing
 * - Designed for future extraction as standalone npm package
 * - Supports both explicit --json flag and automatic non-TTY detection
 *
 * Exit code conventions:
 * - EXIT_SUCCESS (0): Command completed successfully
 * - EXIT_ERROR (1): Command failed with an error
 * - EXIT_NEEDS_INPUT (2): Command needs additional input (prompt required)
 */
/**
 * Exit code for successful command completion
 */
export declare const EXIT_SUCCESS = 0;
/**
 * Exit code for command failure/error
 */
export declare const EXIT_ERROR = 1;
/**
 * Exit code when command needs additional input (prompt required)
 * Use this exit code when outputting a prompt in JSON mode to signal
 * to scripts/agents that the command didn't fail, but needs more input.
 */
export declare const EXIT_NEEDS_INPUT = 2;
/**
 * Choice item for list/checkbox prompts
 */
export interface PromptChoice {
    /** Display text shown to user */
    name: string;
    /** Actual value returned when selected */
    value: string;
    /** Optional: indicates if choice is disabled */
    disabled?: boolean;
    /** Optional: full CLI command to run for this choice (for AI agents) */
    command?: string;
}
/**
 * Form field configuration for multi-field prompts
 */
export interface FormField {
    /** Type of field: input, list, checkbox, confirm, editor */
    type: 'input' | 'list' | 'checkbox' | 'confirm' | 'editor';
    /** Field name */
    name: string;
    /** User-facing message */
    message: string;
    /** Available choices (for list/checkbox types) */
    choices?: PromptChoice[];
    /** Default value if applicable */
    default?: string | boolean | string[];
}
/**
 * Prompt configuration for JSON output
 */
export interface PromptConfig {
    /** Type of prompt: list (single select), checkbox (multi select), confirm, input, editor, or form (multi-field) */
    type: 'list' | 'checkbox' | 'confirm' | 'input' | 'editor' | 'form';
    /** Field name for the prompt answer (not used for form type) */
    name?: string;
    /** User-facing prompt message (not used for form type) */
    message?: string;
    /** Available choices (for list/checkbox types) */
    choices?: PromptChoice[];
    /** Default value if applicable */
    default?: string | boolean | string[];
    /** Fields for form type prompts */
    fields?: FormField[];
    /** Optional context data for complex prompts */
    context?: Record<string, unknown>;
}
/**
 * Metadata included with all JSON outputs
 */
export interface OutputMetadata {
    /** Command that was invoked (e.g., "work spawn") */
    command: string;
    /** Flags that were passed to the command */
    flags: Record<string, unknown>;
    /** Timestamp of the output */
    timestamp?: string;
}
/**
 * JSON output when a prompt would be shown
 */
export interface PromptJsonOutput {
    /** Prompt configuration, or null if no prompt needed */
    prompt: PromptConfig | null;
    /** Command metadata */
    metadata: OutputMetadata;
}
/**
 * JSON output for successful command execution (no prompt needed)
 */
export interface SuccessJsonOutput {
    /** Always null when success output */
    prompt: null;
    /** Indicates successful execution */
    success: true;
    /** Command-specific result data */
    result: Record<string, unknown>;
    /** Command metadata */
    metadata: OutputMetadata;
}
/**
 * JSON output for error conditions
 */
export interface ErrorJsonOutput {
    /** Error details */
    error: {
        /** Machine-readable error code (e.g., "NO_TICKETS_AVAILABLE") */
        code: string;
        /** Human-readable error message */
        message: string;
    };
    /** Command metadata */
    metadata: OutputMetadata;
}
/**
 * Union type for all JSON output types
 */
export type JsonOutput = PromptJsonOutput | SuccessJsonOutput | ErrorJsonOutput;
/**
 * Flags interface for shouldOutputJson
 */
export interface JsonFlags {
    json?: boolean;
}
/**
 * Check if the current environment is non-TTY (piped output)
 *
 * @returns true if stdout is not a TTY (e.g., piped to another process)
 */
export declare function isNonTTY(): boolean;
/**
 * Determine if JSON output should be used
 *
 * Returns true if:
 * - The --json flag is explicitly set
 * - The environment is non-TTY (piped output)
 *
 * @param flags - Command flags object
 * @returns true if JSON output should be used
 */
export declare function shouldOutputJson(flags: JsonFlags): boolean;
/**
 * Create metadata object for JSON output
 *
 * @param command - Command name (e.g., "work spawn")
 * @param flags - Flags passed to the command
 * @returns Metadata object
 */
export declare function createMetadata(command: string, flags: Record<string, unknown>): OutputMetadata;
/**
 * Output a prompt configuration as JSON and exit
 *
 * Use this when a command would normally show an interactive prompt.
 * Outputs the prompt config so agents can understand what input is needed,
 * then exits with EXIT_NEEDS_INPUT (2) to signal the command needs more input.
 *
 * @param config - Prompt configuration
 * @param metadata - Command metadata
 */
export declare function outputPromptAsJson(config: PromptConfig, metadata: OutputMetadata): never;
/**
 * Output success result as JSON
 *
 * Use this when all required data was provided via flags
 * and no prompt is needed.
 *
 * @param result - Command-specific result data
 * @param metadata - Command metadata
 */
export declare function outputSuccessAsJson(result: Record<string, unknown>, metadata: OutputMetadata): void;
/**
 * Output error as JSON and exit
 *
 * Use this when an error occurs and --json flag is active.
 * Provides structured error output for programmatic handling,
 * then exits with EXIT_ERROR (1).
 *
 * @param code - Machine-readable error code (e.g., "NO_TICKETS_AVAILABLE")
 * @param message - Human-readable error message
 * @param metadata - Command metadata
 */
export declare function outputErrorAsJson(code: string, message: string, metadata: OutputMetadata): never;
/**
 * Convert inquirer choices to PromptChoice format
 *
 * Handles both simple string choices and object choices,
 * filtering out Separator instances.
 *
 * @param choices - Inquirer choices array
 * @returns Array of PromptChoice objects
 */
export declare function normalizeChoices(choices: Array<string | {
    name: string;
    value: string;
    disabled?: boolean | string;
    command?: string;
} | unknown>): PromptChoice[];
/**
 * Build a prompt config object from inquirer prompt options
 *
 * @param type - Prompt type
 * @param name - Field name
 * @param message - User-facing message
 * @param choices - Optional choices array
 * @param defaultValue - Optional default value
 * @returns PromptConfig object
 */
export declare function buildPromptConfig(type: 'list' | 'checkbox' | 'confirm' | 'input' | 'editor', name: string, message: string, choices?: Array<string | {
    name: string;
    value: string;
    disabled?: boolean | string;
    command?: string;
} | unknown>, defaultValue?: string | boolean | string[]): PromptConfig;
/**
 * Build a form prompt config with multiple fields
 *
 * @param fields - Array of form field configurations
 * @returns PromptConfig object with type 'form'
 */
export declare function buildFormPromptConfig(fields: FormField[]): PromptConfig;
