@ayurak/aribot-cli 1.0.12 → 1.1.1
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 +20 -11
- package/dist/sdk.js +1 -1
- package/dist/theme.d.ts +46 -0
- package/dist/theme.js +296 -0
- package/package.json +1 -1
- package/src/cli.ts +19 -11
- package/src/sdk.ts +1 -1
- package/src/theme.ts +317 -0
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.1.0');
|
|
41
41
|
// Helper to get auth headers
|
|
42
42
|
function getHeaders() {
|
|
43
43
|
const apiKey = config.get('apiKey');
|
|
@@ -1291,9 +1291,16 @@ program
|
|
|
1291
1291
|
const data = await apiRequest('/v2/sbom/documents/');
|
|
1292
1292
|
spinner.stop();
|
|
1293
1293
|
console.log(chalk_1.default.bold('\nSBOM Documents:\n'));
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1294
|
+
// Backend returns {sbom_documents: [...]}
|
|
1295
|
+
const docs = data.sbom_documents || data.results || (Array.isArray(data) ? data : []);
|
|
1296
|
+
if (docs.length === 0) {
|
|
1297
|
+
console.log(chalk_1.default.dim(' No SBOM documents found'));
|
|
1298
|
+
}
|
|
1299
|
+
else {
|
|
1300
|
+
docs.forEach((s) => {
|
|
1301
|
+
console.log(` ${chalk_1.default.cyan(String(s.id || s.sbom_id).slice(0, 8))} ${s.name || 'Unnamed'} ${chalk_1.default.dim((s.component_count || 0) + ' components')}`);
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1297
1304
|
}
|
|
1298
1305
|
else {
|
|
1299
1306
|
spinner.stop();
|
|
@@ -1454,8 +1461,9 @@ program
|
|
|
1454
1461
|
spinner.stop();
|
|
1455
1462
|
console.log(chalk_1.default.bold('\nAPI Keys:\n'));
|
|
1456
1463
|
(data.results || data || []).forEach((k) => {
|
|
1457
|
-
const status = k.is_active ? chalk_1.default.green('active') : chalk_1.default.red('inactive');
|
|
1458
|
-
|
|
1464
|
+
const status = (k.is_active || k.status === 'active') ? chalk_1.default.green('active') : chalk_1.default.red('inactive');
|
|
1465
|
+
const keyPrefix = k.key_prefix || (k.key ? k.key.slice(0, 8) : 'xxxxxxxx');
|
|
1466
|
+
console.log(` ${chalk_1.default.cyan(k.name)} ${chalk_1.default.dim(keyPrefix + '...')} ${status}`);
|
|
1459
1467
|
});
|
|
1460
1468
|
}
|
|
1461
1469
|
else if (options.create) {
|
|
@@ -1510,7 +1518,7 @@ program
|
|
|
1510
1518
|
spinner.stop();
|
|
1511
1519
|
console.log(chalk_1.default.bold(`\nSearch Results for "${options.search}":\n`));
|
|
1512
1520
|
(data.results || data || []).slice(0, 10).forEach((t) => {
|
|
1513
|
-
console.log(` ${chalk_1.default.cyan(t.name)} ${chalk_1.default.dim('$' + (t.price || 0))}`);
|
|
1521
|
+
console.log(` ${chalk_1.default.cyan(t.title || t.name)} ${chalk_1.default.dim('$' + (t.price || 0))}`);
|
|
1514
1522
|
console.log(chalk_1.default.dim(` ${t.description?.slice(0, 60) || ''}...`));
|
|
1515
1523
|
});
|
|
1516
1524
|
}
|
|
@@ -1519,15 +1527,16 @@ program
|
|
|
1519
1527
|
spinner.stop();
|
|
1520
1528
|
console.log(chalk_1.default.bold('\nFeatured Templates:\n'));
|
|
1521
1529
|
(data.results || data || []).forEach((t) => {
|
|
1522
|
-
console.log(` ${chalk_1.default.green('★')} ${chalk_1.default.cyan(t.name)} ${chalk_1.default.dim('$' + (t.price || 0))}`);
|
|
1530
|
+
console.log(` ${chalk_1.default.green('★')} ${chalk_1.default.cyan(t.title || t.name)} ${chalk_1.default.dim('$' + (t.price || 0))}`);
|
|
1523
1531
|
});
|
|
1524
1532
|
}
|
|
1525
1533
|
else if (options.categories) {
|
|
1526
1534
|
const data = await apiRequest('/v2/marketplace/categories/');
|
|
1527
1535
|
spinner.stop();
|
|
1528
1536
|
console.log(chalk_1.default.bold('\nTemplate Categories:\n'));
|
|
1537
|
+
// Backend returns {value, label} format
|
|
1529
1538
|
(data.results || data || []).forEach((c) => {
|
|
1530
|
-
console.log(` ${chalk_1.default.cyan(c.name)} ${chalk_1.default.dim(c.template_count + ' templates')}`);
|
|
1539
|
+
console.log(` ${chalk_1.default.cyan(c.label || c.name || c.value)} ${chalk_1.default.dim((c.template_count || c.count || '') + ' templates')}`);
|
|
1531
1540
|
});
|
|
1532
1541
|
}
|
|
1533
1542
|
else if (options.myTemplates) {
|
|
@@ -1535,13 +1544,13 @@ program
|
|
|
1535
1544
|
spinner.stop();
|
|
1536
1545
|
console.log(chalk_1.default.bold('\nYour Templates:\n'));
|
|
1537
1546
|
(data.results || data || []).forEach((t) => {
|
|
1538
|
-
console.log(` ${chalk_1.default.cyan(t.name)} ${chalk_1.default.dim(t.status)}`);
|
|
1547
|
+
console.log(` ${chalk_1.default.cyan(t.title || t.name)} ${chalk_1.default.dim(t.status)}`);
|
|
1539
1548
|
});
|
|
1540
1549
|
}
|
|
1541
1550
|
else if (options.get) {
|
|
1542
1551
|
const data = await apiRequest(`/v2/marketplace/v2/templates/${options.get}/`);
|
|
1543
1552
|
spinner.stop();
|
|
1544
|
-
console.log(chalk_1.default.bold(`\n${data.name}\n`));
|
|
1553
|
+
console.log(chalk_1.default.bold(`\n${data.title || data.name}\n`));
|
|
1545
1554
|
console.log(` Category: ${chalk_1.default.cyan(data.category)}`);
|
|
1546
1555
|
console.log(` Price: ${chalk_1.default.yellow('$' + (data.price || 0))}`);
|
|
1547
1556
|
console.log(` Downloads: ${chalk_1.default.dim(data.download_count || 0)}`);
|
package/dist/sdk.js
CHANGED
|
@@ -69,7 +69,7 @@ exports.runComplianceCheck = runComplianceCheck;
|
|
|
69
69
|
const fs = __importStar(require("fs"));
|
|
70
70
|
const path = __importStar(require("path"));
|
|
71
71
|
const crypto = __importStar(require("crypto"));
|
|
72
|
-
const VERSION = '1.0
|
|
72
|
+
const VERSION = '1.1.0';
|
|
73
73
|
const DEFAULT_BASE_URL = 'https://api.aribot.ayurak.com/aribot-api';
|
|
74
74
|
// =============================================================================
|
|
75
75
|
// ERRORS
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ayurak Visual Theme for Aribot CLI
|
|
3
|
+
*
|
|
4
|
+
* Apple Glass-inspired design with orange, gold, black, and white.
|
|
5
|
+
*/
|
|
6
|
+
export declare const colors: {
|
|
7
|
+
orange: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
8
|
+
gold: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
9
|
+
white: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
10
|
+
black: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
11
|
+
gray: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
12
|
+
darkGray: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
13
|
+
success: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
14
|
+
error: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
15
|
+
warning: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
16
|
+
};
|
|
17
|
+
export declare const bold: {
|
|
18
|
+
orange: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
19
|
+
gold: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
20
|
+
white: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
21
|
+
success: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
22
|
+
error: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
23
|
+
warning: import("chalk", { with: { "resolution-mode": "import" } }).ChalkInstance;
|
|
24
|
+
};
|
|
25
|
+
export declare const LOGO_FULL: string;
|
|
26
|
+
export declare const LOGO_SMALL: string;
|
|
27
|
+
export declare const WORDMARK: string;
|
|
28
|
+
export declare const WORDMARK_FULL: string;
|
|
29
|
+
export declare function printLogo(size?: 'full' | 'small' | 'mini'): void;
|
|
30
|
+
export declare function success(message: string): void;
|
|
31
|
+
export declare function error(message: string): void;
|
|
32
|
+
export declare function warning(message: string): void;
|
|
33
|
+
export declare function info(message: string): void;
|
|
34
|
+
export declare function section(title: string): void;
|
|
35
|
+
export declare function keyValue(key: string, value: string): void;
|
|
36
|
+
export declare function severityBadge(severity: string): string;
|
|
37
|
+
export declare function printWelcome(): void;
|
|
38
|
+
export declare function printAuthSuccess(email: string, company: string, plan: string): void;
|
|
39
|
+
export declare function printStatus(status: any, rateLimits?: any): void;
|
|
40
|
+
export declare function printDiagrams(diagrams: any[], total?: number): void;
|
|
41
|
+
export declare function printThreats(threats: any[], diagramName?: string): void;
|
|
42
|
+
export declare function printExportSuccess(filename: string, format: string): void;
|
|
43
|
+
export declare function printComplianceScore(standard: string, score: number, passed: number, failed: number): void;
|
|
44
|
+
export declare function printMethodologies(methodologies: any[]): void;
|
|
45
|
+
export declare function printIntegrationHeader(tool: string): void;
|
|
46
|
+
export declare function box(content: string, title?: string): void;
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Ayurak Visual Theme for Aribot CLI
|
|
4
|
+
*
|
|
5
|
+
* Apple Glass-inspired design with orange, gold, black, and white.
|
|
6
|
+
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.WORDMARK_FULL = exports.WORDMARK = exports.LOGO_SMALL = exports.LOGO_FULL = exports.bold = exports.colors = void 0;
|
|
12
|
+
exports.printLogo = printLogo;
|
|
13
|
+
exports.success = success;
|
|
14
|
+
exports.error = error;
|
|
15
|
+
exports.warning = warning;
|
|
16
|
+
exports.info = info;
|
|
17
|
+
exports.section = section;
|
|
18
|
+
exports.keyValue = keyValue;
|
|
19
|
+
exports.severityBadge = severityBadge;
|
|
20
|
+
exports.printWelcome = printWelcome;
|
|
21
|
+
exports.printAuthSuccess = printAuthSuccess;
|
|
22
|
+
exports.printStatus = printStatus;
|
|
23
|
+
exports.printDiagrams = printDiagrams;
|
|
24
|
+
exports.printThreats = printThreats;
|
|
25
|
+
exports.printExportSuccess = printExportSuccess;
|
|
26
|
+
exports.printComplianceScore = printComplianceScore;
|
|
27
|
+
exports.printMethodologies = printMethodologies;
|
|
28
|
+
exports.printIntegrationHeader = printIntegrationHeader;
|
|
29
|
+
exports.box = box;
|
|
30
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
+
// =============================================================================
|
|
32
|
+
// AYURAK COLOR PALETTE - Apple Glass Inspired
|
|
33
|
+
// =============================================================================
|
|
34
|
+
exports.colors = {
|
|
35
|
+
orange: chalk_1.default.hex('#FF6B35'),
|
|
36
|
+
gold: chalk_1.default.hex('#D4A03C'),
|
|
37
|
+
white: chalk_1.default.white,
|
|
38
|
+
black: chalk_1.default.hex('#1d1d1f'),
|
|
39
|
+
gray: chalk_1.default.hex('#8e8e93'),
|
|
40
|
+
darkGray: chalk_1.default.hex('#3d3d3f'),
|
|
41
|
+
success: chalk_1.default.hex('#34c759'),
|
|
42
|
+
error: chalk_1.default.hex('#ff3b30'),
|
|
43
|
+
warning: chalk_1.default.hex('#ff9500'),
|
|
44
|
+
};
|
|
45
|
+
exports.bold = {
|
|
46
|
+
orange: chalk_1.default.bold.hex('#FF6B35'),
|
|
47
|
+
gold: chalk_1.default.bold.hex('#D4A03C'),
|
|
48
|
+
white: chalk_1.default.bold.white,
|
|
49
|
+
success: chalk_1.default.bold.hex('#34c759'),
|
|
50
|
+
error: chalk_1.default.bold.hex('#ff3b30'),
|
|
51
|
+
warning: chalk_1.default.bold.hex('#ff9500'),
|
|
52
|
+
};
|
|
53
|
+
// =============================================================================
|
|
54
|
+
// ASCII ART LOGOS
|
|
55
|
+
// =============================================================================
|
|
56
|
+
exports.LOGO_FULL = `
|
|
57
|
+
${exports.bold.orange(' ╭──────────────────────────────────────────────────────────────╮')}
|
|
58
|
+
${exports.bold.orange(' │ │')}
|
|
59
|
+
${exports.bold.orange(' │ █████╗ ██████╗ ██╗██████╗ ██████╗ ████████╗ │')}
|
|
60
|
+
${exports.bold.orange(' │ ██╔══██╗██╔══██╗██║██╔══██╗██╔═══██╗╚══██╔══╝ │')}
|
|
61
|
+
${exports.bold.orange(' │ ███████║██████╔╝██║██████╔╝██║ ██║ ██║ │')}
|
|
62
|
+
${exports.bold.orange(' │ ██╔══██║██╔══██╗██║██╔══██╗██║ ██║ ██║ │')}
|
|
63
|
+
${exports.bold.orange(' │ ██║ ██║██║ ██║██║██████╔╝╚██████╔╝ ██║ │')}
|
|
64
|
+
${exports.bold.orange(' │ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═════╝ ╚═════╝ ╚═╝ │')}
|
|
65
|
+
${exports.bold.orange(' │ │')}
|
|
66
|
+
${exports.bold.orange(' │ ')}${exports.colors.gold('Security Intelligence Platform')}${exports.bold.orange(' │')}
|
|
67
|
+
${exports.bold.orange(' │ │')}
|
|
68
|
+
${exports.bold.orange(' ╰──────────────────────────────────────────────────────────────╯')}
|
|
69
|
+
`;
|
|
70
|
+
exports.LOGO_SMALL = `
|
|
71
|
+
${exports.bold.orange(' ▄▀▄ █▀▄ █ █▀▄ █▀█ ▀█▀')} ${exports.colors.gold('Security Intelligence')}
|
|
72
|
+
${exports.bold.orange(' █▀█ █▀▄ █ █▀▄ █▄█ █')}
|
|
73
|
+
`;
|
|
74
|
+
exports.WORDMARK = `${exports.bold.orange('◆')} ${exports.bold.white('aribot')}`;
|
|
75
|
+
exports.WORDMARK_FULL = `${exports.bold.orange('◆')} ${exports.bold.white('ARIBOT')}`;
|
|
76
|
+
// =============================================================================
|
|
77
|
+
// OUTPUT HELPERS
|
|
78
|
+
// =============================================================================
|
|
79
|
+
function printLogo(size = 'small') {
|
|
80
|
+
if (size === 'full') {
|
|
81
|
+
console.log(exports.LOGO_FULL);
|
|
82
|
+
}
|
|
83
|
+
else if (size === 'small') {
|
|
84
|
+
console.log(exports.LOGO_SMALL);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
console.log(exports.WORDMARK);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function success(message) {
|
|
91
|
+
console.log(`${exports.colors.success('✓')} ${message}`);
|
|
92
|
+
}
|
|
93
|
+
function error(message) {
|
|
94
|
+
console.log(`${exports.colors.error('✗')} ${message}`);
|
|
95
|
+
}
|
|
96
|
+
function warning(message) {
|
|
97
|
+
console.log(`${exports.colors.warning('!')} ${message}`);
|
|
98
|
+
}
|
|
99
|
+
function info(message) {
|
|
100
|
+
console.log(`${exports.colors.gray('›')} ${message}`);
|
|
101
|
+
}
|
|
102
|
+
function section(title) {
|
|
103
|
+
console.log();
|
|
104
|
+
console.log(exports.bold.gold(title));
|
|
105
|
+
console.log(exports.colors.orange('─'.repeat(title.length)));
|
|
106
|
+
}
|
|
107
|
+
function keyValue(key, value) {
|
|
108
|
+
console.log(` ${exports.colors.gray(key)} ${value}`);
|
|
109
|
+
}
|
|
110
|
+
function severityBadge(severity) {
|
|
111
|
+
const s = severity.toLowerCase();
|
|
112
|
+
switch (s) {
|
|
113
|
+
case 'critical':
|
|
114
|
+
return chalk_1.default.bgHex('#ff3b30').white.bold(' CRITICAL ');
|
|
115
|
+
case 'high':
|
|
116
|
+
return exports.bold.error('HIGH');
|
|
117
|
+
case 'medium':
|
|
118
|
+
return exports.bold.warning('MEDIUM');
|
|
119
|
+
case 'low':
|
|
120
|
+
return exports.colors.gold('LOW');
|
|
121
|
+
default:
|
|
122
|
+
return exports.colors.gray(severity.toUpperCase());
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// =============================================================================
|
|
126
|
+
// WELCOME & AUTH SCREENS
|
|
127
|
+
// =============================================================================
|
|
128
|
+
function printWelcome() {
|
|
129
|
+
console.log(exports.LOGO_FULL);
|
|
130
|
+
console.log();
|
|
131
|
+
console.log(exports.bold.white('The Security Intelligence Platform'));
|
|
132
|
+
console.log();
|
|
133
|
+
console.log(exports.colors.gold('━'.repeat(58)));
|
|
134
|
+
console.log();
|
|
135
|
+
console.log(` ${exports.colors.orange('◆')} AI-Powered Threat Modeling ${exports.colors.orange('◆')} 100+ Compliance Standards`);
|
|
136
|
+
console.log(` ${exports.colors.orange('◆')} Cloud Security (CSPM/CNAPP) ${exports.colors.orange('◆')} Economic Intelligence`);
|
|
137
|
+
console.log(` ${exports.colors.orange('◆')} Red Team Attack Simulation ${exports.colors.orange('◆')} SBOM & Vulnerability Mgmt`);
|
|
138
|
+
console.log();
|
|
139
|
+
console.log(exports.colors.gold('━'.repeat(58)));
|
|
140
|
+
console.log();
|
|
141
|
+
console.log(` ${exports.colors.gray('Get your API key at:')} ${exports.bold.white('https://portal.aribot.ayurak.com')}`);
|
|
142
|
+
console.log();
|
|
143
|
+
}
|
|
144
|
+
function printAuthSuccess(email, company, plan) {
|
|
145
|
+
console.log();
|
|
146
|
+
console.log(`${exports.colors.success('✓')} ${exports.bold.white('Authenticated successfully')}`);
|
|
147
|
+
console.log();
|
|
148
|
+
console.log(` ${exports.colors.gray('Email')} ${email}`);
|
|
149
|
+
console.log(` ${exports.colors.gray('Company')} ${company}`);
|
|
150
|
+
console.log(` ${exports.colors.gray('Plan')} ${exports.bold.gold(plan)}`);
|
|
151
|
+
console.log();
|
|
152
|
+
section('Quick Start');
|
|
153
|
+
console.log(` ${exports.colors.orange('$')} aribot analyze diagram.png`);
|
|
154
|
+
console.log(` ${exports.colors.orange('$')} aribot diagrams`);
|
|
155
|
+
console.log(` ${exports.colors.orange('$')} aribot compliance SOC2 <id>`);
|
|
156
|
+
console.log(` ${exports.colors.orange('$')} aribot --help`);
|
|
157
|
+
console.log();
|
|
158
|
+
}
|
|
159
|
+
function printStatus(status, rateLimits) {
|
|
160
|
+
console.log();
|
|
161
|
+
console.log(exports.WORDMARK);
|
|
162
|
+
console.log();
|
|
163
|
+
const health = status.status || 'unknown';
|
|
164
|
+
const icon = health === 'healthy' ? exports.colors.success('✓') : exports.colors.error('✗');
|
|
165
|
+
const healthColor = health === 'healthy' ? exports.colors.success : exports.colors.error;
|
|
166
|
+
console.log(` ${exports.colors.gray('Status')} ${icon} ${healthColor(health.charAt(0).toUpperCase() + health.slice(1))}`);
|
|
167
|
+
console.log(` ${exports.colors.gray('Version')} ${status.version || 'N/A'}`);
|
|
168
|
+
console.log(` ${exports.colors.gray('Features')} ${status.features_enabled ? 'Enabled' : 'Disabled'}`);
|
|
169
|
+
if (rateLimits) {
|
|
170
|
+
console.log();
|
|
171
|
+
console.log(` ${exports.colors.gold('Rate Limits')}`);
|
|
172
|
+
console.log(` ${exports.colors.gray('Per min')} ${rateLimits.requests_per_minute || 'unlimited'}`);
|
|
173
|
+
console.log(` ${exports.colors.gray('Per hour')} ${rateLimits.requests_per_hour || 'unlimited'}`);
|
|
174
|
+
}
|
|
175
|
+
console.log();
|
|
176
|
+
}
|
|
177
|
+
// =============================================================================
|
|
178
|
+
// DATA DISPLAY
|
|
179
|
+
// =============================================================================
|
|
180
|
+
function printDiagrams(diagrams, total) {
|
|
181
|
+
console.log();
|
|
182
|
+
console.log(exports.bold.white('Your Diagrams'));
|
|
183
|
+
console.log();
|
|
184
|
+
// Table header
|
|
185
|
+
console.log(` ${exports.colors.gold('ID'.padEnd(10))} ${exports.colors.gold('Name'.padEnd(35))} ${exports.colors.gold(' ')} ${exports.colors.gold('Threats'.padStart(8))} ${exports.colors.gold('Created'.padStart(12))}`);
|
|
186
|
+
console.log(` ${exports.colors.orange('─'.repeat(10))} ${exports.colors.orange('─'.repeat(35))} ${exports.colors.orange('──')} ${exports.colors.orange('─'.repeat(8))} ${exports.colors.orange('─'.repeat(12))}`);
|
|
187
|
+
for (const d of diagrams) {
|
|
188
|
+
const id = (d.id || '').substring(0, 8);
|
|
189
|
+
const name = (d.name || 'Untitled').substring(0, 35).padEnd(35);
|
|
190
|
+
const stage = d.stage || '';
|
|
191
|
+
const icon = stage === 'complete' ? exports.colors.success('✓') : stage === 'processing' ? exports.colors.warning('⋯') : exports.colors.gray('○');
|
|
192
|
+
const threats = String(d.threats_count || 0).padStart(8);
|
|
193
|
+
const created = (d.created_at || '').substring(0, 10).padStart(12);
|
|
194
|
+
console.log(` ${exports.bold.orange(id.padEnd(10))} ${chalk_1.default.white(name)} ${icon} ${exports.colors.gold(threats)} ${exports.colors.gray(created)}`);
|
|
195
|
+
}
|
|
196
|
+
console.log();
|
|
197
|
+
console.log(` ${exports.colors.gray(`Showing ${diagrams.length}${total ? ` of ${total}` : ''} diagrams`)}`);
|
|
198
|
+
console.log();
|
|
199
|
+
}
|
|
200
|
+
function printThreats(threats, diagramName) {
|
|
201
|
+
console.log();
|
|
202
|
+
if (diagramName) {
|
|
203
|
+
console.log(`${exports.bold.white('Threats')} ${exports.colors.gray(diagramName)}`);
|
|
204
|
+
console.log();
|
|
205
|
+
}
|
|
206
|
+
const severities = ['critical', 'high', 'medium', 'low'];
|
|
207
|
+
for (const sev of severities) {
|
|
208
|
+
const items = threats.filter((t) => (t.severity || '').toLowerCase() === sev);
|
|
209
|
+
if (items.length === 0)
|
|
210
|
+
continue;
|
|
211
|
+
console.log(` ${severityBadge(sev)} ${exports.colors.gray(`(${items.length})`)}`);
|
|
212
|
+
for (const t of items.slice(0, 5)) {
|
|
213
|
+
const title = (t.title || 'Untitled').substring(0, 55);
|
|
214
|
+
console.log(` ${exports.colors.gray('›')} ${title}`);
|
|
215
|
+
}
|
|
216
|
+
if (items.length > 5) {
|
|
217
|
+
console.log(` ${exports.colors.gray(` + ${items.length - 5} more`)}`);
|
|
218
|
+
}
|
|
219
|
+
console.log();
|
|
220
|
+
}
|
|
221
|
+
const total = threats.length;
|
|
222
|
+
const crit = threats.filter((t) => (t.severity || '').toLowerCase() === 'critical').length;
|
|
223
|
+
const high = threats.filter((t) => (t.severity || '').toLowerCase() === 'high').length;
|
|
224
|
+
let summary = `${exports.colors.gold('Total:')} ${total} threats`;
|
|
225
|
+
if (crit > 0)
|
|
226
|
+
summary += ` ${exports.colors.error(`${crit} critical`)}`;
|
|
227
|
+
if (high > 0)
|
|
228
|
+
summary += ` ${exports.colors.warning(`${high} high`)}`;
|
|
229
|
+
console.log(summary);
|
|
230
|
+
console.log();
|
|
231
|
+
}
|
|
232
|
+
function printExportSuccess(filename, format) {
|
|
233
|
+
console.log();
|
|
234
|
+
console.log(`${exports.colors.success('✓')} ${exports.bold.white('Report exported')}`);
|
|
235
|
+
console.log();
|
|
236
|
+
console.log(` ${exports.colors.gray('Format')} ${format.toUpperCase()}`);
|
|
237
|
+
console.log(` ${exports.colors.gray('File')} ${filename}`);
|
|
238
|
+
console.log();
|
|
239
|
+
}
|
|
240
|
+
function printComplianceScore(standard, score, passed, failed) {
|
|
241
|
+
console.log();
|
|
242
|
+
console.log(`${exports.bold.white(standard)} ${exports.bold.gold('Compliance')}`);
|
|
243
|
+
console.log();
|
|
244
|
+
const barWidth = 40;
|
|
245
|
+
const filled = Math.round((score / 100) * barWidth);
|
|
246
|
+
const color = score >= 80 ? exports.colors.success : score >= 60 ? exports.colors.warning : exports.colors.error;
|
|
247
|
+
const bar = color('█'.repeat(filled)) + exports.colors.darkGray('░'.repeat(barWidth - filled));
|
|
248
|
+
console.log(` ${bar} ${color(`${score}%`)}`);
|
|
249
|
+
console.log();
|
|
250
|
+
console.log(` ${exports.colors.success(`✓ ${passed} passed`)} ${exports.colors.error(`✗ ${failed} failed`)}`);
|
|
251
|
+
console.log();
|
|
252
|
+
}
|
|
253
|
+
function printMethodologies(methodologies) {
|
|
254
|
+
console.log();
|
|
255
|
+
console.log(exports.bold.white('Threat Modeling Methodologies'));
|
|
256
|
+
console.log();
|
|
257
|
+
for (const m of methodologies) {
|
|
258
|
+
console.log(` ${exports.colors.orange('◆')} ${exports.bold.white(m.name || '')}`);
|
|
259
|
+
if (m.description) {
|
|
260
|
+
console.log(` ${exports.colors.gray(m.description)}`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
console.log();
|
|
264
|
+
}
|
|
265
|
+
// =============================================================================
|
|
266
|
+
// AI INTEGRATION HEADERS
|
|
267
|
+
// =============================================================================
|
|
268
|
+
function printIntegrationHeader(tool) {
|
|
269
|
+
const tools = {
|
|
270
|
+
claude: 'Claude',
|
|
271
|
+
copilot: 'GitHub Copilot',
|
|
272
|
+
gemini: 'Gemini',
|
|
273
|
+
cursor: 'Cursor',
|
|
274
|
+
};
|
|
275
|
+
const name = tools[tool.toLowerCase()] || tool;
|
|
276
|
+
console.log();
|
|
277
|
+
console.log(`${exports.bold.orange('◆')} ${exports.bold.white('ARIBOT')} ${exports.colors.gold('×')} ${exports.bold.white(name)}`);
|
|
278
|
+
console.log();
|
|
279
|
+
}
|
|
280
|
+
// =============================================================================
|
|
281
|
+
// BOX DRAWING
|
|
282
|
+
// =============================================================================
|
|
283
|
+
function box(content, title) {
|
|
284
|
+
const lines = content.split('\n');
|
|
285
|
+
const maxLen = Math.max(...lines.map(l => l.length), title?.length || 0);
|
|
286
|
+
const width = maxLen + 4;
|
|
287
|
+
console.log(exports.colors.orange('╭' + '─'.repeat(width) + '╮'));
|
|
288
|
+
if (title) {
|
|
289
|
+
console.log(exports.colors.orange('│ ') + exports.bold.white(title.padEnd(width - 2)) + exports.colors.orange(' │'));
|
|
290
|
+
console.log(exports.colors.orange('├' + '─'.repeat(width) + '┤'));
|
|
291
|
+
}
|
|
292
|
+
for (const line of lines) {
|
|
293
|
+
console.log(exports.colors.orange('│ ') + line.padEnd(width - 2) + exports.colors.orange(' │'));
|
|
294
|
+
}
|
|
295
|
+
console.log(exports.colors.orange('╰' + '─'.repeat(width) + '╯'));
|
|
296
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ayurak/aribot-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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.1.0');
|
|
40
40
|
|
|
41
41
|
// Helper to get auth headers
|
|
42
42
|
function getHeaders(): Record<string, string> {
|
|
@@ -1424,9 +1424,15 @@ program
|
|
|
1424
1424
|
const data = await apiRequest('/v2/sbom/documents/');
|
|
1425
1425
|
spinner.stop();
|
|
1426
1426
|
console.log(chalk.bold('\nSBOM Documents:\n'));
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1427
|
+
// Backend returns {sbom_documents: [...]}
|
|
1428
|
+
const docs = data.sbom_documents || data.results || (Array.isArray(data) ? data : []);
|
|
1429
|
+
if (docs.length === 0) {
|
|
1430
|
+
console.log(chalk.dim(' No SBOM documents found'));
|
|
1431
|
+
} else {
|
|
1432
|
+
docs.forEach((s: any) => {
|
|
1433
|
+
console.log(` ${chalk.cyan(String(s.id || s.sbom_id).slice(0, 8))} ${s.name || 'Unnamed'} ${chalk.dim((s.component_count || 0) + ' components')}`);
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1430
1436
|
|
|
1431
1437
|
} else {
|
|
1432
1438
|
spinner.stop();
|
|
@@ -1590,8 +1596,9 @@ program
|
|
|
1590
1596
|
spinner.stop();
|
|
1591
1597
|
console.log(chalk.bold('\nAPI Keys:\n'));
|
|
1592
1598
|
(data.results || data || []).forEach((k: any) => {
|
|
1593
|
-
const status = k.is_active ? chalk.green('active') : chalk.red('inactive');
|
|
1594
|
-
|
|
1599
|
+
const status = (k.is_active || k.status === 'active') ? chalk.green('active') : chalk.red('inactive');
|
|
1600
|
+
const keyPrefix = k.key_prefix || (k.key ? k.key.slice(0, 8) : 'xxxxxxxx');
|
|
1601
|
+
console.log(` ${chalk.cyan(k.name)} ${chalk.dim(keyPrefix + '...')} ${status}`);
|
|
1595
1602
|
});
|
|
1596
1603
|
|
|
1597
1604
|
} else if (options.create) {
|
|
@@ -1647,7 +1654,7 @@ program
|
|
|
1647
1654
|
spinner.stop();
|
|
1648
1655
|
console.log(chalk.bold(`\nSearch Results for "${options.search}":\n`));
|
|
1649
1656
|
(data.results || data || []).slice(0, 10).forEach((t: any) => {
|
|
1650
|
-
console.log(` ${chalk.cyan(t.name)} ${chalk.dim('$' + (t.price || 0))}`);
|
|
1657
|
+
console.log(` ${chalk.cyan(t.title || t.name)} ${chalk.dim('$' + (t.price || 0))}`);
|
|
1651
1658
|
console.log(chalk.dim(` ${t.description?.slice(0, 60) || ''}...`));
|
|
1652
1659
|
});
|
|
1653
1660
|
|
|
@@ -1656,15 +1663,16 @@ program
|
|
|
1656
1663
|
spinner.stop();
|
|
1657
1664
|
console.log(chalk.bold('\nFeatured Templates:\n'));
|
|
1658
1665
|
(data.results || data || []).forEach((t: any) => {
|
|
1659
|
-
console.log(` ${chalk.green('★')} ${chalk.cyan(t.name)} ${chalk.dim('$' + (t.price || 0))}`);
|
|
1666
|
+
console.log(` ${chalk.green('★')} ${chalk.cyan(t.title || t.name)} ${chalk.dim('$' + (t.price || 0))}`);
|
|
1660
1667
|
});
|
|
1661
1668
|
|
|
1662
1669
|
} else if (options.categories) {
|
|
1663
1670
|
const data = await apiRequest('/v2/marketplace/categories/');
|
|
1664
1671
|
spinner.stop();
|
|
1665
1672
|
console.log(chalk.bold('\nTemplate Categories:\n'));
|
|
1673
|
+
// Backend returns {value, label} format
|
|
1666
1674
|
(data.results || data || []).forEach((c: any) => {
|
|
1667
|
-
console.log(` ${chalk.cyan(c.name)} ${chalk.dim(c.template_count + ' templates')}`);
|
|
1675
|
+
console.log(` ${chalk.cyan(c.label || c.name || c.value)} ${chalk.dim((c.template_count || c.count || '') + ' templates')}`);
|
|
1668
1676
|
});
|
|
1669
1677
|
|
|
1670
1678
|
} else if (options.myTemplates) {
|
|
@@ -1672,13 +1680,13 @@ program
|
|
|
1672
1680
|
spinner.stop();
|
|
1673
1681
|
console.log(chalk.bold('\nYour Templates:\n'));
|
|
1674
1682
|
(data.results || data || []).forEach((t: any) => {
|
|
1675
|
-
console.log(` ${chalk.cyan(t.name)} ${chalk.dim(t.status)}`);
|
|
1683
|
+
console.log(` ${chalk.cyan(t.title || t.name)} ${chalk.dim(t.status)}`);
|
|
1676
1684
|
});
|
|
1677
1685
|
|
|
1678
1686
|
} else if (options.get) {
|
|
1679
1687
|
const data = await apiRequest(`/v2/marketplace/v2/templates/${options.get}/`);
|
|
1680
1688
|
spinner.stop();
|
|
1681
|
-
console.log(chalk.bold(`\n${data.name}\n`));
|
|
1689
|
+
console.log(chalk.bold(`\n${data.title || data.name}\n`));
|
|
1682
1690
|
console.log(` Category: ${chalk.cyan(data.category)}`);
|
|
1683
1691
|
console.log(` Price: ${chalk.yellow('$' + (data.price || 0))}`);
|
|
1684
1692
|
console.log(` Downloads: ${chalk.dim(data.download_count || 0)}`);
|
package/src/sdk.ts
CHANGED
|
@@ -33,7 +33,7 @@ import * as fs from 'fs';
|
|
|
33
33
|
import * as path from 'path';
|
|
34
34
|
import * as crypto from 'crypto';
|
|
35
35
|
|
|
36
|
-
const VERSION = '1.0
|
|
36
|
+
const VERSION = '1.1.0';
|
|
37
37
|
const DEFAULT_BASE_URL = 'https://api.aribot.ayurak.com/aribot-api';
|
|
38
38
|
|
|
39
39
|
// =============================================================================
|
package/src/theme.ts
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ayurak Visual Theme for Aribot CLI
|
|
3
|
+
*
|
|
4
|
+
* Apple Glass-inspired design with orange, gold, black, and white.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
|
|
9
|
+
// =============================================================================
|
|
10
|
+
// AYURAK COLOR PALETTE - Apple Glass Inspired
|
|
11
|
+
// =============================================================================
|
|
12
|
+
|
|
13
|
+
export const colors = {
|
|
14
|
+
orange: chalk.hex('#FF6B35'),
|
|
15
|
+
gold: chalk.hex('#D4A03C'),
|
|
16
|
+
white: chalk.white,
|
|
17
|
+
black: chalk.hex('#1d1d1f'),
|
|
18
|
+
gray: chalk.hex('#8e8e93'),
|
|
19
|
+
darkGray: chalk.hex('#3d3d3f'),
|
|
20
|
+
success: chalk.hex('#34c759'),
|
|
21
|
+
error: chalk.hex('#ff3b30'),
|
|
22
|
+
warning: chalk.hex('#ff9500'),
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const bold = {
|
|
26
|
+
orange: chalk.bold.hex('#FF6B35'),
|
|
27
|
+
gold: chalk.bold.hex('#D4A03C'),
|
|
28
|
+
white: chalk.bold.white,
|
|
29
|
+
success: chalk.bold.hex('#34c759'),
|
|
30
|
+
error: chalk.bold.hex('#ff3b30'),
|
|
31
|
+
warning: chalk.bold.hex('#ff9500'),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// =============================================================================
|
|
35
|
+
// ASCII ART LOGOS
|
|
36
|
+
// =============================================================================
|
|
37
|
+
|
|
38
|
+
export const LOGO_FULL = `
|
|
39
|
+
${bold.orange(' ╭──────────────────────────────────────────────────────────────╮')}
|
|
40
|
+
${bold.orange(' │ │')}
|
|
41
|
+
${bold.orange(' │ █████╗ ██████╗ ██╗██████╗ ██████╗ ████████╗ │')}
|
|
42
|
+
${bold.orange(' │ ██╔══██╗██╔══██╗██║██╔══██╗██╔═══██╗╚══██╔══╝ │')}
|
|
43
|
+
${bold.orange(' │ ███████║██████╔╝██║██████╔╝██║ ██║ ██║ │')}
|
|
44
|
+
${bold.orange(' │ ██╔══██║██╔══██╗██║██╔══██╗██║ ██║ ██║ │')}
|
|
45
|
+
${bold.orange(' │ ██║ ██║██║ ██║██║██████╔╝╚██████╔╝ ██║ │')}
|
|
46
|
+
${bold.orange(' │ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═════╝ ╚═════╝ ╚═╝ │')}
|
|
47
|
+
${bold.orange(' │ │')}
|
|
48
|
+
${bold.orange(' │ ')}${colors.gold('Security Intelligence Platform')}${bold.orange(' │')}
|
|
49
|
+
${bold.orange(' │ │')}
|
|
50
|
+
${bold.orange(' ╰──────────────────────────────────────────────────────────────╯')}
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
export const LOGO_SMALL = `
|
|
54
|
+
${bold.orange(' ▄▀▄ █▀▄ █ █▀▄ █▀█ ▀█▀')} ${colors.gold('Security Intelligence')}
|
|
55
|
+
${bold.orange(' █▀█ █▀▄ █ █▀▄ █▄█ █')}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
export const WORDMARK = `${bold.orange('◆')} ${bold.white('aribot')}`;
|
|
59
|
+
export const WORDMARK_FULL = `${bold.orange('◆')} ${bold.white('ARIBOT')}`;
|
|
60
|
+
|
|
61
|
+
// =============================================================================
|
|
62
|
+
// OUTPUT HELPERS
|
|
63
|
+
// =============================================================================
|
|
64
|
+
|
|
65
|
+
export function printLogo(size: 'full' | 'small' | 'mini' = 'small'): void {
|
|
66
|
+
if (size === 'full') {
|
|
67
|
+
console.log(LOGO_FULL);
|
|
68
|
+
} else if (size === 'small') {
|
|
69
|
+
console.log(LOGO_SMALL);
|
|
70
|
+
} else {
|
|
71
|
+
console.log(WORDMARK);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function success(message: string): void {
|
|
76
|
+
console.log(`${colors.success('✓')} ${message}`);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function error(message: string): void {
|
|
80
|
+
console.log(`${colors.error('✗')} ${message}`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function warning(message: string): void {
|
|
84
|
+
console.log(`${colors.warning('!')} ${message}`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function info(message: string): void {
|
|
88
|
+
console.log(`${colors.gray('›')} ${message}`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function section(title: string): void {
|
|
92
|
+
console.log();
|
|
93
|
+
console.log(bold.gold(title));
|
|
94
|
+
console.log(colors.orange('─'.repeat(title.length)));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function keyValue(key: string, value: string): void {
|
|
98
|
+
console.log(` ${colors.gray(key)} ${value}`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function severityBadge(severity: string): string {
|
|
102
|
+
const s = severity.toLowerCase();
|
|
103
|
+
switch (s) {
|
|
104
|
+
case 'critical':
|
|
105
|
+
return chalk.bgHex('#ff3b30').white.bold(' CRITICAL ');
|
|
106
|
+
case 'high':
|
|
107
|
+
return bold.error('HIGH');
|
|
108
|
+
case 'medium':
|
|
109
|
+
return bold.warning('MEDIUM');
|
|
110
|
+
case 'low':
|
|
111
|
+
return colors.gold('LOW');
|
|
112
|
+
default:
|
|
113
|
+
return colors.gray(severity.toUpperCase());
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// =============================================================================
|
|
118
|
+
// WELCOME & AUTH SCREENS
|
|
119
|
+
// =============================================================================
|
|
120
|
+
|
|
121
|
+
export function printWelcome(): void {
|
|
122
|
+
console.log(LOGO_FULL);
|
|
123
|
+
console.log();
|
|
124
|
+
console.log(bold.white('The Security Intelligence Platform'));
|
|
125
|
+
console.log();
|
|
126
|
+
console.log(colors.gold('━'.repeat(58)));
|
|
127
|
+
console.log();
|
|
128
|
+
console.log(` ${colors.orange('◆')} AI-Powered Threat Modeling ${colors.orange('◆')} 100+ Compliance Standards`);
|
|
129
|
+
console.log(` ${colors.orange('◆')} Cloud Security (CSPM/CNAPP) ${colors.orange('◆')} Economic Intelligence`);
|
|
130
|
+
console.log(` ${colors.orange('◆')} Red Team Attack Simulation ${colors.orange('◆')} SBOM & Vulnerability Mgmt`);
|
|
131
|
+
console.log();
|
|
132
|
+
console.log(colors.gold('━'.repeat(58)));
|
|
133
|
+
console.log();
|
|
134
|
+
console.log(` ${colors.gray('Get your API key at:')} ${bold.white('https://portal.aribot.ayurak.com')}`);
|
|
135
|
+
console.log();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function printAuthSuccess(email: string, company: string, plan: string): void {
|
|
139
|
+
console.log();
|
|
140
|
+
console.log(`${colors.success('✓')} ${bold.white('Authenticated successfully')}`);
|
|
141
|
+
console.log();
|
|
142
|
+
console.log(` ${colors.gray('Email')} ${email}`);
|
|
143
|
+
console.log(` ${colors.gray('Company')} ${company}`);
|
|
144
|
+
console.log(` ${colors.gray('Plan')} ${bold.gold(plan)}`);
|
|
145
|
+
console.log();
|
|
146
|
+
section('Quick Start');
|
|
147
|
+
console.log(` ${colors.orange('$')} aribot analyze diagram.png`);
|
|
148
|
+
console.log(` ${colors.orange('$')} aribot diagrams`);
|
|
149
|
+
console.log(` ${colors.orange('$')} aribot compliance SOC2 <id>`);
|
|
150
|
+
console.log(` ${colors.orange('$')} aribot --help`);
|
|
151
|
+
console.log();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function printStatus(status: any, rateLimits?: any): void {
|
|
155
|
+
console.log();
|
|
156
|
+
console.log(WORDMARK);
|
|
157
|
+
console.log();
|
|
158
|
+
|
|
159
|
+
const health = status.status || 'unknown';
|
|
160
|
+
const icon = health === 'healthy' ? colors.success('✓') : colors.error('✗');
|
|
161
|
+
const healthColor = health === 'healthy' ? colors.success : colors.error;
|
|
162
|
+
|
|
163
|
+
console.log(` ${colors.gray('Status')} ${icon} ${healthColor(health.charAt(0).toUpperCase() + health.slice(1))}`);
|
|
164
|
+
console.log(` ${colors.gray('Version')} ${status.version || 'N/A'}`);
|
|
165
|
+
console.log(` ${colors.gray('Features')} ${status.features_enabled ? 'Enabled' : 'Disabled'}`);
|
|
166
|
+
|
|
167
|
+
if (rateLimits) {
|
|
168
|
+
console.log();
|
|
169
|
+
console.log(` ${colors.gold('Rate Limits')}`);
|
|
170
|
+
console.log(` ${colors.gray('Per min')} ${rateLimits.requests_per_minute || 'unlimited'}`);
|
|
171
|
+
console.log(` ${colors.gray('Per hour')} ${rateLimits.requests_per_hour || 'unlimited'}`);
|
|
172
|
+
}
|
|
173
|
+
console.log();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// =============================================================================
|
|
177
|
+
// DATA DISPLAY
|
|
178
|
+
// =============================================================================
|
|
179
|
+
|
|
180
|
+
export function printDiagrams(diagrams: any[], total?: number): void {
|
|
181
|
+
console.log();
|
|
182
|
+
console.log(bold.white('Your Diagrams'));
|
|
183
|
+
console.log();
|
|
184
|
+
|
|
185
|
+
// Table header
|
|
186
|
+
console.log(` ${colors.gold('ID'.padEnd(10))} ${colors.gold('Name'.padEnd(35))} ${colors.gold(' ')} ${colors.gold('Threats'.padStart(8))} ${colors.gold('Created'.padStart(12))}`);
|
|
187
|
+
console.log(` ${colors.orange('─'.repeat(10))} ${colors.orange('─'.repeat(35))} ${colors.orange('──')} ${colors.orange('─'.repeat(8))} ${colors.orange('─'.repeat(12))}`);
|
|
188
|
+
|
|
189
|
+
for (const d of diagrams) {
|
|
190
|
+
const id = (d.id || '').substring(0, 8);
|
|
191
|
+
const name = (d.name || 'Untitled').substring(0, 35).padEnd(35);
|
|
192
|
+
const stage = d.stage || '';
|
|
193
|
+
const icon = stage === 'complete' ? colors.success('✓') : stage === 'processing' ? colors.warning('⋯') : colors.gray('○');
|
|
194
|
+
const threats = String(d.threats_count || 0).padStart(8);
|
|
195
|
+
const created = (d.created_at || '').substring(0, 10).padStart(12);
|
|
196
|
+
|
|
197
|
+
console.log(` ${bold.orange(id.padEnd(10))} ${chalk.white(name)} ${icon} ${colors.gold(threats)} ${colors.gray(created)}`);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
console.log();
|
|
201
|
+
console.log(` ${colors.gray(`Showing ${diagrams.length}${total ? ` of ${total}` : ''} diagrams`)}`);
|
|
202
|
+
console.log();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function printThreats(threats: any[], diagramName?: string): void {
|
|
206
|
+
console.log();
|
|
207
|
+
|
|
208
|
+
if (diagramName) {
|
|
209
|
+
console.log(`${bold.white('Threats')} ${colors.gray(diagramName)}`);
|
|
210
|
+
console.log();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const severities = ['critical', 'high', 'medium', 'low'];
|
|
214
|
+
for (const sev of severities) {
|
|
215
|
+
const items = threats.filter((t: any) => (t.severity || '').toLowerCase() === sev);
|
|
216
|
+
if (items.length === 0) continue;
|
|
217
|
+
|
|
218
|
+
console.log(` ${severityBadge(sev)} ${colors.gray(`(${items.length})`)}`);
|
|
219
|
+
|
|
220
|
+
for (const t of items.slice(0, 5)) {
|
|
221
|
+
const title = (t.title || 'Untitled').substring(0, 55);
|
|
222
|
+
console.log(` ${colors.gray('›')} ${title}`);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (items.length > 5) {
|
|
226
|
+
console.log(` ${colors.gray(` + ${items.length - 5} more`)}`);
|
|
227
|
+
}
|
|
228
|
+
console.log();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const total = threats.length;
|
|
232
|
+
const crit = threats.filter((t: any) => (t.severity || '').toLowerCase() === 'critical').length;
|
|
233
|
+
const high = threats.filter((t: any) => (t.severity || '').toLowerCase() === 'high').length;
|
|
234
|
+
|
|
235
|
+
let summary = `${colors.gold('Total:')} ${total} threats`;
|
|
236
|
+
if (crit > 0) summary += ` ${colors.error(`${crit} critical`)}`;
|
|
237
|
+
if (high > 0) summary += ` ${colors.warning(`${high} high`)}`;
|
|
238
|
+
console.log(summary);
|
|
239
|
+
console.log();
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function printExportSuccess(filename: string, format: string): void {
|
|
243
|
+
console.log();
|
|
244
|
+
console.log(`${colors.success('✓')} ${bold.white('Report exported')}`);
|
|
245
|
+
console.log();
|
|
246
|
+
console.log(` ${colors.gray('Format')} ${format.toUpperCase()}`);
|
|
247
|
+
console.log(` ${colors.gray('File')} ${filename}`);
|
|
248
|
+
console.log();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export function printComplianceScore(standard: string, score: number, passed: number, failed: number): void {
|
|
252
|
+
console.log();
|
|
253
|
+
console.log(`${bold.white(standard)} ${bold.gold('Compliance')}`);
|
|
254
|
+
console.log();
|
|
255
|
+
|
|
256
|
+
const barWidth = 40;
|
|
257
|
+
const filled = Math.round((score / 100) * barWidth);
|
|
258
|
+
const color = score >= 80 ? colors.success : score >= 60 ? colors.warning : colors.error;
|
|
259
|
+
|
|
260
|
+
const bar = color('█'.repeat(filled)) + colors.darkGray('░'.repeat(barWidth - filled));
|
|
261
|
+
console.log(` ${bar} ${color(`${score}%`)}`);
|
|
262
|
+
console.log();
|
|
263
|
+
console.log(` ${colors.success(`✓ ${passed} passed`)} ${colors.error(`✗ ${failed} failed`)}`);
|
|
264
|
+
console.log();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export function printMethodologies(methodologies: any[]): void {
|
|
268
|
+
console.log();
|
|
269
|
+
console.log(bold.white('Threat Modeling Methodologies'));
|
|
270
|
+
console.log();
|
|
271
|
+
|
|
272
|
+
for (const m of methodologies) {
|
|
273
|
+
console.log(` ${colors.orange('◆')} ${bold.white(m.name || '')}`);
|
|
274
|
+
if (m.description) {
|
|
275
|
+
console.log(` ${colors.gray(m.description)}`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
console.log();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// =============================================================================
|
|
282
|
+
// AI INTEGRATION HEADERS
|
|
283
|
+
// =============================================================================
|
|
284
|
+
|
|
285
|
+
export function printIntegrationHeader(tool: string): void {
|
|
286
|
+
const tools: Record<string, string> = {
|
|
287
|
+
claude: 'Claude',
|
|
288
|
+
copilot: 'GitHub Copilot',
|
|
289
|
+
gemini: 'Gemini',
|
|
290
|
+
cursor: 'Cursor',
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const name = tools[tool.toLowerCase()] || tool;
|
|
294
|
+
console.log();
|
|
295
|
+
console.log(`${bold.orange('◆')} ${bold.white('ARIBOT')} ${colors.gold('×')} ${bold.white(name)}`);
|
|
296
|
+
console.log();
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// =============================================================================
|
|
300
|
+
// BOX DRAWING
|
|
301
|
+
// =============================================================================
|
|
302
|
+
|
|
303
|
+
export function box(content: string, title?: string): void {
|
|
304
|
+
const lines = content.split('\n');
|
|
305
|
+
const maxLen = Math.max(...lines.map(l => l.length), title?.length || 0);
|
|
306
|
+
const width = maxLen + 4;
|
|
307
|
+
|
|
308
|
+
console.log(colors.orange('╭' + '─'.repeat(width) + '╮'));
|
|
309
|
+
if (title) {
|
|
310
|
+
console.log(colors.orange('│ ') + bold.white(title.padEnd(width - 2)) + colors.orange(' │'));
|
|
311
|
+
console.log(colors.orange('├' + '─'.repeat(width) + '┤'));
|
|
312
|
+
}
|
|
313
|
+
for (const line of lines) {
|
|
314
|
+
console.log(colors.orange('│ ') + line.padEnd(width - 2) + colors.orange(' │'));
|
|
315
|
+
}
|
|
316
|
+
console.log(colors.orange('╰' + '─'.repeat(width) + '╯'));
|
|
317
|
+
}
|