@danainnovations/cortex-mcp 1.0.79 → 1.0.81

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.
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ openBrowser
4
+ } from "./chunk-HXROEPYY.js";
5
+ export {
6
+ openBrowser
7
+ };
8
+ //# sourceMappingURL=browser-RCYYNQJN.js.map
@@ -46,6 +46,33 @@ function getWindowsHomeFromWSL() {
46
46
  }
47
47
  return null;
48
48
  }
49
+ function getStoreClaudePath() {
50
+ try {
51
+ const localAppData = process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local");
52
+ const packagesDir = join(localAppData, "Packages");
53
+ const dirs = readdirSync(packagesDir).filter((d) => d.startsWith("Claude_"));
54
+ if (dirs.length > 0) {
55
+ return join(
56
+ packagesDir,
57
+ dirs[0],
58
+ "LocalCache",
59
+ "Roaming",
60
+ "Claude",
61
+ "claude_desktop_config.json"
62
+ );
63
+ }
64
+ } catch {
65
+ }
66
+ return null;
67
+ }
68
+ function getStandardClaudeDesktopPath() {
69
+ const home = homedir();
70
+ return join(
71
+ process.env.APPDATA || join(home, "AppData", "Roaming"),
72
+ "Claude",
73
+ "claude_desktop_config.json"
74
+ );
75
+ }
49
76
  function getClaudeDesktopConfigPath() {
50
77
  const home = getHomeDir();
51
78
  const p = getPlatform();
@@ -64,12 +91,11 @@ function getClaudeDesktopConfigPath() {
64
91
  "Claude",
65
92
  "claude_desktop_config.json"
66
93
  );
67
- case "windows":
68
- return join(
69
- process.env.APPDATA || join(home, "AppData", "Roaming"),
70
- "Claude",
71
- "claude_desktop_config.json"
72
- );
94
+ case "windows": {
95
+ const storePath = getStoreClaudePath();
96
+ if (storePath) return storePath;
97
+ return getStandardClaudeDesktopPath();
98
+ }
73
99
  case "linux":
74
100
  return join(home, ".config", "Claude", "claude_desktop_config.json");
75
101
  }
@@ -104,6 +130,8 @@ export {
104
130
  getHomeDir,
105
131
  getPlatform,
106
132
  isWSL,
133
+ getStoreClaudePath,
134
+ getStandardClaudeDesktopPath,
107
135
  getClaudeDesktopConfigPath,
108
136
  getCursorConfigPath,
109
137
  getVSCodeMcpConfigPath,
@@ -111,4 +139,4 @@ export {
111
139
  getCodexConfigPath,
112
140
  openBrowser
113
141
  };
114
- //# sourceMappingURL=chunk-YA4Q2GAN.js.map
142
+ //# sourceMappingURL=chunk-HXROEPYY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/browser.ts","../src/utils/platform.ts"],"sourcesContent":["import { exec } from \"node:child_process\";\nimport { getPlatform } from \"./platform.js\";\n\nexport function openBrowser(url: string): Promise<void> {\n return new Promise((resolve) => {\n const platform = getPlatform();\n const cmd =\n platform === \"macos\" ? `open \"${url}\"` :\n platform === \"windows\" ? `start \"\" \"${url}\"` :\n `xdg-open \"${url}\"`;\n exec(cmd, () => resolve());\n });\n}\n","import { homedir, platform } from \"node:os\";\nimport { join } from \"node:path\";\nimport { readFileSync, readdirSync } from \"node:fs\";\nimport { execSync } from \"node:child_process\";\n\n/** Get the user's home directory */\nexport function getHomeDir(): string {\n return homedir();\n}\n\n/** Get the current platform */\nexport function getPlatform(): \"macos\" | \"windows\" | \"linux\" {\n const p = platform();\n if (p === \"darwin\") return \"macos\";\n if (p === \"win32\") return \"windows\";\n return \"linux\";\n}\n\n/** Detect if running inside Windows Subsystem for Linux */\nexport function isWSL(): boolean {\n if (getPlatform() !== \"linux\") return false;\n try {\n const version = readFileSync(\"/proc/version\", \"utf-8\");\n return /microsoft|wsl/i.test(version);\n } catch {\n return false;\n }\n}\n\n/** Resolve the Windows user home directory from within WSL via /mnt/c */\nfunction getWindowsHomeFromWSL(): string | null {\n try {\n // Try cmd.exe to get the Windows USERNAME\n const raw = execSync(\"cmd.exe /c echo %USERNAME%\", {\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n timeout: 5000,\n }).toString().trim().replace(/\\r/g, \"\");\n if (raw && raw !== \"%USERNAME%\") {\n return `/mnt/c/Users/${raw}`;\n }\n } catch {\n // cmd.exe may not be available — fall through\n }\n\n try {\n // Fallback: scan /mnt/c/Users for a single non-system user directory\n const dirs = readdirSync(\"/mnt/c/Users\").filter(\n (d) =>\n d !== \"Public\" &&\n d !== \"Default\" &&\n d !== \"Default User\" &&\n d !== \"All Users\" &&\n !d.startsWith(\".\")\n );\n if (dirs.length === 1) return `/mnt/c/Users/${dirs[0]}`;\n } catch {\n // /mnt/c not mounted\n }\n\n return null;\n}\n\n/**\n * Detect Microsoft Store Claude Desktop install path.\n * Store apps use a virtualized filesystem under LocalCache\\Roaming.\n */\nexport function getStoreClaudePath(): string | null {\n try {\n const localAppData = process.env.LOCALAPPDATA || join(homedir(), \"AppData\", \"Local\");\n const packagesDir = join(localAppData, \"Packages\");\n const dirs = readdirSync(packagesDir).filter((d) => d.startsWith(\"Claude_\"));\n if (dirs.length > 0) {\n return join(\n packagesDir,\n dirs[0],\n \"LocalCache\",\n \"Roaming\",\n \"Claude\",\n \"claude_desktop_config.json\"\n );\n }\n } catch {\n // Not a Store install or can't read Packages dir\n }\n return null;\n}\n\n/**\n * Get the standard (non-Store) Claude Desktop config path on Windows.\n */\nexport function getStandardClaudeDesktopPath(): string {\n const home = homedir();\n return join(\n process.env.APPDATA || join(home, \"AppData\", \"Roaming\"),\n \"Claude\",\n \"claude_desktop_config.json\"\n );\n}\n\n/**\n * Get the Claude Desktop config file path for the current platform.\n * On Windows, prefers the Microsoft Store virtualized path if detected.\n */\nexport function getClaudeDesktopConfigPath(): string {\n const home = getHomeDir();\n const p = getPlatform();\n\n // WSL: Claude Desktop is a Windows app — write to the Windows AppData path\n if (p === \"linux\" && isWSL()) {\n const winHome = getWindowsHomeFromWSL();\n if (winHome) {\n return join(winHome, \"AppData\", \"Roaming\", \"Claude\", \"claude_desktop_config.json\");\n }\n }\n\n switch (p) {\n case \"macos\":\n return join(\n home,\n \"Library\",\n \"Application Support\",\n \"Claude\",\n \"claude_desktop_config.json\"\n );\n case \"windows\": {\n // Prefer Microsoft Store path if installed (virtualized filesystem)\n const storePath = getStoreClaudePath();\n if (storePath) return storePath;\n return getStandardClaudeDesktopPath();\n }\n case \"linux\":\n return join(home, \".config\", \"Claude\", \"claude_desktop_config.json\");\n }\n}\n\n/**\n * Get the Cursor MCP config file path for the current platform.\n */\nexport function getCursorConfigPath(): string {\n const home = getHomeDir();\n return join(home, \".cursor\", \"mcp.json\");\n}\n\n/**\n * Get the VS Code MCP config file path for the current platform.\n */\nexport function getVSCodeMcpConfigPath(): string {\n const home = getHomeDir();\n return join(home, \".vscode\", \"mcp.json\");\n}\n\n/**\n * Get the Antigravity MCP config file path for the current platform.\n */\nexport function getAntigravityConfigPath(): string {\n const home = getHomeDir();\n return join(home, \".gemini\", \"antigravity\", \"mcp_config.json\");\n}\n\n/**\n * Get the Codex (OpenAI) config file path.\n * Shared by both Codex CLI and Codex IDE extension.\n */\nexport function getCodexConfigPath(): string {\n const home = getHomeDir();\n return join(home, \".codex\", \"config.toml\");\n}\n"],"mappings":"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","names":["platform"]}
package/dist/cli.js CHANGED
@@ -17,10 +17,12 @@ import {
17
17
  getCursorConfigPath,
18
18
  getHomeDir,
19
19
  getPlatform,
20
+ getStandardClaudeDesktopPath,
21
+ getStoreClaudePath,
20
22
  getVSCodeMcpConfigPath,
21
23
  isWSL,
22
24
  openBrowser
23
- } from "./chunk-YA4Q2GAN.js";
25
+ } from "./chunk-HXROEPYY.js";
24
26
 
25
27
  // bin/cli.ts
26
28
  import { Command } from "commander";
@@ -1231,6 +1233,13 @@ function getWizardHtml() {
1231
1233
  return html;
1232
1234
  }).join('');
1233
1235
 
1236
+ // Add verify button for debugging config issues
1237
+ var verifyHtml = '<div style="margin-top: 12px; text-align: center;">' +
1238
+ '<button onclick="verifyConfig()" style="background: transparent; border: 1px solid #555; color: #aaa; padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 12px;">Verify Config File</button>' +
1239
+ '<pre id="verify-result" style="display:none; margin-top: 8px; padding: 10px; background: #1a1a2e; border-radius: 6px; font-size: 11px; text-align: left; max-height: 200px; overflow: auto; color: #ccc;"></pre>' +
1240
+ '</div>';
1241
+ resultEl.innerHTML += verifyHtml;
1242
+
1234
1243
  btn.textContent = 'Continue';
1235
1244
  btn.disabled = false;
1236
1245
  btn.onclick = function() { goToStep('connect'); };
@@ -1427,6 +1436,19 @@ function getWizardHtml() {
1427
1436
  });
1428
1437
  }
1429
1438
 
1439
+ async function verifyConfig() {
1440
+ var el = document.getElementById('verify-result');
1441
+ el.style.display = 'block';
1442
+ el.textContent = 'Reading config file...';
1443
+ try {
1444
+ var resp = await fetch('/api/debug/config');
1445
+ var data = await resp.json();
1446
+ el.textContent = JSON.stringify(data, null, 2);
1447
+ } catch (err) {
1448
+ el.textContent = 'Error: ' + err.message;
1449
+ }
1450
+ }
1451
+
1430
1452
  function copySnippet(btn) {
1431
1453
  var pre = btn.parentElement.querySelector('pre');
1432
1454
  navigator.clipboard.writeText(pre.textContent).then(function() {
@@ -1445,6 +1467,9 @@ function getWizardHtml() {
1445
1467
  </html>`;
1446
1468
  }
1447
1469
 
1470
+ // src/wizard/routes.ts
1471
+ import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
1472
+
1448
1473
  // src/config/clients.ts
1449
1474
  import { existsSync, readFileSync, writeFileSync } from "fs";
1450
1475
  import { dirname } from "path";
@@ -1572,6 +1597,36 @@ function configureClaudeDesktop(_serverUrl, apiKey, _mcps) {
1572
1597
  }
1573
1598
  servers["cortex"] = cortexEntry;
1574
1599
  writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
1600
+ if (getPlatform() === "windows") {
1601
+ const storePath = getStoreClaudePath();
1602
+ const standardPath = getStandardClaudeDesktopPath();
1603
+ const altPath = configPath === storePath ? standardPath : storePath;
1604
+ if (altPath && altPath !== configPath) {
1605
+ try {
1606
+ const altDir = dirname(altPath);
1607
+ if (!existsSync(altDir)) {
1608
+ mkdirSync(altDir, { recursive: true });
1609
+ }
1610
+ let altConfig = {};
1611
+ if (existsSync(altPath)) {
1612
+ try {
1613
+ altConfig = JSON.parse(readFileSync(altPath, "utf-8"));
1614
+ } catch {
1615
+ }
1616
+ }
1617
+ if (!altConfig.mcpServers || typeof altConfig.mcpServers !== "object") {
1618
+ altConfig.mcpServers = {};
1619
+ }
1620
+ const altServers = altConfig.mcpServers;
1621
+ for (const key of Object.keys(altServers)) {
1622
+ if (key.startsWith("cortex-") || key === "cortex") delete altServers[key];
1623
+ }
1624
+ altServers["cortex"] = cortexEntry;
1625
+ writeFileSync(altPath, JSON.stringify(altConfig, null, 2) + "\n");
1626
+ } catch {
1627
+ }
1628
+ }
1629
+ }
1575
1630
  if (isWindowsTarget) {
1576
1631
  const start = Date.now();
1577
1632
  while (Date.now() - start < 500) {
@@ -2107,6 +2162,28 @@ async function handleApiRoute(path, searchParams, req, res, options, onComplete)
2107
2162
  json(res, { results });
2108
2163
  return true;
2109
2164
  }
2165
+ if (path === "/api/debug/config" && method === "GET") {
2166
+ const configPath = getClaudeDesktopConfigPath();
2167
+ const result = {
2168
+ path: configPath,
2169
+ exists: existsSync4(configPath),
2170
+ platform: getPlatform()
2171
+ };
2172
+ if (existsSync4(configPath)) {
2173
+ try {
2174
+ const raw = readFileSync4(configPath, "utf-8");
2175
+ const parsed = JSON.parse(raw);
2176
+ result.contents = parsed;
2177
+ result.hasMcpServers = !!parsed?.mcpServers;
2178
+ result.hasCortex = !!parsed?.mcpServers?.cortex;
2179
+ } catch (e) {
2180
+ result.error = String(e);
2181
+ result.rawContents = readFileSync4(configPath, "utf-8");
2182
+ }
2183
+ }
2184
+ json(res, result);
2185
+ return true;
2186
+ }
2110
2187
  if (path === "/api/connections" && method === "GET") {
2111
2188
  const apiKey = getState().apiKey;
2112
2189
  try {
@@ -2342,7 +2419,7 @@ async function runConfigure(options) {
2342
2419
  }
2343
2420
 
2344
2421
  // src/proxy/stdio-server.ts
2345
- import { readFileSync as readFileSync5, statSync as statSync2 } from "fs";
2422
+ import { readFileSync as readFileSync6, statSync as statSync2 } from "fs";
2346
2423
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2347
2424
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2348
2425
  import {
@@ -2458,9 +2535,9 @@ var CortexHttpClient = class {
2458
2535
  import {
2459
2536
  copyFileSync,
2460
2537
  cpSync,
2461
- existsSync as existsSync4,
2538
+ existsSync as existsSync5,
2462
2539
  mkdirSync as mkdirSync4,
2463
- readFileSync as readFileSync4,
2540
+ readFileSync as readFileSync5,
2464
2541
  readdirSync,
2465
2542
  rmSync,
2466
2543
  statSync,
@@ -2513,7 +2590,7 @@ function resolvePath(p) {
2513
2590
  }
2514
2591
  function isBinaryFile(filePath) {
2515
2592
  try {
2516
- const fd = readFileSync4(filePath, { flag: "r" });
2593
+ const fd = readFileSync5(filePath, { flag: "r" });
2517
2594
  const chunk = fd.subarray(0, BINARY_CHECK_SIZE);
2518
2595
  if (chunk.length === 0) return false;
2519
2596
  for (const sig of BINARY_SIGNATURES) {
@@ -2600,7 +2677,7 @@ function handleReadFile(args) {
2600
2677
  throw new Error(`File size (${stat.size} bytes) exceeds maximum allowed size (${MAX_READ_SIZE} bytes).`);
2601
2678
  }
2602
2679
  if (isBinaryFile(filePath)) {
2603
- const raw = readFileSync4(filePath);
2680
+ const raw = readFileSync5(filePath);
2604
2681
  return ok({
2605
2682
  content: raw.toString("base64"),
2606
2683
  is_binary: true,
@@ -2609,7 +2686,7 @@ function handleReadFile(args) {
2609
2686
  path: filePath
2610
2687
  });
2611
2688
  }
2612
- const text = readFileSync4(filePath, encoding);
2689
+ const text = readFileSync5(filePath, encoding);
2613
2690
  return ok({
2614
2691
  content: text,
2615
2692
  is_binary: false,
@@ -2630,7 +2707,7 @@ function handleReadFileLines(args) {
2630
2707
  }
2631
2708
  if (startLine < 1) throw new Error("start_line must be >= 1.");
2632
2709
  if (endLine !== void 0 && endLine < startLine) throw new Error("end_line must be >= start_line.");
2633
- const text = readFileSync4(filePath, encoding);
2710
+ const text = readFileSync5(filePath, encoding);
2634
2711
  const allLines = text.split(/\n/);
2635
2712
  const totalLines = allLines.length;
2636
2713
  const startIdx = startLine - 1;
@@ -2653,7 +2730,7 @@ function handleWriteFile(args) {
2653
2730
  const isBinary = args.is_binary || false;
2654
2731
  const overwrite = args.overwrite !== false;
2655
2732
  const createParents = args.create_parents || false;
2656
- const created = !existsSync4(filePath);
2733
+ const created = !existsSync5(filePath);
2657
2734
  if (!overwrite && !created) {
2658
2735
  throw new Error("File already exists.");
2659
2736
  }
@@ -2684,7 +2761,7 @@ function handleAppendFile(args) {
2684
2761
  const filePath = resolvePath(args.path);
2685
2762
  const content = args.content;
2686
2763
  const encoding = args.encoding || "utf-8";
2687
- if (!existsSync4(filePath)) throw new Error("File not found.");
2764
+ if (!existsSync5(filePath)) throw new Error("File not found.");
2688
2765
  const encoded = Buffer.from(content, encoding);
2689
2766
  appendFileSync(filePath, content, encoding);
2690
2767
  const newSize = statSync(filePath).size;
@@ -2697,7 +2774,7 @@ function handleAppendFile(args) {
2697
2774
  function handleCreateDirectory(args) {
2698
2775
  const dirPath = resolvePath(args.path);
2699
2776
  const parents = args.parents !== false;
2700
- if (existsSync4(dirPath)) {
2777
+ if (existsSync5(dirPath)) {
2701
2778
  return ok({ path: dirPath, created: false });
2702
2779
  }
2703
2780
  if (parents) {
@@ -2710,7 +2787,7 @@ function handleCreateDirectory(args) {
2710
2787
  function handleDelete(args) {
2711
2788
  const targetPath = resolvePath(args.path);
2712
2789
  const recursive = args.recursive || false;
2713
- if (!existsSync4(targetPath)) throw new Error("Path not found.");
2790
+ if (!existsSync5(targetPath)) throw new Error("Path not found.");
2714
2791
  const stat = statSync(targetPath, { throwIfNoEntry: false });
2715
2792
  if (!stat) throw new Error("Path not found.");
2716
2793
  if (stat.isDirectory()) {
@@ -2740,8 +2817,8 @@ function handleMove(args) {
2740
2817
  const source = resolvePath(args.source);
2741
2818
  const destination = resolvePath(args.destination);
2742
2819
  const overwrite = args.overwrite || false;
2743
- if (!existsSync4(source)) throw new Error("Source path not found.");
2744
- if (existsSync4(destination) && !overwrite) throw new Error("Destination already exists.");
2820
+ if (!existsSync5(source)) throw new Error("Source path not found.");
2821
+ if (existsSync5(destination) && !overwrite) throw new Error("Destination already exists.");
2745
2822
  const stat = statSync(source);
2746
2823
  const type = stat.isDirectory() ? "directory" : "file";
2747
2824
  const bytesMoved = stat.isDirectory() ? countDirectoryContents(source).bytes : stat.size;
@@ -2771,11 +2848,11 @@ function handleCopy(args) {
2771
2848
  const source = resolvePath(args.source);
2772
2849
  const destination = resolvePath(args.destination);
2773
2850
  const overwrite = args.overwrite || false;
2774
- if (!existsSync4(source)) throw new Error("Source path not found.");
2775
- if (existsSync4(destination) && !overwrite) throw new Error("Destination already exists.");
2851
+ if (!existsSync5(source)) throw new Error("Source path not found.");
2852
+ if (existsSync5(destination) && !overwrite) throw new Error("Destination already exists.");
2776
2853
  const stat = statSync(source);
2777
2854
  if (stat.isDirectory()) {
2778
- if (existsSync4(destination) && overwrite) {
2855
+ if (existsSync5(destination) && overwrite) {
2779
2856
  rmSync(destination, { recursive: true });
2780
2857
  }
2781
2858
  cpSync(source, destination, { recursive: true });
@@ -2792,7 +2869,7 @@ function handleListDirectory(args) {
2792
2869
  const maxDepth = args.max_depth || 1;
2793
2870
  const pattern = args.pattern;
2794
2871
  const includeHidden = args.include_hidden || false;
2795
- if (!existsSync4(dirPath)) throw new Error("Directory not found.");
2872
+ if (!existsSync5(dirPath)) throw new Error("Directory not found.");
2796
2873
  const stat = statSync(dirPath);
2797
2874
  if (!stat.isDirectory()) throw new Error("Path is not a directory.");
2798
2875
  const effectiveDepth = recursive ? maxDepth : 1;
@@ -2847,7 +2924,7 @@ function handleListDirectory(args) {
2847
2924
  }
2848
2925
  function handleExists(args) {
2849
2926
  const targetPath = resolvePath(args.path);
2850
- const pathExists = existsSync4(targetPath);
2927
+ const pathExists = existsSync5(targetPath);
2851
2928
  let type = null;
2852
2929
  if (pathExists) {
2853
2930
  const stat = statSync(targetPath, { throwIfNoEntry: false });
@@ -2859,7 +2936,7 @@ function handleExists(args) {
2859
2936
  }
2860
2937
  function handleGetFileInfo(args) {
2861
2938
  const filePath = resolvePath(args.path);
2862
- if (!existsSync4(filePath)) throw new Error("Path not found.");
2939
+ if (!existsSync5(filePath)) throw new Error("Path not found.");
2863
2940
  const stat = statSync(filePath, { throwIfNoEntry: false });
2864
2941
  if (!stat) throw new Error("Path not found.");
2865
2942
  const isDir = stat.isDirectory();
@@ -2885,7 +2962,7 @@ function handleSearchFiles(args) {
2885
2962
  const recursive = args.recursive !== false;
2886
2963
  const includeHidden = args.include_hidden || false;
2887
2964
  const maxResults = args.max_results || 1e3;
2888
- if (!existsSync4(searchPath)) throw new Error("Directory not found.");
2965
+ if (!existsSync5(searchPath)) throw new Error("Directory not found.");
2889
2966
  if (!statSync(searchPath).isDirectory()) throw new Error("Path is not a directory.");
2890
2967
  const patternRe = globToRegex(pattern);
2891
2968
  const matches = [];
@@ -2932,7 +3009,7 @@ function handleFindInFiles(args) {
2932
3009
  const contextLines = args.context_lines || 0;
2933
3010
  const maxResults = args.max_results || 500;
2934
3011
  const includeHidden = args.include_hidden || false;
2935
- if (!existsSync4(searchPath)) throw new Error("Directory not found.");
3012
+ if (!existsSync5(searchPath)) throw new Error("Directory not found.");
2936
3013
  if (!statSync(searchPath).isDirectory()) throw new Error("Path is not a directory.");
2937
3014
  const flags = caseSensitive ? "" : "i";
2938
3015
  const re = isRegex ? new RegExp(query, flags) : new RegExp(query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), flags);
@@ -2961,7 +3038,7 @@ function handleFindInFiles(args) {
2961
3038
  let fileHasMatch = false;
2962
3039
  let lines;
2963
3040
  try {
2964
- const text = readFileSync4(fullPath, "utf-8");
3041
+ const text = readFileSync5(fullPath, "utf-8");
2965
3042
  lines = text.split("\n");
2966
3043
  } catch {
2967
3044
  continue;
@@ -3001,7 +3078,7 @@ function handleGetTree(args) {
3001
3078
  const maxDepth = args.max_depth || 3;
3002
3079
  const includeHidden = args.include_hidden || false;
3003
3080
  const maxEntries = args.max_entries || 500;
3004
- if (!existsSync4(rootPath)) throw new Error("Directory not found.");
3081
+ if (!existsSync5(rootPath)) throw new Error("Directory not found.");
3005
3082
  if (!statSync(rootPath).isDirectory()) throw new Error("Path is not a directory.");
3006
3083
  const lines = [];
3007
3084
  let entryCount = 0;
@@ -3156,7 +3233,7 @@ async function handleLocalFileUpload(cortex, toolName, args) {
3156
3233
  };
3157
3234
  }
3158
3235
  if (fileSize <= INLINE_UPLOAD_MAX) {
3159
- const fileBuffer2 = readFileSync5(filePath);
3236
+ const fileBuffer2 = readFileSync6(filePath);
3160
3237
  const base64Content = fileBuffer2.toString("base64");
3161
3238
  const forwardArgs = { ...args, content: base64Content };
3162
3239
  delete forwardArgs.file_path;
@@ -3208,7 +3285,7 @@ async function handleLocalFileUpload(cortex, toolName, args) {
3208
3285
  isError: true
3209
3286
  };
3210
3287
  }
3211
- const fileBuffer = readFileSync5(filePath);
3288
+ const fileBuffer = readFileSync6(filePath);
3212
3289
  const chunkSize = 2.5 * 1024 * 1024;
3213
3290
  const total = fileBuffer.length;
3214
3291
  let driveItem = {};
@@ -3375,7 +3452,7 @@ function runStatus() {
3375
3452
  }
3376
3453
 
3377
3454
  // src/cli/reset.ts
3378
- import { existsSync as existsSync5, unlinkSync as unlinkSync3, rmdirSync } from "fs";
3455
+ import { existsSync as existsSync6, unlinkSync as unlinkSync3, rmdirSync } from "fs";
3379
3456
  function runReset() {
3380
3457
  console.log("");
3381
3458
  console.log(" Resetting Cortex MCP configuration...");
@@ -3396,7 +3473,7 @@ function runReset() {
3396
3473
  ` Codex: ${codexReset ? "entries removed" : "no entries found"}`
3397
3474
  );
3398
3475
  const configPath = getConfigPath();
3399
- if (existsSync5(configPath)) {
3476
+ if (existsSync6(configPath)) {
3400
3477
  unlinkSync3(configPath);
3401
3478
  console.log(` Config file: removed`);
3402
3479
  }
@@ -4090,7 +4167,7 @@ program.command("disconnect <provider>").description("Remove your personal OAuth
4090
4167
  });
4091
4168
  program.command("connect-mobile").description("Connect Cortex to Claude on mobile \u2014 opens setup page in browser").action(async () => {
4092
4169
  const { DEFAULT_SERVER_URL: DEFAULT_SERVER_URL3 } = await import("./constants-QSLA3TAZ.js");
4093
- const { openBrowser: openBrowser2 } = await import("./browser-S7WMSQYY.js");
4170
+ const { openBrowser: openBrowser2 } = await import("./browser-RCYYNQJN.js");
4094
4171
  const url = `${DEFAULT_SERVER_URL3}/connect`;
4095
4172
  console.log("\nOpening Cortex connect page...");
4096
4173
  console.log(` ${url}