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