import { type StateScope } from './state-locator.js';
export interface PurgeOp {
    path: string;
    scope: StateScope;
    kind: 'file' | 'dir' | 'missing';
    bytes: number;
    removed: boolean;
    error?: string;
}
export interface PurgeReport {
    ops: PurgeOp[];
    totalBytesRemoved: number;
    totalBytesSkipped: number;
    leftovers: string[];
    dryRun: boolean;
}
export declare function dirBytes(target: string): number;
export declare function purgePath(target: string, scope: StateScope, options?: {
    dryRun?: boolean;
}): PurgeOp;
/** Purge every entry returned by enumerateStatePaths, plus manifest-recorded ones. */
export declare function purgeStatePaths(extras?: Array<{
    path: string;
    scope: StateScope;
}>, options?: {
    dryRun?: boolean;
}): PurgeReport;
/** Purge every known Nexus tmp root. */
export declare function purgeTmpRoots(options?: {
    dryRun?: boolean;
}): PurgeReport;
/** Report paths that remain under the state dir after a purge attempt. */
export declare function collectLeftovers(stateDir?: string): string[];
/**
 * Sweep: bound a directory so that its entries respect maxAgeMs, maxCount, maxBytes.
 * Oldest entries are removed first. Used for worktrees and runs dirs so storage
 * growth has a ceiling even when users never call uninstall.
 */
export interface SweepOptions {
    maxAgeMs?: number;
    maxCount?: number;
    maxBytes?: number;
    dryRun?: boolean;
    /** If true, keep the root dir itself even if it becomes empty. */
    keepRoot?: boolean;
}
export interface SweepReport {
    root: string;
    removed: Array<{
        path: string;
        bytes: number;
        reason: 'age' | 'count' | 'bytes';
    }>;
    totalBytesBefore: number;
    totalBytesAfter: number;
    entriesBefore: number;
    entriesAfter: number;
    dryRun: boolean;
}
export declare function sweepDirectory(root: string, opts: SweepOptions): SweepReport;
/** Remove any git-worktree directory that no longer appears in `git worktree list`. */
export declare function sweepOrphanWorktrees(repoRoot: string, options?: {
    dryRun?: boolean;
}): Promise<PurgeReport>;
export declare function formatBytes(n: number): string;
