import type { Config } from '../config/schema.js';
import type { ErrorCategory } from '../lib/logger.js';
import type { ScanPRStatus as PRStatus, ScanResult } from '../lib/pr-status.js';
export interface KickassOpts {
    force?: boolean;
    staleAfter?: string;
    dryRun?: boolean;
    roundMode?: 'crazy' | 'halfcrazy';
    timeout?: string;
    concurrent?: number;
    staggerMs?: number;
}
export type KickassAction = 'review' | 'fix' | 'recheck' | 'skip';
export type KickassSkipReason = 'fork_pr' | 'stale_signature';
export type KickassFailureReason = ErrorCategory;
export type FixDeliveryMode = Config['post_review']['auto_fix']['delivery']['mode'];
export interface PreflightItem {
    pr: PRStatus;
    action: KickassAction;
    transition: string;
    details: string[];
    explanation?: string;
    skipReason?: KickassSkipReason;
    chainRecheck?: boolean;
}
export interface KickassExecutionResult {
    pr: PRStatus;
    status: 'executed' | 'skipped' | 'failed';
    reason?: KickassSkipReason | KickassFailureReason;
}
export interface ExecuteKickassDeps {
    getCurrentHeadSha: (item: PreflightItem) => Promise<string>;
    dispatchRun: (item: PreflightItem, timeoutMs?: number) => Promise<string | void>;
    /** Route status messages through a custom sink (e.g. PRBoard scrollback). Defaults to console.log. */
    log?: (msg: string) => void;
    /** Called just before dispatchRun — use to add a board slot. */
    onDispatchStart?: (item: PreflightItem, key: string, startedAt: number) => void;
    /** Called after a successful dispatchRun — use to complete a board slot. verdict is parsed from subprocess output when available. */
    onDispatchEnd?: (item: PreflightItem, key: string, startedAt: number, verdict?: string | null) => void;
    /** Called when dispatchRun throws — use to mark a board slot as failed. */
    onDispatchFail?: (item: PreflightItem, key: string, error: unknown) => void;
    /**
     * Called when timeout failures hit the pump threshold (3). Return new timeout in ms to apply,
     * or null to skip. Omit to disable interactive pumping (e.g. in tests or CI).
     */
    onTimeoutPump?: (currentMs: number | undefined, failures: number) => Promise<number | null>;
}
export interface KickassDeps {
    loadScanResult: (options: {
        force?: boolean;
        staleAfterMs: number;
    }) => Promise<ScanResult>;
    pickPRs: (prs: PRStatus[]) => Promise<PRStatus[]>;
    confirm: (message: string) => Promise<boolean>;
    getFixDeliveryMode?: () => FixDeliveryMode | Promise<FixDeliveryMode>;
    getCurrentHeadSha: (item: PreflightItem) => Promise<string>;
    onBeforeExecute?: () => void;
    onAfterExecute?: () => void;
    dispatchRun: (item: PreflightItem, timeoutMs?: number) => Promise<string | void>;
    onTimeoutPump?: (currentMs: number | undefined, failures: number) => Promise<number | null>;
}
export declare function runKickass(opts?: KickassOpts): Promise<void>;
export declare function runKickassWithDeps(opts: KickassOpts | undefined, deps: KickassDeps): Promise<void>;
export declare function buildPreflightPlan(prs: PRStatus[], roundMode?: 'crazy' | 'halfcrazy', fixDeliveryMode?: FixDeliveryMode): PreflightItem[];
export declare function verdictBoardUpdateForAction(action: KickassAction, verdict: string): {
    verdict?: string;
    recheckVerdict?: string;
};
export declare function executeKickassPlan(plan: PreflightItem[], deps: ExecuteKickassDeps, concurrency?: number, staggerMs?: number): Promise<KickassExecutionResult[]>;
export declare function printPreflight(plan: PreflightItem[], mergeReady?: PRStatus[]): void;
export declare function printMergeReady(prs: PRStatus[]): void;
export declare function summarizeExecutionResults(results: KickassExecutionResult[]): string;
export declare function printExecutionSummary(results: KickassExecutionResult[]): void;
export declare function buildKickassRunArgs(itemOrPR: PreflightItem | PRStatus, roundMode?: 'crazy' | 'halfcrazy', timeout?: string): string[];
export interface CliInvocation {
    command: string;
    args: string[];
}
interface ResolveCliInvocationOptions {
    argvEntry?: string;
    execPath?: string;
    exists?: (path: string) => boolean;
    urlToPath?: (url: URL) => string;
}
export declare function resolveCliInvocation(options?: ResolveCliInvocationOptions): CliInvocation;
export {};
//# sourceMappingURL=kickass.d.ts.map