import { ImportPlan } from '../rest/projects.js'; import { BaseCommand } from '../commands/baseCommand.js'; export declare class PlanSelectionError extends Error { constructor(message: string, options?: ErrorOptions); } export interface PlanFlags { all?: boolean; planId?: string; } /** * Rejects contradictory flag combinations before any plans are fetched, so that * an impossible command line fails identically whether or not plans happen to * exist remotely. */ export declare function validatePlanFlagsOrExit(command: BaseCommand, flags: PlanFlags): void; /** * Reports the "no candidate plans" case, returning `true` when the caller should * stop. * * An explicit `--plan-id` that cannot be satisfied is a failure and exits 1, so * that agents and CI observe it. Having nothing to do when no specific plan was * requested is not a failure: it exits 0 and reads as information rather than an * error. */ export declare function reportNoCandidatePlans(command: BaseCommand, plans: ImportPlan[], options: { planId?: string; action: string; nothingToDo: string; }): boolean; /** * Resolves a single import plan without prompting when possible, so that agents * and CI can drive the import commands headlessly: * * - When `planId` is given, the matching plan is selected (works in any mode). * - Otherwise, in a non-interactive (agent/CI) session, a single candidate plan * is auto-selected; multiple candidates require an explicit `--plan-id`. * * Returns `undefined` when the caller should fall back to interactive selection, * i.e. an interactive session with no `--plan-id`. This keeps the existing * interactive behavior untouched. * * @throws {PlanSelectionError} when the requested plan id does not exist, or * when selection is ambiguous in a non-interactive session. */ export declare function resolvePlanNonInteractively(plans: ImportPlan[], planId: string | undefined, action: string): ImportPlan | undefined; /** * Resolves a single import plan for a command, falling back to interactive * selection when appropriate. On an unrecoverable {@link PlanSelectionError} * (unknown `--plan-id`, or an ambiguous non-interactive selection) it reports * the error and exits with a non-zero code so agents/CI observe the failure. */ export declare function selectPlanOrExit(command: BaseCommand, plans: ImportPlan[], planId: string | undefined, action: string, interactiveFallback: () => Promise): Promise; /** * Resolves one or more import plans for a bulk command (e.g. `import cancel`), * falling back to interactive multi-selection when appropriate. * * - `--all` selects every candidate plan without prompting. * - `--all` and `--plan-id` are mutually exclusive. Commands are expected to * reject the combination up front via {@link validatePlanFlagsOrExit}; the * check is repeated here so the helper is safe to call on its own. * - Otherwise a single plan is resolved via {@link resolvePlanNonInteractively}, * falling back to interactive selection when it returns `undefined`. * * On an unrecoverable {@link PlanSelectionError} it reports the error and exits * with a non-zero code so agents/CI observe the failure. */ export declare function selectPlansOrExit(command: BaseCommand, plans: ImportPlan[], { all, planId }: { all: boolean; planId: string | undefined; }, action: string, interactiveFallback: () => Promise): Promise;