@nexus-cortex/cli 4.26.0 → 4.26.1
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/bin/cortex.js +35 -3
- package/package.json +2 -2
package/bin/cortex.js
CHANGED
|
@@ -25,12 +25,28 @@
|
|
|
25
25
|
import { spawn, spawnSync } from 'child_process';
|
|
26
26
|
import { fileURLToPath } from 'url';
|
|
27
27
|
import { dirname, join, resolve } from 'path';
|
|
28
|
-
import { existsSync, realpathSync } from 'fs';
|
|
28
|
+
import { existsSync, readFileSync, realpathSync } from 'fs';
|
|
29
|
+
import { createRequire } from 'module';
|
|
29
30
|
|
|
31
|
+
const __cortex_require = createRequire(import.meta.url);
|
|
30
32
|
const __cortex_filename = fileURLToPath(import.meta.url);
|
|
31
33
|
const __cortex_dirname = dirname(realpathSync(__cortex_filename));
|
|
32
34
|
const MONOREPO_ROOT = resolve(__cortex_dirname, '..', '..', '..');
|
|
33
|
-
|
|
35
|
+
|
|
36
|
+
// Locate the server entry. From a git clone it's the monorepo's built server;
|
|
37
|
+
// from an npm install (`@nexus-cortex/cli` alongside `@nexus-cortex/server`) it's
|
|
38
|
+
// resolved through node_modules. Falls back to the monorepo path so the
|
|
39
|
+
// "not found" guidance in startServer() still fires when neither exists.
|
|
40
|
+
function resolveServerEntry() {
|
|
41
|
+
const monorepoServer = join(MONOREPO_ROOT, 'packages', 'server', 'dist', 'index.js');
|
|
42
|
+
if (existsSync(monorepoServer)) return monorepoServer;
|
|
43
|
+
try {
|
|
44
|
+
return __cortex_require.resolve('@nexus-cortex/server');
|
|
45
|
+
} catch {
|
|
46
|
+
return monorepoServer;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const SERVER_ENTRY = resolveServerEntry();
|
|
34
50
|
|
|
35
51
|
// Resolve CORTEX_ROOT (the install root holding the shipped .cortex scaffold —
|
|
36
52
|
// builtin agents/skills) when the user hasn't set it. Git clone → the monorepo
|
|
@@ -51,6 +67,19 @@ let serverProcess = null;
|
|
|
51
67
|
|
|
52
68
|
const args = process.argv.slice(2);
|
|
53
69
|
|
|
70
|
+
// ── Version ───────────────────────────────────────────────────────
|
|
71
|
+
// Standalone — no server needed. Reads this package's own package.json.
|
|
72
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
73
|
+
let version = 'unknown';
|
|
74
|
+
try {
|
|
75
|
+
version = JSON.parse(
|
|
76
|
+
readFileSync(join(__cortex_dirname, '..', 'package.json'), 'utf8'),
|
|
77
|
+
).version;
|
|
78
|
+
} catch { /* leave 'unknown' */ }
|
|
79
|
+
console.log(`cortex ${version}`);
|
|
80
|
+
process.exit(0);
|
|
81
|
+
}
|
|
82
|
+
|
|
54
83
|
// ── Headless Commander delegation ─────────────────────────────────
|
|
55
84
|
// `cortex` is primarily the HTTP chat/PR client; the headless Commander program
|
|
56
85
|
// (autoresearch, models, message, mcp, config, …) lives in dist/index.js. If the
|
|
@@ -172,6 +201,7 @@ AGENT (autonomous one-shot):
|
|
|
172
201
|
|
|
173
202
|
FLAGS:
|
|
174
203
|
--help, -h Show this help
|
|
204
|
+
--version, -v Print the cortex version and exit
|
|
175
205
|
--model, -m ID Model to use (overrides server default)
|
|
176
206
|
--new Start a fresh session before sending
|
|
177
207
|
--resume ID Resume a specific session by UUID
|
|
@@ -243,7 +273,9 @@ async function shutdownServer() {
|
|
|
243
273
|
|
|
244
274
|
async function startServer() {
|
|
245
275
|
if (!existsSync(SERVER_ENTRY)) {
|
|
246
|
-
console.error(
|
|
276
|
+
console.error('[cortex] Nexus Cortex server not found.');
|
|
277
|
+
console.error(' npm install: npm install @nexus-cortex/server');
|
|
278
|
+
console.error(' from source: npm run build (from the monorepo root)');
|
|
247
279
|
process.exit(1);
|
|
248
280
|
}
|
|
249
281
|
process.stderr.write(`[cortex] No server on ${BASE_URL} -- starting one...\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexus-cortex/cli",
|
|
3
|
-
"version": "4.26.
|
|
3
|
+
"version": "4.26.1",
|
|
4
4
|
"description": "Nexus Cortex CLI - Terminal interface for multi-provider LLM orchestration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"prepack": "node ../../scripts/copy-pkg-cortex-scaffold.mjs"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@nexus-cortex/core": "^4.26.
|
|
22
|
+
"@nexus-cortex/core": "^4.26.1",
|
|
23
23
|
"chalk": "^4.1.2",
|
|
24
24
|
"cli-spinners": "^2.9.0",
|
|
25
25
|
"commander": "^11.0.0",
|