import { type Output } from '../output.js'; import { type UpdateCheckCache, type UpdateTag } from '../update/notice.js'; import { type EnvironmentName } from '../config/environments.js'; import { type Exists, type InstallLocation, type SpawnManager } from '../update/self-install.js'; /** * Everything this command touches outside itself, in one place — including the two reads that look * like constants (`currentVersion`, `pinned`) but are both facts about the machine it happens to be * running on, and the cache write, which would otherwise reach into the real `~/.bitmagic` from a * test run. */ export interface SelfUpdateDeps { currentVersion: () => string; pinned: () => EnvironmentName | undefined; resolve: () => InstallLocation; fetchTag: (tag: UpdateTag) => Promise; spawn: SpawnManager; readVersion: (dir: string) => string | null; writable: (dir: string) => boolean; /** * Path probe used to locate the package manager. Injected for the same reason as everything else * here: the tests describe machines that do not exist, and a real `existsSync` would answer for * this one instead — silently dropping every case into the PATH fallback. */ exists: Exists; writeCache: (cache: UpdateCheckCache) => void; sleep: (ms: number) => Promise; now: () => number; execPath: string; } export declare const defaultSelfUpdateDeps: SelfUpdateDeps; /** * Which npm line to install from, and never a question put to the creator. * * The order is the same rule the startup nudge already applies, just acted on instead of printed: * an explicit `--tag` is a deliberate override; otherwise a project's committed pin decides, * because the project is where a wrong line actually bites (a prerelease against `prod` calls * `/api/cli/v1` endpoints that are not deployed there yet); and outside a project the only honest * answer is the line this build is already on. * * That middle case is what makes this command the fix for `cliLineMismatchNotice` too: run inside * a project on the wrong line, it crosses over without being told to. */ export declare function resolveTargetTag(explicit: string | undefined, pinned: 'dev' | 'prod' | 'local' | undefined, currentVersion: string): UpdateTag; /** What `--json` reports, and what the human lines above it say in prose. */ export interface SelfUpdateResult { ok: true; /** The version that was running when the command started. */ from: string; /** The version now on disk. Equal to `from` when there was nothing newer. */ to: string; tag: UpdateTag; /** True when an install actually ran. False when the CLI was already current. */ updated: boolean; manager: 'npm' | 'pnpm'; packageDir: string; } export declare function runSelfUpdate(explicitTag: string | undefined, output: Output, deps?: SelfUpdateDeps): Promise; export declare const selfUpdateCommand: import("citty").CommandDef<{ readonly tag: { readonly type: "string"; readonly description: string; }; readonly json: { readonly type: "boolean"; readonly description: "Print the result as JSON on stdout; all progress goes to stderr."; }; }>;