import type { Logger, SpawnFn } from "./loader.js";
export type InstallMode = "global" | "local" | "npx" | "unknown";
export interface SelfUpdateDeps {
    logger?: Logger;
    http?: {
        get: (url: string, opts?: any) => Promise<{
            data: any;
        }>;
    };
    spawn?: SpawnFn;
}
/**
 * Compare two semver strings (lenient — handles `X.Y.Z`; prerelease tags
 * are compared using semver semantics: dot-split identifiers, numeric
 * vs alphanumeric ranking, shorter set wins on a tie — see
 * `comparePrerelease()` below). Returns:
 *   <0  if a < b
 *   0   if a === b
 *   >0  if a > b
 *
 * We avoid pulling in the full `semver` dep for this single use site.
 */
export declare function compareVersions(a: string, b: string): number;
export interface CheckResult {
    latest: string | null;
    newer: boolean;
}
/**
 * Hit the npm registry for the dist-tag.latest of `doc-detective`. Bounded
 * by a 3 s timeout. Any failure — network, parse, semver, anything —
 * yields { newer: false } and a debug-level log; we never let a registry
 * hiccup block the run.
 */
export declare function checkForUpdate(currentVersion: string, deps?: SelfUpdateDeps): Promise<CheckResult>;
/**
 * Decide whether the running shim is installed as a global npm bin, a local
 * project dep, or being invoked via `npx`. Used to choose the right update
 * command — global gets `npm install -g`, npx re-execs through `npx -y`,
 * and local just gets an info-level "update available" line because
 * mutating the user's package.json is out of scope for self-update.
 */
export declare function detectInstallMode(): InstallMode;
export interface SelfUpdateResult {
    updated: boolean;
    /** True iff the caller should NOT continue running this process. */
    reexec: boolean;
}
/**
 * Perform a self-update for the running shim, scoped by install mode.
 *   - global: spawn `npm install -g doc-detective@<latest>`, then re-exec.
 *   - npx:    re-exec via `npx -y doc-detective@latest <…orig argv>`.
 *   - local:  log an info-level "update available" line, return updated:false.
 *   - unknown: like local — never mutate state we don't understand.
 *
 * In the re-exec paths, the child inherits the parent's stdio and is
 * spawned with DOC_DETECTIVE_SKIP_AUTO_UPDATE=1 to prevent infinite update
 * loops if the new version's check fires again.
 */
export declare function selfUpdate(latestVersion: string, mode: InstallMode, deps?: SelfUpdateDeps): Promise<SelfUpdateResult>;
//# sourceMappingURL=selfUpdate.d.ts.map