/** * State garbage collection for .specweave/state/ * * Whitelist-driven: only entries matching KNOWN junk patterns are ever deleted, * and never anything on the KEEP list. Everything else is left alone. * * Used by `specweave gc` (dry-run by default) and by the SessionStart hook * (silent, at most once per 24h via the `.gc-last` marker). */ export declare const GC_MARKER = ".gc-last"; export declare const GC_INTERVAL_MS: number; export declare const INTERVIEW_MAX_AGE_MS: number; /** Files/dirs (top-level in state/) that coordination depends on. Never touched. */ export declare const STATE_KEEP: readonly string[]; export interface GcEntry { /** Path relative to stateDir, forward slashes */ path: string; bytes: number; kind: 'file' | 'dir'; } export interface GcOptions { /** Delete when true; otherwise only plan. Default false. */ apply?: boolean; /** Clock override for tests */ now?: number; /** Age after which interview-*.json is junk. Default 30 days. */ interviewMaxAgeMs?: number; } export interface GcResult { stateDir: string; candidates: GcEntry[]; deleted: GcEntry[]; bytes: number; applied: boolean; } export declare function dirSize(dir: string): number; /** * List junk entries in stateDir without deleting anything. */ export declare function planStatePurge(stateDir: string, options?: GcOptions): GcEntry[]; /** * Purge junk from stateDir. Dry-run unless `apply` is true. * Writes the `.gc-last` marker after an applied run. */ export declare function purgeState(stateDir: string, options?: GcOptions): GcResult; /** * True when no applied purge has run in the last GC_INTERVAL_MS. */ export declare function isGcDue(stateDir: string, now?: number): boolean; export interface NestedSpecweaveDir { /** Path relative to projectRoot, forward slashes */ path: string; bytes: number; /** No config.json → never `specweave init`-ed here; likely a stray copy */ stale: boolean; } /** * Find .specweave/ directories nested below the project root (max depth 4). * Reports only; never deletes. */ export declare function findNestedSpecweaveDirs(projectRoot: string, maxDepth?: number): NestedSpecweaveDir[]; /** Size of /.worktrees (0 when absent). */ export declare function worktreesSize(projectRoot: string): number; export declare function formatBytes(n: number): string; //# sourceMappingURL=state-gc.d.ts.map