import { classifyWorkspace } from "./classify.js"; import { type LockInfo } from "./lockfile.js"; import { type JournalEntry } from "./journal.js"; /** * v0.7 — `solosquad uninstall` precheck. * Per docs/plan/v0.7-uninstall-lifecycle.md §5.1 step 0 + P0 #5 + P1 #6/#7/#9. * * Read-only — does not mutate the workspace, does not acquire the lock * itself (the caller does, after this report is approved). Surfaces: * * - Workspace + repositories paths (the "not-touched" notice) * - Stale lockfile detection (caller may auto-clear) * - Journal resume hints (incomplete stages from prior run) * - Live PM/scheduler PIDs (`--force` required to bypass) * - Uncommitted/unpushed git changes in repositories * - Workspace itself being a git working tree * - Archive path writable + free space × 1.5 sanity check */ export interface PrecheckResult { /** True if no blockers. Warnings may still exist. */ ok: boolean; /** Soft notes (sortable in CLI). */ warnings: string[]; /** Hard blockers — uninstall must not proceed unless --force or fixed. */ blockers: string[]; /** Untouched repository absolute paths (display to user). */ protectedRepoPaths: string[]; /** Existing lock holder, if any. */ existingLock: { info: LockInfo | null; isStale: boolean; path: string; }; /** Stages from a previous run that began but did not end. */ incompleteStages: string[]; /** Journal entries (caller may render). */ journalEntries: JournalEntry[]; /** Detected live solosquad bot/cron PIDs. */ livePids: number[]; /** Repos with uncommitted or unpushed changes. */ reposWithGitDrift: string[]; /** True if `/.git` exists. */ workspaceIsGitTree: boolean; /** Estimated archive size (bytes). */ estimatedArchiveBytes: number; /** Disk free at archive destination (bytes). */ archiveDestFreeBytes: number; } export interface PrecheckOptions { workspace: string; /** Where the archive zip will go (defaults to `~/`). */ archivePath: string; /** Override PID detection (tests). */ livePidsOverride?: number[]; /** Override disk free (tests). */ freeBytesOverride?: number; /** Bypass PM/scheduler PID + git-drift blockers. */ force?: boolean; } export declare function precheck(opts: PrecheckOptions): Promise; declare function detectLivePids(): number[]; declare function detectGitDrift(repoPath: string): boolean; declare function diskFreeBytes(dir: string): number; declare function isDirWritable(dir: string): boolean; declare function estimateArchiveBytes(c: ReturnType): number; export declare const _precheckInternals: { detectLivePids: typeof detectLivePids; detectGitDrift: typeof detectGitDrift; diskFreeBytes: typeof diskFreeBytes; isDirWritable: typeof isDirWritable; estimateArchiveBytes: typeof estimateArchiveBytes; }; export {};