@ayurak/aribot-cli 1.0.8 → 1.0.9

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 (3) hide show
  1. package/dist/cli.js +40 -8
  2. package/package.json +1 -1
  3. package/src/cli.ts +45 -8
package/dist/cli.js CHANGED
@@ -448,6 +448,7 @@ program
448
448
  .option('--roi <investment>', 'Calculate ROI for security investment (in USD)')
449
449
  .option('--tco <provider>', 'Calculate TCO for cloud provider (aws, azure, gcp)')
450
450
  .option('--analyze <diagram-id>', 'Analyze costs for a diagram')
451
+ .option('--cost <diagram-id>', 'AI-powered cost intelligence for diagram')
451
452
  .option('--dashboard', 'Show economic intelligence dashboard')
452
453
  .action(async (options) => {
453
454
  const spinner = (0, ora_1.default)('Calculating...').start();
@@ -496,19 +497,50 @@ program
496
497
  console.log(` Security Costs: ${chalk_1.default.yellow('$' + (data.security_cost || 0).toLocaleString())}`);
497
498
  console.log(` Breach Risk Cost: ${chalk_1.default.red('$' + (data.breach_risk_cost || 0).toLocaleString())}`);
498
499
  }
500
+ else if (options.cost) {
501
+ // Diagram-specific cost analysis
502
+ const fullId = await resolveDiagramId(options.cost);
503
+ const data = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/cost-intelligence/`);
504
+ spinner.succeed('Cost analysis complete!');
505
+ console.log(chalk_1.default.bold('\nDiagram Cost Analysis:\n'));
506
+ const summary = data.cost_summary || data;
507
+ console.log(` Monthly Cost: ${chalk_1.default.cyan('$' + (summary.total_monthly || summary.monthly || 0).toLocaleString())}`);
508
+ console.log(` Annual Cost: ${chalk_1.default.yellow('$' + (summary.total_annual || (summary.total_monthly || 0) * 12).toLocaleString())}`);
509
+ console.log(` Component Count: ${chalk_1.default.white(summary.component_count || data.components?.length || 0)}`);
510
+ console.log(` Region: ${chalk_1.default.white(summary.region || 'us-east-1')}`);
511
+ if (data.cost_breakdown?.length > 0) {
512
+ console.log(chalk_1.default.bold('\nCost Breakdown:\n'));
513
+ data.cost_breakdown.slice(0, 5).forEach((c) => {
514
+ console.log(` ${chalk_1.default.cyan('•')} ${c.name || c.component}: ${chalk_1.default.yellow('$' + (c.monthly || c.cost || 0).toLocaleString())}/mo`);
515
+ });
516
+ }
517
+ if (data.recommendations?.length > 0) {
518
+ console.log(chalk_1.default.bold('\nOptimization Recommendations:\n'));
519
+ data.recommendations.slice(0, 3).forEach((r) => {
520
+ console.log(` ${chalk_1.default.green('•')} ${r.title || r.description || r}`);
521
+ });
522
+ }
523
+ }
499
524
  else if (options.dashboard) {
500
525
  // Get economic intelligence from threat modeling endpoint
501
526
  const data = await apiRequest('/v2/threat-modeling/economic-intelligence/');
502
527
  spinner.succeed('Dashboard loaded!');
503
528
  console.log(chalk_1.default.bold('\nEconomic Intelligence Dashboard:\n'));
504
- const summary = data.summary || data;
505
- console.log(` Total Security Spend: ${chalk_1.default.cyan('$' + (summary.total_security_spend || summary.total_spend || 0).toLocaleString())}`);
506
- console.log(` Risk Score: ${chalk_1.default.yellow(summary.risk_score || summary.overall_risk_score || 'N/A')}`);
507
- console.log(` Cost Efficiency: ${chalk_1.default.green((summary.efficiency_score || summary.cost_efficiency || 0) + '%')}`);
508
- if (data.recommendations?.length > 0) {
509
- console.log(chalk_1.default.bold('\nTop Recommendations:\n'));
510
- data.recommendations.slice(0, 3).forEach((r) => {
511
- console.log(` ${chalk_1.default.cyan('•')} ${r.title || r.description || r}`);
529
+ const summary = data.company_summary || data.summary || data;
530
+ console.log(` Total Monthly: ${chalk_1.default.cyan('$' + (summary.total_monthly || summary.total_security_spend || 0).toLocaleString())}`);
531
+ console.log(` Total Annual: ${chalk_1.default.yellow('$' + (summary.total_annual || 0).toLocaleString())}`);
532
+ console.log(` Total Diagrams: ${chalk_1.default.white(summary.total_diagrams || 0)}`);
533
+ console.log(` Region: ${chalk_1.default.white(summary.region || 'us-east-1')}`);
534
+ if (data.top_cost_drivers?.length > 0) {
535
+ console.log(chalk_1.default.bold('\nTop Cost Drivers:\n'));
536
+ data.top_cost_drivers.slice(0, 5).forEach((d) => {
537
+ console.log(` ${chalk_1.default.cyan('•')} ${d.name}: ${chalk_1.default.yellow('$' + (d.monthly_cost || 0).toLocaleString())}/mo (${d.component_count || 0} components)`);
538
+ });
539
+ }
540
+ if (data.intelligence?.recommendations?.length > 0) {
541
+ console.log(chalk_1.default.bold('\nAI Recommendations:\n'));
542
+ data.intelligence.recommendations.slice(0, 3).forEach((r) => {
543
+ console.log(` ${chalk_1.default.green('•')} ${r.title || r.description || r}`);
512
544
  });
513
545
  }
514
546
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ayurak/aribot-cli",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Aribot - Economic, Regulatory & Security APIs for Modern Applications. Advanced multi-framework threat modeling (STRIDE, PASTA, NIST, Aristiun), 100+ compliance standards, Cloud Security, FinOps, and Red Team automation.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/cli.ts CHANGED
@@ -507,6 +507,7 @@ program
507
507
  .option('--roi <investment>', 'Calculate ROI for security investment (in USD)')
508
508
  .option('--tco <provider>', 'Calculate TCO for cloud provider (aws, azure, gcp)')
509
509
  .option('--analyze <diagram-id>', 'Analyze costs for a diagram')
510
+ .option('--cost <diagram-id>', 'AI-powered cost intelligence for diagram')
510
511
  .option('--dashboard', 'Show economic intelligence dashboard')
511
512
  .action(async (options) => {
512
513
  const spinner = ora('Calculating...').start();
@@ -559,6 +560,34 @@ program
559
560
  console.log(` Security Costs: ${chalk.yellow('$' + (data.security_cost || 0).toLocaleString())}`);
560
561
  console.log(` Breach Risk Cost: ${chalk.red('$' + (data.breach_risk_cost || 0).toLocaleString())}`);
561
562
 
563
+ } else if (options.cost) {
564
+ // Diagram-specific cost analysis
565
+ const fullId = await resolveDiagramId(options.cost);
566
+ const data = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/cost-intelligence/`);
567
+
568
+ spinner.succeed('Cost analysis complete!');
569
+ console.log(chalk.bold('\nDiagram Cost Analysis:\n'));
570
+
571
+ const summary = data.cost_summary || data;
572
+ console.log(` Monthly Cost: ${chalk.cyan('$' + (summary.total_monthly || summary.monthly || 0).toLocaleString())}`);
573
+ console.log(` Annual Cost: ${chalk.yellow('$' + (summary.total_annual || (summary.total_monthly || 0) * 12).toLocaleString())}`);
574
+ console.log(` Component Count: ${chalk.white(summary.component_count || data.components?.length || 0)}`);
575
+ console.log(` Region: ${chalk.white(summary.region || 'us-east-1')}`);
576
+
577
+ if (data.cost_breakdown?.length > 0) {
578
+ console.log(chalk.bold('\nCost Breakdown:\n'));
579
+ data.cost_breakdown.slice(0, 5).forEach((c: any) => {
580
+ console.log(` ${chalk.cyan('•')} ${c.name || c.component}: ${chalk.yellow('$' + (c.monthly || c.cost || 0).toLocaleString())}/mo`);
581
+ });
582
+ }
583
+
584
+ if (data.recommendations?.length > 0) {
585
+ console.log(chalk.bold('\nOptimization Recommendations:\n'));
586
+ data.recommendations.slice(0, 3).forEach((r: any) => {
587
+ console.log(` ${chalk.green('•')} ${r.title || r.description || r}`);
588
+ });
589
+ }
590
+
562
591
  } else if (options.dashboard) {
563
592
  // Get economic intelligence from threat modeling endpoint
564
593
  const data = await apiRequest('/v2/threat-modeling/economic-intelligence/');
@@ -566,15 +595,23 @@ program
566
595
  spinner.succeed('Dashboard loaded!');
567
596
  console.log(chalk.bold('\nEconomic Intelligence Dashboard:\n'));
568
597
 
569
- const summary = data.summary || data;
570
- console.log(` Total Security Spend: ${chalk.cyan('$' + (summary.total_security_spend || summary.total_spend || 0).toLocaleString())}`);
571
- console.log(` Risk Score: ${chalk.yellow(summary.risk_score || summary.overall_risk_score || 'N/A')}`);
572
- console.log(` Cost Efficiency: ${chalk.green((summary.efficiency_score || summary.cost_efficiency || 0) + '%')}`);
598
+ const summary = data.company_summary || data.summary || data;
599
+ console.log(` Total Monthly: ${chalk.cyan('$' + (summary.total_monthly || summary.total_security_spend || 0).toLocaleString())}`);
600
+ console.log(` Total Annual: ${chalk.yellow('$' + (summary.total_annual || 0).toLocaleString())}`);
601
+ console.log(` Total Diagrams: ${chalk.white(summary.total_diagrams || 0)}`);
602
+ console.log(` Region: ${chalk.white(summary.region || 'us-east-1')}`);
573
603
 
574
- if (data.recommendations?.length > 0) {
575
- console.log(chalk.bold('\nTop Recommendations:\n'));
576
- data.recommendations.slice(0, 3).forEach((r: any) => {
577
- console.log(` ${chalk.cyan('•')} ${r.title || r.description || r}`);
604
+ if (data.top_cost_drivers?.length > 0) {
605
+ console.log(chalk.bold('\nTop Cost Drivers:\n'));
606
+ data.top_cost_drivers.slice(0, 5).forEach((d: any) => {
607
+ console.log(` ${chalk.cyan('•')} ${d.name}: ${chalk.yellow('$' + (d.monthly_cost || 0).toLocaleString())}/mo (${d.component_count || 0} components)`);
608
+ });
609
+ }
610
+
611
+ if (data.intelligence?.recommendations?.length > 0) {
612
+ console.log(chalk.bold('\nAI Recommendations:\n'));
613
+ data.intelligence.recommendations.slice(0, 3).forEach((r: any) => {
614
+ console.log(` ${chalk.green('•')} ${r.title || r.description || r}`);
578
615
  });
579
616
  }
580
617