@fmdzc/cli-ai 3.2.2 → 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +18 -0
- package/dist/index.js +125 -125
- package/package.json +3 -2
package/README.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -5,6 +5,24 @@
|
|
|
5
5
|
// Saves ~200-400ms startup time and reduces runtime overhead
|
|
6
6
|
process.env.NODE_ENV = 'production';
|
|
7
7
|
|
|
8
|
+
// ── Node.js version gate ────────────────────────────────────────────────
|
|
9
|
+
// Runs before any imports or modern API usage so the error message is
|
|
10
|
+
// always reachable. Uses only APIs available since Node 0.x (process.versions,
|
|
11
|
+
// parseInt, console, process.exit) so it works on ANY Node version that
|
|
12
|
+
// can parse ESM (>= 12). Cross-platform — no OS-specific code.
|
|
13
|
+
const MIN_NODE_MAJOR = 20;
|
|
14
|
+
const nodeVersion = process.versions.node;
|
|
15
|
+
const nodeMajor = parseInt(nodeVersion.split('.')[0], 10);
|
|
16
|
+
if (Number.isNaN(nodeMajor) || nodeMajor < MIN_NODE_MAJOR) {
|
|
17
|
+
console.error(
|
|
18
|
+
'\n CLI AI requires Node.js >= ' + MIN_NODE_MAJOR + '.0.0' +
|
|
19
|
+
'\n Current version: ' + (nodeVersion || 'unknown') +
|
|
20
|
+
'\n' +
|
|
21
|
+
'\n Install the latest LTS: https://nodejs.org\n',
|
|
22
|
+
);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
8
26
|
// Fast-path: handle --help and --version before loading ANY dependencies
|
|
9
27
|
// These flags should respond instantly, not after 60-120s of import resolution
|
|
10
28
|
const args = process.argv.slice(2);
|