Lines 1-44javascript
4 * cortex — Natural language interface to the Nexus Cortex library
7 * cortex "Read package.json and tell me the version"
8 * cortex --model deepseek-v4-flash "Explain generics"
9 * cortex --resume abc123 "Continue from where we left off"
10 * cortex --new "Start a fresh conversation"
11 * cortex --json "Give me raw response"
15 * Connects to a running Nexus Cortex server (default: localhost:4000).
16 * If no server is running, prints instructions to start one.
19 * - Quick natural language queries from the shell
20 * - Agent-to-agent communication (invoke as a task tool)
21 * - Scripting and pipeline integration (--json mode)
22 * - Multi-turn conversations via session resume
25import { spawn, spawnSync } from 'child_process';
26import { fileURLToPath } from 'url';
HighEntrypoint Build Divergence
Manifest entrypoint contains risky behavior absent from dist/build output.
bin/cortex.jsView on unpkg · L6 HighChild Process
Package source references child process execution.
bin/cortex.jsView on unpkg · L24 27import { dirname, join, resolve } from 'path';
28import { existsSync, readFileSync, realpathSync, mkdirSync, openSync, writeFileSync, copyFileSync } from 'fs';
29import { homedir } from 'os';
30import { createRequire } from 'module';
32const __cortex_require = createRequire(import.meta.url);
33const __cortex_filename = fileURLToPath(import.meta.url);
34const __cortex_dirname = dirname(realpathSync(__cortex_filename));
35const MONOREPO_ROOT = resolve(__cortex_dirname, '..', '..', '..');
37// Locate the server entry. From a git clone it's the monorepo's built server;
38// from an npm install (`@nexus-cortex/cli` alongside `@nexus-cortex/server`) it's
39// resolved through node_modules. Falls back to the monorepo path so the
40// "not found" guidance in startServer() still fires when neither exists.
41function resolveServerEntry() {
42 const monorepoServer = join(MONOREPO_ROOT, 'packages', 'server', 'dist', 'index.js');
43 if (existsSync(monorepoServer)) return monorepoServer;