@lanonasis/cli 3.6.3 → 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 +61 -15
  36. package/dist/utils/formatting.js +14 -6
  37. package/dist/utils/mcp-client.js +132 -77
  38. package/package.json +17 -92
  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,3 +1,2 @@
1
- import { Command } from 'commander';
2
- declare const apiKeysCommand: Command;
1
+ declare const apiKeysCommand: any;
3
2
  export default apiKeysCommand;
@@ -1,27 +1,32 @@
1
- import { Command } from 'commander';
2
- import inquirer from 'inquirer';
3
- import chalk from 'chalk';
4
- import Table from 'cli-table3';
5
- import { apiClient } from '../utils/api.js';
6
- import { formatDate, truncateText } from '../utils/formatting.js';
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const inquirer_1 = __importDefault(require("inquirer"));
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const cli_table3_1 = __importDefault(require("cli-table3"));
10
+ const api_js_1 = require("../utils/api.js");
11
+ const formatting_js_1 = require("../utils/formatting.js");
7
12
  // Enhanced VPS-style color scheme
8
13
  const colors = {
9
- primary: chalk.blue.bold,
10
- success: chalk.green,
11
- warning: chalk.yellow,
12
- error: chalk.red,
13
- info: chalk.cyan,
14
- accent: chalk.magenta,
15
- muted: chalk.gray,
16
- highlight: chalk.white.bold
14
+ primary: chalk_1.default.blue.bold,
15
+ success: chalk_1.default.green,
16
+ warning: chalk_1.default.yellow,
17
+ error: chalk_1.default.red,
18
+ info: chalk_1.default.cyan,
19
+ accent: chalk_1.default.magenta,
20
+ muted: chalk_1.default.gray,
21
+ highlight: chalk_1.default.white.bold
17
22
  };
18
- const apiKeysCommand = new Command('api-keys')
23
+ const apiKeysCommand = new commander_1.Command('api-keys')
19
24
  .alias('keys')
20
25
  .description(colors.info('🔐 Manage API keys securely with enterprise-grade encryption'));
21
26
  // ============================================================================
22
27
  // PROJECT COMMANDS
23
28
  // ============================================================================
24
- const projectsCommand = new Command('projects')
29
+ const projectsCommand = new commander_1.Command('projects')
25
30
  .description(colors.accent('📁 Manage API key projects and organization'));
26
31
  projectsCommand
27
32
  .command('create')
@@ -38,7 +43,7 @@ projectsCommand
38
43
  organizationId: options.organizationId
39
44
  };
40
45
  if (options.interactive || !projectData.name || !projectData.organizationId) {
41
- const answers = await inquirer.prompt([
46
+ const answers = await inquirer_1.default.prompt([
42
47
  {
43
48
  type: 'input',
44
49
  name: 'name',
@@ -65,16 +70,16 @@ projectsCommand
65
70
  ]);
66
71
  projectData = { ...projectData, ...answers };
67
72
  }
68
- const project = await apiClient.post('/api-keys/projects', projectData);
69
- console.log(chalk.green('✅ Project created successfully!'));
70
- console.log(chalk.blue(`Project ID: ${project.id}`));
71
- console.log(chalk.blue(`Name: ${project.name}`));
73
+ const project = await api_js_1.apiClient.post('/api-keys/projects', projectData);
74
+ console.log(chalk_1.default.green('✅ Project created successfully!'));
75
+ console.log(chalk_1.default.blue(`Project ID: ${project.id}`));
76
+ console.log(chalk_1.default.blue(`Name: ${project.name}`));
72
77
  if (project.description) {
73
- console.log(chalk.blue(`Description: ${project.description}`));
78
+ console.log(chalk_1.default.blue(`Description: ${project.description}`));
74
79
  }
75
80
  }
76
81
  catch (error) {
77
- console.error(chalk.red('❌ Failed to create project:'), error.message);
82
+ console.error(chalk_1.default.red('❌ Failed to create project:'), error.message);
78
83
  process.exit(1);
79
84
  }
80
85
  });
@@ -85,33 +90,33 @@ projectsCommand
85
90
  .option('--json', 'Output as JSON')
86
91
  .action(async (options) => {
87
92
  try {
88
- const projects = await apiClient.get('/api-keys/projects');
93
+ const projects = await api_js_1.apiClient.get('/api-keys/projects');
89
94
  if (options.json) {
90
95
  console.log(JSON.stringify(projects, null, 2));
91
96
  return;
92
97
  }
93
98
  if (projects.length === 0) {
94
- console.log(chalk.yellow('No projects found'));
99
+ console.log(chalk_1.default.yellow('No projects found'));
95
100
  return;
96
101
  }
97
- const table = new Table({
98
- head: ['ID', 'Name', 'Description', 'Owner', 'Created'].map(h => chalk.cyan(h)),
102
+ const table = new cli_table3_1.default({
103
+ head: ['ID', 'Name', 'Description', 'Owner', 'Created'].map(h => chalk_1.default.cyan(h)),
99
104
  style: { head: [], border: [] }
100
105
  });
101
106
  projects.forEach((project) => {
102
107
  table.push([
103
- truncateText(project.id, 20),
108
+ (0, formatting_js_1.truncateText)(project.id, 20),
104
109
  project.name,
105
- truncateText(project.description || '-', 30),
106
- truncateText(project.ownerId, 20),
107
- formatDate(project.createdAt)
110
+ (0, formatting_js_1.truncateText)(project.description || '-', 30),
111
+ (0, formatting_js_1.truncateText)(project.ownerId, 20),
112
+ (0, formatting_js_1.formatDate)(project.createdAt)
108
113
  ]);
109
114
  });
110
115
  console.log(table.toString());
111
- console.log(chalk.gray(`Total: ${projects.length} projects`));
116
+ console.log(chalk_1.default.gray(`Total: ${projects.length} projects`));
112
117
  }
113
118
  catch (error) {
114
- console.error(chalk.red('❌ Failed to list projects:'), error.message);
119
+ console.error(chalk_1.default.red('❌ Failed to list projects:'), error.message);
115
120
  process.exit(1);
116
121
  }
117
122
  });
@@ -145,8 +150,8 @@ apiKeysCommand
145
150
  rotationFrequency: parseInt(options.rotationFrequency)
146
151
  };
147
152
  if (options.interactive || !keyData.name || !keyData.value || !keyData.projectId) {
148
- const projects = await apiClient.get('/api-keys/projects');
149
- const answers = await inquirer.prompt([
153
+ const projects = await api_js_1.apiClient.get('/api-keys/projects');
154
+ const answers = await inquirer_1.default.prompt([
150
155
  {
151
156
  type: 'input',
152
157
  name: 'name',
@@ -225,7 +230,7 @@ apiKeysCommand
225
230
  ]);
226
231
  keyData = { ...keyData, ...answers };
227
232
  }
228
- const apiKey = await apiClient.post('/api-keys', keyData);
233
+ const apiKey = await api_js_1.apiClient.post('/api-keys', keyData);
229
234
  console.log(colors.success('🔐 API key created successfully!'));
230
235
  console.log(colors.info('━'.repeat(50)));
231
236
  console.log(`${colors.highlight('Key ID:')} ${colors.primary(apiKey.id)}`);
@@ -253,7 +258,7 @@ apiKeysCommand
253
258
  if (options.projectId) {
254
259
  url += `?projectId=${options.projectId}`;
255
260
  }
256
- const apiKeys = await apiClient.get(url);
261
+ const apiKeys = await api_js_1.apiClient.get(url);
257
262
  if (options.json) {
258
263
  console.log(JSON.stringify(apiKeys, null, 2));
259
264
  return;
@@ -265,7 +270,7 @@ apiKeysCommand
265
270
  }
266
271
  console.log(colors.primary('🔐 API Key Management'));
267
272
  console.log(colors.info('═'.repeat(80)));
268
- const table = new Table({
273
+ const table = new cli_table3_1.default({
269
274
  head: ['ID', 'Name', 'Type', 'Environment', 'Status', 'Usage', 'Last Rotated'].map(h => colors.accent(h)),
270
275
  style: { head: [], border: [] }
271
276
  });
@@ -273,13 +278,13 @@ apiKeysCommand
273
278
  const statusColor = key.status === 'active' ? colors.success :
274
279
  key.status === 'rotating' ? colors.warning : colors.error;
275
280
  table.push([
276
- truncateText(key.id, 20),
281
+ (0, formatting_js_1.truncateText)(key.id, 20),
277
282
  key.name,
278
283
  key.keyType,
279
284
  key.environment,
280
285
  statusColor(key.status),
281
286
  colors.highlight(key.usageCount.toString()),
282
- formatDate(key.lastRotated)
287
+ (0, formatting_js_1.formatDate)(key.lastRotated)
283
288
  ]);
284
289
  });
285
290
  console.log(table.toString());
@@ -299,7 +304,7 @@ apiKeysCommand
299
304
  .option('--json', 'Output as JSON')
300
305
  .action(async (keyId, options) => {
301
306
  try {
302
- const apiKey = await apiClient.get(`/api-keys/${keyId}`);
307
+ const apiKey = await api_js_1.apiClient.get(`/api-keys/${keyId}`);
303
308
  if (options.json) {
304
309
  console.log(JSON.stringify(apiKey, null, 2));
305
310
  return;
@@ -318,11 +323,11 @@ apiKeysCommand
318
323
  console.log(`${colors.highlight('Usage Count:')} ${colors.accent(apiKey.usageCount)}`);
319
324
  console.log(`${colors.highlight('Tags:')} ${colors.muted(apiKey.tags.join(', ') || 'None')}`);
320
325
  console.log(`${colors.highlight('Rotation Frequency:')} ${colors.info(apiKey.rotationFrequency)} days`);
321
- console.log(`${colors.highlight('Last Rotated:')} ${colors.muted(formatDate(apiKey.lastRotated))}`);
322
- console.log(`${colors.highlight('Created:')} ${colors.muted(formatDate(apiKey.createdAt))}`);
323
- console.log(`${colors.highlight('Updated:')} ${colors.muted(formatDate(apiKey.updatedAt))}`);
326
+ console.log(`${colors.highlight('Last Rotated:')} ${colors.muted((0, formatting_js_1.formatDate)(apiKey.lastRotated))}`);
327
+ console.log(`${colors.highlight('Created:')} ${colors.muted((0, formatting_js_1.formatDate)(apiKey.createdAt))}`);
328
+ console.log(`${colors.highlight('Updated:')} ${colors.muted((0, formatting_js_1.formatDate)(apiKey.updatedAt))}`);
324
329
  if (apiKey.expiresAt) {
325
- console.log(`${colors.highlight('Expires:')} ${colors.warning(formatDate(apiKey.expiresAt))}`);
330
+ console.log(`${colors.highlight('Expires:')} ${colors.warning((0, formatting_js_1.formatDate)(apiKey.expiresAt))}`);
326
331
  }
327
332
  console.log(colors.info('═'.repeat(60)));
328
333
  }
@@ -353,8 +358,8 @@ apiKeysCommand
353
358
  if (options.rotationFrequency)
354
359
  updateData.rotationFrequency = parseInt(options.rotationFrequency);
355
360
  if (options.interactive || Object.keys(updateData).length === 0) {
356
- const current = await apiClient.get(`/api-keys/${keyId}`);
357
- const answers = await inquirer.prompt([
361
+ const current = await api_js_1.apiClient.get(`/api-keys/${keyId}`);
362
+ const answers = await inquirer_1.default.prompt([
358
363
  {
359
364
  type: 'input',
360
365
  name: 'name',
@@ -395,7 +400,7 @@ apiKeysCommand
395
400
  updateData = { ...updateData, ...answers };
396
401
  delete updateData.updateValue;
397
402
  }
398
- const updatedKey = await apiClient.put(`/api-keys/${keyId}`, updateData);
403
+ const updatedKey = await api_js_1.apiClient.put(`/api-keys/${keyId}`, updateData);
399
404
  console.log(colors.success('🔄 API key updated successfully!'));
400
405
  console.log(colors.info('━'.repeat(40)));
401
406
  console.log(`${colors.highlight('Name:')} ${colors.accent(updatedKey.name)}`);
@@ -420,8 +425,8 @@ apiKeysCommand
420
425
  .action(async (keyId, options) => {
421
426
  try {
422
427
  if (!options.force) {
423
- const apiKey = await apiClient.get(`/api-keys/${keyId}`);
424
- const { confirm } = await inquirer.prompt([
428
+ const apiKey = await api_js_1.apiClient.get(`/api-keys/${keyId}`);
429
+ const { confirm } = await inquirer_1.default.prompt([
425
430
  {
426
431
  type: 'confirm',
427
432
  name: 'confirm',
@@ -434,7 +439,7 @@ apiKeysCommand
434
439
  return;
435
440
  }
436
441
  }
437
- await apiClient.delete(`/api-keys/${keyId}`);
442
+ await api_js_1.apiClient.delete(`/api-keys/${keyId}`);
438
443
  console.log(colors.success('🗑️ API key deleted successfully!'));
439
444
  }
440
445
  catch (error) {
@@ -445,7 +450,7 @@ apiKeysCommand
445
450
  // ============================================================================
446
451
  // MCP COMMANDS
447
452
  // ============================================================================
448
- const mcpCommand = new Command('mcp')
453
+ const mcpCommand = new commander_1.Command('mcp')
449
454
  .description(colors.accent('🤖 Model Context Protocol (MCP) - Secure AI agent access'));
450
455
  mcpCommand
451
456
  .command('register-tool')
@@ -478,7 +483,7 @@ mcpCommand
478
483
  riskLevel: options.riskLevel
479
484
  };
480
485
  if (options.interactive || !toolData.toolId || !toolData.toolName || !toolData.organizationId) {
481
- const answers = await inquirer.prompt([
486
+ const answers = await inquirer_1.default.prompt([
482
487
  {
483
488
  type: 'input',
484
489
  name: 'toolId',
@@ -564,7 +569,7 @@ mcpCommand
564
569
  delete toolData.maxConcurrentSessions;
565
570
  delete toolData.maxSessionDuration;
566
571
  }
567
- const tool = await apiClient.post('/api-keys/mcp/tools', toolData);
572
+ const tool = await api_js_1.apiClient.post('/api-keys/mcp/tools', toolData);
568
573
  console.log(colors.success('🤖 MCP tool registered successfully!'));
569
574
  console.log(colors.info('━'.repeat(50)));
570
575
  console.log(`${colors.highlight('Tool ID:')} ${colors.primary(tool.toolId)}`);
@@ -584,7 +589,7 @@ mcpCommand
584
589
  .option('--json', 'Output as JSON')
585
590
  .action(async (options) => {
586
591
  try {
587
- const tools = await apiClient.get('/api-keys/mcp/tools');
592
+ const tools = await api_js_1.apiClient.get('/api-keys/mcp/tools');
588
593
  if (options.json) {
589
594
  console.log(JSON.stringify(tools, null, 2));
590
595
  return;
@@ -596,7 +601,7 @@ mcpCommand
596
601
  }
597
602
  console.log(colors.primary('🤖 Registered MCP Tools'));
598
603
  console.log(colors.info('═'.repeat(80)));
599
- const table = new Table({
604
+ const table = new cli_table3_1.default({
600
605
  head: ['Tool ID', 'Name', 'Risk Level', 'Status', 'Auto Approve', 'Created'].map(h => colors.accent(h)),
601
606
  style: { head: [], border: [] }
602
607
  });
@@ -609,7 +614,7 @@ mcpCommand
609
614
  tool.riskLevel,
610
615
  statusColor(tool.status),
611
616
  tool.autoApprove ? colors.success('Yes') : colors.error('No'),
612
- formatDate(tool.createdAt)
617
+ (0, formatting_js_1.formatDate)(tool.createdAt)
613
618
  ]);
614
619
  });
615
620
  console.log(table.toString());
@@ -644,8 +649,8 @@ mcpCommand
644
649
  };
645
650
  if (options.interactive || !requestData.toolId || !requestData.organizationId ||
646
651
  requestData.keyNames.length === 0 || !requestData.environment || !requestData.justification) {
647
- const tools = await apiClient.get('/api-keys/mcp/tools');
648
- const answers = await inquirer.prompt([
652
+ const tools = await api_js_1.apiClient.get('/api-keys/mcp/tools');
653
+ const answers = await inquirer_1.default.prompt([
649
654
  {
650
655
  type: 'list',
651
656
  name: 'toolId',
@@ -695,7 +700,7 @@ mcpCommand
695
700
  ]);
696
701
  requestData = { ...requestData, ...answers };
697
702
  }
698
- const response = await apiClient.post('/api-keys/mcp/request-access', requestData);
703
+ const response = await api_js_1.apiClient.post('/api-keys/mcp/request-access', requestData);
699
704
  console.log(colors.success('🔐 Access request created successfully!'));
700
705
  console.log(colors.info('━'.repeat(50)));
701
706
  console.log(`${colors.highlight('Request ID:')} ${colors.primary(response.requestId)}`);
@@ -711,7 +716,7 @@ mcpCommand
711
716
  // ============================================================================
712
717
  // ANALYTICS COMMANDS
713
718
  // ============================================================================
714
- const analyticsCommand = new Command('analytics')
719
+ const analyticsCommand = new commander_1.Command('analytics')
715
720
  .description('View API key usage analytics and security events');
716
721
  analyticsCommand
717
722
  .command('usage')
@@ -730,27 +735,27 @@ analyticsCommand
730
735
  if (params.toString()) {
731
736
  url += `?${params.toString()}`;
732
737
  }
733
- const analytics = await apiClient.get(url);
738
+ const analytics = await api_js_1.apiClient.get(url);
734
739
  if (options.json) {
735
740
  console.log(JSON.stringify(analytics, null, 2));
736
741
  return;
737
742
  }
738
743
  if (analytics.length === 0) {
739
- console.log(chalk.yellow('No usage data found'));
744
+ console.log(chalk_1.default.yellow('No usage data found'));
740
745
  return;
741
746
  }
742
- const table = new Table({
743
- head: ['Key ID', 'Operation', 'Tool ID', 'Success', 'Timestamp'].map(h => chalk.cyan(h)),
747
+ const table = new cli_table3_1.default({
748
+ head: ['Key ID', 'Operation', 'Tool ID', 'Success', 'Timestamp'].map(h => chalk_1.default.cyan(h)),
744
749
  style: { head: [], border: [] }
745
750
  });
746
751
  analytics.forEach((entry) => {
747
752
  const successColor = entry.success ? colors.success('✓') : colors.error('✗');
748
753
  table.push([
749
- truncateText(entry.keyId || '-', 20),
754
+ (0, formatting_js_1.truncateText)(entry.keyId || '-', 20),
750
755
  entry.operation,
751
- truncateText(entry.toolId || '-', 15),
756
+ (0, formatting_js_1.truncateText)(entry.toolId || '-', 15),
752
757
  successColor,
753
- formatDate(entry.timestamp)
758
+ (0, formatting_js_1.formatDate)(entry.timestamp)
754
759
  ]);
755
760
  });
756
761
  console.log(table.toString());
@@ -774,7 +779,7 @@ analyticsCommand
774
779
  if (options.severity) {
775
780
  url += `?severity=${options.severity}`;
776
781
  }
777
- const events = await apiClient.get(url);
782
+ const events = await api_js_1.apiClient.get(url);
778
783
  if (options.json) {
779
784
  console.log(JSON.stringify(events, null, 2));
780
785
  return;
@@ -785,7 +790,7 @@ analyticsCommand
785
790
  }
786
791
  console.log(colors.primary('🛡️ Security Events Monitor'));
787
792
  console.log(colors.info('═'.repeat(80)));
788
- const table = new Table({
793
+ const table = new cli_table3_1.default({
789
794
  head: ['Event Type', 'Severity', 'Description', 'Resolved', 'Timestamp'].map(h => colors.accent(h)),
790
795
  style: { head: [], border: [] }
791
796
  });
@@ -796,9 +801,9 @@ analyticsCommand
796
801
  table.push([
797
802
  event.eventType,
798
803
  severityColor(event.severity.toUpperCase()),
799
- truncateText(event.description, 40),
804
+ (0, formatting_js_1.truncateText)(event.description, 40),
800
805
  event.resolved ? colors.success('✓') : colors.warning('Pending'),
801
- formatDate(event.timestamp)
806
+ (0, formatting_js_1.formatDate)(event.timestamp)
802
807
  ]);
803
808
  });
804
809
  console.log(table.toString());
@@ -815,4 +820,4 @@ analyticsCommand
815
820
  apiKeysCommand.addCommand(projectsCommand);
816
821
  apiKeysCommand.addCommand(mcpCommand);
817
822
  apiKeysCommand.addCommand(analyticsCommand);
818
- export default apiKeysCommand;
823
+ exports.default = apiKeysCommand;