delimit-cli 3.11.4 → 3.11.5

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/lib/api-engine.js CHANGED
@@ -17,13 +17,34 @@ const fs = require('fs');
17
17
  const os = require('os');
18
18
 
19
19
  // Gateway root — the Python engine lives here
20
+ // Resolution order: env var > ~/.delimit/server > ~/.delimit/gateway > bundled gateway
20
21
  const DELIMIT_HOME = process.env.DELIMIT_HOME || path.join(os.homedir(), '.delimit');
21
- const GATEWAY_ROOT = process.env.DELIMIT_GATEWAY_ROOT || path.join(DELIMIT_HOME, 'gateway');
22
+ const GATEWAY_ROOT = (() => {
23
+ if (process.env.DELIMIT_GATEWAY_ROOT) return process.env.DELIMIT_GATEWAY_ROOT;
24
+ // Check ~/.delimit/server (where `delimit setup` installs)
25
+ const serverPath = path.join(DELIMIT_HOME, 'server');
26
+ if (fs.existsSync(path.join(serverPath, 'core'))) return serverPath;
27
+ // Check ~/.delimit/gateway (legacy path)
28
+ const gatewayPath = path.join(DELIMIT_HOME, 'gateway');
29
+ if (fs.existsSync(path.join(gatewayPath, 'core'))) return gatewayPath;
30
+ // Check bundled gateway inside the npm package
31
+ const bundledPath = path.join(__dirname, '..', 'gateway');
32
+ if (fs.existsSync(path.join(bundledPath, 'core'))) return bundledPath;
33
+ // Fallback — will fail with a clear error in runGateway()
34
+ return gatewayPath;
35
+ })();
22
36
 
23
37
  // Python executable — prefer venv if available
24
38
  const PYTHON = (() => {
25
39
  const venvPy = path.join(DELIMIT_HOME, 'venv', 'bin', 'python');
26
40
  if (fs.existsSync(venvPy)) return venvPy;
41
+ // Check common python locations
42
+ for (const cmd of ['python3', 'python']) {
43
+ try {
44
+ execSync(`${cmd} --version`, { stdio: 'pipe' });
45
+ return cmd;
46
+ } catch {}
47
+ }
27
48
  return 'python3';
28
49
  })();
29
50
 
@@ -33,6 +54,20 @@ const PYTHON = (() => {
33
54
  * Returns parsed JSON or throws.
34
55
  */
35
56
  function runGateway(pythonCode, timeoutMs = 30000) {
57
+ // Check that the gateway core exists before trying to run
58
+ if (!fs.existsSync(path.join(GATEWAY_ROOT, 'core'))) {
59
+ const msg = [
60
+ 'Delimit gateway engine not found.',
61
+ '',
62
+ 'Run one of:',
63
+ ' npx delimit-cli setup # full install with MCP server',
64
+ ' delimit setup # if globally installed',
65
+ '',
66
+ 'Or set DELIMIT_GATEWAY_ROOT to your gateway directory.',
67
+ ].join('\n');
68
+ throw new Error(msg);
69
+ }
70
+
36
71
  const tmpFile = path.join(os.tmpdir(), `delimit_${process.pid}_${Date.now()}.py`);
37
72
  try {
38
73
  fs.writeFileSync(tmpFile, pythonCode);
@@ -50,6 +85,18 @@ function runGateway(pythonCode, timeoutMs = 30000) {
50
85
  if (err.stdout) {
51
86
  try { return JSON.parse(err.stdout.trim()); } catch (_) {}
52
87
  }
88
+ // Improve error messages for common failures
89
+ const stderr = err.stderr || '';
90
+ if (stderr.includes('No module named') || stderr.includes('ModuleNotFoundError')) {
91
+ throw new Error(
92
+ `Python dependency missing. Run: npx delimit-cli setup\n\nDetails: ${stderr.trim()}`
93
+ );
94
+ }
95
+ if (err.message && err.message.includes('ENOENT')) {
96
+ throw new Error(
97
+ `Python not found. Install Python 3.9+ and try again.\n\nDetails: ${err.message}`
98
+ );
99
+ }
53
100
  throw new Error(err.stderr || err.message || 'Gateway execution failed');
54
101
  } finally {
55
102
  try { fs.unlinkSync(tmpFile); } catch (_) {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "delimit-cli",
3
3
  "mcpName": "io.github.delimit-ai/delimit",
4
- "version": "3.11.4",
4
+ "version": "3.11.5",
5
5
  "description": "One workspace for every AI coding assistant. Tasks, memory, and governance carry between Claude Code, Codex, and Gemini CLI.",
6
6
  "main": "index.js",
7
7
  "files": [
package/server.json CHANGED
@@ -7,13 +7,13 @@
7
7
  "url": "https://github.com/delimit-ai/delimit",
8
8
  "source": "github"
9
9
  },
10
- "version": "3.11.4",
10
+ "version": "3.11.5",
11
11
  "websiteUrl": "https://delimit.ai",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "npm",
15
15
  "identifier": "delimit-cli",
16
- "version": "3.11.4",
16
+ "version": "3.11.5",
17
17
  "transport": {
18
18
  "type": "stdio"
19
19
  }