@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,90 +1,51 @@
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.configCommands = configCommands;
40
- const chalk_1 = __importDefault(require("chalk"));
41
- const inquirer_1 = __importDefault(require("inquirer"));
42
- const path = __importStar(require("path"));
43
- const config_js_1 = require("../utils/config.js");
44
- const api_js_1 = require("../utils/api.js");
45
- function configCommands(program) {
1
+ import chalk from 'chalk';
2
+ import inquirer from 'inquirer';
3
+ import * as path from 'path';
4
+ import { CLIConfig } from '../utils/config.js';
5
+ import { apiClient } from '../utils/api.js';
6
+ export function configCommands(program) {
46
7
  // Generic config set command
47
8
  program
48
9
  .command('set <key> <value>')
49
10
  .description('Set configuration value')
50
11
  .action(async (key, value) => {
51
- const config = new config_js_1.CLIConfig();
12
+ const config = new CLIConfig();
52
13
  await config.init();
53
14
  // Handle special cases
54
15
  switch (key) {
55
16
  case 'api-url':
56
17
  await config.setApiUrl(value);
57
- console.log(chalk_1.default.green('✓ API URL updated:'), value);
18
+ console.log(chalk.green('✓ API URL updated:'), value);
58
19
  break;
59
20
  case 'ai-integration':
60
21
  if (value === 'claude-mcp') {
61
22
  config.set('mcpEnabled', true);
62
23
  config.set('aiIntegration', 'claude-mcp');
63
- console.log(chalk_1.default.green('✓ AI integration set to Claude MCP'));
64
- console.log(chalk_1.default.cyan(' MCP will be automatically initialized for memory operations'));
65
- console.log(chalk_1.default.cyan(' Run "lanonasis mcp-server init" to test the connection'));
24
+ console.log(chalk.green('✓ AI integration set to Claude MCP'));
25
+ console.log(chalk.cyan(' MCP will be automatically initialized for memory operations'));
26
+ console.log(chalk.cyan(' Run "lanonasis mcp-server init" to test the connection'));
66
27
  }
67
28
  else {
68
- console.log(chalk_1.default.yellow('⚠️ Unknown AI integration:'), value);
69
- console.log(chalk_1.default.gray(' Currently supported: claude-mcp'));
29
+ console.log(chalk.yellow('⚠️ Unknown AI integration:'), value);
30
+ console.log(chalk.gray(' Currently supported: claude-mcp'));
70
31
  }
71
32
  break;
72
33
  case 'mcp-use-remote':
73
34
  config.set('mcpUseRemote', value === 'true');
74
- console.log(chalk_1.default.green('✓ MCP remote mode:'), value === 'true' ? 'enabled' : 'disabled');
35
+ console.log(chalk.green('✓ MCP remote mode:'), value === 'true' ? 'enabled' : 'disabled');
75
36
  break;
76
37
  case 'mcp-server-path':
77
38
  config.set('mcpServerPath', value);
78
- console.log(chalk_1.default.green('✓ MCP server path updated:'), value);
39
+ console.log(chalk.green('✓ MCP server path updated:'), value);
79
40
  break;
80
41
  case 'mcp-server-url':
81
42
  config.set('mcpServerUrl', value);
82
- console.log(chalk_1.default.green('✓ MCP server URL updated:'), value);
43
+ console.log(chalk.green('✓ MCP server URL updated:'), value);
83
44
  break;
84
45
  default:
85
46
  // Generic config set
86
47
  config.set(key, value);
87
- console.log(chalk_1.default.green(`✓ ${key} set to:`), value);
48
+ console.log(chalk.green(`✓ ${key} set to:`), value);
88
49
  }
89
50
  });
90
51
  // Generic config get command
@@ -92,14 +53,14 @@ function configCommands(program) {
92
53
  .command('get <key>')
93
54
  .description('Get configuration value')
94
55
  .action(async (key) => {
95
- const config = new config_js_1.CLIConfig();
56
+ const config = new CLIConfig();
96
57
  await config.init();
97
58
  const value = config.get(key);
98
59
  if (value !== undefined) {
99
- console.log(chalk_1.default.green(`${key}:`), value);
60
+ console.log(chalk.green(`${key}:`), value);
100
61
  }
101
62
  else {
102
- console.log(chalk_1.default.yellow(`⚠️ ${key} is not set`));
63
+ console.log(chalk.yellow(`⚠️ ${key} is not set`));
103
64
  }
104
65
  });
105
66
  // Show current configuration
@@ -107,21 +68,21 @@ function configCommands(program) {
107
68
  .command('show')
108
69
  .description('Show current configuration')
109
70
  .action(async () => {
110
- const config = new config_js_1.CLIConfig();
71
+ const config = new CLIConfig();
111
72
  await config.init();
112
- console.log(chalk_1.default.blue.bold('⚙️ Current Configuration'));
73
+ console.log(chalk.blue.bold('⚙️ Current Configuration'));
113
74
  console.log();
114
- console.log(chalk_1.default.green('API URL:'), config.getApiUrl());
115
- console.log(chalk_1.default.green('Config Path:'), config.getConfigPath());
75
+ console.log(chalk.green('API URL:'), config.getApiUrl());
76
+ console.log(chalk.green('Config Path:'), config.getConfigPath());
116
77
  const isAuth = await config.isAuthenticated();
117
- console.log(chalk_1.default.green('Authenticated:'), isAuth ? chalk_1.default.green('Yes') : chalk_1.default.red('No'));
78
+ console.log(chalk.green('Authenticated:'), isAuth ? chalk.green('Yes') : chalk.red('No'));
118
79
  if (isAuth) {
119
80
  const user = await config.getCurrentUser();
120
81
  if (user) {
121
- console.log(chalk_1.default.green('User:'), user.email);
122
- console.log(chalk_1.default.green('Organization:'), user.organization_id);
123
- console.log(chalk_1.default.green('Role:'), user.role);
124
- console.log(chalk_1.default.green('Plan:'), user.plan);
82
+ console.log(chalk.green('User:'), user.email);
83
+ console.log(chalk.green('Organization:'), user.organization_id);
84
+ console.log(chalk.green('Role:'), user.role);
85
+ console.log(chalk.green('Plan:'), user.plan);
125
86
  }
126
87
  }
127
88
  });
@@ -130,9 +91,9 @@ function configCommands(program) {
130
91
  .command('list')
131
92
  .description('List all configuration options')
132
93
  .action(async () => {
133
- const config = new config_js_1.CLIConfig();
94
+ const config = new CLIConfig();
134
95
  await config.init();
135
- console.log(chalk_1.default.blue.bold('📋 Configuration Options'));
96
+ console.log(chalk.blue.bold('📋 Configuration Options'));
136
97
  console.log();
137
98
  const configOptions = [
138
99
  { key: 'api-url', description: 'API endpoint URL', current: config.getApiUrl() },
@@ -143,10 +104,10 @@ function configCommands(program) {
143
104
  { key: 'mcpEnabled', description: 'MCP integration enabled', current: config.get('mcpEnabled') || false }
144
105
  ];
145
106
  configOptions.forEach(opt => {
146
- console.log(chalk_1.default.green(opt.key.padEnd(20)), chalk_1.default.gray(opt.description.padEnd(30)), chalk_1.default.yellow(String(opt.current)));
107
+ console.log(chalk.green(opt.key.padEnd(20)), chalk.gray(opt.description.padEnd(30)), chalk.yellow(String(opt.current)));
147
108
  });
148
109
  console.log();
149
- console.log(chalk_1.default.gray('Use "lanonasis config set <key> <value>" to update any option'));
110
+ console.log(chalk.gray('Use "lanonasis config set <key> <value>" to update any option'));
150
111
  });
151
112
  // Set API URL
152
113
  program
@@ -154,10 +115,10 @@ function configCommands(program) {
154
115
  .description('Set API URL')
155
116
  .argument('[url]', 'API URL')
156
117
  .action(async (url) => {
157
- const config = new config_js_1.CLIConfig();
118
+ const config = new CLIConfig();
158
119
  await config.init();
159
120
  if (!url) {
160
- const answer = await inquirer_1.default.prompt([
121
+ const answer = await inquirer.prompt([
161
122
  {
162
123
  type: 'input',
163
124
  name: 'url',
@@ -177,43 +138,43 @@ function configCommands(program) {
177
138
  url = answer.url;
178
139
  }
179
140
  await config.setApiUrl(url);
180
- console.log(chalk_1.default.green('✓ API URL updated:'), url);
141
+ console.log(chalk.green('✓ API URL updated:'), url);
181
142
  });
182
143
  // Test connection
183
144
  program
184
145
  .command('test')
185
146
  .description('Test connection to API')
186
147
  .action(async () => {
187
- const config = new config_js_1.CLIConfig();
148
+ const config = new CLIConfig();
188
149
  await config.init();
189
- console.log(chalk_1.default.blue('🔌 Testing connection...'));
190
- console.log(chalk_1.default.gray(`API URL: ${config.getApiUrl()}`));
150
+ console.log(chalk.blue('🔌 Testing connection...'));
151
+ console.log(chalk.gray(`API URL: ${config.getApiUrl()}`));
191
152
  console.log();
192
153
  try {
193
- const health = await api_js_1.apiClient.getHealth();
194
- console.log(chalk_1.default.green('✓ Connection successful'));
154
+ const health = await apiClient.getHealth();
155
+ console.log(chalk.green('✓ Connection successful'));
195
156
  console.log(`Status: ${health.status}`);
196
157
  console.log(`Version: ${health.version}`);
197
158
  if (health.dependencies) {
198
159
  console.log();
199
- console.log(chalk_1.default.yellow('Dependencies:'));
160
+ console.log(chalk.yellow('Dependencies:'));
200
161
  Object.entries(health.dependencies).forEach(([name, info]) => {
201
- const status = info.status === 'healthy' ? chalk_1.default.green('✓') : chalk_1.default.red('✖');
162
+ const status = info.status === 'healthy' ? chalk.green('✓') : chalk.red('✖');
202
163
  const responseTime = info.response_time || info.latency_ms || 0;
203
164
  console.log(` ${status} ${name}: ${info.status} (${responseTime}ms)`);
204
165
  });
205
166
  }
206
167
  }
207
168
  catch (error) {
208
- console.log(chalk_1.default.red('✖ Connection failed'));
169
+ console.log(chalk.red('✖ Connection failed'));
209
170
  const errorCode = error && typeof error === 'object' && 'code' in error ? error.code : null;
210
171
  const errorMessage = error instanceof Error ? error.message : 'Unknown error';
211
172
  if (errorCode === 'ECONNREFUSED') {
212
- console.error(chalk_1.default.red('Cannot connect to API server'));
213
- console.log(chalk_1.default.yellow('Make sure the API server is running'));
173
+ console.error(chalk.red('Cannot connect to API server'));
174
+ console.log(chalk.yellow('Make sure the API server is running'));
214
175
  }
215
176
  else {
216
- console.error(chalk_1.default.red('Error:'), errorMessage);
177
+ console.error(chalk.red('Error:'), errorMessage);
217
178
  }
218
179
  process.exit(1);
219
180
  }
@@ -224,17 +185,17 @@ function configCommands(program) {
224
185
  .description('Discover service endpoints')
225
186
  .option('-v, --verbose', 'show detailed discovery information')
226
187
  .action(async (options) => {
227
- const config = new config_js_1.CLIConfig();
188
+ const config = new CLIConfig();
228
189
  await config.init();
229
- console.log(chalk_1.default.blue('🔍 Discovering service endpoints...'));
190
+ console.log(chalk.blue('🔍 Discovering service endpoints...'));
230
191
  console.log();
231
192
  try {
232
193
  await config.discoverServices(options.verbose);
233
194
  const services = config.get('discoveredServices');
234
195
  if (services) {
235
- console.log(chalk_1.default.green('✓ Service discovery completed'));
196
+ console.log(chalk.green('✓ Service discovery completed'));
236
197
  console.log();
237
- console.log(chalk_1.default.yellow('Discovered endpoints:'));
198
+ console.log(chalk.yellow('Discovered endpoints:'));
238
199
  console.log(` Auth: ${services.auth_base}`);
239
200
  console.log(` Memory: ${services.memory_base}`);
240
201
  console.log(` MCP HTTP: ${services.mcp_base}`);
@@ -244,33 +205,33 @@ function configCommands(program) {
244
205
  }
245
206
  }
246
207
  catch {
247
- console.log(chalk_1.default.red('✖ Service discovery failed'));
248
- console.log(chalk_1.default.gray('Using fallback endpoints'));
208
+ console.log(chalk.red('✖ Service discovery failed'));
209
+ console.log(chalk.gray('Using fallback endpoints'));
249
210
  }
250
211
  });
251
212
  program
252
213
  .command('endpoints')
253
214
  .description('Show current service endpoints')
254
215
  .action(async () => {
255
- const config = new config_js_1.CLIConfig();
216
+ const config = new CLIConfig();
256
217
  await config.init();
257
218
  const services = config.get('discoveredServices');
258
219
  const hasManualOverrides = config.hasManualEndpointOverrides();
259
220
  const lastDiscovery = config.get('lastServiceDiscovery');
260
221
  const lastManualUpdate = config.get('lastManualEndpointUpdate');
261
- console.log(chalk_1.default.blue.bold('🌐 Service Endpoints'));
222
+ console.log(chalk.blue.bold('🌐 Service Endpoints'));
262
223
  console.log();
263
224
  if (services) {
264
- console.log(chalk_1.default.yellow('Current endpoints:'));
265
- console.log(` Auth Base: ${chalk_1.default.white(services.auth_base)}`);
266
- console.log(` Memory Base: ${chalk_1.default.white(services.memory_base)}`);
267
- console.log(` MCP HTTP: ${chalk_1.default.white(services.mcp_base)}`);
268
- console.log(` MCP WebSocket: ${chalk_1.default.white(services.mcp_ws_base)}`);
269
- console.log(` MCP SSE: ${chalk_1.default.white(services.mcp_sse_base)}`);
270
- console.log(` Project Scope: ${chalk_1.default.white(services.project_scope)}`);
225
+ console.log(chalk.yellow('Current endpoints:'));
226
+ console.log(` Auth Base: ${chalk.white(services.auth_base)}`);
227
+ console.log(` Memory Base: ${chalk.white(services.memory_base)}`);
228
+ console.log(` MCP HTTP: ${chalk.white(services.mcp_base)}`);
229
+ console.log(` MCP WebSocket: ${chalk.white(services.mcp_ws_base)}`);
230
+ console.log(` MCP SSE: ${chalk.white(services.mcp_sse_base)}`);
231
+ console.log(` Project Scope: ${chalk.white(services.project_scope)}`);
271
232
  console.log();
272
233
  if (hasManualOverrides) {
273
- console.log(chalk_1.default.cyan('📝 Manual overrides are active'));
234
+ console.log(chalk.cyan('📝 Manual overrides are active'));
274
235
  if (lastManualUpdate) {
275
236
  const updateDate = new Date(lastManualUpdate);
276
237
  console.log(` Last updated: ${updateDate.toLocaleString()}`);
@@ -278,30 +239,30 @@ function configCommands(program) {
278
239
  }
279
240
  else if (lastDiscovery) {
280
241
  const discoveryDate = new Date(lastDiscovery);
281
- console.log(chalk_1.default.green('🔍 Endpoints from service discovery'));
242
+ console.log(chalk.green('🔍 Endpoints from service discovery'));
282
243
  console.log(` Last discovered: ${discoveryDate.toLocaleString()}`);
283
244
  }
284
245
  else {
285
- console.log(chalk_1.default.gray('📋 Using fallback endpoints'));
246
+ console.log(chalk.gray('📋 Using fallback endpoints'));
286
247
  }
287
248
  }
288
249
  else {
289
- console.log(chalk_1.default.yellow('⚠️ No endpoints configured'));
290
- console.log(chalk_1.default.gray('Run: lanonasis config discover'));
250
+ console.log(chalk.yellow('⚠️ No endpoints configured'));
251
+ console.log(chalk.gray('Run: lanonasis config discover'));
291
252
  }
292
253
  });
293
254
  program
294
255
  .command('set-endpoint <type> <url>')
295
256
  .description('Set manual endpoint override (auth|memory|mcp-http|mcp-ws|mcp-sse)')
296
257
  .action(async (type, url) => {
297
- const config = new config_js_1.CLIConfig();
258
+ const config = new CLIConfig();
298
259
  await config.init();
299
260
  // Validate URL format
300
261
  try {
301
262
  new URL(url);
302
263
  }
303
264
  catch {
304
- console.log(chalk_1.default.red('✖ Invalid URL format'));
265
+ console.log(chalk.red('✖ Invalid URL format'));
305
266
  process.exit(1);
306
267
  }
307
268
  // Map type to config key
@@ -314,29 +275,29 @@ function configCommands(program) {
314
275
  };
315
276
  const configKey = endpointMap[type];
316
277
  if (!configKey) {
317
- console.log(chalk_1.default.red('✖ Invalid endpoint type'));
318
- console.log(chalk_1.default.gray('Valid types: auth, memory, mcp-http, mcp-ws, mcp-sse'));
278
+ console.log(chalk.red('✖ Invalid endpoint type'));
279
+ console.log(chalk.gray('Valid types: auth, memory, mcp-http, mcp-ws, mcp-sse'));
319
280
  process.exit(1);
320
281
  }
321
282
  // Set the manual override
322
283
  const overrides = { [configKey]: url };
323
284
  await config.setManualEndpoints(overrides);
324
- console.log(chalk_1.default.green(`✓ ${type} endpoint set to:`), url);
325
- console.log(chalk_1.default.cyan('💡 Use "lanonasis config clear-overrides" to remove manual overrides'));
285
+ console.log(chalk.green(`✓ ${type} endpoint set to:`), url);
286
+ console.log(chalk.cyan('💡 Use "lanonasis config clear-overrides" to remove manual overrides'));
326
287
  });
327
288
  program
328
289
  .command('clear-overrides')
329
290
  .description('Clear manual endpoint overrides and rediscover services')
330
291
  .action(async () => {
331
- const config = new config_js_1.CLIConfig();
292
+ const config = new CLIConfig();
332
293
  await config.init();
333
294
  if (!config.hasManualEndpointOverrides()) {
334
- console.log(chalk_1.default.yellow('⚠️ No manual overrides to clear'));
295
+ console.log(chalk.yellow('⚠️ No manual overrides to clear'));
335
296
  return;
336
297
  }
337
298
  await config.clearManualEndpointOverrides();
338
- console.log(chalk_1.default.green('✓ Manual endpoint overrides cleared'));
339
- console.log(chalk_1.default.cyan('✓ Service endpoints rediscovered'));
299
+ console.log(chalk.green('✓ Manual endpoint overrides cleared'));
300
+ console.log(chalk.cyan('✓ Service endpoints rediscovered'));
340
301
  });
341
302
  // Validate configuration
342
303
  program
@@ -345,10 +306,10 @@ function configCommands(program) {
345
306
  .option('-v, --verbose', 'show detailed validation information')
346
307
  .option('--repair', 'automatically repair common issues')
347
308
  .action(async (options) => {
348
- const config = new config_js_1.CLIConfig();
309
+ const config = new CLIConfig();
349
310
  await config.init();
350
- console.log(chalk_1.default.blue.bold('🔍 Configuration Validation'));
351
- console.log(chalk_1.default.cyan('━'.repeat(50)));
311
+ console.log(chalk.blue.bold('🔍 Configuration Validation'));
312
+ console.log(chalk.cyan('━'.repeat(50)));
352
313
  console.log();
353
314
  const validation = {
354
315
  configExists: false,
@@ -363,101 +324,101 @@ function configCommands(program) {
363
324
  repairs: []
364
325
  };
365
326
  // Step 1: Check config file existence and readability
366
- console.log(chalk_1.default.cyan('1. Configuration File'));
327
+ console.log(chalk.cyan('1. Configuration File'));
367
328
  try {
368
329
  validation.configExists = await config.exists();
369
330
  if (validation.configExists) {
370
- console.log(chalk_1.default.green(' ✓ Config file exists at'), config.getConfigPath());
331
+ console.log(chalk.green(' ✓ Config file exists at'), config.getConfigPath());
371
332
  // Try to read the config
372
333
  await config.load();
373
334
  validation.configReadable = true;
374
- console.log(chalk_1.default.green(' ✓ Config file is readable'));
335
+ console.log(chalk.green(' ✓ Config file is readable'));
375
336
  // Check config version
376
337
  validation.configVersion = config.get('version');
377
338
  if (validation.configVersion) {
378
- console.log(chalk_1.default.green(' ✓ Config version:'), validation.configVersion);
339
+ console.log(chalk.green(' ✓ Config version:'), validation.configVersion);
379
340
  }
380
341
  else {
381
- console.log(chalk_1.default.yellow(' ⚠ Config version missing (legacy config)'));
342
+ console.log(chalk.yellow(' ⚠ Config version missing (legacy config)'));
382
343
  validation.issues.push('Config version missing');
383
344
  if (options.repair) {
384
345
  await config.save(); // This will add the version
385
346
  validation.repairs.push('Added config version');
386
- console.log(chalk_1.default.cyan(' → Repaired: Added config version'));
347
+ console.log(chalk.cyan(' → Repaired: Added config version'));
387
348
  }
388
349
  }
389
350
  validation.configFormat = true;
390
351
  }
391
352
  else {
392
- console.log(chalk_1.default.red(' ✖ Config file not found'));
353
+ console.log(chalk.red(' ✖ Config file not found'));
393
354
  validation.issues.push('Config file does not exist');
394
355
  if (options.repair) {
395
356
  await config.save(); // Create empty config
396
357
  validation.repairs.push('Created config file');
397
- console.log(chalk_1.default.cyan(' → Repaired: Created config file'));
358
+ console.log(chalk.cyan(' → Repaired: Created config file'));
398
359
  }
399
360
  }
400
361
  }
401
362
  catch (error) {
402
- console.log(chalk_1.default.red(' ✖ Config file is corrupted or unreadable'));
403
- console.log(chalk_1.default.gray(` Error: ${error instanceof Error ? error.message : 'Unknown error'}`));
363
+ console.log(chalk.red(' ✖ Config file is corrupted or unreadable'));
364
+ console.log(chalk.gray(` Error: ${error instanceof Error ? error.message : 'Unknown error'}`));
404
365
  validation.issues.push('Config file is corrupted');
405
366
  if (options.repair) {
406
367
  try {
407
368
  // Try to backup the corrupted config
408
369
  const backupPath = await config.backupConfig();
409
- console.log(chalk_1.default.cyan(` → Backed up corrupted config to: ${backupPath}`));
370
+ console.log(chalk.cyan(` → Backed up corrupted config to: ${backupPath}`));
410
371
  // Create new config
411
372
  await config.clear();
412
373
  await config.save();
413
374
  validation.repairs.push('Recreated corrupted config file');
414
- console.log(chalk_1.default.cyan(' → Repaired: Recreated config file'));
375
+ console.log(chalk.cyan(' → Repaired: Recreated config file'));
415
376
  }
416
377
  catch {
417
- console.log(chalk_1.default.red(' ✖ Could not repair corrupted config'));
378
+ console.log(chalk.red(' ✖ Could not repair corrupted config'));
418
379
  }
419
380
  }
420
381
  }
421
382
  // Step 2: Validate authentication configuration
422
- console.log(chalk_1.default.cyan('\n2. Authentication Configuration'));
383
+ console.log(chalk.cyan('\n2. Authentication Configuration'));
423
384
  const token = config.getToken();
424
385
  const vendorKey = config.getVendorKey();
425
386
  const authMethod = config.get('authMethod');
426
387
  if (!token && !vendorKey) {
427
- console.log(chalk_1.default.yellow(' ⚠ No authentication credentials configured'));
388
+ console.log(chalk.yellow(' ⚠ No authentication credentials configured'));
428
389
  validation.issues.push('No authentication credentials');
429
390
  }
430
391
  else {
431
- console.log(chalk_1.default.green(' ✓ Authentication credentials found'));
392
+ console.log(chalk.green(' ✓ Authentication credentials found'));
432
393
  // Validate auth method consistency
433
394
  if (vendorKey && authMethod !== 'vendor_key') {
434
- console.log(chalk_1.default.yellow(' ⚠ Auth method mismatch (has vendor key but method is not vendor_key)'));
395
+ console.log(chalk.yellow(' ⚠ Auth method mismatch (has vendor key but method is not vendor_key)'));
435
396
  validation.issues.push('Auth method mismatch');
436
397
  if (options.repair) {
437
398
  config.set('authMethod', 'vendor_key');
438
399
  await config.save();
439
400
  validation.repairs.push('Fixed auth method for vendor key');
440
- console.log(chalk_1.default.cyan(' → Repaired: Set auth method to vendor_key'));
401
+ console.log(chalk.cyan(' → Repaired: Set auth method to vendor_key'));
441
402
  }
442
403
  }
443
404
  else if (token && !vendorKey && authMethod !== 'jwt' && authMethod !== 'oauth') {
444
- console.log(chalk_1.default.yellow(' ⚠ Auth method mismatch (has token but method is not jwt/oauth)'));
405
+ console.log(chalk.yellow(' ⚠ Auth method mismatch (has token but method is not jwt/oauth)'));
445
406
  validation.issues.push('Auth method mismatch');
446
407
  if (options.repair) {
447
408
  config.set('authMethod', 'jwt');
448
409
  await config.save();
449
410
  validation.repairs.push('Fixed auth method for token');
450
- console.log(chalk_1.default.cyan(' → Repaired: Set auth method to jwt'));
411
+ console.log(chalk.cyan(' → Repaired: Set auth method to jwt'));
451
412
  }
452
413
  }
453
414
  // Validate vendor key presence if present
454
415
  if (vendorKey) {
455
416
  const formatValidation = config.validateVendorKeyFormat(vendorKey);
456
417
  if (formatValidation === true) {
457
- console.log(chalk_1.default.green(' ✓ Vendor key is set'));
418
+ console.log(chalk.green(' ✓ Vendor key is set'));
458
419
  }
459
420
  else {
460
- console.log(chalk_1.default.red(` ✖ Vendor key issue: ${formatValidation}`));
421
+ console.log(chalk.red(` ✖ Vendor key issue: ${formatValidation}`));
461
422
  validation.issues.push('Vendor key missing or invalid');
462
423
  }
463
424
  }
@@ -466,28 +427,28 @@ function configCommands(program) {
466
427
  const isValid = await config.validateStoredCredentials();
467
428
  validation.authenticationValid = isValid;
468
429
  if (isValid) {
469
- console.log(chalk_1.default.green(' ✓ Authentication credentials are valid'));
430
+ console.log(chalk.green(' ✓ Authentication credentials are valid'));
470
431
  }
471
432
  else {
472
- console.log(chalk_1.default.red(' ✖ Authentication credentials are invalid'));
433
+ console.log(chalk.red(' ✖ Authentication credentials are invalid'));
473
434
  validation.issues.push('Invalid authentication credentials');
474
435
  }
475
436
  }
476
437
  catch (error) {
477
- console.log(chalk_1.default.yellow(' ⚠ Could not validate authentication credentials'));
438
+ console.log(chalk.yellow(' ⚠ Could not validate authentication credentials'));
478
439
  if (options.verbose) {
479
- console.log(chalk_1.default.gray(` Error: ${error instanceof Error ? error.message : 'Unknown error'}`));
440
+ console.log(chalk.gray(` Error: ${error instanceof Error ? error.message : 'Unknown error'}`));
480
441
  }
481
442
  }
482
443
  }
483
444
  // Step 3: Validate service endpoints
484
- console.log(chalk_1.default.cyan('\n3. Service Endpoints'));
445
+ console.log(chalk.cyan('\n3. Service Endpoints'));
485
446
  try {
486
447
  await config.discoverServices(options.verbose);
487
448
  const services = config.get('discoveredServices');
488
449
  if (services) {
489
450
  validation.endpointsValid = true;
490
- console.log(chalk_1.default.green(' ✓ Service endpoints are configured'));
451
+ console.log(chalk.green(' ✓ Service endpoints are configured'));
491
452
  // Validate endpoint URLs
492
453
  const endpoints = [
493
454
  { name: 'Auth', url: services.auth_base },
@@ -501,32 +462,32 @@ function configCommands(program) {
501
462
  try {
502
463
  new URL(endpoint.url);
503
464
  if (options.verbose) {
504
- console.log(chalk_1.default.green(` ✓ ${endpoint.name}: ${endpoint.url}`));
465
+ console.log(chalk.green(` ✓ ${endpoint.name}: ${endpoint.url}`));
505
466
  }
506
467
  }
507
468
  catch {
508
- console.log(chalk_1.default.red(` ✖ Invalid ${endpoint.name} URL: ${endpoint.url}`));
469
+ console.log(chalk.red(` ✖ Invalid ${endpoint.name} URL: ${endpoint.url}`));
509
470
  validation.issues.push(`Invalid ${endpoint.name} URL`);
510
471
  }
511
472
  }
512
473
  }
513
474
  // Check for manual overrides
514
475
  if (config.hasManualEndpointOverrides()) {
515
- console.log(chalk_1.default.cyan(' ℹ Manual endpoint overrides are active'));
476
+ console.log(chalk.cyan(' ℹ Manual endpoint overrides are active'));
516
477
  const lastUpdate = config.get('lastManualEndpointUpdate');
517
478
  if (lastUpdate && options.verbose) {
518
479
  const updateDate = new Date(lastUpdate);
519
- console.log(chalk_1.default.gray(` Last updated: ${updateDate.toLocaleString()}`));
480
+ console.log(chalk.gray(` Last updated: ${updateDate.toLocaleString()}`));
520
481
  }
521
482
  }
522
483
  }
523
484
  else {
524
- console.log(chalk_1.default.red(' ✖ Service endpoints are not configured'));
485
+ console.log(chalk.red(' ✖ Service endpoints are not configured'));
525
486
  validation.issues.push('Service endpoints not configured');
526
487
  }
527
488
  }
528
489
  catch {
529
- console.log(chalk_1.default.red(' ✖ Service endpoint discovery failed'));
490
+ console.log(chalk.red(' ✖ Service endpoint discovery failed'));
530
491
  validation.issues.push('Service endpoint discovery failed');
531
492
  if (options.repair) {
532
493
  // Set fallback endpoints
@@ -538,52 +499,52 @@ function configCommands(program) {
538
499
  mcp_sse_base: 'https://mcp.lanonasis.com/api/v1/events'
539
500
  });
540
501
  validation.repairs.push('Set fallback service endpoints');
541
- console.log(chalk_1.default.cyan(' → Repaired: Set fallback service endpoints'));
502
+ console.log(chalk.cyan(' → Repaired: Set fallback service endpoints'));
542
503
  }
543
504
  }
544
505
  // Step 4: Validate MCP configuration
545
- console.log(chalk_1.default.cyan('\n4. MCP Configuration'));
506
+ console.log(chalk.cyan('\n4. MCP Configuration'));
546
507
  const mcpPreference = config.get('mcpPreference');
547
508
  // const mcpServerPath = config.get<string>('mcpServerPath');
548
509
  const mcpServerUrl = config.get('mcpServerUrl');
549
510
  if (mcpPreference) {
550
511
  if (['local', 'remote', 'auto'].includes(mcpPreference)) {
551
- console.log(chalk_1.default.green(` ✓ MCP preference: ${mcpPreference}`));
512
+ console.log(chalk.green(` ✓ MCP preference: ${mcpPreference}`));
552
513
  validation.mcpConfigValid = true;
553
514
  }
554
515
  else {
555
- console.log(chalk_1.default.red(` ✖ Invalid MCP preference: ${mcpPreference}`));
516
+ console.log(chalk.red(` ✖ Invalid MCP preference: ${mcpPreference}`));
556
517
  validation.issues.push('Invalid MCP preference');
557
518
  if (options.repair) {
558
519
  config.set('mcpPreference', 'auto');
559
520
  await config.save();
560
521
  validation.repairs.push('Reset MCP preference to auto');
561
- console.log(chalk_1.default.cyan(' → Repaired: Reset MCP preference to auto'));
522
+ console.log(chalk.cyan(' → Repaired: Reset MCP preference to auto'));
562
523
  }
563
524
  }
564
525
  }
565
526
  else {
566
- console.log(chalk_1.default.yellow(' ⚠ MCP preference not set (using default: auto)'));
527
+ console.log(chalk.yellow(' ⚠ MCP preference not set (using default: auto)'));
567
528
  if (options.repair) {
568
529
  config.set('mcpPreference', 'auto');
569
530
  await config.save();
570
531
  validation.repairs.push('Set default MCP preference');
571
- console.log(chalk_1.default.cyan(' → Repaired: Set MCP preference to auto'));
532
+ console.log(chalk.cyan(' → Repaired: Set MCP preference to auto'));
572
533
  }
573
534
  }
574
535
  // Validate MCP URLs if present
575
536
  if (mcpServerUrl) {
576
537
  try {
577
538
  new URL(mcpServerUrl);
578
- console.log(chalk_1.default.green(' ✓ MCP server URL is valid'));
539
+ console.log(chalk.green(' ✓ MCP server URL is valid'));
579
540
  }
580
541
  catch {
581
- console.log(chalk_1.default.red(` ✖ Invalid MCP server URL: ${mcpServerUrl}`));
542
+ console.log(chalk.red(` ✖ Invalid MCP server URL: ${mcpServerUrl}`));
582
543
  validation.issues.push('Invalid MCP server URL');
583
544
  }
584
545
  }
585
546
  // Step 5: Check for configuration backup
586
- console.log(chalk_1.default.cyan('\n5. Configuration Backup'));
547
+ console.log(chalk.cyan('\n5. Configuration Backup'));
587
548
  try {
588
549
  const configDir = path.dirname(config.getConfigPath());
589
550
  const fs = await import('fs/promises');
@@ -591,44 +552,44 @@ function configCommands(program) {
591
552
  const backupFiles = files.filter(f => f.startsWith('config.backup.'));
592
553
  if (backupFiles.length > 0) {
593
554
  validation.backupExists = true;
594
- console.log(chalk_1.default.green(` ✓ Found ${backupFiles.length} configuration backup(s)`));
555
+ console.log(chalk.green(` ✓ Found ${backupFiles.length} configuration backup(s)`));
595
556
  if (options.verbose) {
596
557
  const latestBackup = backupFiles.sort().reverse()[0];
597
- console.log(chalk_1.default.gray(` Latest backup: ${latestBackup}`));
558
+ console.log(chalk.gray(` Latest backup: ${latestBackup}`));
598
559
  }
599
560
  }
600
561
  else {
601
- console.log(chalk_1.default.yellow(' ⚠ No configuration backups found'));
562
+ console.log(chalk.yellow(' ⚠ No configuration backups found'));
602
563
  if (options.repair) {
603
564
  const backupPath = await config.backupConfig();
604
565
  validation.repairs.push('Created configuration backup');
605
- console.log(chalk_1.default.cyan(` → Repaired: Created backup at ${path.basename(backupPath)}`));
566
+ console.log(chalk.cyan(` → Repaired: Created backup at ${path.basename(backupPath)}`));
606
567
  }
607
568
  }
608
569
  }
609
570
  catch (error) {
610
- console.log(chalk_1.default.yellow(' ⚠ Could not check for backups'));
571
+ console.log(chalk.yellow(' ⚠ Could not check for backups'));
611
572
  if (options.verbose) {
612
- console.log(chalk_1.default.gray(` Error: ${error instanceof Error ? error.message : 'Unknown error'}`));
573
+ console.log(chalk.gray(` Error: ${error instanceof Error ? error.message : 'Unknown error'}`));
613
574
  }
614
575
  }
615
576
  // Summary and recommendations
616
- console.log(chalk_1.default.blue.bold('\n📋 Configuration Validation Summary'));
617
- console.log(chalk_1.default.cyan('━'.repeat(50)));
577
+ console.log(chalk.blue.bold('\n📋 Configuration Validation Summary'));
578
+ console.log(chalk.cyan('━'.repeat(50)));
618
579
  if (validation.issues.length === 0) {
619
- console.log(chalk_1.default.green('✅ Configuration validation passed!'));
620
- console.log(chalk_1.default.cyan(' Your configuration is valid and healthy.'));
580
+ console.log(chalk.green('✅ Configuration validation passed!'));
581
+ console.log(chalk.cyan(' Your configuration is valid and healthy.'));
621
582
  }
622
583
  else {
623
- console.log(chalk_1.default.red(`❌ Found ${validation.issues.length} issue(s):`));
584
+ console.log(chalk.red(`❌ Found ${validation.issues.length} issue(s):`));
624
585
  validation.issues.forEach(issue => {
625
- console.log(chalk_1.default.red(` • ${issue}`));
586
+ console.log(chalk.red(` • ${issue}`));
626
587
  });
627
588
  }
628
589
  if (validation.repairs.length > 0) {
629
- console.log(chalk_1.default.yellow(`\n🔧 Applied ${validation.repairs.length} repair(s):`));
590
+ console.log(chalk.yellow(`\n🔧 Applied ${validation.repairs.length} repair(s):`));
630
591
  validation.repairs.forEach(repair => {
631
- console.log(chalk_1.default.cyan(` • ${repair}`));
592
+ console.log(chalk.cyan(` • ${repair}`));
632
593
  });
633
594
  }
634
595
  // Recommendations
@@ -646,9 +607,9 @@ function configCommands(program) {
646
607
  recommendations.push('Run: lanonasis config validate --repair (to create backup)');
647
608
  }
648
609
  if (recommendations.length > 0) {
649
- console.log(chalk_1.default.yellow('\n💡 Recommended actions:'));
610
+ console.log(chalk.yellow('\n💡 Recommended actions:'));
650
611
  recommendations.forEach(rec => {
651
- console.log(chalk_1.default.cyan(` • ${rec}`));
612
+ console.log(chalk.cyan(` • ${rec}`));
652
613
  });
653
614
  }
654
615
  });
@@ -657,16 +618,16 @@ function configCommands(program) {
657
618
  .command('backup')
658
619
  .description('Create a backup of current configuration')
659
620
  .action(async () => {
660
- const config = new config_js_1.CLIConfig();
621
+ const config = new CLIConfig();
661
622
  await config.init();
662
623
  try {
663
624
  const backupPath = await config.backupConfig();
664
- console.log(chalk_1.default.green('✓ Configuration backed up to:'));
665
- console.log(chalk_1.default.cyan(` ${backupPath}`));
625
+ console.log(chalk.green('✓ Configuration backed up to:'));
626
+ console.log(chalk.cyan(` ${backupPath}`));
666
627
  }
667
628
  catch (error) {
668
- console.log(chalk_1.default.red('✖ Failed to create backup:'));
669
- console.log(chalk_1.default.gray(` ${error instanceof Error ? error.message : 'Unknown error'}`));
629
+ console.log(chalk.red('✖ Failed to create backup:'));
630
+ console.log(chalk.gray(` ${error instanceof Error ? error.message : 'Unknown error'}`));
670
631
  process.exit(1);
671
632
  }
672
633
  });
@@ -676,7 +637,7 @@ function configCommands(program) {
676
637
  .description('Restore configuration from backup')
677
638
  .argument('[backup-file]', 'specific backup file to restore from')
678
639
  .action(async (backupFile) => {
679
- const config = new config_js_1.CLIConfig();
640
+ const config = new CLIConfig();
680
641
  await config.init();
681
642
  try {
682
643
  const configDir = path.dirname(config.getConfigPath());
@@ -691,17 +652,17 @@ function configCommands(program) {
691
652
  const files = await fs.readdir(configDir);
692
653
  const backupFiles = files.filter(f => f.startsWith('config.backup.')).sort().reverse();
693
654
  if (backupFiles.length === 0) {
694
- console.log(chalk_1.default.red('✖ No backup files found'));
695
- console.log(chalk_1.default.gray(' Run: lanonasis config backup'));
655
+ console.log(chalk.red('✖ No backup files found'));
656
+ console.log(chalk.gray(' Run: lanonasis config backup'));
696
657
  process.exit(1);
697
658
  }
698
659
  backupPath = path.join(configDir, backupFiles[0]);
699
- console.log(chalk_1.default.cyan(`Using latest backup: ${backupFiles[0]}`));
660
+ console.log(chalk.cyan(`Using latest backup: ${backupFiles[0]}`));
700
661
  }
701
662
  // Verify backup file exists
702
663
  await fs.access(backupPath);
703
664
  // Confirm restoration
704
- const answer = await inquirer_1.default.prompt([
665
+ const answer = await inquirer.prompt([
705
666
  {
706
667
  type: 'confirm',
707
668
  name: 'confirm',
@@ -710,20 +671,20 @@ function configCommands(program) {
710
671
  }
711
672
  ]);
712
673
  if (!answer.confirm) {
713
- console.log(chalk_1.default.yellow('Restore cancelled'));
674
+ console.log(chalk.yellow('Restore cancelled'));
714
675
  return;
715
676
  }
716
677
  // Create backup of current config before restoring
717
678
  const currentBackupPath = await config.backupConfig();
718
- console.log(chalk_1.default.cyan(`Current config backed up to: ${path.basename(currentBackupPath)}`));
679
+ console.log(chalk.cyan(`Current config backed up to: ${path.basename(currentBackupPath)}`));
719
680
  // Restore from backup
720
681
  await fs.copyFile(backupPath, config.getConfigPath());
721
- console.log(chalk_1.default.green('✓ Configuration restored from backup'));
722
- console.log(chalk_1.default.cyan(' You may need to re-authenticate if credentials were changed'));
682
+ console.log(chalk.green('✓ Configuration restored from backup'));
683
+ console.log(chalk.cyan(' You may need to re-authenticate if credentials were changed'));
723
684
  }
724
685
  catch (error) {
725
- console.log(chalk_1.default.red('✖ Failed to restore from backup:'));
726
- console.log(chalk_1.default.gray(` ${error instanceof Error ? error.message : 'Unknown error'}`));
686
+ console.log(chalk.red('✖ Failed to restore from backup:'));
687
+ console.log(chalk.gray(` ${error instanceof Error ? error.message : 'Unknown error'}`));
727
688
  process.exit(1);
728
689
  }
729
690
  });
@@ -734,7 +695,7 @@ function configCommands(program) {
734
695
  .option('-f, --force', 'skip confirmation')
735
696
  .action(async (options) => {
736
697
  if (!options.force) {
737
- const answer = await inquirer_1.default.prompt([
698
+ const answer = await inquirer.prompt([
738
699
  {
739
700
  type: 'confirm',
740
701
  name: 'confirm',
@@ -743,21 +704,21 @@ function configCommands(program) {
743
704
  }
744
705
  ]);
745
706
  if (!answer.confirm) {
746
- console.log(chalk_1.default.yellow('Reset cancelled'));
707
+ console.log(chalk.yellow('Reset cancelled'));
747
708
  return;
748
709
  }
749
710
  }
750
- const config = new config_js_1.CLIConfig();
711
+ const config = new CLIConfig();
751
712
  // Create backup before reset
752
713
  try {
753
714
  const backupPath = await config.backupConfig();
754
- console.log(chalk_1.default.cyan(`Configuration backed up to: ${path.basename(backupPath)}`));
715
+ console.log(chalk.cyan(`Configuration backed up to: ${path.basename(backupPath)}`));
755
716
  }
756
717
  catch {
757
718
  // Ignore backup errors during reset
758
719
  }
759
720
  await config.clear();
760
- console.log(chalk_1.default.green('✓ Configuration reset'));
761
- console.log(chalk_1.default.yellow('Run'), chalk_1.default.white('lanonasis auth login'), chalk_1.default.yellow('to reconfigure'));
721
+ console.log(chalk.green('✓ Configuration reset'));
722
+ console.log(chalk.yellow('Run'), chalk.white('lanonasis auth login'), chalk.yellow('to reconfigure'));
762
723
  });
763
724
  }