@ayurak/aribot-cli 1.0.8 → 1.0.10
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.
- package/dist/cli.js +61 -30
- package/package.json +1 -1
- package/src/cli.ts +66 -32
package/dist/cli.js
CHANGED
|
@@ -37,7 +37,7 @@ const program = new commander_1.Command();
|
|
|
37
37
|
program
|
|
38
38
|
.name('aribot')
|
|
39
39
|
.description('Aribot - Economic, Regulatory & Security APIs for Modern Applications')
|
|
40
|
-
.version('1.0.
|
|
40
|
+
.version('1.0.10');
|
|
41
41
|
// Helper to get auth headers
|
|
42
42
|
function getHeaders() {
|
|
43
43
|
const apiKey = config.get('apiKey');
|
|
@@ -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
|
|
506
|
-
console.log(`
|
|
507
|
-
console.log(`
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
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
|
}
|
|
@@ -945,36 +977,35 @@ program
|
|
|
945
977
|
const data = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/generate-ai-insights/`, {
|
|
946
978
|
method: 'POST',
|
|
947
979
|
body: JSON.stringify({
|
|
948
|
-
include_recommendations: true
|
|
949
|
-
include_cost_analysis: true
|
|
980
|
+
include_recommendations: true
|
|
950
981
|
})
|
|
951
982
|
});
|
|
952
983
|
spinner.succeed('AI insights generated!');
|
|
953
984
|
console.log(chalk_1.default.bold('\nAI Architecture Insights:\n'));
|
|
954
|
-
|
|
955
|
-
console.log(`
|
|
956
|
-
console.log(`
|
|
957
|
-
console.log(`
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
985
|
+
console.log(` Diagram: ${chalk_1.default.cyan(data.diagram_name || 'N/A')}`);
|
|
986
|
+
console.log(` Components: ${chalk_1.default.white(data.component_count || 0)}`);
|
|
987
|
+
console.log(` AI Provider: ${chalk_1.default.green(data.provider || 'ai_agent')}`);
|
|
988
|
+
console.log(` Generated: ${chalk_1.default.gray(data.generated_at || 'now')}`);
|
|
989
|
+
const threats = data.threats || [];
|
|
990
|
+
if (threats.length > 0) {
|
|
991
|
+
console.log(chalk_1.default.bold('\nPredicted Threats:\n'));
|
|
992
|
+
threats.slice(0, 5).forEach((t) => {
|
|
993
|
+
const severity = t.severity || 'medium';
|
|
994
|
+
const severityColor = severity === 'critical' || severity === 'high' ? chalk_1.default.red : chalk_1.default.yellow;
|
|
995
|
+
console.log(` ${severityColor('!')} ${t.name || t.threat_id}: ${t.description || ''}`);
|
|
996
|
+
if (t.probability) {
|
|
997
|
+
console.log(` ${chalk_1.default.gray(`Probability: ${(t.probability * 100).toFixed(0)}%`)}`);
|
|
998
|
+
}
|
|
964
999
|
});
|
|
965
1000
|
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
console.log(chalk_1.default.bold('\nWeaknesses:\n'));
|
|
969
|
-
weaknesses.slice(0, 3).forEach((w) => {
|
|
970
|
-
console.log(` ${chalk_1.default.red('✗')} ${w.title || w.description || w}`);
|
|
971
|
-
});
|
|
1001
|
+
else {
|
|
1002
|
+
console.log(chalk_1.default.green('\n No critical threats identified.'));
|
|
972
1003
|
}
|
|
973
|
-
const recommendations =
|
|
1004
|
+
const recommendations = data.recommendations || [];
|
|
974
1005
|
if (recommendations.length > 0) {
|
|
975
1006
|
console.log(chalk_1.default.bold('\nAI Recommendations:\n'));
|
|
976
|
-
recommendations.slice(0,
|
|
977
|
-
console.log(` ${chalk_1.default.cyan('→')} ${r.title || r.description || r}`);
|
|
1007
|
+
recommendations.slice(0, 5).forEach((r) => {
|
|
1008
|
+
console.log(` ${chalk_1.default.cyan('→')} ${typeof r === 'string' ? r : (r.title || r.description || r)}`);
|
|
978
1009
|
});
|
|
979
1010
|
}
|
|
980
1011
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ayurak/aribot-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
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
|
@@ -36,7 +36,7 @@ const program = new Command();
|
|
|
36
36
|
program
|
|
37
37
|
.name('aribot')
|
|
38
38
|
.description('Aribot - Economic, Regulatory & Security APIs for Modern Applications')
|
|
39
|
-
.version('1.0.
|
|
39
|
+
.version('1.0.10');
|
|
40
40
|
|
|
41
41
|
// Helper to get auth headers
|
|
42
42
|
function getHeaders(): Record<string, string> {
|
|
@@ -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
|
|
571
|
-
console.log(`
|
|
572
|
-
console.log(`
|
|
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.
|
|
575
|
-
console.log(chalk.bold('\nTop
|
|
576
|
-
data.
|
|
577
|
-
console.log(` ${chalk.cyan('•')} ${
|
|
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
|
|
|
@@ -1058,8 +1095,7 @@ program
|
|
|
1058
1095
|
const data = await apiRequest(`/v2/threat-modeling/diagrams/${fullId}/generate-ai-insights/`, {
|
|
1059
1096
|
method: 'POST',
|
|
1060
1097
|
body: JSON.stringify({
|
|
1061
|
-
include_recommendations: true
|
|
1062
|
-
include_cost_analysis: true
|
|
1098
|
+
include_recommendations: true
|
|
1063
1099
|
})
|
|
1064
1100
|
});
|
|
1065
1101
|
|
|
@@ -1067,33 +1103,31 @@ program
|
|
|
1067
1103
|
|
|
1068
1104
|
console.log(chalk.bold('\nAI Architecture Insights:\n'));
|
|
1069
1105
|
|
|
1070
|
-
|
|
1071
|
-
console.log(`
|
|
1072
|
-
console.log(`
|
|
1073
|
-
console.log(`
|
|
1074
|
-
console.log(` AI Confidence: ${chalk.green((insights.confidence || 0.88) * 100 + '%')}`);
|
|
1075
|
-
|
|
1076
|
-
const strengths = insights.strengths || [];
|
|
1077
|
-
if (strengths.length > 0) {
|
|
1078
|
-
console.log(chalk.bold('\nStrengths:\n'));
|
|
1079
|
-
strengths.slice(0, 3).forEach((s: any) => {
|
|
1080
|
-
console.log(` ${chalk.green('✓')} ${s.title || s.description || s}`);
|
|
1081
|
-
});
|
|
1082
|
-
}
|
|
1106
|
+
console.log(` Diagram: ${chalk.cyan(data.diagram_name || 'N/A')}`);
|
|
1107
|
+
console.log(` Components: ${chalk.white(data.component_count || 0)}`);
|
|
1108
|
+
console.log(` AI Provider: ${chalk.green(data.provider || 'ai_agent')}`);
|
|
1109
|
+
console.log(` Generated: ${chalk.gray(data.generated_at || 'now')}`);
|
|
1083
1110
|
|
|
1084
|
-
const
|
|
1085
|
-
if (
|
|
1086
|
-
console.log(chalk.bold('\
|
|
1087
|
-
|
|
1088
|
-
|
|
1111
|
+
const threats = data.threats || [];
|
|
1112
|
+
if (threats.length > 0) {
|
|
1113
|
+
console.log(chalk.bold('\nPredicted Threats:\n'));
|
|
1114
|
+
threats.slice(0, 5).forEach((t: any) => {
|
|
1115
|
+
const severity = t.severity || 'medium';
|
|
1116
|
+
const severityColor = severity === 'critical' || severity === 'high' ? chalk.red : chalk.yellow;
|
|
1117
|
+
console.log(` ${severityColor('!')} ${t.name || t.threat_id}: ${t.description || ''}`);
|
|
1118
|
+
if (t.probability) {
|
|
1119
|
+
console.log(` ${chalk.gray(`Probability: ${(t.probability * 100).toFixed(0)}%`)}`);
|
|
1120
|
+
}
|
|
1089
1121
|
});
|
|
1122
|
+
} else {
|
|
1123
|
+
console.log(chalk.green('\n No critical threats identified.'));
|
|
1090
1124
|
}
|
|
1091
1125
|
|
|
1092
|
-
const recommendations =
|
|
1126
|
+
const recommendations = data.recommendations || [];
|
|
1093
1127
|
if (recommendations.length > 0) {
|
|
1094
1128
|
console.log(chalk.bold('\nAI Recommendations:\n'));
|
|
1095
|
-
recommendations.slice(0,
|
|
1096
|
-
console.log(` ${chalk.cyan('→')} ${r.title || r.description || r}`);
|
|
1129
|
+
recommendations.slice(0, 5).forEach((r: any) => {
|
|
1130
|
+
console.log(` ${chalk.cyan('→')} ${typeof r === 'string' ? r : (r.title || r.description || r)}`);
|
|
1097
1131
|
});
|
|
1098
1132
|
}
|
|
1099
1133
|
} catch (error) {
|