@lanonasis/cli 3.6.5 → 3.6.7

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 (40) hide show
  1. package/dist/commands/api-keys.d.ts +2 -1
  2. package/dist/commands/api-keys.js +73 -78
  3. package/dist/commands/auth.js +160 -167
  4. package/dist/commands/completion.js +31 -39
  5. package/dist/commands/config.js +162 -201
  6. package/dist/commands/enhanced-memory.js +11 -17
  7. package/dist/commands/guide.js +79 -88
  8. package/dist/commands/init.js +14 -20
  9. package/dist/commands/mcp.d.ts +10 -0
  10. package/dist/commands/mcp.js +167 -156
  11. package/dist/commands/memory.js +77 -83
  12. package/dist/commands/organization.js +15 -21
  13. package/dist/commands/topics.js +52 -58
  14. package/dist/core/achievements.js +19 -26
  15. package/dist/core/architecture.js +42 -59
  16. package/dist/core/dashboard.js +71 -81
  17. package/dist/core/error-handler.js +30 -39
  18. package/dist/core/power-mode.js +46 -53
  19. package/dist/core/progress.js +35 -44
  20. package/dist/core/welcome.js +56 -64
  21. package/dist/enhanced-cli.js +49 -58
  22. package/dist/index-simple.js +75 -113
  23. package/dist/index.js +64 -69
  24. package/dist/mcp/access-control.js +13 -17
  25. package/dist/mcp/client/enhanced-client.js +16 -23
  26. package/dist/mcp/enhanced-server.js +10 -14
  27. package/dist/mcp/logger.js +3 -7
  28. package/dist/mcp/memory-state.js +13 -17
  29. package/dist/mcp/schemas/tool-schemas.d.ts +16 -16
  30. package/dist/mcp/schemas/tool-schemas.js +122 -126
  31. package/dist/mcp/server/lanonasis-server.js +66 -57
  32. package/dist/mcp/transports/transport-manager.js +18 -25
  33. package/dist/mcp/vector-store.js +6 -10
  34. package/dist/mcp-server.js +23 -27
  35. package/dist/utils/api.js +19 -26
  36. package/dist/utils/config.d.ts +2 -1
  37. package/dist/utils/config.js +65 -78
  38. package/dist/utils/formatting.js +6 -14
  39. package/dist/utils/mcp-client.js +76 -117
  40. package/package.json +36 -5
@@ -1,51 +1,11 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.MCPClient = void 0;
40
- exports.getMCPClient = getMCPClient;
41
- const index_js_1 = require("@modelcontextprotocol/sdk/client/index.js");
42
- const stdio_js_1 = require("@modelcontextprotocol/sdk/client/stdio.js");
43
- const chalk_1 = __importDefault(require("chalk"));
44
- const config_js_1 = require("./config.js");
45
- const fs = __importStar(require("fs"));
46
- const eventsource_1 = require("eventsource");
47
- const ws_1 = __importDefault(require("ws"));
48
- class MCPClient {
1
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
+ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
3
+ import chalk from 'chalk';
4
+ import { CLIConfig } from './config.js';
5
+ import * as fs from 'fs';
6
+ import { EventSource } from 'eventsource';
7
+ import WebSocket from 'ws';
8
+ export class MCPClient {
49
9
  client = null;
50
10
  config;
51
11
  isConnected = false;
@@ -58,7 +18,7 @@ class MCPClient {
58
18
  lastHealthCheck = null;
59
19
  activeConnectionMode = 'local'; // Track actual connection mode
60
20
  constructor() {
61
- this.config = new config_js_1.CLIConfig();
21
+ this.config = new CLIConfig();
62
22
  }
63
23
  /**
64
24
  * Overrides the configuration directory used by the underlying CLI config.
@@ -134,10 +94,10 @@ class MCPClient {
134
94
  'wss://mcp.lanonasis.com/ws';
135
95
  wsUrl = wsUrlValue;
136
96
  if (this.retryAttempts === 0) {
137
- console.log(chalk_1.default.cyan(`Connecting to WebSocket MCP server at ${wsUrl}...`));
97
+ console.log(chalk.cyan(`Connecting to WebSocket MCP server at ${wsUrl}...`));
138
98
  }
139
99
  else {
140
- console.log(chalk_1.default.yellow(`Retry ${this.retryAttempts}/${this.maxRetries}: Connecting to WebSocket MCP server...`));
100
+ console.log(chalk.yellow(`Retry ${this.retryAttempts}/${this.maxRetries}: Connecting to WebSocket MCP server...`));
141
101
  }
142
102
  // Initialize WebSocket connection
143
103
  await this.initializeWebSocket(wsUrl);
@@ -155,10 +115,10 @@ class MCPClient {
155
115
  'https://mcp.lanonasis.com/api/v1';
156
116
  serverUrl = serverUrlValue;
157
117
  if (this.retryAttempts === 0) {
158
- console.log(chalk_1.default.cyan(`Connecting to remote MCP server at ${serverUrl}...`));
118
+ console.log(chalk.cyan(`Connecting to remote MCP server at ${serverUrl}...`));
159
119
  }
160
120
  else {
161
- console.log(chalk_1.default.yellow(`Retry ${this.retryAttempts}/${this.maxRetries}: Connecting to remote MCP server...`));
121
+ console.log(chalk.yellow(`Retry ${this.retryAttempts}/${this.maxRetries}: Connecting to remote MCP server...`));
162
122
  }
163
123
  // Initialize SSE connection for real-time updates
164
124
  await this.initializeSSE(serverUrl);
@@ -172,22 +132,22 @@ class MCPClient {
172
132
  // Local MCP server connection requires explicit path via option or config
173
133
  serverPath = options.serverPath ?? this.config.get('mcpServerPath');
174
134
  if (!serverPath) {
175
- console.log(chalk_1.default.yellow('⚠️ No local MCP server path configured.'));
176
- console.log(chalk_1.default.cyan('💡 Prefer using WebSocket mode (default). Or configure a local path via:'));
177
- console.log(chalk_1.default.cyan(' lanonasis config set mcpServerPath /absolute/path/to/server.js'));
135
+ console.log(chalk.yellow('⚠️ No local MCP server path configured.'));
136
+ console.log(chalk.cyan('💡 Prefer using WebSocket mode (default). Or configure a local path via:'));
137
+ console.log(chalk.cyan(' lanonasis config set mcpServerPath /absolute/path/to/server.js'));
178
138
  throw new Error('Local MCP server path not provided');
179
139
  }
180
140
  // Check if the server file exists
181
141
  if (!fs.existsSync(serverPath)) {
182
- console.log(chalk_1.default.yellow(`⚠️ Local MCP server not found at ${serverPath}`));
183
- console.log(chalk_1.default.cyan('💡 For remote use WebSocket: lanonasis mcp connect --mode websocket --url wss://mcp.lanonasis.com/ws'));
142
+ console.log(chalk.yellow(`⚠️ Local MCP server not found at ${serverPath}`));
143
+ console.log(chalk.cyan('💡 For remote use WebSocket: lanonasis mcp connect --mode websocket --url wss://mcp.lanonasis.com/ws'));
184
144
  throw new Error(`MCP server not found at ${serverPath}`);
185
145
  }
186
146
  if (this.retryAttempts === 0) {
187
- console.log(chalk_1.default.cyan(`Connecting to local MCP server at ${serverPath}...`));
147
+ console.log(chalk.cyan(`Connecting to local MCP server at ${serverPath}...`));
188
148
  }
189
149
  else {
190
- console.log(chalk_1.default.yellow(`Retry ${this.retryAttempts}/${this.maxRetries}: Connecting to local MCP server...`));
150
+ console.log(chalk.yellow(`Retry ${this.retryAttempts}/${this.maxRetries}: Connecting to local MCP server...`));
191
151
  }
192
152
  // Allow passing extra args to local server (e.g., --stdio) via options or env/config
193
153
  // Precedence: options.localArgs -> env.MCP_LOCAL_SERVER_ARGS -> config.mcpLocalArgs -> none
@@ -200,11 +160,11 @@ class MCPClient {
200
160
  ? options.localArgs
201
161
  : (envArgs.length > 0 ? envArgs : configArgs);
202
162
  const args = [serverPath, ...extraArgs];
203
- const localTransport = new stdio_js_1.StdioClientTransport({
163
+ const localTransport = new StdioClientTransport({
204
164
  command: 'node',
205
165
  args
206
166
  });
207
- this.client = new index_js_1.Client({
167
+ this.client = new Client({
208
168
  name: '@lanonasis/cli',
209
169
  version: '3.0.1'
210
170
  });
@@ -212,7 +172,7 @@ class MCPClient {
212
172
  this.isConnected = true;
213
173
  this.activeConnectionMode = 'local';
214
174
  this.retryAttempts = 0;
215
- console.log(chalk_1.default.green('✓ Connected to MCP server'));
175
+ console.log(chalk.green('✓ Connected to MCP server'));
216
176
  this.startHealthMonitoring();
217
177
  return true;
218
178
  }
@@ -223,7 +183,7 @@ class MCPClient {
223
183
  ?? this.config.getMCPRestUrl()
224
184
  ?? 'https://mcp.lanonasis.com/api/v1';
225
185
  serverUrl = serverUrlValue;
226
- console.log(chalk_1.default.yellow(`Unknown connection mode '${String(connectionMode)}', falling back to remote at ${serverUrl}`));
186
+ console.log(chalk.yellow(`Unknown connection mode '${String(connectionMode)}', falling back to remote at ${serverUrl}`));
227
187
  await this.initializeSSE(serverUrl);
228
188
  this.isConnected = true;
229
189
  this.activeConnectionMode = 'remote';
@@ -244,23 +204,23 @@ class MCPClient {
244
204
  // Check if this is an authentication error (don't retry these)
245
205
  if (this.isAuthenticationError(error)) {
246
206
  const authMsg = error?.message ?? '';
247
- console.error(chalk_1.default.red('Authentication failed:'), authMsg);
207
+ console.error(chalk.red('Authentication failed:'), authMsg);
248
208
  this.provideAuthenticationGuidance(error);
249
209
  this.isConnected = false;
250
210
  return false;
251
211
  }
252
212
  this.retryAttempts++;
253
213
  if (this.retryAttempts >= this.maxRetries) {
254
- console.error(chalk_1.default.red(`Failed to connect after ${this.maxRetries} attempts`));
214
+ console.error(chalk.red(`Failed to connect after ${this.maxRetries} attempts`));
255
215
  this.provideNetworkTroubleshootingGuidance(error);
256
216
  this.isConnected = false;
257
217
  return false;
258
218
  }
259
219
  // For network errors, retry with exponential backoff
260
220
  const delay = await this.exponentialBackoff(this.retryAttempts);
261
- console.log(chalk_1.default.yellow(`Network error, retrying in ${delay}ms... (${this.retryAttempts}/${this.maxRetries})`));
221
+ console.log(chalk.yellow(`Network error, retrying in ${delay}ms... (${this.retryAttempts}/${this.maxRetries})`));
262
222
  const message = error?.message ?? String(error);
263
- console.log(chalk_1.default.gray(`Error: ${message}`));
223
+ console.log(chalk.gray(`Error: ${message}`));
264
224
  await new Promise(resolve => setTimeout(resolve, delay));
265
225
  return this.connectWithRetry(options);
266
226
  }
@@ -283,61 +243,61 @@ class MCPClient {
283
243
  * Provide authentication-specific guidance
284
244
  */
285
245
  provideAuthenticationGuidance(error) {
286
- console.log(chalk_1.default.yellow('\n🔐 Authentication Issue Detected:'));
246
+ console.log(chalk.yellow('\n🔐 Authentication Issue Detected:'));
287
247
  const msg = error?.message ?? '';
288
248
  if (msg.includes('AUTHENTICATION_REQUIRED')) {
289
- console.log(chalk_1.default.cyan('• No credentials found. Run: lanonasis auth login'));
290
- console.log(chalk_1.default.cyan('• Or set a vendor key: lanonasis auth login --vendor-key <your-key>'));
249
+ console.log(chalk.cyan('• No credentials found. Run: lanonasis auth login'));
250
+ console.log(chalk.cyan('• Or set a vendor key: lanonasis auth login --vendor-key <your-key>'));
291
251
  }
292
252
  else if (msg.includes('AUTHENTICATION_INVALID')) {
293
- console.log(chalk_1.default.cyan('• Invalid credentials. Confirm the vendor key matches your dashboard value'));
294
- console.log(chalk_1.default.cyan('• Try: lanonasis auth logout && lanonasis auth login'));
253
+ console.log(chalk.cyan('• Invalid credentials. Confirm the vendor key matches your dashboard value'));
254
+ console.log(chalk.cyan('• Try: lanonasis auth logout && lanonasis auth login'));
295
255
  }
296
256
  else if (msg.includes('expired')) {
297
- console.log(chalk_1.default.cyan('• Token expired. Re-authenticate: lanonasis auth login'));
298
- console.log(chalk_1.default.cyan('• Or refresh: lanonasis auth refresh (if available)'));
257
+ console.log(chalk.cyan('• Token expired. Re-authenticate: lanonasis auth login'));
258
+ console.log(chalk.cyan('• Or refresh: lanonasis auth refresh (if available)'));
299
259
  }
300
260
  else {
301
- console.log(chalk_1.default.cyan('• Check authentication status: lanonasis auth status'));
302
- console.log(chalk_1.default.cyan('• Re-authenticate: lanonasis auth login'));
303
- console.log(chalk_1.default.cyan('• Verify vendor key: lanonasis auth login --vendor-key <your-key>'));
261
+ console.log(chalk.cyan('• Check authentication status: lanonasis auth status'));
262
+ console.log(chalk.cyan('• Re-authenticate: lanonasis auth login'));
263
+ console.log(chalk.cyan('• Verify vendor key: lanonasis auth login --vendor-key <your-key>'));
304
264
  }
305
265
  }
306
266
  /**
307
267
  * Provide network troubleshooting guidance
308
268
  */
309
269
  provideNetworkTroubleshootingGuidance(_error) {
310
- console.log(chalk_1.default.yellow('\n🌐 Network Issue Detected:'));
270
+ console.log(chalk.yellow('\n🌐 Network Issue Detected:'));
311
271
  const msg = _error?.message ?? '';
312
272
  if (msg.includes('ECONNREFUSED') || msg.includes('connect ECONNREFUSED')) {
313
- console.log(chalk_1.default.cyan('• Connection refused. Service may be down:'));
314
- console.log(chalk_1.default.cyan(' - For remote: Check https://mcp.lanonasis.com/health'));
315
- console.log(chalk_1.default.cyan(' - For WebSocket: Check wss://mcp.lanonasis.com/ws'));
316
- console.log(chalk_1.default.cyan(' - For local: Install local MCP server'));
273
+ console.log(chalk.cyan('• Connection refused. Service may be down:'));
274
+ console.log(chalk.cyan(' - For remote: Check https://mcp.lanonasis.com/health'));
275
+ console.log(chalk.cyan(' - For WebSocket: Check wss://mcp.lanonasis.com/ws'));
276
+ console.log(chalk.cyan(' - For local: Install local MCP server'));
317
277
  }
318
278
  else if (msg.includes('timeout') || msg.includes('ETIMEDOUT')) {
319
- console.log(chalk_1.default.cyan('• Connection timeout. Check network:'));
320
- console.log(chalk_1.default.cyan(' - Verify internet connectivity'));
321
- console.log(chalk_1.default.cyan(' - Check firewall settings'));
322
- console.log(chalk_1.default.cyan(' - Try different connection mode: --mode remote'));
279
+ console.log(chalk.cyan('• Connection timeout. Check network:'));
280
+ console.log(chalk.cyan(' - Verify internet connectivity'));
281
+ console.log(chalk.cyan(' - Check firewall settings'));
282
+ console.log(chalk.cyan(' - Try different connection mode: --mode remote'));
323
283
  }
324
284
  else if (msg.includes('ENOTFOUND') || msg.includes('getaddrinfo')) {
325
- console.log(chalk_1.default.cyan('• DNS resolution failed:'));
326
- console.log(chalk_1.default.cyan(' - Check DNS settings'));
327
- console.log(chalk_1.default.cyan(' - Verify server URL is correct'));
328
- console.log(chalk_1.default.cyan(' - Try using IP address instead of hostname'));
285
+ console.log(chalk.cyan('• DNS resolution failed:'));
286
+ console.log(chalk.cyan(' - Check DNS settings'));
287
+ console.log(chalk.cyan(' - Verify server URL is correct'));
288
+ console.log(chalk.cyan(' - Try using IP address instead of hostname'));
329
289
  }
330
290
  else if (msg.includes('certificate') || msg.includes('SSL') || msg.includes('TLS')) {
331
- console.log(chalk_1.default.cyan('• SSL/TLS certificate issue:'));
332
- console.log(chalk_1.default.cyan(' - Check system time and date'));
333
- console.log(chalk_1.default.cyan(' - Update CA certificates'));
334
- console.log(chalk_1.default.cyan(' - Try different connection mode'));
291
+ console.log(chalk.cyan('• SSL/TLS certificate issue:'));
292
+ console.log(chalk.cyan(' - Check system time and date'));
293
+ console.log(chalk.cyan(' - Update CA certificates'));
294
+ console.log(chalk.cyan(' - Try different connection mode'));
335
295
  }
336
296
  else {
337
- console.log(chalk_1.default.cyan('• General network error:'));
338
- console.log(chalk_1.default.cyan(' - Check server status'));
339
- console.log(chalk_1.default.cyan(' - Verify network connectivity'));
340
- console.log(chalk_1.default.cyan(' - Try: lanonasis mcp diagnose (when available)'));
297
+ console.log(chalk.cyan('• General network error:'));
298
+ console.log(chalk.cyan(' - Check server status'));
299
+ console.log(chalk.cyan(' - Verify network connectivity'));
300
+ console.log(chalk.cyan(' - Try: lanonasis mcp diagnose (when available)'));
341
301
  }
342
302
  }
343
303
  /**
@@ -392,7 +352,7 @@ class MCPClient {
392
352
  const currentTime = Math.floor(Date.now() / 1000);
393
353
  // Check if token is expired or expires within 5 minutes
394
354
  if (payload.exp && payload.exp < currentTime + 300) {
395
- console.log(chalk_1.default.yellow('Token is expired or expiring soon, attempting refresh...'));
355
+ console.log(chalk.yellow('Token is expired or expiring soon, attempting refresh...'));
396
356
  await this.refreshTokenIfNeeded();
397
357
  }
398
358
  }
@@ -420,7 +380,7 @@ class MCPClient {
420
380
  });
421
381
  if (response.data.access_token) {
422
382
  await this.config.setAndSave('token', response.data.access_token);
423
- console.log(chalk_1.default.green('✓ Token refreshed successfully'));
383
+ console.log(chalk.green('✓ Token refreshed successfully'));
424
384
  }
425
385
  }
426
386
  catch {
@@ -460,18 +420,18 @@ class MCPClient {
460
420
  const token = this.config.get('token');
461
421
  if (token) {
462
422
  // EventSource doesn't support headers directly, append token to URL
463
- this.sseConnection = new eventsource_1.EventSource(`${sseUrl}?token=${encodeURIComponent(token)}`);
423
+ this.sseConnection = new EventSource(`${sseUrl}?token=${encodeURIComponent(token)}`);
464
424
  this.sseConnection.onmessage = (event) => {
465
425
  try {
466
426
  const data = JSON.parse(event.data);
467
- console.log(chalk_1.default.blue('📡 Real-time update:'), data.type);
427
+ console.log(chalk.blue('📡 Real-time update:'), data.type);
468
428
  }
469
429
  catch {
470
430
  // Ignore parse errors
471
431
  }
472
432
  };
473
433
  this.sseConnection.onerror = () => {
474
- console.error(chalk_1.default.yellow('⚠️ SSE connection error (will retry)'));
434
+ console.error(chalk.yellow('⚠️ SSE connection error (will retry)'));
475
435
  };
476
436
  }
477
437
  }
@@ -491,14 +451,14 @@ class MCPClient {
491
451
  this.wsConnection = null;
492
452
  }
493
453
  // Create new WebSocket connection with authentication
494
- this.wsConnection = new ws_1.default(wsUrl, [], {
454
+ this.wsConnection = new WebSocket(wsUrl, [], {
495
455
  headers: {
496
456
  'Authorization': `Bearer ${token}`,
497
457
  'X-API-Key': token
498
458
  }
499
459
  });
500
460
  this.wsConnection.on('open', () => {
501
- console.log(chalk_1.default.green('✅ Connected to MCP WebSocket server'));
461
+ console.log(chalk.green('✅ Connected to MCP WebSocket server'));
502
462
  // Send initialization message
503
463
  this.sendWebSocketMessage({
504
464
  id: 1,
@@ -519,22 +479,22 @@ class MCPClient {
519
479
  this.wsConnection.on('message', (data) => {
520
480
  try {
521
481
  const message = JSON.parse(data.toString());
522
- console.log(chalk_1.default.blue('📡 MCP message:'), message.id, message.method || 'response');
482
+ console.log(chalk.blue('📡 MCP message:'), message.id, message.method || 'response');
523
483
  }
524
484
  catch (error) {
525
485
  console.error('Failed to parse WebSocket message:', error);
526
486
  }
527
487
  });
528
488
  this.wsConnection.on('error', (error) => {
529
- console.error(chalk_1.default.red('WebSocket error:'), error);
489
+ console.error(chalk.red('WebSocket error:'), error);
530
490
  reject(error);
531
491
  });
532
492
  this.wsConnection.on('close', (code, reason) => {
533
- console.log(chalk_1.default.yellow(`WebSocket connection closed (${code}): ${reason}`));
493
+ console.log(chalk.yellow(`WebSocket connection closed (${code}): ${reason}`));
534
494
  // Auto-reconnect after delay
535
495
  setTimeout(() => {
536
496
  if (this.isConnected) {
537
- console.log(chalk_1.default.blue('🔄 Attempting to reconnect to WebSocket...'));
497
+ console.log(chalk.blue('🔄 Attempting to reconnect to WebSocket...'));
538
498
  this.initializeWebSocket(wsUrl).catch(err => {
539
499
  console.error('Failed to reconnect:', err);
540
500
  });
@@ -602,7 +562,7 @@ class MCPClient {
602
562
  }
603
563
  catch {
604
564
  const connectionMode = this.activeConnectionMode || 'remote';
605
- console.log(chalk_1.default.yellow(`⚠️ ${connectionMode} connection health check failed, attempting reconnection...`));
565
+ console.log(chalk.yellow(`⚠️ ${connectionMode} connection health check failed, attempting reconnection...`));
606
566
  await this.handleHealthCheckFailure();
607
567
  }
608
568
  }
@@ -610,7 +570,7 @@ class MCPClient {
610
570
  * Check WebSocket connection health
611
571
  */
612
572
  async checkWebSocketHealth() {
613
- if (!this.wsConnection || this.wsConnection.readyState !== ws_1.default.OPEN) {
573
+ if (!this.wsConnection || this.wsConnection.readyState !== WebSocket.OPEN) {
614
574
  throw new Error('WebSocket connection not open');
615
575
  }
616
576
  // Send a ping message to check connectivity
@@ -671,7 +631,7 @@ class MCPClient {
671
631
  const options = {
672
632
  connectionMode
673
633
  };
674
- console.log(chalk_1.default.yellow(`↻ Attempting reconnection using ${connectionMode} mode...`));
634
+ console.log(chalk.yellow(`↻ Attempting reconnection using ${connectionMode} mode...`));
675
635
  // Add specific URLs if available
676
636
  if (connectionMode === 'websocket') {
677
637
  options.serverUrl = this.config.get('mcpWebSocketUrl');
@@ -685,10 +645,10 @@ class MCPClient {
685
645
  // Attempt reconnection
686
646
  const reconnected = await this.connect(options);
687
647
  if (reconnected) {
688
- console.log(chalk_1.default.green('✓ Reconnected to MCP server'));
648
+ console.log(chalk.green('✓ Reconnected to MCP server'));
689
649
  }
690
650
  else {
691
- console.log(chalk_1.default.red('✗ Failed to reconnect to MCP server'));
651
+ console.log(chalk.red('✗ Failed to reconnect to MCP server'));
692
652
  }
693
653
  }
694
654
  /**
@@ -903,10 +863,9 @@ class MCPClient {
903
863
  };
904
864
  }
905
865
  }
906
- exports.MCPClient = MCPClient;
907
866
  // Singleton instance
908
867
  let mcpClientInstance = null;
909
- function getMCPClient() {
868
+ export function getMCPClient() {
910
869
  if (!mcpClientInstance) {
911
870
  mcpClientInstance = new MCPClient();
912
871
  }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@lanonasis/cli",
3
- "version": "3.6.5",
3
+ "version": "3.6.7",
4
+ "type": "module",
4
5
  "main": "dist/index.js",
5
6
  "types": "dist/index.d.ts",
6
7
  "bin": {
@@ -19,11 +20,41 @@
19
20
  "README.md",
20
21
  "LICENSE"
21
22
  ],
22
- "scripts": {
23
- "build": "rimraf dist && tsc -p tsconfig.json",
24
- "prepublishOnly": "npm run build"
23
+ "dependencies": {
24
+ "@modelcontextprotocol/sdk": "^1.1.1",
25
+ "axios": "^1.7.7",
26
+ "chalk": "^5.3.0",
27
+ "cli-progress": "^3.12.0",
28
+ "cli-table3": "^0.6.3",
29
+ "commander": "^12.1.0",
30
+ "date-fns": "^4.1.0",
31
+ "dotenv": "^16.4.5",
32
+ "eventsource": "^4.0.0",
33
+ "inquirer": "^9.3.6",
34
+ "jwt-decode": "^4.0.0",
35
+ "open": "^10.2.0",
36
+ "ora": "^8.0.1",
37
+ "table": "^6.9.0",
38
+ "word-wrap": "^1.2.5",
39
+ "ws": "^8.18.0",
40
+ "zod": "^3.24.4"
25
41
  },
26
42
  "devDependencies": {
27
- "rimraf": "^6.1.0"
43
+ "@jest/globals": "^29.7.0",
44
+ "@types/cli-progress": "^3.11.6",
45
+ "@types/inquirer": "^9.0.7",
46
+ "@types/node": "^22.10.2",
47
+ "@types/ws": "^8.5.12",
48
+ "jest": "^29.7.0",
49
+ "rimraf": "^5.0.7",
50
+ "ts-jest": "^29.1.1",
51
+ "typescript": "^5.7.2"
52
+ },
53
+ "scripts": {
54
+ "build": "rimraf dist && tsc -p tsconfig.json",
55
+ "prepublishOnly": "npm run build",
56
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
57
+ "test:watch": "npm test -- --watch",
58
+ "test:coverage": "npm test -- --coverage"
28
59
  }
29
60
  }