@vigilbase/cli
Version:
Vigilbase CLI — security scanners, agent tools, and Vigilbase One from the terminal.
22 lines (21 loc) • 1.14 kB
JavaScript
/**
* The first release of each supported Node.js line with the 2026-10-21 security fixes. Keep in step with `engines`
* in package.json; later majors count as patched.
*/
const PATCHED_RELEASES = new Map([[22, [23, 4]], [24, [22, 1]], [26, [12, 1]]]);
const LATEST_LINE = 26;
const SUPPORTED = 'Node.js 22.23.4+, 24.22.1+ or 26.12.1+';
/** Why this Node shouldn't run the CLI, or null when it is a supported, patched release. */
export function nodeRuntimeWarning(version = process.versions.node) {
const [major, minor, patch] = version.split('.').map((part) => Number.parseInt(part, 10));
if (!Number.isInteger(major) || !Number.isInteger(minor) || !Number.isInteger(patch))
return null;
if (major > LATEST_LINE)
return null;
const fixed = PATCHED_RELEASES.get(major);
if (!fixed)
return `Node.js ${version} is no longer supported and gets no security fixes. Use ${SUPPORTED} (https://nodejs.org).`;
if (minor > fixed[0] || (minor === fixed[0] && patch >= fixed[1]))
return null;
return `Node.js ${version} is missing security fixes. Use ${SUPPORTED} (https://nodejs.org).`;
}