/** * The CLI's own version, read from the package.json that ships in the npm tarball (npm * always includes it, whatever the `files` array says). Resolved relative to this module, * so it works both from `dist/` at runtime and from `src/` under vitest — both are one * level below the package root. Best-effort: a missing/garbled file yields `0.0.0` rather * than throwing, since `substrat --version` must never fail. */ export declare function cliVersion(): string; export type Advisory = { level: 'blocked' | 'behind'; message: string; } | null; /** * The freshness decision, as a pure function so it can be tested without a TTY or a * network. The control plane — the authority on whether this CLI is still *compatible*, * which npm's `latest` tag is not — advertises two values on every response: * `min` the oldest version it will keep accepting pushes from (the compat floor) * `latest` the newest published version * Below the floor is `blocked` (the server also refuses the push outright — this is just * the friendly heads-up); merely behind `latest` is `behind`. Anything unparseable or * absent yields no advisory, so a server that says nothing costs nothing. */ export declare function staleAdvisory(current: string, server: { min?: string | null; latest?: string | null; }): Advisory; /** * Detect a stale WORKSPACE build (#386). In the monorepo the `substrat` bin is a * symlink to `packages/cli/dist/cli.js`, so after a `git pull` that touched `src/` * without a rebuild, the stale dist fails in maximally confusing ways — e.g. a Zod * refusal of `registry: undefined` after #363 made the field required, with nothing * saying the CLI itself was the problem. The published tarball ships no `src/` * (package.json `files`), so for an npm-installed CLI this is always null. * * Pure decision over two directories so it is testable with temp dirs: newest `.ts` * mtime under src (recursing is unnecessary — the CLI's src is flat) vs newest `.js` * mtime under dist. Returns the warning to print, or null. */ export declare function distStaleAdvisory(srcDir: string, distDir: string): string | null; /** * Warn (stderr, never stdout) when the running dist is older than the checkout's src. * A no-op outside the monorepo (no `src/` in the tarball), when running straight from * source (vitest/tsx), and on any error — a freshness nudge must never fail a command. */ export declare function warnIfDistStale(): void; /** Response headers carrying the version advisory (see {@link staleAdvisory}). */ export declare const CLI_MIN_VERSION_HEADER = "x-substrat-cli-min-version"; export declare const CLI_LATEST_VERSION_HEADER = "x-substrat-cli-latest-version"; /** * Read the version advisory off a control-plane response and nudge the builder — to * stderr (never stdout, which `push` output is parsed from), and only on a TTY, so * scripted/CI runs stay silent. Never throws: a version banner must not be able to fail * a deploy. Call it on any authenticated response; the server side may not advertise the * headers yet, in which case this is a no-op. */ export declare function warnIfStale(headers: Headers): void; //# sourceMappingURL=version.d.ts.map