/** Result from running the installed binary and parsing its reported version. */
export interface InstalledVersionVerification {
    ok: boolean;
    actual?: string;
    path?: string;
}
/** Paths and verifier used while replacing a downloaded binary update. */
export interface BinaryReplacementOptions {
    targetPath: string;
    tempPath: string;
    backupPath: string;
    expectedVersion: string;
    verifyInstalledVersion: (expectedVersion: string) => Promise<InstalledVersionVerification>;
}
/**
 * Parse update subcommand arguments.
 * Returns undefined if not an update command.
 */
export declare function parseUpdateArgs(args: string[]): {
    force: boolean;
    check: boolean;
    plugins: boolean;
} | undefined;
type UpdateMethod = "brew" | "mise" | "bun" | "binary";
interface UpdateMethodResolutionOptions {
    homebrewPrefix?: string;
    miseBinDirs?: readonly string[];
    miseDataDir?: string;
}
export declare function resolveUpdateMethodForTest(ompPath: string, bunBinDir: string | undefined, options?: UpdateMethodResolutionOptions): UpdateMethod;
interface BunInstallCachePruneResult {
    scannedPackages: number;
    removedEntries: number;
}
/**
 * Prune Bun's package cache so each package keeps only its newest cached version.
 *
 * Bun stores package cache entries as both a package marker directory
 * (`react/19.2.6@@@1`) and a materialized package directory
 * (`react@19.2.6@@@1`). Global `omp` updates can leave one full copy per
 * release. The marker and materialized entries are removed together so the
 * cache stays internally consistent.
 */
export declare function pruneBunInstallCache(cacheDir: string, packageNames?: Set<string>): Promise<BunInstallCachePruneResult>;
export declare function resolveBunGlobalNodeModulesDirFromLocations(globalBinDir: string | undefined, cacheDir: string | undefined): string | undefined;
/**
 * Best-effort removal of binary-update backups left by earlier runs.
 *
 * Each self-update moves the previous executable to `<binary>.<timestamp>.<pid>.bak`
 * before swapping the new one in. On Windows that backup cannot be deleted
 * while the updating process is alive, so it is left for a later run to reclaim
 * once its owning process has exited. Also matches the legacy fixed
 * `<binary>.bak` name produced before backups were timestamped, so users
 * upgrading from a buggy release get the orphaned file cleaned up.
 */
export declare function sweepStaleBackups(targetPath: string): Promise<void>;
/**
 * Atomically replace the installed binary and roll back if version verification fails.
 */
export declare function replaceBinaryForUpdate(options: BinaryReplacementOptions): Promise<InstalledVersionVerification>;
/**
 * Build the bun argv used to globally install a specific omp version.
 *
 * The version is selected by hitting {@link NPM_REGISTRY} directly in
 * {@link getLatestRelease}, so the install MUST observe the same catalog:
 *
 * - `--registry=${NPM_REGISTRY}` pins the install to the official registry
 *   regardless of the user's bunfig/`.npmrc`. A mirror (corporate proxy,
 *   Taobao, …) that hasn't yet replicated the release would otherwise reject
 *   a version the upstream registry already advertises.
 * - `--no-cache` tells bun to ignore its on-disk manifest snapshot so it
 *   re-fetches metadata from that registry on every invocation.
 *
 * Together these two flags make `omp update` produce exactly the registry
 * lookup the version check just performed. See #1686.
 *
 * Also pins {@link NATIVES_PACKAGE} and the platform-specific
 * `@oh-my-pi/pi-natives-<tag>` leaf to `expectedVersion`. `bun install -g`
 * does not reliably refresh transitive `optionalDependencies` when the
 * top-level package is the only one bumped, so the native addon and its
 * version sentinel can drift out of sync with the freshly installed
 * `@oh-my-pi/pi-coding-agent` and the loader aborts at
 * `validateLoadedBindings` on the next launch
 * (`The .node file on disk is from a different release than this loader`).
 * Listing the natives explicitly forces bun to replace them in lock-step.
 * The leaf is added only on tags the release pipeline actually publishes
 * ({@link SUPPORTED_NATIVE_TAGS}) so unsupported platforms still fail with
 * the original "no matching version" message instead of `EBADPLATFORM`.
 * See #1824.
 */
export declare function buildBunInstallArgs(expectedVersion: string, nativeTag?: string): string[];
export declare function buildHomebrewUpdateArgs(force: boolean): string[];
export declare function buildMiseUpgradeArgs(): string[];
export declare function buildMiseForceInstallArgs(expectedVersion: string): string[];
/**
 * Run the update command.
 */
export declare function runUpdateCommand(opts: {
    force: boolean;
    check: boolean;
}): Promise<void>;
/**
 * Print update command help.
 */
export declare function printUpdateHelp(): void;
export {};
