@ekkos/cli 1.3.1 → 1.3.2

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 (82) hide show
  1. package/dist/commands/dashboard.js +147 -57
  2. package/dist/commands/init.d.ts +1 -0
  3. package/dist/commands/init.js +54 -16
  4. package/dist/commands/run.js +163 -44
  5. package/dist/commands/status.d.ts +4 -1
  6. package/dist/commands/status.js +165 -27
  7. package/dist/commands/synk.d.ts +7 -0
  8. package/dist/commands/synk.js +339 -0
  9. package/dist/deploy/settings.d.ts +6 -5
  10. package/dist/deploy/settings.js +27 -17
  11. package/dist/index.js +12 -82
  12. package/dist/lib/usage-parser.d.ts +1 -1
  13. package/dist/lib/usage-parser.js +5 -3
  14. package/dist/local/index.d.ts +14 -0
  15. package/dist/local/index.js +28 -0
  16. package/dist/local/local-embeddings.d.ts +49 -0
  17. package/dist/local/local-embeddings.js +232 -0
  18. package/dist/local/offline-fallback.d.ts +44 -0
  19. package/dist/local/offline-fallback.js +159 -0
  20. package/dist/local/sqlite-store.d.ts +126 -0
  21. package/dist/local/sqlite-store.js +393 -0
  22. package/dist/local/sync-engine.d.ts +42 -0
  23. package/dist/local/sync-engine.js +223 -0
  24. package/dist/synk/api.d.ts +22 -0
  25. package/dist/synk/api.js +133 -0
  26. package/dist/synk/auth.d.ts +7 -0
  27. package/dist/synk/auth.js +30 -0
  28. package/dist/synk/config.d.ts +18 -0
  29. package/dist/synk/config.js +37 -0
  30. package/dist/synk/daemon/control-client.d.ts +11 -0
  31. package/dist/synk/daemon/control-client.js +101 -0
  32. package/dist/synk/daemon/control-server.d.ts +24 -0
  33. package/dist/synk/daemon/control-server.js +91 -0
  34. package/dist/synk/daemon/run.d.ts +14 -0
  35. package/dist/synk/daemon/run.js +338 -0
  36. package/dist/synk/encryption.d.ts +17 -0
  37. package/dist/synk/encryption.js +133 -0
  38. package/dist/synk/index.d.ts +13 -0
  39. package/dist/synk/index.js +36 -0
  40. package/dist/synk/machine-client.d.ts +42 -0
  41. package/dist/synk/machine-client.js +218 -0
  42. package/dist/synk/persistence.d.ts +51 -0
  43. package/dist/synk/persistence.js +211 -0
  44. package/dist/synk/qr.d.ts +5 -0
  45. package/dist/synk/qr.js +33 -0
  46. package/dist/synk/session-bridge.d.ts +58 -0
  47. package/dist/synk/session-bridge.js +171 -0
  48. package/dist/synk/session-client.d.ts +46 -0
  49. package/dist/synk/session-client.js +240 -0
  50. package/dist/synk/types.d.ts +574 -0
  51. package/dist/synk/types.js +74 -0
  52. package/dist/utils/platform.d.ts +5 -1
  53. package/dist/utils/platform.js +24 -4
  54. package/dist/utils/proxy-url.d.ts +10 -0
  55. package/dist/utils/proxy-url.js +19 -0
  56. package/dist/utils/state.d.ts +1 -1
  57. package/dist/utils/state.js +11 -3
  58. package/package.json +13 -4
  59. package/templates/claude-plugins-admin/AGENT_TEAM_PROPOSALS.md +0 -819
  60. package/templates/claude-plugins-admin/README.md +0 -446
  61. package/templates/claude-plugins-admin/autonomous-admin-agent/.claude-plugin/plugin.json +0 -8
  62. package/templates/claude-plugins-admin/autonomous-admin-agent/commands/agent.md +0 -595
  63. package/templates/claude-plugins-admin/backend-agent/.claude-plugin/plugin.json +0 -8
  64. package/templates/claude-plugins-admin/backend-agent/commands/backend.md +0 -798
  65. package/templates/claude-plugins-admin/deploy-guardian/.claude-plugin/plugin.json +0 -8
  66. package/templates/claude-plugins-admin/deploy-guardian/commands/deploy.md +0 -554
  67. package/templates/claude-plugins-admin/frontend-agent/.claude-plugin/plugin.json +0 -8
  68. package/templates/claude-plugins-admin/frontend-agent/commands/frontend.md +0 -881
  69. package/templates/claude-plugins-admin/mcp-server-manager/.claude-plugin/plugin.json +0 -8
  70. package/templates/claude-plugins-admin/mcp-server-manager/commands/mcp.md +0 -85
  71. package/templates/claude-plugins-admin/memory-system-monitor/.claude-plugin/plugin.json +0 -8
  72. package/templates/claude-plugins-admin/memory-system-monitor/commands/memory-health.md +0 -569
  73. package/templates/claude-plugins-admin/qa-agent/.claude-plugin/plugin.json +0 -8
  74. package/templates/claude-plugins-admin/qa-agent/commands/qa.md +0 -863
  75. package/templates/claude-plugins-admin/tech-lead-agent/.claude-plugin/plugin.json +0 -8
  76. package/templates/claude-plugins-admin/tech-lead-agent/commands/lead.md +0 -732
  77. package/templates/hooks-node/lib/state.js +0 -187
  78. package/templates/hooks-node/stop.js +0 -416
  79. package/templates/hooks-node/user-prompt-submit.js +0 -337
  80. package/templates/rules/00-hooks-contract.mdc +0 -89
  81. package/templates/rules/30-ekkos-core.mdc +0 -188
  82. package/templates/rules/31-ekkos-messages.mdc +0 -78
@@ -48,18 +48,38 @@ function detectInstalledIDEs() {
48
48
  return ides;
49
49
  }
50
50
  /**
51
- * Get the current running IDE from environment
51
+ * Get the current running IDE from environment variables and cwd directory markers.
52
+ * Checks (in priority order):
53
+ * 1. Dedicated IDE env vars (CURSOR_USER_ID, VSCODE_INJECTION, CODEIUM_USER_ID, CLAUDE_CODE)
54
+ * 2. TERM_PROGRAM / TERMINAL_EMULATOR
55
+ * 3. Project-local directory markers (.cursor/, .windsurf/, .vscode/ in cwd)
52
56
  */
53
57
  function detectCurrentIDE() {
58
+ // 1. Dedicated env vars — most reliable signal
59
+ if (process.env.CURSOR_USER_ID)
60
+ return 'cursor';
61
+ if (process.env.CODEIUM_USER_ID)
62
+ return 'windsurf';
63
+ if (process.env.VSCODE_INJECTION || process.env.VSCODE_IPC_HOOK_CLI)
64
+ return 'claude'; // Claude Code runs inside VS Code
65
+ if (process.env.CLAUDE_CODE)
66
+ return 'claude';
67
+ // 2. TERM_PROGRAM / TERMINAL_EMULATOR
54
68
  const termProgram = process.env.TERM_PROGRAM?.toLowerCase() || '';
55
69
  const termEmulator = process.env.TERMINAL_EMULATOR?.toLowerCase() || '';
56
70
  if (termProgram.includes('cursor'))
57
71
  return 'cursor';
58
- if (termProgram.includes('vscode') || termEmulator.includes('vscode'))
59
- return 'vscode';
60
72
  if (termProgram.includes('windsurf') || termProgram.includes('codeium'))
61
73
  return 'windsurf';
62
- if (process.env.CLAUDE_CODE)
74
+ if (termProgram.includes('vscode') || termEmulator.includes('vscode'))
63
75
  return 'claude';
76
+ // 3. Project-local directory markers (cwd)
77
+ const cwd = process.cwd();
78
+ if ((0, fs_1.existsSync)((0, path_1.join)(cwd, '.cursor')))
79
+ return 'cursor';
80
+ if ((0, fs_1.existsSync)((0, path_1.join)(cwd, '.windsurf')))
81
+ return 'windsurf';
82
+ if ((0, fs_1.existsSync)((0, path_1.join)(cwd, '.vscode')))
83
+ return 'claude'; // VS Code / Claude Code
64
84
  return null;
65
85
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Shared proxy URL builder for ekkOS proxy integration
3
+ * Used by: commands/run.ts, commands/test-claude.ts, synk/daemon/run.ts
4
+ */
5
+ export declare const EKKOS_PROXY_URL: string;
6
+ /**
7
+ * Build a fully-qualified proxy URL with user/session binding params.
8
+ * Format: https://proxy.ekkos.dev/proxy/{userId}/{sessionName}?project={base64(cwd)}&sid={sessionId}&tz={tz}
9
+ */
10
+ export declare function buildProxyUrl(userId: string, sessionName: string, projectPath: string, sessionId: string): string;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * Shared proxy URL builder for ekkOS proxy integration
4
+ * Used by: commands/run.ts, commands/test-claude.ts, synk/daemon/run.ts
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.EKKOS_PROXY_URL = void 0;
8
+ exports.buildProxyUrl = buildProxyUrl;
9
+ // eslint-disable-next-line no-restricted-syntax -- Config URL, not API key
10
+ exports.EKKOS_PROXY_URL = process.env.EKKOS_PROXY_URL || 'https://proxy.ekkos.dev';
11
+ /**
12
+ * Build a fully-qualified proxy URL with user/session binding params.
13
+ * Format: https://proxy.ekkos.dev/proxy/{userId}/{sessionName}?project={base64(cwd)}&sid={sessionId}&tz={tz}
14
+ */
15
+ function buildProxyUrl(userId, sessionName, projectPath, sessionId) {
16
+ const projectPathEncoded = Buffer.from(projectPath).toString('base64url');
17
+ const userTz = Intl.DateTimeFormat().resolvedOptions().timeZone;
18
+ return `${exports.EKKOS_PROXY_URL}/proxy/${encodeURIComponent(userId)}/${encodeURIComponent(sessionName)}?project=${projectPathEncoded}&sid=${encodeURIComponent(sessionId)}&tz=${encodeURIComponent(userTz)}`;
19
+ }
@@ -76,7 +76,7 @@ export declare function getMostRecentSession(): {
76
76
  lastActive: string;
77
77
  } | null;
78
78
  /**
79
- * Get all active sessions (filters out stale ones with dead PIDs)
79
+ * Get all active sessions (filters out stale ones with dead PIDs or old heartbeats)
80
80
  */
81
81
  export declare function getActiveSessions(): ActiveSession[];
82
82
  /**
@@ -253,7 +253,7 @@ function getMostRecentSession() {
253
253
  // Track multiple concurrent Claude Code sessions without state collision
254
254
  // ═══════════════════════════════════════════════════════════════════════════
255
255
  /**
256
- * Get all active sessions (filters out stale ones with dead PIDs)
256
+ * Get all active sessions (filters out stale ones with dead PIDs or old heartbeats)
257
257
  */
258
258
  function getActiveSessions() {
259
259
  ensureEkkosDir();
@@ -263,8 +263,16 @@ function getActiveSessions() {
263
263
  }
264
264
  const content = fs.readFileSync(exports.ACTIVE_SESSIONS_FILE, 'utf-8');
265
265
  const sessions = JSON.parse(content);
266
- // Filter out sessions with dead PIDs
267
- const alive = sessions.filter(s => isProcessAlive(s.pid));
266
+ const now = Date.now();
267
+ const STALE_MS = 12 * 60 * 60 * 1000; // 12 hours — no heartbeat = stale
268
+ // Filter out sessions with dead PIDs or stale heartbeats
269
+ const alive = sessions.filter(s => {
270
+ // Check heartbeat staleness first (cheap, no syscall)
271
+ const lastBeat = new Date(s.lastHeartbeat).getTime();
272
+ if (now - lastBeat > STALE_MS)
273
+ return false;
274
+ return isProcessAlive(s.pid);
275
+ });
268
276
  // If we filtered any out, update the file
269
277
  if (alive.length !== sessions.length) {
270
278
  fs.writeFileSync(exports.ACTIVE_SESSIONS_FILE, JSON.stringify(alive, null, 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekkos/cli",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Setup ekkOS memory for AI coding assistants (Claude Code, Cursor, Windsurf)",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "scripts": {
12
12
  "build": "tsc",
13
- "dev": "ts-node src/index.ts",
13
+ "dev": "tsx src/index.ts",
14
14
  "prepack": "node scripts/build-templates.js prepack",
15
15
  "postpack": "node scripts/build-templates.js postpack",
16
16
  "prepublishOnly": "npm run build"
@@ -28,7 +28,9 @@
28
28
  "author": "ekkOS",
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
+ "@ekkos/synk-wire": "workspace:*",
31
32
  "@supabase/supabase-js": "^2.39.8",
33
+ "axios": "^1.7.0",
32
34
  "blessed": "^0.1.81",
33
35
  "blessed-contrib": "^4.11.0",
34
36
  "ccusage": "^18.0.5",
@@ -38,7 +40,11 @@
38
40
  "node-pty": "1.2.0-beta.7",
39
41
  "open": "^10.0.0",
40
42
  "ora": "^8.0.1",
41
- "ws": "^8.19.0"
43
+ "qrcode-terminal": "^0.12.0",
44
+ "socket.io-client": "^4.8.0",
45
+ "tweetnacl": "^1.0.3",
46
+ "ws": "^8.19.0",
47
+ "zod": "^3.23.0"
42
48
  },
43
49
  "devDependencies": {
44
50
  "@types/blessed": "^0.1.27",
@@ -50,6 +56,9 @@
50
56
  },
51
57
  "files": [
52
58
  "dist",
53
- "templates"
59
+ "templates",
60
+ "!templates/claude-plugins-admin",
61
+ "!templates/hooks-node",
62
+ "!templates/rules"
54
63
  ]
55
64
  }