import { type PMOContext } from './pmo-context.js';
import { PromptCommand } from '../prompt-command.js';
import { type JsonFlags } from '../prompt-json.js';
/**
 * Base flags for JSON/agent mode support
 * Include these in your command's flags by spreading: ...jsonModeFlags
 * @deprecated Use machineOutputFlags instead
 */
export declare const jsonModeFlags: {
    json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
    machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
};
/**
 * Base flags for machine-readable output mode
 * Include these in your command's flags by spreading: ...machineOutputFlags
 * --json and --machine/-m both trigger JSON output mode
 */
export declare const machineOutputFlags: {
    json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
    machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
};
/**
 * Base flags shared by all PMO commands
 * Include these in your command's flags by spreading: ...pmoBaseFlags
 */
export declare const pmoBaseFlags: {
    json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
    machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
    project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
};
/**
 * Base command class for PMO commands
 *
 * Provides automatic PMO context initialization and cleanup:
 * - Initializes storage before run() executes
 * - Ensures storage.close() is called even if errors occur
 * - Provides common PMO flags (--project)
 *
 * Storage is project-agnostic - projectId is passed explicitly to operations.
 *
 * Usage:
 * ```typescript
 * import { PMOCommand, pmoBaseFlags } from '../../lib/pmo/base-command.js';
 *
 * export default class MyCommand extends PMOCommand {
 *   static flags = {
 *     ...pmoBaseFlags,
 *     // additional flags...
 *   };
 *
 *   async execute(): Promise<void> {
 *     // For project-agnostic operations (e.g., get ticket by ID):
 *     const ticket = await this.storage.getTicketById('TKT-123');
 *
 *     // For project-scoped operations, get projectId first:
 *     const projectId = await this.requireProject();
 *     const board = await this.storage.getBoard(projectId);
 *
 *     // Or derive from an entity:
 *     const projectId = ticket.projectId;
 *     await this.storage.moveTicket(projectId, ticket.id, 'Done');
 *   }
 * }
 * ```
 */
export declare abstract class PMOCommand extends PromptCommand {
    /**
     * PMO context with storage, pmoPath, etc.
     * Available after init() runs (before execute())
     */
    protected pmoContext: PMOContext;
    /**
     * Flag to track if context was successfully initialized
     */
    private contextInitialized;
    /**
     * Cached project ID from -P flag
     */
    private projectFlag?;
    /**
     * Logger function for PMO context
     * Can be overridden to customize logging behavior
     */
    protected pmoLogger(msg: string): void;
    /**
     * oclif init hook - runs before the command executes
     * Initializes PMO context with storage access
     */
    init(): Promise<void>;
    /**
     * Require a project to be selected.
     * Returns projectId that should be passed to storage operations.
     *
     * Priority:
     * 1. If -P flag was provided, uses that
     * 2. If only one project exists, uses that
     * 3. If multiple projects exist, prompts user to select one (or outputs JSON if jsonMode)
     *
     * @param options.filterEmptyProjects - Only show projects with tickets
     * @param options.jsonMode - JSON mode configuration for AI agents
     * @returns The selected project ID - pass this to storage operations
     */
    protected requireProject(options?: {
        filterEmptyProjects?: boolean;
        jsonMode?: {
            flags: JsonFlags & Record<string, unknown>;
            commandName: string;
            baseCommand: string;
        };
    }): Promise<string>;
    /**
     * Get project name by ID
     */
    protected getProjectName(projectId: string): Promise<string>;
    /**
     * Select from a list of items with JSON mode support for AI agents.
     *
     * In JSON mode: outputs choices as JSON with command field and exits
     * In interactive mode: shows prompt and returns selected value
     *
     * @param options Configuration for the selection
     * @returns The selected value (only in interactive mode)
     *
     * @example
     * ```typescript
     * const ticketId = await this.selectFromList({
     *   message: 'Select ticket:',
     *   items: tickets,
     *   getName: (t) => `${t.id}: ${t.title}`,
     *   getValue: (t) => t.id,
     *   getCommand: (t) => `prlt ticket view ${t.id} --json`,
     *   jsonMode: { flags, commandName: 'ticket view' },
     * });
     * ```
     */
    protected selectFromList<T>(options: {
        /** Prompt message shown to user */
        message: string;
        /** Items to select from */
        items: T[];
        /** Extract display name from item */
        getName: (item: T) => string;
        /** Extract value from item */
        getValue: (item: T) => string;
        /** Build command string for item (should include --json) */
        getCommand: (item: T) => string;
        /** JSON mode config - if provided and flags indicate JSON mode, outputs JSON */
        jsonMode?: {
            flags: JsonFlags & Record<string, unknown>;
            commandName: string;
        } | null;
        /** Optional: include a Cancel option */
        allowCancel?: boolean;
        /** Optional: custom cancel value (default: null returned) */
        cancelValue?: string;
    }): Promise<string | null>;
    /**
     * Prompt for input with JSON mode support for AI agents.
     *
     * In JSON mode: outputs field info as JSON and exits
     * In interactive mode: shows prompt and returns input value
     *
     * @param options Configuration for the input
     * @returns The input value (only in interactive mode)
     */
    protected promptForInput(options: {
        /** Prompt message shown to user */
        message: string;
        /** Field name for the prompt */
        fieldName: string;
        /** Default value */
        defaultValue?: string;
        /** Validation function */
        validate?: (input: string) => boolean | string;
        /** JSON mode config */
        jsonMode?: {
            flags: JsonFlags & Record<string, unknown>;
            commandName: string;
            /** Hint for how to provide this value */
            commandHint: string;
            /** Example command */
            example?: string;
        } | null;
    }): Promise<string>;
    /**
     * Unified error handler for JSON/interactive modes.
     *
     * Consolidates error handling to avoid message drift between JSON and interactive modes.
     * In JSON mode: outputs structured error JSON and exits
     * In interactive mode: calls this.error() with the message
     *
     * @param code - Error code for JSON output (e.g., 'NOT_FOUND', 'DOCKER_NOT_RUNNING')
     * @param message - Human-readable error message (used in both modes)
     * @param options - Configuration for error handling
     *
     * @example
     * ```typescript
     * // Instead of duplicating messages:
     * // if (jsonMode) { outputErrorAsJson('CODE', 'msg', ...); }
     * // this.error('msg');
     *
     * // Use:
     * this.handleError('DOCKER_NOT_RUNNING', 'Docker is not running.', {
     *   jsonMode,
     *   commandName: 'agent auth',
     *   flags,
     * });
     * ```
     */
    protected handleError(code: string, message: string, options: {
        jsonMode: boolean;
        commandName: string;
        flags: Record<string, unknown>;
    }): never;
    /**
     * Override run() to delegate to execute() and ensure cleanup
     * Subclasses should implement execute() instead of run()
     */
    run(): Promise<void>;
    /**
     * Main command logic - implement this instead of run()
     * PMO context is available via this.pmoContext
     */
    protected abstract execute(): Promise<void>;
    /**
     * Cleanup handler - ensures storage is closed
     * Called automatically after execute() completes or throws
     */
    protected cleanup(): Promise<void>;
    /**
     * oclif catch hook - called when an error occurs
     * Ensures cleanup even on errors
     */
    catch(error: Error & {
        exitCode?: number;
    }): Promise<void>;
    /**
     * oclif finally hook - called after run() completes
     */
    finally(_: Error | undefined): Promise<void>;
    /** Storage instance */
    protected get storage(): import("./storage-sqlite.js").SQLiteStorage;
    /** PMO directory path */
    protected get pmoPath(): string;
}
