import type { Interfaces } from '@oclif/core';
import { Command } from '@oclif/core';
import { type ReadBlueprintResult } from './actions/blueprints/blueprint.js';
import { type LocatedBlueprintsConfig } from './actions/blueprints/config.js';
import type { CoreResult } from './cores/index.js';
import type { AuthParams, ScopeType, Stack, Warning } from './utils/types.js';
export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof RuntimeCommand)['baseFlags'] & T['flags']>;
export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
export declare const pathFlagConfig: {
    description: string;
    env: string;
    aliases: string[];
    char: 'p';
};
export declare const baseFlags: {
    json: Interfaces.BooleanFlag<boolean>;
    path: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
    trace: Interfaces.BooleanFlag<boolean>;
    'validate-resources': Interfaces.BooleanFlag<boolean>;
    verbose: Interfaces.BooleanFlag<boolean>;
};
export declare const stackFlagConfig: {
    description: string;
};
export declare const projectIdFlagConfig: {
    description: string;
    aliases: string[];
    exclusive: string[];
};
export declare const organizationIdFlagConfig: {
    description: string;
    aliases: string[];
    exclusive: string[];
};
/**
 * Guarantees flags and args.
 * Also centralizes baseFlags and enables oclif's built-in --json for all subclasses.
 * @extends Command
 */
export declare abstract class RuntimeCommand<T extends typeof Command> extends Command {
    protected flags: Flags<T>;
    protected args: Args<T>;
    static baseFlags: {
        json: Interfaces.BooleanFlag<boolean>;
        path: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
        trace: Interfaces.BooleanFlag<boolean>;
        'validate-resources': Interfaces.BooleanFlag<boolean>;
        verbose: Interfaces.BooleanFlag<boolean>;
    };
    static enableJsonFlag: boolean;
    /**
     * Generates help text for this command class
     * @param bin - The bin name to use for the help text; e.g. 'sanity', defaults to 'sanity-run'
     * @param commandId - The sub-command to use for the help text; optional but recommended for better help text
     * @returns The oclif-styled help text for the command
     * @example const helpText = InfoCommand.getHelpText('sanity', 'blueprints info')
     */
    static getHelpText(bin?: string, commandId?: string): string;
    init(): Promise<void>;
    /**
     * Throws an oclif error from a failed CoreResult.
     * forwarding suggestions, ref, or code to oclif's PrettyPrintableError rendering.
     */
    protected coreError(result: CoreResult & {
        success: false;
    }): never;
    /**
     * Renders any actionable items the user can take that don't warrant throwing an error.
     */
    protected renderWarnings(warnings: Warning[]): void;
    /**
     * If an error doesn't have suggestions, match against known patterns to
     * attach relevant suggestions before oclif renders the error.
     *
     * Add patterns to `CATCH_HINT_PATTERNS` as needed.
     */
    protected catch(err: Error & {
        exitCode?: number;
    }): Promise<unknown>;
}
/**
 * Context a command can declare it needs.
 * The base class resolves each from the best available source during init().
 * Dependencies are resolved implicitly -- declaring 'deployedStack' implies
 * token, scope, and stackId without listing them.
 *
 * - token:         Authenticated API token
 * - blueprint:     Parsed local blueprint file (filesystem)
 * - scope:         scopeType + scopeId (from flags, env, config file, or blueprint)
 * - stackId:       stackId (from flags, env, config file, blueprint, or inferred)
 * - deployedStack: Remote Stack object fetched from the API (implies token, scope, stackId)
 */
export type Need = 'token' | 'blueprint' | 'scope' | 'stackId' | 'deployedStack';
/**
 * Base command that resolves context declaratively from a `static needs` array.
 * Commands declare what they *directly use*; the base class resolves transitive
 * dependencies automatically (e.g. 'deployedStack' implies token, scope, stackId).
 *
 * When a command needs only remote context (e.g. `['deployedStack']`),
 * no local blueprint file is required -- flags and config are sufficient.
 *
 * @example
 * ```ts
 * class InfoCommand extends ResolvedCommand<typeof InfoCommand> {
 *   static needs = ['deployedStack'] as const
 *   // token, scope, stackId resolved automatically
 * }
 * ```
 *
 * @extends RuntimeCommand
 */
export declare abstract class ResolvedCommand<T extends typeof Command> extends RuntimeCommand<T> {
    static needs: readonly Need[];
    static baseFlags: {
        json: Interfaces.BooleanFlag<boolean>;
        path: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
        trace: Interfaces.BooleanFlag<boolean>;
        'validate-resources': Interfaces.BooleanFlag<boolean>;
        verbose: Interfaces.BooleanFlag<boolean>;
        stack: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
        'project-id': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
        'organization-id': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
    };
    protected sanityToken: string;
    protected blueprint: ReadBlueprintResult;
    protected scopeType: ScopeType;
    protected scopeId: string;
    protected stackId: string;
    /**
     * locally-resolved Stack ID (flags > env > module > config)
     * populated regardless of `needs` and is never required
     */
    protected resolvedStackId?: string;
    /**
     * locally-resolved scope (flags > env > module > config)
     * populated regardless of `needs` and is never required
     */
    protected resolvedScopeType?: ScopeType;
    protected resolvedScopeId?: string;
    /**
     * the located `.sanity/blueprint.config.json` (if any), populated regardless of
     * `needs`. Lets commands read/update local config without requiring a manifest.
     */
    protected blueprintConfig?: LocatedBlueprintsConfig | null;
    protected auth: AuthParams;
    protected deployedStack: Stack;
    /** Runs after flag parsing and before declared command context is resolved. */
    protected preResolve(): Promise<void>;
    init(): Promise<void>;
}
