/**
 * Atomic package installation / replacement.
 *
 * The sequence:
 *   1. Rename existing packageDir → packageDir.bak  (backup)
 *   2. Create new empty packageDir
 *   3. Call install() which writes to packageDir
 *   4. On success: delete packageDir.bak
 *   5. On failure: delete packageDir (partial), rename .bak → packageDir (restore)
 *
 * cleanupResiduals() removes any .tmp or .bak directories left by previous
 * failed runs before starting a new installation.
 */
export interface AtomicReplaceOptions {
    /** Absolute path to the package directory (final install location). */
    packageDir: string;
    /** Callback that writes the new package content into packageDir. */
    install: () => Promise<void>;
}
/**
 * Remove any leftover .tmp or .bak directories from a previous failed installation.
 *
 * @param packageDir - absolute path to the package directory (not the .tmp/.bak path)
 */
export declare function cleanupResiduals(packageDir: string): void;
/**
 * Atomically replace a package directory.
 *
 * If the package directory already exists, it is renamed to .bak before
 * installing the new version. On success, .bak is removed. On failure,
 * the new (partial) directory is removed and .bak is restored.
 *
 * If the package directory does not yet exist, creates it fresh.
 */
export declare function atomicReplace(options: AtomicReplaceOptions): Promise<void>;
//# sourceMappingURL=atomic-update.d.ts.map