brains-cli 0.1.0

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.
@@ -0,0 +1,144 @@
1
+ 'use strict';
2
+
3
+ const chalk = require('chalk');
4
+ const boxen = require('boxen');
5
+ const figlet = require('figlet');
6
+ const gradient = require('gradient-string');
7
+ const Table = require('cli-table3');
8
+
9
+ const BRAND = gradient(['#7B2FFF', '#FF3366']);
10
+ const SUCCESS = chalk.hex('#00CC88');
11
+ const ACCENT = chalk.hex('#7B2FFF');
12
+ const DIM = chalk.dim;
13
+ const WARN = chalk.hex('#FF8800');
14
+
15
+ function showBanner() {
16
+ const banner = figlet.textSync('brains.io', {
17
+ font: 'Small',
18
+ horizontalLayout: 'default',
19
+ });
20
+
21
+ console.log('');
22
+ console.log(BRAND(banner));
23
+ console.log(DIM(' The AI agent ecosystem for developers\n'));
24
+ }
25
+
26
+ function showBox(title, content, borderColor = '#7B2FFF') {
27
+ console.log(
28
+ boxen(content, {
29
+ title,
30
+ titleAlignment: 'left',
31
+ padding: 1,
32
+ margin: { top: 1, bottom: 1 },
33
+ borderColor,
34
+ borderStyle: 'round',
35
+ })
36
+ );
37
+ }
38
+
39
+ function showSuccess(message) {
40
+ console.log(`\n ${SUCCESS('✓')} ${message}`);
41
+ }
42
+
43
+ function showError(message) {
44
+ console.log(`\n ${chalk.red('✗')} ${message}`);
45
+ }
46
+
47
+ function showInfo(message) {
48
+ console.log(` ${ACCENT('→')} ${message}`);
49
+ }
50
+
51
+ function showWarning(message) {
52
+ console.log(` ${WARN('⚠')} ${message}`);
53
+ }
54
+
55
+ function createBrainTable(brains) {
56
+ const table = new Table({
57
+ head: [
58
+ chalk.white.bold('Name'),
59
+ chalk.white.bold('Category'),
60
+ chalk.white.bold('Description'),
61
+ chalk.white.bold('Price'),
62
+ ],
63
+ style: {
64
+ head: [],
65
+ border: ['dim'],
66
+ },
67
+ colWidths: [22, 14, 44, 10],
68
+ wordWrap: true,
69
+ });
70
+
71
+ brains.forEach((brain) => {
72
+ const categoryColors = {
73
+ builder: chalk.hex('#FF3366'),
74
+ role: chalk.hex('#7B2FFF'),
75
+ reviewer: chalk.hex('#00AAFF'),
76
+ domain: chalk.hex('#00CC88'),
77
+ };
78
+ const catColor = categoryColors[brain.category] || chalk.white;
79
+
80
+ table.push([
81
+ chalk.bold(brain.name),
82
+ catColor(brain.category),
83
+ DIM(brain.shortDesc),
84
+ brain.price === 0 ? SUCCESS('Free') : chalk.white(`$${brain.price}`),
85
+ ]);
86
+ });
87
+
88
+ return table.toString();
89
+ }
90
+
91
+ function createDetailView(brain) {
92
+ const categoryColors = {
93
+ builder: '#FF3366',
94
+ role: '#7B2FFF',
95
+ reviewer: '#00AAFF',
96
+ domain: '#00CC88',
97
+ };
98
+ const color = categoryColors[brain.category] || '#ffffff';
99
+
100
+ let content = '';
101
+ content += `${chalk.hex(color).bold(brain.category.toUpperCase())} `;
102
+ content += brain.price === 0 ? SUCCESS('FREE') : chalk.white(`$${brain.price}`);
103
+ content += `\n\n`;
104
+ content += `${chalk.white(brain.description)}\n\n`;
105
+
106
+ content += `${chalk.bold('Capabilities:')}\n`;
107
+ brain.capabilities.forEach((cap) => {
108
+ content += ` ${chalk.hex(color)('▸')} ${cap}\n`;
109
+ });
110
+
111
+ content += `\n${chalk.bold('Tech Stack:')} ${DIM(brain.stack.join(', '))}`;
112
+ content += `\n${chalk.bold('Installs:')} ${DIM(brain.installs.toLocaleString())}`;
113
+ content += ` ${chalk.bold('Rating:')} ${chalk.hex('#FBBF24')('★')} ${brain.rating}`;
114
+
115
+ if (brain.usage) {
116
+ content += `\n\n${chalk.bold('Quick Start:')}\n`;
117
+ content += ` ${DIM('$')} ${ACCENT(brain.usage)}`;
118
+ }
119
+
120
+ return boxen(content, {
121
+ title: `🧠 ${brain.name}`,
122
+ titleAlignment: 'left',
123
+ padding: 1,
124
+ margin: { top: 1, bottom: 1 },
125
+ borderColor: color,
126
+ borderStyle: 'round',
127
+ });
128
+ }
129
+
130
+ module.exports = {
131
+ showBanner,
132
+ showBox,
133
+ showSuccess,
134
+ showError,
135
+ showInfo,
136
+ showWarning,
137
+ createBrainTable,
138
+ createDetailView,
139
+ BRAND,
140
+ SUCCESS,
141
+ ACCENT,
142
+ DIM,
143
+ WARN,
144
+ };