@gokulvenkatareddy/cortex 0.1.8 → 0.1.9

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.
Files changed (3) hide show
  1. package/bin/cortex +46 -46
  2. package/dist/cli.mjs +10 -10
  3. package/package.json +1 -1
package/bin/cortex CHANGED
@@ -1,46 +1,46 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * CORTEX — Global CLI entry point
4
- *
4
+ *
5
5
  * Works anywhere — even when installed via:
6
- * npm install -g @gokul77898/cortex
7
- * npx @gokul77898/cortex
8
- *
6
+ * npm install -g @gokulvenkatareddy/cortex
7
+ * npx @gokulvenkatareddy/cortex
8
+ *
9
9
  * Config lives in ~/.cortex/.env (the user's machine, NOT this package).
10
10
  * API keys are NEVER stored in the npm package folder.
11
11
  */
12
12
 
13
- import { execFileSync, spawn } from 'child_process'
14
- import * as fs from 'fs'
15
- import * as os from 'os'
16
- import * as path from 'path'
17
- import { fileURLToPath } from 'url'
13
+ import { execFileSync, spawn } from 'child_process';
14
+ import * as fs from 'fs';
15
+ import * as os from 'os';
16
+ import * as path from 'path';
17
+ import { fileURLToPath } from 'url';
18
18
 
19
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
20
- const ROOT = path.resolve(__dirname, '..')
21
- const CLI_PATH = path.join(ROOT, 'dist', 'cli.mjs')
22
- const WIZARD = path.join(ROOT, 'scripts', 'setup-wizard.ts')
19
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
20
+ const ROOT = path.resolve(__dirname, '..');
21
+ const CLI_PATH = path.join(ROOT, 'dist', 'cli.mjs');
22
+ const WIZARD = path.join(ROOT, 'scripts', 'setup-wizard.ts');
23
23
 
24
24
  // Config lives in the user's home dir, NOT the package folder
25
- const CONFIG_DIR = path.join(os.homedir(), '.cortex')
26
- const CONFIG_ENV = path.join(CONFIG_DIR, '.env')
25
+ const CONFIG_DIR = path.join(os.homedir(), '.cortex');
26
+ const CONFIG_ENV = path.join(CONFIG_DIR, '.env');
27
27
 
28
- const args = process.argv.slice(2)
28
+ const args = process.argv.slice(2);
29
29
 
30
30
  // ─── Load ~/.cortex/.env into the environment ──────────────────────────────
31
- function loadUserConfig(): Record<string, string> {
32
- if (!fs.existsSync(CONFIG_ENV)) return {}
33
- const lines = fs.readFileSync(CONFIG_ENV, 'utf8').split('\n')
34
- const env: Record<string, string> = {}
31
+ function loadUserConfig() {
32
+ if (!fs.existsSync(CONFIG_ENV)) return {};
33
+ const lines = fs.readFileSync(CONFIG_ENV, 'utf8').split('\n');
34
+ const env = {};
35
35
  for (const line of lines) {
36
- const m = line.match(/^([A-Z_]+)=(.+)$/)
37
- if (m) env[m[1]] = m[2]
36
+ const m = line.match(/^([A-Z_]+)=(.+)$/);
37
+ if (m) env[m[1]] = m[2];
38
38
  }
39
- return env
39
+ return env;
40
40
  }
41
41
 
42
- function isConfigured(): boolean {
43
- const env = loadUserConfig()
42
+ function isConfigured() {
43
+ const env = loadUserConfig();
44
44
  return !!(
45
45
  env['NVIDIA_API_KEY'] ||
46
46
  env['OPENAI_API_KEY'] ||
@@ -58,52 +58,52 @@ function runWizard() {
58
58
  ['bun', [WIZARD]],
59
59
  ['npx', ['--yes', 'tsx', WIZARD]],
60
60
  ['node', ['--loader', 'ts-node/esm', WIZARD]],
61
- ]
61
+ ];
62
62
 
63
63
  for (const [cmd, cmdArgs] of runners) {
64
64
  try {
65
- execFileSync(cmd as string, cmdArgs as string[], { stdio: 'inherit', cwd: ROOT })
66
- return
67
- } catch {
68
- continue
65
+ execFileSync(cmd, cmdArgs, { stdio: 'inherit', cwd: ROOT });
66
+ return;
67
+ } catch (e) {
68
+ continue;
69
69
  }
70
70
  }
71
71
 
72
- console.error('\n❌ Could not run setup wizard.')
73
- console.error(' Install bun first: https://bun.sh\n')
74
- process.exit(1)
72
+ console.error('\n❌ Could not run setup wizard.');
73
+ console.error(' Install bun first: https://bun.sh\n');
74
+ process.exit(1);
75
75
  }
76
76
 
77
77
  // ─── Launch CORTEX with user config injected ───────────────────────────────
78
- function launchCortex(extraEnv: Record<string, string> = {}) {
78
+ function launchCortex(extraEnv = {}) {
79
79
  if (!fs.existsSync(CLI_PATH)) {
80
- console.error(`\n❌ dist/cli.mjs not found. Run: npm run build\n`)
81
- process.exit(1)
80
+ console.error(`\n❌ dist/cli.mjs not found.\n`);
81
+ process.exit(1);
82
82
  }
83
83
 
84
- const userConfig = loadUserConfig()
85
- const mergedEnv = { ...process.env, ...userConfig, ...extraEnv }
84
+ const userConfig = loadUserConfig();
85
+ const mergedEnv = { ...process.env, ...userConfig, ...extraEnv };
86
86
 
87
87
  const proc = spawn('node', [CLI_PATH, ...args], {
88
88
  stdio: 'inherit',
89
89
  cwd: ROOT,
90
90
  env: mergedEnv,
91
- })
91
+ });
92
92
 
93
- proc.on('exit', code => process.exit(code ?? 0))
93
+ proc.on('exit', code => process.exit(code ?? 0));
94
94
  }
95
95
 
96
96
  // ─── Entry point ───────────────────────────────────────────────────────────
97
97
  if (args[0] === 'setup' || args[0] === 'init' || args[0] === 'configure' || args[0] === 'login') {
98
98
  // Force re-run wizard
99
- runWizard()
100
- launchCortex()
99
+ runWizard();
100
+ launchCortex();
101
101
  } else if (!isConfigured()) {
102
102
  // First time — run wizard then launch
103
- console.log('\n Welcome to CORTEX! Running first-time setup...\n')
104
- runWizard()
105
- launchCortex()
103
+ console.log('\n Welcome to CORTEX! Running first-time setup...\n');
104
+ runWizard();
105
+ launchCortex();
106
106
  } else {
107
107
  // Already configured — launch directly
108
- launchCortex()
108
+ launchCortex();
109
109
  }
package/dist/cli.mjs CHANGED
@@ -367806,7 +367806,7 @@ function getCORTEXEnvMetadata() {
367806
367806
  function getBuildAgeMinutes() {
367807
367807
  if (false)
367808
367808
  ;
367809
- const buildTime = new Date("2026-05-07T10:26:56.208Z").getTime();
367809
+ const buildTime = new Date("2026-05-07T10:32:20.024Z").getTime();
367810
367810
  if (isNaN(buildTime))
367811
367811
  return;
367812
367812
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -394597,7 +394597,7 @@ function buildPrimarySection() {
394597
394597
  }, undefined, false, undefined, this);
394598
394598
  return [{
394599
394599
  label: "Version",
394600
- value: "0.1.8"
394600
+ value: "0.1.9"
394601
394601
  }, {
394602
394602
  label: "Session name",
394603
394603
  value: nameValue
@@ -460176,7 +460176,7 @@ var init_bridge_kick = __esm(() => {
460176
460176
  var call60 = async () => {
460177
460177
  return {
460178
460178
  type: "text",
460179
- value: `${"99.0.0"} (built ${"2026-05-07T10:26:56.208Z"})`
460179
+ value: `${"99.0.0"} (built ${"2026-05-07T10:32:20.024Z"})`
460180
460180
  };
460181
460181
  }, version2, version_default;
460182
460182
  var init_version = __esm(() => {
@@ -534306,7 +534306,7 @@ function WelcomeV2() {
534306
534306
  dimColor: true,
534307
534307
  children: [
534308
534308
  "v",
534309
- "0.1.8",
534309
+ "0.1.9",
534310
534310
  " "
534311
534311
  ]
534312
534312
  }, undefined, true, undefined, this)
@@ -534506,7 +534506,7 @@ function WelcomeV2() {
534506
534506
  dimColor: true,
534507
534507
  children: [
534508
534508
  "v",
534509
- "0.1.8",
534509
+ "0.1.9",
534510
534510
  " "
534511
534511
  ]
534512
534512
  }, undefined, true, undefined, this)
@@ -534732,7 +534732,7 @@ function AppleTerminalWelcomeV2(t0) {
534732
534732
  dimColor: true,
534733
534733
  children: [
534734
534734
  "v",
534735
- "0.1.8",
534735
+ "0.1.9",
534736
534736
  " "
534737
534737
  ]
534738
534738
  }, undefined, true, undefined, this);
@@ -534986,7 +534986,7 @@ function AppleTerminalWelcomeV2(t0) {
534986
534986
  dimColor: true,
534987
534987
  children: [
534988
534988
  "v",
534989
- "0.1.8",
534989
+ "0.1.9",
534990
534990
  " "
534991
534991
  ]
534992
534992
  }, undefined, true, undefined, this);
@@ -554867,7 +554867,7 @@ Usage: cortex --remote "your task description"`, () => gracefulShutdown(1));
554867
554867
  pendingHookMessages
554868
554868
  }, renderAndRun);
554869
554869
  }
554870
- }).version("0.1.8 (CORTEX)", "-v, --version", "Output the version number");
554870
+ }).version("0.1.9 (CORTEX)", "-v, --version", "Output the version number");
554871
554871
  program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
554872
554872
  program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
554873
554873
  if (canUserConfigureAdvisor()) {
@@ -555462,7 +555462,7 @@ if (false) {}
555462
555462
  async function main2() {
555463
555463
  const args = process.argv.slice(2);
555464
555464
  if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
555465
- const v = typeof MACRO !== "undefined" ? "0.1.8" : "99.0.0-dev";
555465
+ const v = typeof MACRO !== "undefined" ? "0.1.9" : "99.0.0-dev";
555466
555466
  console.log(`${v} (CORTEX)`);
555467
555467
  return;
555468
555468
  }
@@ -555647,4 +555647,4 @@ ${DIM4} session id:${RESET4} ${BOLD2}${handle.sessionId}${RESET4} ${DIM4}(rotat
555647
555647
  }
555648
555648
  main2();
555649
555649
 
555650
- //# debugId=BA466C33C47FEA3864756E2164756E21
555650
+ //# debugId=980A0E66F60E322964756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gokulvenkatareddy/cortex",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "CORTEX — Autonomous AGI Terminal. Any LLM, one command. NVIDIA, OpenAI, Gemini, Groq, Ollama and more.",
5
5
  "type": "module",
6
6
  "bin": {