/** * Fail-fast Node-version guard for the OpenLore CLI. * * Why this exists: OpenLore requires Node >=22.13, but OpenSpec requires only * >=20.19. When OpenLore runs as an OpenSpec plugin, a user on Node 20/21 can run * `openspec lore generate`, which spawns `openlore` under a Node OpenLore does not * support. `engines` in package.json is advisory at install time and does NOT * protect that spawn. So we check at runtime and, below the floor, write ONE * legible line to stderr (required + actual versions) and exit with a stable, * dedicated code — never a stack trace or a partial run — so the host propagates a * legible failure through its exit-code plumbing. * * This module is imported FIRST in src/cli/index.ts so it evaluates before * commander and the heavy command modules. Keep it dependency-free. */ /** Minimum supported Node. This is the first line where `node:sqlite` — imported * at module load by EdgeStore, the epistemic lease, and preflight scoring — is * available WITHOUT `--experimental-sqlite` (unflagged in Node 22.13.0 / 23.4.0, * nodejs/node#55854). MUST stay in sync with package.json `engines.node` and * constants.ts's `MIN_NODE_*` (a test asserts all three). */ export declare const MIN_NODE: { readonly major: 22; readonly minor: 13; }; /** Stable, dedicated exit code for "unsupported Node" (documented contract). */ export declare const EXIT_UNSUPPORTED_NODE = 78; export interface NodeVersionCheck { ok: boolean; message?: string; } /** * Probe whether `node:sqlite` is actually loadable in THIS runtime, rather than * inferring it from the version number. `process.getBuiltinModule` exists since * Node 22.3 (below our floor), returns the builtin when available and `undefined` * when it is not (e.g. still behind a flag on 23.0–23.3, or stripped from a distro * build). Injectable so the capability path is unit-testable without a second Node. */ export declare function isSqliteAvailable(getBuiltinModule?: (id: string) => unknown): boolean; /** * Version + capability check — no exit side effect, so it is unit-testable. * Version arithmetic gates first (a clear "upgrade Node" message), then the * capability probe has the final word: a version number that satisfies the floor * but on which `node:sqlite` is not loadable still fails, naming the missing * builtin. `probe` is injectable so both branches are testable on a capable host. */ export declare function checkNodeVersion(versionString?: string, probe?: () => boolean): NodeVersionCheck; /** Side-effecting guard: writes one stderr line and exits when Node is too old. */ export declare function assertSupportedNode(): void; //# sourceMappingURL=node-version-guard.d.ts.map