import { spawn } from 'node:child_process'; /** @purpose Serialized cache structure persisted by the update-check worker. */ export type UpdateCheckCache = { /** @purpose ISO8601 timestamp of the most recent registry check */ lastCheck: string; /** @purpose Latest version string from npm registry response */ latestVersion: string; }; /** @purpose Configuration driving the update-check service behaviour. */ export type UpdateCheckOptions = { /** @purpose Package identity — name and semver version */ pkg: { name: string; version: string; }; /** @purpose Minimum interval between checks in ms | @invariant Default 24h (86_400_000 ms) */ interval?: number; /** @purpose Suppress stderr notification when stderr is not a TTY | @invariant Default true — suppresses display only, never the check */ skipNotificationIfNoTty?: boolean; /** @purpose Directory for the update-check cache file | @invariant Must exist before worker spawn */ cacheDir?: string; /** @purpose Inject a custom spawn implementation for testing | @invariant Test seam only — not used in production */ _spawnFn?: typeof spawn; }; /** * @purpose Orchestrate a non-blocking update check — read cache, spawn worker if stale, register deferred notification. * @implements {UpdateCheck} in specs/cli/update-check/update-check.spec.md#updatecheck * @invariant Never throws — all failure paths are silent. * @invariant Never blocks process.exit — spawn uses unref(). * @param pkg Package identity with name and semver version. * @param [opts] Optional configuration overrides. * @post Returns synchronously without blocking; if stale/missing cache: detached worker spawned via unref(); if fresh cache with newer version: beforeExit hook registered. * @sideEffect FS: reads and writes cache directory. Subprocess: may spawn UpdateCheckWorker. */ export declare function checkForUpdates(pkg: { name: string; version: string; }, opts?: Partial): void;