@nexus-cortex/cli 4.34.4 → 4.34.6
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 +27 -2
- package/package.json +2 -2
package/bin/cortex.js
CHANGED
|
@@ -86,6 +86,11 @@ if (args.includes('--version') || args.includes('-v')) {
|
|
|
86
86
|
// first positional arg is one of those subcommands, hand the whole invocation off
|
|
87
87
|
// to it — this is what makes `cortex autoresearch experiment … --json` work on PATH
|
|
88
88
|
// (the auto-research container contract).
|
|
89
|
+
// Parsed during flag-handling further down, but the delegation below may auto-start
|
|
90
|
+
// the server before that runs — declare it here (undefined => server uses its default
|
|
91
|
+
// idle behavior) so startServer() can read it without hitting the temporal dead zone.
|
|
92
|
+
let idleTimeoutFlag;
|
|
93
|
+
|
|
89
94
|
const COMMANDER_SUBCOMMANDS = new Set([
|
|
90
95
|
'autoresearch', 'models', 'message', 'mcp', 'config', 'permissions', 'context',
|
|
91
96
|
'tools', 'middleware', 'artifact', 'cache', 'system-messages', 'tmux',
|
|
@@ -93,6 +98,16 @@ const COMMANDER_SUBCOMMANDS = new Set([
|
|
|
93
98
|
]);
|
|
94
99
|
const __firstPositional = args.find((a) => !a.startsWith('-'));
|
|
95
100
|
if (__firstPositional && COMMANDER_SUBCOMMANDS.has(__firstPositional)) {
|
|
101
|
+
// A few delegated subcommands talk to the cortex server over HTTP (they connect via
|
|
102
|
+
// CortexClient to localhost:PORT). Auto-start the server first so e.g.
|
|
103
|
+
// `cortex mcp enable <name>` works without a running server instead of failing with a
|
|
104
|
+
// bare "fetch failed". File-only subcommands (mcp init/edit/list/validate) don't need it.
|
|
105
|
+
const __sub = args.find((a) => !a.startsWith('-') && a !== __firstPositional);
|
|
106
|
+
const __needsServer =
|
|
107
|
+
__firstPositional === 'mcp' && ['enable', 'disable', 'tools', 'status', 'server'].includes(__sub);
|
|
108
|
+
if (__needsServer) {
|
|
109
|
+
await ensureServer();
|
|
110
|
+
}
|
|
96
111
|
const CLI_ENTRY = join(__cortex_dirname, '..', 'dist', 'index.js');
|
|
97
112
|
const res = spawnSync(process.execPath, [CLI_ENTRY, ...args], { stdio: 'inherit' });
|
|
98
113
|
process.exit(res.status ?? 0);
|
|
@@ -140,7 +155,7 @@ const modelId = getFlagValue('--model') || getFlagValue('-m');
|
|
|
140
155
|
const resumeId = getFlagValue('--resume');
|
|
141
156
|
const prMode = getFlagValue('--pr');
|
|
142
157
|
const timeoutFlag = getFlagValue('--timeout');
|
|
143
|
-
|
|
158
|
+
idleTimeoutFlag = getFlagValue('--idle-timeout');
|
|
144
159
|
const cwdFlag = getFlagValue('--cwd'); // `cortex agent` target directory
|
|
145
160
|
hasFlag('--yolo'); // accepted but redundant — agent auto-approves by default
|
|
146
161
|
const messageTimeoutMs = timeoutFlag ? parseInt(timeoutFlag, 10) : 600000; // 10 min default for messages
|
|
@@ -286,7 +301,17 @@ async function startServer() {
|
|
|
286
301
|
}
|
|
287
302
|
serverProcess = spawn('node', serverArgs, {
|
|
288
303
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
289
|
-
|
|
304
|
+
// Run the server in — and treat as project root — the directory cortex was invoked
|
|
305
|
+
// from, so `cd foo && cortex "..."` operates on `foo` (not the home dir or a stale
|
|
306
|
+
// PROJECT_PATH from the global ~/.cortex/.env). An explicitly-exported PROJECT_PATH /
|
|
307
|
+
// PROJECT_ROOT still wins (e.g. the autoresearch container sets one deliberately).
|
|
308
|
+
cwd: process.cwd(),
|
|
309
|
+
env: {
|
|
310
|
+
...process.env,
|
|
311
|
+
PORT: BASE_PORT,
|
|
312
|
+
PROJECT_PATH: process.env.PROJECT_PATH || process.cwd(),
|
|
313
|
+
PROJECT_ROOT: process.env.PROJECT_ROOT || process.cwd(),
|
|
314
|
+
},
|
|
290
315
|
detached: true,
|
|
291
316
|
});
|
|
292
317
|
serverProcess.unref();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexus-cortex/cli",
|
|
3
|
-
"version": "4.34.
|
|
3
|
+
"version": "4.34.6",
|
|
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.34.
|
|
22
|
+
"@nexus-cortex/core": "^4.34.6",
|
|
23
23
|
"chalk": "^4.1.2",
|
|
24
24
|
"cli-spinners": "^2.9.0",
|
|
25
25
|
"commander": "^11.0.0",
|