/** * NEXUS project registry bulk-clean. * * Purges project_registry rows matching configurable path/status criteria. * Supports dry-run mode and returns a summary result. * * @task T1473 */ import { type EngineResult } from '../engine-result.js'; /** Thrown when no filter criteria are provided to cleanProjects. */ export declare class NoCriteriaError extends Error { /** @override */ readonly name = "NoCriteriaError"; constructor(); } /** Thrown when --pattern is not a valid JS regex. */ export declare class InvalidPatternError extends Error { /** @override */ readonly name = "InvalidPatternError"; constructor(pattern: string, cause: unknown); } /** Options for {@link cleanProjects}. */ export interface CleanProjectsOptions { /** When true, perform a dry-run scan only — no deletions. */ dryRun: boolean; /** JS regex pattern matched against project_path. */ pattern?: string; /** Match paths containing a .temp/ segment. */ includeTemp?: boolean; /** Match paths containing tmp/test/fixture/scratch/sandbox segments. */ includeTests?: boolean; /** Match rows where health_status is 'unhealthy'. */ matchUnhealthy?: boolean; /** Match rows where last_indexed IS NULL. */ matchNeverIndexed?: boolean; /** Match rows whose project_path no longer exists on disk (T9117). */ matchOrphaned?: boolean; /** * Match rows that are path-divergent duplicates of the same canonical * project (T9149 W5 pollution cleanup). Groups rows by canonicalProjectId * and flags all but the most-recently-indexed one as polluted. */ matchPolluted?: boolean; /** After DB delete, `rm -rf` each matched path that still exists on disk (T9117). */ removeFs?: boolean; /** After DB delete, run sqlite VACUUM on nexus.db to reclaim space (T9117). */ vacuum?: boolean; /** * When matchPolluted is set and dryRun is false, write an audit JSONL to * ~/.local/state/cleo/nexus-cleanup-.jsonl before deletion (T9149). */ auditLog?: boolean; } /** Result envelope for {@link cleanProjects}. */ export interface CleanProjectsResult { /** Whether this was a dry-run (no deletions performed). */ dryRun: boolean; /** Number of rows matching criteria. */ matched: number; /** Number of rows actually deleted (0 when dryRun is true). */ purged: number; /** Rows remaining after deletion. */ remaining: number; /** Sample of matched project paths (first 10). */ sample: string[]; /** Total registry rows scanned. */ totalCount: number; /** Number of on-disk paths successfully removed when `removeFs` is set (T9117). */ fsRemoved?: number; /** Number of on-disk paths that failed to remove when `removeFs` is set (T9117). */ fsFailed?: number; /** Bytes freed by VACUUM when `vacuum` is set (T9117). */ vacuumBytesFreed?: number; } /** * Bulk-purge project registry rows matching configurable criteria. * * At least one of `pattern`, `includeTemp`, `includeTests`, `matchUnhealthy`, * or `matchNeverIndexed` must be set — otherwise throws {@link NoCriteriaError}. * If `pattern` is set but invalid, throws {@link InvalidPatternError}. * When `dryRun` is true, performs only a preview scan with no deletions. * * @param opts - Clean options. * @returns Clean result with match count and sample. * @throws {NoCriteriaError} When no filter criteria are provided. * @throws {InvalidPatternError} When `opts.pattern` is not a valid regex. * * @example * const preview = await cleanProjects({ dryRun: true, includeTemp: true }); * console.log(preview.matched, 'projects would be purged'); */ export declare function cleanProjects(opts: CleanProjectsOptions): Promise; export declare function nexusProjectsClean(opts: { dryRun?: boolean; pattern?: string; includeTemp?: boolean; includeTests?: boolean; matchUnhealthy?: boolean; matchNeverIndexed?: boolean; matchOrphaned?: boolean; removeFs?: boolean; vacuum?: boolean; }): Promise>; //# sourceMappingURL=projects-clean.d.ts.map