@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,12 +1,18 @@
1
+ "use strict";
1
2
  /**
2
3
  * Main Dashboard Command Center
3
4
  * The central hub for all CLI operations after authentication
4
5
  */
5
- import chalk from 'chalk';
6
- import inquirer from 'inquirer';
7
- import boxen from 'boxen';
8
- import Table from 'cli-table3';
9
- export class DashboardCommandCenter {
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.AnalyticsView = exports.InteractiveSearch = exports.InteractiveMemoryCreator = exports.DashboardCommandCenter = void 0;
11
+ const chalk_1 = __importDefault(require("chalk"));
12
+ const inquirer_1 = __importDefault(require("inquirer"));
13
+ const boxen_1 = __importDefault(require("boxen"));
14
+ const cli_table3_1 = __importDefault(require("cli-table3"));
15
+ class DashboardCommandCenter {
10
16
  stateManager;
11
17
  stats;
12
18
  constructor(stateManager) {
@@ -34,7 +40,7 @@ export class DashboardCommandCenter {
34
40
  const header = `Onasis Command Center`;
35
41
  const userInfo = `◐ ${email}`;
36
42
  const padding = 72 - header.length - userInfo.length - 4;
37
- return boxen(chalk.bold(header) + ' '.repeat(padding) + chalk.dim(userInfo), {
43
+ return (0, boxen_1.default)(chalk_1.default.bold(header) + ' '.repeat(padding) + chalk_1.default.dim(userInfo), {
38
44
  borderStyle: 'round',
39
45
  borderColor: 'cyan',
40
46
  padding: 0
@@ -57,19 +63,19 @@ export class DashboardCommandCenter {
57
63
  }
58
64
  renderQuickStats() {
59
65
  const stats = [
60
- `├─ ${chalk.bold(this.stats.totalMemories)} Memories`,
61
- `├─ ${chalk.bold(this.stats.totalTopics)} Topics`,
62
- `└─ ${chalk.bold(this.stats.apiKeys)} API Keys`
66
+ `├─ ${chalk_1.default.bold(this.stats.totalMemories)} Memories`,
67
+ `├─ ${chalk_1.default.bold(this.stats.totalTopics)} Topics`,
68
+ `└─ ${chalk_1.default.bold(this.stats.apiKeys)} API Keys`
63
69
  ];
64
- return chalk.blue('📊 Quick Stats\n') + stats.join('\n');
70
+ return chalk_1.default.blue('📊 Quick Stats\n') + stats.join('\n');
65
71
  }
66
72
  renderRecentActivity() {
67
73
  const activities = this.stats.recentActivity.slice(0, 3).map((activity, index) => {
68
74
  const isLast = index === this.stats.recentActivity.slice(0, 3).length - 1;
69
75
  const prefix = isLast ? '└─' : '├─';
70
- return `${prefix} "${activity.target}" ${chalk.dim(`(${activity.timestamp})`)}`;
76
+ return `${prefix} "${activity.target}" ${chalk_1.default.dim(`(${activity.timestamp})`)}`;
71
77
  });
72
- return chalk.green('🎯 Recent Activity\n') + activities.join('\n');
78
+ return chalk_1.default.green('🎯 Recent Activity\n') + activities.join('\n');
73
79
  }
74
80
  renderMainMenu() {
75
81
  const menuItems = [
@@ -77,28 +83,28 @@ export class DashboardCommandCenter {
77
83
  ['2. 📁 Browse Topics', '5. 🔑 Manage API Keys'],
78
84
  ['3. 📊 View Analytics', '6. ⚙️ Settings']
79
85
  ];
80
- const menuContent = chalk.bold('What would you like to do?\n\n') +
86
+ const menuContent = chalk_1.default.bold('What would you like to do?\n\n') +
81
87
  menuItems.map(row => ` ${row[0]} ${row[1]}`).join('\n') +
82
88
  '\n\n' +
83
- chalk.dim('Type a number, command, or describe what you need...');
84
- return boxen(menuContent, {
89
+ chalk_1.default.dim('Type a number, command, or describe what you need...');
90
+ return (0, boxen_1.default)(menuContent, {
85
91
  padding: 1,
86
92
  borderStyle: 'single',
87
93
  borderColor: 'gray'
88
94
  });
89
95
  }
90
96
  renderFooter() {
91
- return chalk.dim(' [↵] Smart Command [/] Search [Tab] Complete [?] Help');
97
+ return chalk_1.default.dim(' [↵] Smart Command [/] Search [Tab] Complete [?] Help');
92
98
  }
93
99
  async handleUserInput() {
94
- const { input } = await inquirer.prompt({
100
+ const { input } = await inquirer_1.default.prompt({
95
101
  type: 'input',
96
102
  name: 'input',
97
- message: chalk.green('>'),
103
+ message: chalk_1.default.green('>'),
98
104
  transformer: (input) => {
99
105
  // Real-time input transformation/hints
100
106
  if (input.startsWith('/')) {
101
- return chalk.cyan(input) + chalk.dim(' (search mode)');
107
+ return chalk_1.default.cyan(input) + chalk_1.default.dim(' (search mode)');
102
108
  }
103
109
  return input;
104
110
  }
@@ -171,31 +177,31 @@ export class DashboardCommandCenter {
171
177
  await search.search(_query);
172
178
  }
173
179
  async browseTopics() {
174
- console.log(chalk.yellow('Browse Topics - Coming soon...'));
180
+ console.log(chalk_1.default.yellow('Browse Topics - Coming soon...'));
175
181
  }
176
182
  async viewAnalytics() {
177
183
  const analytics = new AnalyticsView(this.stateManager);
178
184
  await analytics.show();
179
185
  }
180
186
  async manageApiKeys() {
181
- console.log(chalk.yellow('API Key Management - Coming soon...'));
187
+ console.log(chalk_1.default.yellow('API Key Management - Coming soon...'));
182
188
  }
183
189
  async openSettings() {
184
- console.log(chalk.yellow('Settings - Coming soon...'));
190
+ console.log(chalk_1.default.yellow('Settings - Coming soon...'));
185
191
  }
186
192
  async showHelp() {
187
- console.log(boxen(chalk.bold('📚 Help & Commands\n\n') +
188
- chalk.cyan('Creating Memories:\n') +
193
+ console.log((0, boxen_1.default)(chalk_1.default.bold('📚 Help & Commands\n\n') +
194
+ chalk_1.default.cyan('Creating Memories:\n') +
189
195
  ' create, new, add - Start creating a new memory\n' +
190
196
  ' "remember that..." - Natural language memory creation\n\n' +
191
- chalk.cyan('Searching:\n') +
197
+ chalk_1.default.cyan('Searching:\n') +
192
198
  ' search, find, / - Search your memories\n' +
193
199
  ' /keyword - Quick search for keyword\n\n' +
194
- chalk.cyan('Navigation:\n') +
200
+ chalk_1.default.cyan('Navigation:\n') +
195
201
  ' 1-6 - Select numbered menu options\n' +
196
202
  ' back, exit - Return to previous screen\n' +
197
203
  ' clear - Clear the screen\n\n' +
198
- chalk.dim('Pro tip: Use Tab for auto-completion'), {
204
+ chalk_1.default.dim('Pro tip: Use Tab for auto-completion'), {
199
205
  padding: 1,
200
206
  borderStyle: 'single',
201
207
  borderColor: 'gray'
@@ -203,7 +209,7 @@ export class DashboardCommandCenter {
203
209
  }
204
210
  async interpretSmartCommand(input) {
205
211
  // AI-powered command interpretation
206
- console.log(chalk.dim(`Interpreting: "${input}"...`));
212
+ console.log(chalk_1.default.dim(`Interpreting: "${input}"...`));
207
213
  // Simulate smart interpretation
208
214
  if (input.toLowerCase().includes('remember')) {
209
215
  const content = input.replace(/remember( that)?/i, '').trim();
@@ -211,7 +217,7 @@ export class DashboardCommandCenter {
211
217
  await creator.createQuick(content);
212
218
  }
213
219
  else {
214
- console.log(chalk.yellow(`Command not recognized. Type '?' for help.`));
220
+ console.log(chalk_1.default.yellow(`Command not recognized. Type '?' for help.`));
215
221
  }
216
222
  }
217
223
  loadStats() {
@@ -228,20 +234,21 @@ export class DashboardCommandCenter {
228
234
  };
229
235
  }
230
236
  }
237
+ exports.DashboardCommandCenter = DashboardCommandCenter;
231
238
  /**
232
239
  * Interactive Memory Creator
233
240
  */
234
- export class InteractiveMemoryCreator {
241
+ class InteractiveMemoryCreator {
235
242
  stateManager;
236
243
  constructor(stateManager) {
237
244
  this.stateManager = stateManager;
238
245
  }
239
246
  async create() {
240
247
  console.clear();
241
- console.log(chalk.bold.blue('📝 Creating New Memory\n'));
248
+ console.log(chalk_1.default.bold.blue('📝 Creating New Memory\n'));
242
249
  console.log("Let's capture your knowledge. I'll guide you through it:\n");
243
250
  // Title input with validation
244
- const { title } = await inquirer.prompt([
251
+ const { title } = await inquirer_1.default.prompt([
245
252
  {
246
253
  type: 'input',
247
254
  name: 'title',
@@ -257,15 +264,15 @@ export class InteractiveMemoryCreator {
257
264
  },
258
265
  transformer: (input) => {
259
266
  if (input.length > 0) {
260
- return input + chalk.dim(` (${input.length}/100)`);
267
+ return input + chalk_1.default.dim(` (${input.length}/100)`);
261
268
  }
262
269
  return input;
263
270
  }
264
271
  }
265
272
  ]);
266
- console.log(chalk.green('✓ Great title! Clear and searchable.\n'));
273
+ console.log(chalk_1.default.green('✓ Great title! Clear and searchable.\n'));
267
274
  // Content input
268
- const { content } = await inquirer.prompt([
275
+ const { content } = await inquirer_1.default.prompt([
269
276
  {
270
277
  type: 'editor',
271
278
  name: 'content',
@@ -277,8 +284,8 @@ export class InteractiveMemoryCreator {
277
284
  // Analyze content and suggest metadata
278
285
  const suggestions = this.analyzeContent(content);
279
286
  if (suggestions.topic) {
280
- console.log(chalk.cyan(`📎 I noticed this looks like ${suggestions.contentType}. Would you like to:`));
281
- const { topicChoice } = await inquirer.prompt([
287
+ console.log(chalk_1.default.cyan(`📎 I noticed this looks like ${suggestions.contentType}. Would you like to:`));
288
+ const { topicChoice } = await inquirer_1.default.prompt([
282
289
  {
283
290
  type: 'list',
284
291
  name: 'topicChoice',
@@ -291,7 +298,7 @@ export class InteractiveMemoryCreator {
291
298
  }
292
299
  ]);
293
300
  if (topicChoice === 'new') {
294
- const { newTopic } = await inquirer.prompt([
301
+ const { newTopic } = await inquirer_1.default.prompt([
295
302
  {
296
303
  type: 'input',
297
304
  name: 'newTopic',
@@ -306,8 +313,8 @@ export class InteractiveMemoryCreator {
306
313
  }
307
314
  // Tag selection
308
315
  if (suggestions.tags.length > 0) {
309
- console.log(chalk.cyan('🏷️ Suggested tags based on content:'));
310
- const { selectedTags } = await inquirer.prompt([
316
+ console.log(chalk_1.default.cyan('🏷️ Suggested tags based on content:'));
317
+ const { selectedTags } = await inquirer_1.default.prompt([
311
318
  {
312
319
  type: 'checkbox',
313
320
  name: 'selectedTags',
@@ -320,7 +327,7 @@ export class InteractiveMemoryCreator {
320
327
  pageSize: 10
321
328
  }
322
329
  ]);
323
- const { additionalTags } = await inquirer.prompt([
330
+ const { additionalTags } = await inquirer_1.default.prompt([
324
331
  {
325
332
  type: 'input',
326
333
  name: 'additionalTags',
@@ -334,7 +341,7 @@ export class InteractiveMemoryCreator {
334
341
  suggestions.tags = selectedTags;
335
342
  }
336
343
  // Memory type selection
337
- const { memoryType } = await inquirer.prompt([
344
+ const { memoryType } = await inquirer_1.default.prompt([
338
345
  {
339
346
  type: 'list',
340
347
  name: 'memoryType',
@@ -356,7 +363,7 @@ export class InteractiveMemoryCreator {
356
363
  type: memoryType
357
364
  });
358
365
  // Confirm save
359
- const { action } = await inquirer.prompt([
366
+ const { action } = await inquirer_1.default.prompt([
360
367
  {
361
368
  type: 'list',
362
369
  name: 'action',
@@ -369,8 +376,8 @@ export class InteractiveMemoryCreator {
369
376
  }
370
377
  ]);
371
378
  if (action === 'save') {
372
- console.log(chalk.green('\n✓ Memory saved successfully!'));
373
- console.log(chalk.dim('ID: mem_abc123'));
379
+ console.log(chalk_1.default.green('\n✓ Memory saved successfully!'));
380
+ console.log(chalk_1.default.dim('ID: mem_abc123'));
374
381
  }
375
382
  else if (action === 'edit') {
376
383
  // Restart the process
@@ -378,7 +385,7 @@ export class InteractiveMemoryCreator {
378
385
  }
379
386
  }
380
387
  async createQuick(content) {
381
- console.log(chalk.green(`✓ Quick memory created: "${content}"`));
388
+ console.log(chalk_1.default.green(`✓ Quick memory created: "${content}"`));
382
389
  }
383
390
  analyzeContent(content) {
384
391
  // Simple content analysis
@@ -410,11 +417,11 @@ export class InteractiveMemoryCreator {
410
417
  reference: '📖',
411
418
  project: '🎯'
412
419
  }[memory.type] || '📝';
413
- console.log(boxen(`${typeIcon} ${chalk.bold(memory.type.charAt(0).toUpperCase() + memory.type.slice(1))} Memory\n\n` +
414
- `${chalk.bold('Title:')} ${memory.title}\n` +
415
- `${chalk.bold('Topic:')} ${memory.topic || 'None'}\n` +
416
- `${chalk.bold('Tags:')} ${memory.tags.join(', ')}\n\n` +
417
- chalk.dim(memory.content.substring(0, 100) + '...'), {
420
+ console.log((0, boxen_1.default)(`${typeIcon} ${chalk_1.default.bold(memory.type.charAt(0).toUpperCase() + memory.type.slice(1))} Memory\n\n` +
421
+ `${chalk_1.default.bold('Title:')} ${memory.title}\n` +
422
+ `${chalk_1.default.bold('Topic:')} ${memory.topic || 'None'}\n` +
423
+ `${chalk_1.default.bold('Tags:')} ${memory.tags.join(', ')}\n\n` +
424
+ chalk_1.default.dim(memory.content.substring(0, 100) + '...'), {
418
425
  padding: 1,
419
426
  borderStyle: 'single',
420
427
  borderColor: 'green',
@@ -423,18 +430,19 @@ export class InteractiveMemoryCreator {
423
430
  }));
424
431
  }
425
432
  }
433
+ exports.InteractiveMemoryCreator = InteractiveMemoryCreator;
426
434
  /**
427
435
  * Interactive Search Experience
428
436
  */
429
- export class InteractiveSearch {
437
+ class InteractiveSearch {
430
438
  stateManager;
431
439
  constructor(stateManager) {
432
440
  this.stateManager = stateManager;
433
441
  }
434
442
  async search(initialQuery = '') {
435
443
  console.clear();
436
- console.log(chalk.bold.blue('🔍 Search Everything\n'));
437
- const { query } = await inquirer.prompt([
444
+ console.log(chalk_1.default.bold.blue('🔍 Search Everything\n'));
445
+ const { query } = await inquirer_1.default.prompt([
438
446
  {
439
447
  type: 'input',
440
448
  name: 'query',
@@ -442,7 +450,7 @@ export class InteractiveSearch {
442
450
  default: initialQuery,
443
451
  transformer: (input) => {
444
452
  if (input.length > 0) {
445
- return chalk.cyan(input);
453
+ return chalk_1.default.cyan(input);
446
454
  }
447
455
  return input;
448
456
  }
@@ -452,12 +460,12 @@ export class InteractiveSearch {
452
460
  return;
453
461
  }
454
462
  // Simulate search
455
- console.log(chalk.dim(`\nSearching for "${query}"...`));
463
+ console.log(chalk_1.default.dim(`\nSearching for "${query}"...`));
456
464
  await this.simulateDelay(500);
457
465
  // Display results
458
466
  this.displayResults(query);
459
467
  // Result actions
460
- const { action } = await inquirer.prompt([
468
+ const { action } = await inquirer_1.default.prompt([
461
469
  {
462
470
  type: 'list',
463
471
  name: 'action',
@@ -480,7 +488,7 @@ export class InteractiveSearch {
480
488
  await this.search('');
481
489
  break;
482
490
  case 'view':
483
- console.log(chalk.green('Viewing result...'));
491
+ console.log(chalk_1.default.green('Viewing result...'));
484
492
  break;
485
493
  }
486
494
  }
@@ -490,12 +498,12 @@ export class InteractiveSearch {
490
498
  { score: 87, title: 'Payment Error Handling Strategy', age: '1 week ago', type: 'Context', tags: 'error-handling, payments' },
491
499
  { score: 76, title: 'Q3 Payment Provider Comparison', age: '2 weeks ago', type: 'Reference', tags: 'analysis, vendors' }
492
500
  ];
493
- console.log(boxen(chalk.bold(`Found ${results.length} relevant memories`) + chalk.dim(' (137ms)\n\n') +
501
+ console.log((0, boxen_1.default)(chalk_1.default.bold(`Found ${results.length} relevant memories`) + chalk_1.default.dim(' (137ms)\n\n') +
494
502
  results.map((r, i) => {
495
503
  const marker = i === 0 ? '▶' : ' ';
496
- return `${marker} ${chalk.green(r.score + '%')} │ ${chalk.bold(r.title)}\n` +
497
- ` │ ${chalk.dim(r.age + ' • ' + r.type + ' • ' + r.tags)}\n` +
498
- ` │ ${chalk.dim('"...complete integration guide for Stripe payment..."')}`;
504
+ return `${marker} ${chalk_1.default.green(r.score + '%')} │ ${chalk_1.default.bold(r.title)}\n` +
505
+ ` │ ${chalk_1.default.dim(r.age + ' • ' + r.type + ' • ' + r.tags)}\n` +
506
+ ` │ ${chalk_1.default.dim('"...complete integration guide for Stripe payment..."')}`;
499
507
  }).join('\n\n'), {
500
508
  padding: 1,
501
509
  borderStyle: 'single',
@@ -508,19 +516,20 @@ export class InteractiveSearch {
508
516
  return new Promise(resolve => setTimeout(resolve, ms));
509
517
  }
510
518
  }
519
+ exports.InteractiveSearch = InteractiveSearch;
511
520
  /**
512
521
  * Analytics View
513
522
  */
514
- export class AnalyticsView {
523
+ class AnalyticsView {
515
524
  stateManager;
516
525
  constructor(stateManager) {
517
526
  this.stateManager = stateManager;
518
527
  }
519
528
  async show() {
520
529
  console.clear();
521
- console.log(chalk.bold.blue('📊 Analytics Dashboard\n'));
530
+ console.log(chalk_1.default.bold.blue('📊 Analytics Dashboard\n'));
522
531
  // Create analytics table
523
- const table = new Table({
532
+ const table = new cli_table3_1.default({
524
533
  head: ['Metric', 'Value', 'Change'],
525
534
  colWidths: [25, 15, 15],
526
535
  style: {
@@ -528,13 +537,13 @@ export class AnalyticsView {
528
537
  border: ['gray']
529
538
  }
530
539
  });
531
- table.push(['Total Memories', '247', chalk.green('+12')], ['Topics', '12', chalk.green('+2')], ['Tags Used', '89', chalk.green('+8')], ['API Calls (Month)', '1,432', chalk.yellow('+5%')], ['Search Queries', '342', chalk.green('+18%')], ['Avg Response Time', '124ms', chalk.green('-8%')]);
540
+ table.push(['Total Memories', '247', chalk_1.default.green('+12')], ['Topics', '12', chalk_1.default.green('+2')], ['Tags Used', '89', chalk_1.default.green('+8')], ['API Calls (Month)', '1,432', chalk_1.default.yellow('+5%')], ['Search Queries', '342', chalk_1.default.green('+18%')], ['Avg Response Time', '124ms', chalk_1.default.green('-8%')]);
532
541
  console.log(table.toString());
533
542
  // Memory growth chart
534
- console.log('\n' + chalk.bold('Memory Growth (Last 7 Days)'));
543
+ console.log('\n' + chalk_1.default.bold('Memory Growth (Last 7 Days)'));
535
544
  this.renderChart();
536
545
  // Top topics
537
- console.log('\n' + chalk.bold('Top Topics'));
546
+ console.log('\n' + chalk_1.default.bold('Top Topics'));
538
547
  const topics = [
539
548
  { name: 'Architecture', count: 45 },
540
549
  { name: 'API', count: 38 },
@@ -544,7 +553,7 @@ export class AnalyticsView {
544
553
  ];
545
554
  topics.forEach(topic => {
546
555
  const bar = '█'.repeat(Math.floor(topic.count / 2));
547
- console.log(` ${topic.name.padEnd(15)} ${chalk.cyan(bar)} ${topic.count}`);
556
+ console.log(` ${topic.name.padEnd(15)} ${chalk_1.default.cyan(bar)} ${topic.count}`);
548
557
  });
549
558
  }
550
559
  renderChart() {
@@ -556,7 +565,7 @@ export class AnalyticsView {
556
565
  for (const value of data) {
557
566
  const barHeight = Math.round((value / max) * height);
558
567
  if (barHeight >= row) {
559
- line += chalk.cyan('█ ');
568
+ line += chalk_1.default.cyan('█ ');
560
569
  }
561
570
  else {
562
571
  line += ' ';
@@ -564,6 +573,7 @@ export class AnalyticsView {
564
573
  }
565
574
  console.log(line);
566
575
  }
567
- console.log(' ' + chalk.dim('M T W T F S S'));
576
+ console.log(' ' + chalk_1.default.dim('M T W T F S S'));
568
577
  }
569
578
  }
579
+ exports.AnalyticsView = AnalyticsView;
@@ -1,10 +1,16 @@
1
+ "use strict";
1
2
  /**
2
3
  * Enhanced Error Handling and Recovery System
3
4
  * Provides intelligent error messages and recovery suggestions
4
5
  */
5
- import chalk from 'chalk';
6
- import boxen from 'boxen';
7
- export class ErrorHandler {
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ValidationError = exports.ErrorBoundary = exports.ErrorHandler = void 0;
11
+ const chalk_1 = __importDefault(require("chalk"));
12
+ const boxen_1 = __importDefault(require("boxen"));
13
+ class ErrorHandler {
8
14
  stateManager;
9
15
  errorHistory = [];
10
16
  constructor(stateManager) {
@@ -202,9 +208,9 @@ export class ErrorHandler {
202
208
  displayError(error) {
203
209
  const icon = this.getErrorIcon(error.severity || 'error');
204
210
  const color = this.getErrorColor(error.severity || 'error');
205
- const errorBox = boxen(`${icon} ${chalk.bold(error.name || 'Error')}\n\n` +
211
+ const errorBox = (0, boxen_1.default)(`${icon} ${chalk_1.default.bold(error.name || 'Error')}\n\n` +
206
212
  `${error.message}\n` +
207
- (error.suggestion ? `\n${chalk.yellow('💡 ' + error.suggestion)}` : ''), {
213
+ (error.suggestion ? `\n${chalk_1.default.yellow('💡 ' + error.suggestion)}` : ''), {
208
214
  padding: 1,
209
215
  borderStyle: 'round',
210
216
  borderColor: color,
@@ -217,41 +223,41 @@ export class ErrorHandler {
217
223
  * Offer recovery actions to the user
218
224
  */
219
225
  offerRecovery(actions) {
220
- console.log(chalk.bold('\n🔧 Possible Solutions:\n'));
226
+ console.log(chalk_1.default.bold('\n🔧 Possible Solutions:\n'));
221
227
  actions.forEach((action, index) => {
222
- console.log(` ${chalk.cyan(`${index + 1}.`)} ${chalk.bold(action.label)}\n` +
223
- ` ${chalk.gray('Command:')} ${chalk.green(action.command)}\n` +
224
- (action.description ? ` ${chalk.dim(action.description)}\n` : ''));
228
+ console.log(` ${chalk_1.default.cyan(`${index + 1}.`)} ${chalk_1.default.bold(action.label)}\n` +
229
+ ` ${chalk_1.default.gray('Command:')} ${chalk_1.default.green(action.command)}\n` +
230
+ (action.description ? ` ${chalk_1.default.dim(action.description)}\n` : ''));
225
231
  });
226
- console.log(chalk.dim('\nRun any of the above commands to resolve the issue.'));
232
+ console.log(chalk_1.default.dim('\nRun any of the above commands to resolve the issue.'));
227
233
  }
228
234
  /**
229
235
  * Log debug information for verbose mode
230
236
  */
231
237
  logDebugInfo(error) {
232
- console.error(chalk.dim('\n--- Debug Information ---'));
233
- console.error(chalk.dim('Timestamp:'), new Date().toISOString());
234
- console.error(chalk.dim('Error Type:'), error.name);
235
- console.error(chalk.dim('Error Code:'), error.code || 'N/A');
238
+ console.error(chalk_1.default.dim('\n--- Debug Information ---'));
239
+ console.error(chalk_1.default.dim('Timestamp:'), new Date().toISOString());
240
+ console.error(chalk_1.default.dim('Error Type:'), error.name);
241
+ console.error(chalk_1.default.dim('Error Code:'), error.code || 'N/A');
236
242
  if (error.stack) {
237
- console.error(chalk.dim('Stack Trace:'));
238
- console.error(chalk.dim(error.stack));
243
+ console.error(chalk_1.default.dim('Stack Trace:'));
244
+ console.error(chalk_1.default.dim(error.stack));
239
245
  }
240
246
  if (error.context) {
241
- console.error(chalk.dim('Context:'));
242
- console.error(chalk.dim(JSON.stringify(error.context, null, 2)));
247
+ console.error(chalk_1.default.dim('Context:'));
248
+ console.error(chalk_1.default.dim(JSON.stringify(error.context, null, 2)));
243
249
  }
244
- console.error(chalk.dim('--- End Debug Information ---\n'));
250
+ console.error(chalk_1.default.dim('--- End Debug Information ---\n'));
245
251
  }
246
252
  /**
247
253
  * Get error icon based on severity
248
254
  */
249
255
  getErrorIcon(severity) {
250
256
  switch (severity) {
251
- case 'error': return chalk.red('✖');
252
- case 'warning': return chalk.yellow('⚠');
253
- case 'info': return chalk.blue('ℹ');
254
- default: return chalk.red('✖');
257
+ case 'error': return chalk_1.default.red('✖');
258
+ case 'warning': return chalk_1.default.yellow('⚠');
259
+ case 'info': return chalk_1.default.blue('ℹ');
260
+ default: return chalk_1.default.red('✖');
255
261
  }
256
262
  }
257
263
  /**
@@ -283,18 +289,19 @@ export class ErrorHandler {
283
289
  async retryLastOperation() {
284
290
  const lastError = this.errorHistory[this.errorHistory.length - 1];
285
291
  if (lastError && lastError.context?.operation) {
286
- console.log(chalk.cyan('🔄 Retrying last operation...'));
292
+ console.log(chalk_1.default.cyan('🔄 Retrying last operation...'));
287
293
  // Implementation would retry the stored operation
288
294
  }
289
295
  else {
290
- console.log(chalk.yellow('No operation to retry'));
296
+ console.log(chalk_1.default.yellow('No operation to retry'));
291
297
  }
292
298
  }
293
299
  }
300
+ exports.ErrorHandler = ErrorHandler;
294
301
  /**
295
302
  * Global error boundary for the CLI
296
303
  */
297
- export class ErrorBoundary {
304
+ class ErrorBoundary {
298
305
  errorHandler;
299
306
  constructor(errorHandler) {
300
307
  this.errorHandler = errorHandler;
@@ -328,13 +335,13 @@ export class ErrorBoundary {
328
335
  });
329
336
  // Handle SIGINT (Ctrl+C)
330
337
  process.on('SIGINT', () => {
331
- console.log(chalk.yellow('\n\n👋 Gracefully shutting down...'));
338
+ console.log(chalk_1.default.yellow('\n\n👋 Gracefully shutting down...'));
332
339
  this.cleanup();
333
340
  process.exit(0);
334
341
  });
335
342
  // Handle SIGTERM
336
343
  process.on('SIGTERM', () => {
337
- console.log(chalk.yellow('\n\n🛑 Received termination signal...'));
344
+ console.log(chalk_1.default.yellow('\n\n🛑 Received termination signal...'));
338
345
  this.cleanup();
339
346
  process.exit(0);
340
347
  });
@@ -346,7 +353,7 @@ export class ErrorBoundary {
346
353
  // Save any pending state
347
354
  // Close any open connections
348
355
  // Flush any buffers
349
- console.log(chalk.dim('Cleanup complete'));
356
+ console.log(chalk_1.default.dim('Cleanup complete'));
350
357
  }
351
358
  /**
352
359
  * Wrap async functions with error handling
@@ -363,10 +370,11 @@ export class ErrorBoundary {
363
370
  });
364
371
  }
365
372
  }
373
+ exports.ErrorBoundary = ErrorBoundary;
366
374
  /**
367
375
  * Validation error for input validation
368
376
  */
369
- export class ValidationError extends Error {
377
+ class ValidationError extends Error {
370
378
  severity = 'warning';
371
379
  suggestion;
372
380
  constructor(message, field, suggestion) {
@@ -378,3 +386,4 @@ export class ValidationError extends Error {
378
386
  this.suggestion = suggestion;
379
387
  }
380
388
  }
389
+ exports.ValidationError = ValidationError;