export interface StagingPruneResult { removed: string[]; /** Staging dirs that could not be removed (usually: still locked). */ kept: string[]; } /** * Abandoned npm staging directories for this package, WITHOUT removing them. * * `doctor` reports rather than repairs: a diagnostic that silently deletes * directories is a diagnostic nobody trusts. The upgrade helper is the only * caller of `pruneAbandonedStaging`, and it prints what it removed. */ export declare function abandonedStagingDirs(liveInstallDir: string, root?: string): string[]; /** * Remove abandoned npm staging directories for this package. * * Safe by construction: it only ever touches names matching STAGING_DIR_PATTERN * inside the npm global `node_modules`, which by definition excludes the live * install. A directory it cannot remove (still mapped by a dead-but-not-gone * process, or a concurrent npm) is reported rather than forced - `rmSync` * failing is information, not an error to swallow. * * `root` and `liveInstallDir` are parameters so the unit tests can point this * at a temp directory instead of the real npm tree. */ export declare function pruneAbandonedStaging(liveInstallDir: string, root?: string): StagingPruneResult; export interface NativeHolder { pid: number; /** The native modules this process has mapped. */ modules: string[]; } /** * Processes referencing this install tree that have native modules mapped. * * `selfPid` is excluded: the upgrade helper runs FROM the install tree, so it * would otherwise always report itself and turn a useful warning into noise. */ export declare function listNativeModuleHolders(installDir: string, selfPid?: number): NativeHolder[]; export interface PreflightReport { staging: StagingPruneResult; holders: NativeHolder[]; /** One-line human summary for the daemon log / upgrade helper. */ summary: string[]; } /** * Run both checks. Always returns a report - never throws, because a preflight * that cannot run must not be the reason an upgrade fails. */ export declare function preflightUpgrade(installDir: string, selfPid?: number): PreflightReport;