brains-cli 0.1.0 → 1.0.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/.env.example +2 -0
- package/README.md +64 -81
- package/bin/brains.js +23 -1
- package/package.json +2 -1
- package/src/api.js +103 -0
- package/src/commands/config.js +108 -0
- package/src/commands/install.js +3 -1
- package/src/commands/run.js +425 -317
- package/src/config.js +105 -0
- package/src/utils/files.js +239 -0
package/.env.example
ADDED
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# brains-cli
|
|
2
2
|
|
|
3
3
|
> **Install the world's greatest brains.** AI-powered dev agents you can browse, install, and run from your terminal.
|
|
4
4
|
|
|
5
|
-
Brains are intelligent, conversational AI agents
|
|
5
|
+
Brains are intelligent, conversational AI agents powered by Claude. Unlike dumb templates or scaffolders, Brains **talk to you**, understand your context, and generate production-grade output tailored to your specific needs.
|
|
6
6
|
|
|
7
7
|
## Quick Start
|
|
8
8
|
|
|
@@ -10,29 +10,38 @@ Brains are intelligent, conversational AI agents that act as specialized team me
|
|
|
10
10
|
# Install globally
|
|
11
11
|
npm install -g brains-cli
|
|
12
12
|
|
|
13
|
+
# Set your Anthropic API key
|
|
14
|
+
brains config set api_key sk-ant-your-key-here
|
|
15
|
+
|
|
13
16
|
# Explore available brains
|
|
14
17
|
brains explore
|
|
15
18
|
|
|
16
|
-
# Install a brain
|
|
19
|
+
# Install and run a brain
|
|
17
20
|
brains install resume
|
|
18
|
-
|
|
19
|
-
# Run it
|
|
20
21
|
brains run resume
|
|
21
22
|
```
|
|
22
23
|
|
|
23
|
-
##
|
|
24
|
+
## How It Works
|
|
25
|
+
|
|
26
|
+
1. **Browse** the registry of 11 specialized AI agent Brains
|
|
27
|
+
2. **Install** the ones you need to `~/.brains/`
|
|
28
|
+
3. **Run** them — they interview you, then generate real output using Claude
|
|
29
|
+
|
|
30
|
+
Every Brain has a unique personality, methodology, and expertise defined by a detailed system prompt. When you run a Brain, it calls the Claude API with that system prompt and your context to generate real, production-grade results.
|
|
24
31
|
|
|
25
|
-
|
|
32
|
+
## Brain Categories
|
|
26
33
|
|
|
27
|
-
###
|
|
34
|
+
### Builder Brains — Generate entire projects
|
|
28
35
|
|
|
29
36
|
| Brain | Description | Price |
|
|
30
37
|
|-------|-------------|-------|
|
|
31
|
-
| `resume` | Build a
|
|
38
|
+
| `resume` | Build a complete Next.js resume/portfolio site | Free |
|
|
32
39
|
| `mvp` | Turn a product idea into a full-stack MVP | $9.99 |
|
|
33
40
|
| `landing` | Generate high-converting landing pages | Free |
|
|
34
41
|
|
|
35
|
-
|
|
42
|
+
Builder brains ask you questions, then call Claude to generate a complete project with all files written to disk.
|
|
43
|
+
|
|
44
|
+
### Role Brains — Act as team members
|
|
36
45
|
|
|
37
46
|
| Brain | Description | Price |
|
|
38
47
|
|-------|-------------|-------|
|
|
@@ -40,14 +49,18 @@ A Brain is an AI agent with a specific personality, methodology, and expertise.
|
|
|
40
49
|
| `backend` | Backend architect (APIs, databases, infra) | $4.99 |
|
|
41
50
|
| `architect` | System design, diagrams, and technical decisions | $9.99 |
|
|
42
51
|
|
|
43
|
-
|
|
52
|
+
Role brains enter a conversational REPL — chat back and forth with a specialist who maintains full context.
|
|
53
|
+
|
|
54
|
+
### Reviewer Brains — Analyze & improve code
|
|
44
55
|
|
|
45
56
|
| Brain | Description | Price |
|
|
46
57
|
|-------|-------------|-------|
|
|
47
58
|
| `reviewer` | Deep, senior-level code review | Free |
|
|
48
59
|
| `security` | Find vulnerabilities and harden your app | $4.99 |
|
|
49
60
|
|
|
50
|
-
|
|
61
|
+
Reviewer brains scan your project files, send them to Claude, and output a structured review report.
|
|
62
|
+
|
|
63
|
+
### Domain Brains — Deep tech expertise
|
|
51
64
|
|
|
52
65
|
| Brain | Description | Price |
|
|
53
66
|
|-------|-------------|-------|
|
|
@@ -55,11 +68,13 @@ A Brain is an AI agent with a specific personality, methodology, and expertise.
|
|
|
55
68
|
| `supabase` | Supabase expert (auth, RLS, edge functions) | $4.99 |
|
|
56
69
|
| `stripe` | Payments, subscriptions, webhooks | $4.99 |
|
|
57
70
|
|
|
71
|
+
Domain brains are conversational experts in a specific technology.
|
|
72
|
+
|
|
58
73
|
## Commands
|
|
59
74
|
|
|
60
75
|
### `brains explore`
|
|
61
76
|
|
|
62
|
-
|
|
77
|
+
Interactive terminal browser for discovering Brains.
|
|
63
78
|
|
|
64
79
|
```bash
|
|
65
80
|
brains explore # Browse all
|
|
@@ -69,27 +84,29 @@ brains explore -s "nextjs" # Search
|
|
|
69
84
|
|
|
70
85
|
### `brains install <brain>`
|
|
71
86
|
|
|
72
|
-
Download and
|
|
87
|
+
Download and save a Brain locally.
|
|
73
88
|
|
|
74
89
|
```bash
|
|
75
|
-
brains install resume
|
|
76
|
-
brains install mvp # Install MVP generator
|
|
90
|
+
brains install resume
|
|
77
91
|
brains i reviewer # Short alias
|
|
78
92
|
```
|
|
79
93
|
|
|
80
94
|
### `brains run <brain>`
|
|
81
95
|
|
|
82
|
-
|
|
96
|
+
The core feature. Activates a Brain and connects it to Claude.
|
|
83
97
|
|
|
84
98
|
```bash
|
|
85
|
-
brains run resume #
|
|
86
|
-
brains run reviewer #
|
|
99
|
+
brains run resume # Builder: generates a project
|
|
100
|
+
brains run reviewer # Reviewer: scans and reviews your codebase
|
|
101
|
+
brains run frontend # Role: conversational REPL with a specialist
|
|
87
102
|
brains run mvp --with stripe supabase # Stack multiple brains
|
|
88
103
|
```
|
|
89
104
|
|
|
105
|
+
**Brain stacking** merges system prompts so a single agent has combined expertise.
|
|
106
|
+
|
|
90
107
|
### `brains list`
|
|
91
108
|
|
|
92
|
-
Show
|
|
109
|
+
Show installed Brains.
|
|
93
110
|
|
|
94
111
|
```bash
|
|
95
112
|
brains list # or: brains ls
|
|
@@ -97,94 +114,60 @@ brains list # or: brains ls
|
|
|
97
114
|
|
|
98
115
|
### `brains create [name]`
|
|
99
116
|
|
|
100
|
-
Author a new Brain
|
|
117
|
+
Author a new Brain with an interactive wizard.
|
|
101
118
|
|
|
102
119
|
```bash
|
|
103
120
|
brains create my-brain
|
|
104
|
-
brains create --template builder # Start from a template
|
|
105
121
|
```
|
|
106
122
|
|
|
107
123
|
### `brains publish`
|
|
108
124
|
|
|
109
|
-
Publish your Brain to the
|
|
125
|
+
Publish your Brain to the registry.
|
|
110
126
|
|
|
111
127
|
```bash
|
|
112
128
|
cd my-brain/
|
|
113
|
-
brains publish
|
|
114
|
-
brains publish --private # Private (team only)
|
|
129
|
+
brains publish
|
|
115
130
|
```
|
|
116
131
|
|
|
117
|
-
|
|
132
|
+
### `brains config`
|
|
118
133
|
|
|
119
|
-
|
|
134
|
+
Manage your API key and settings.
|
|
120
135
|
|
|
121
136
|
```bash
|
|
122
|
-
#
|
|
123
|
-
brains
|
|
124
|
-
|
|
125
|
-
#
|
|
126
|
-
brains
|
|
137
|
+
brains config # Show all settings
|
|
138
|
+
brains config set api_key sk-ant-... # Save API key
|
|
139
|
+
brains config set model claude-sonnet-4-20250514
|
|
140
|
+
brains config get api_key # Show current key (masked)
|
|
141
|
+
brains config reset # Reset to defaults
|
|
127
142
|
```
|
|
128
143
|
|
|
129
|
-
##
|
|
144
|
+
## Configuration
|
|
130
145
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
├── brain.json ← Configuration (name, category, capabilities, price)
|
|
136
|
-
├── BRAIN.md ← System prompt & documentation
|
|
137
|
-
└── README.md ← Public readme for the registry
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
The **system prompt** in `BRAIN.md` is the core of your Brain. It defines:
|
|
141
|
-
- **Personality** — How the brain communicates
|
|
142
|
-
- **Methodology** — Step-by-step workflow
|
|
143
|
-
- **Principles** — Rules and best practices
|
|
144
|
-
- **Output format** — How results are structured
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
# Scaffold a new brain
|
|
148
|
-
brains create my-brain
|
|
149
|
-
|
|
150
|
-
# Edit the system prompt
|
|
151
|
-
$EDITOR my-brain/BRAIN.md
|
|
152
|
-
|
|
153
|
-
# Test locally
|
|
154
|
-
brains run my-brain
|
|
155
|
-
|
|
156
|
-
# Publish to registry
|
|
157
|
-
cd my-brain && brains publish
|
|
158
|
-
```
|
|
146
|
+
API key resolution order:
|
|
147
|
+
1. `ANTHROPIC_API_KEY` environment variable
|
|
148
|
+
2. `~/.brains/config.json` (set via `brains config set api_key`)
|
|
149
|
+
3. Interactive prompt on first run
|
|
159
150
|
|
|
160
151
|
## Architecture
|
|
161
152
|
|
|
162
153
|
```
|
|
163
|
-
~/.brains/
|
|
164
|
-
├──
|
|
154
|
+
~/.brains/
|
|
155
|
+
├── config.json # API key, model, preferences
|
|
156
|
+
├── installed.json # Registry of installed brains
|
|
157
|
+
├── sessions/ # Saved conversation transcripts
|
|
165
158
|
├── resume/
|
|
166
|
-
│ ├── brain.json
|
|
167
|
-
│ └── BRAIN.md
|
|
168
|
-
├── reviewer/
|
|
169
|
-
│ ├── brain.json
|
|
170
|
-
│ └── BRAIN.md
|
|
159
|
+
│ ├── brain.json # Brain config + system prompt
|
|
160
|
+
│ └── BRAIN.md # Human-readable docs
|
|
171
161
|
└── ...
|
|
172
162
|
```
|
|
173
163
|
|
|
174
|
-
##
|
|
175
|
-
|
|
176
|
-
| Tier | Price | Includes |
|
|
177
|
-
|------|-------|----------|
|
|
178
|
-
| Free | $0 | 4 free brains (resume, landing, reviewer, nextjs) |
|
|
179
|
-
| Pro | $20/mo | All brains + brain stacking + priority |
|
|
180
|
-
| Enterprise | Custom | Private registry + team management |
|
|
181
|
-
|
|
182
|
-
Brain creators set their own prices. Platform takes 20%.
|
|
183
|
-
|
|
184
|
-
## Contributing
|
|
164
|
+
## Tech Stack
|
|
185
165
|
|
|
186
|
-
|
|
166
|
+
- **Runtime**: Node.js 16+ (CommonJS)
|
|
167
|
+
- **AI**: Claude via `@anthropic-ai/sdk` (streaming)
|
|
168
|
+
- **CLI**: Commander.js, Inquirer.js
|
|
169
|
+
- **UI**: Chalk, Ora, Boxen, Figlet, gradient-string, cli-table3
|
|
187
170
|
|
|
188
171
|
## License
|
|
189
172
|
|
|
190
|
-
MIT
|
|
173
|
+
MIT
|
package/bin/brains.js
CHANGED
|
@@ -10,8 +10,24 @@ const { run } = require('../src/commands/run');
|
|
|
10
10
|
const { list } = require('../src/commands/list');
|
|
11
11
|
const { create } = require('../src/commands/create');
|
|
12
12
|
const { publish } = require('../src/commands/publish');
|
|
13
|
+
const { config } = require('../src/commands/config');
|
|
13
14
|
const { showBanner } = require('../src/utils/ui');
|
|
14
15
|
|
|
16
|
+
// Graceful shutdown on Ctrl+C
|
|
17
|
+
process.on('SIGINT', () => {
|
|
18
|
+
console.log('\n');
|
|
19
|
+
process.exit(0);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Suppress unhandled rejection noise — errors are handled in commands
|
|
23
|
+
process.on('unhandledRejection', (err) => {
|
|
24
|
+
if (err && err.message !== 'NO_API_KEY') {
|
|
25
|
+
const chalk = require('chalk');
|
|
26
|
+
console.error(`\n ${chalk.red('✗')} Unexpected error: ${err.message || err}\n`);
|
|
27
|
+
}
|
|
28
|
+
process.exit(1);
|
|
29
|
+
});
|
|
30
|
+
|
|
15
31
|
showBanner();
|
|
16
32
|
|
|
17
33
|
program
|
|
@@ -39,7 +55,7 @@ program
|
|
|
39
55
|
program
|
|
40
56
|
.command('run <brain>')
|
|
41
57
|
.alias('r')
|
|
42
|
-
.description('Run an installed Brain
|
|
58
|
+
.description('Run an installed Brain — the core AI experience')
|
|
43
59
|
.option('-w, --with <brains...>', 'Stack multiple brains together')
|
|
44
60
|
.option('-d, --dir <directory>', 'Target directory (default: current)')
|
|
45
61
|
.option('--no-interactive', 'Run without interactive prompts')
|
|
@@ -66,6 +82,12 @@ program
|
|
|
66
82
|
.option('--private', 'Publish as a private Brain')
|
|
67
83
|
.action(publish);
|
|
68
84
|
|
|
85
|
+
// ─── Config: Manage settings ───
|
|
86
|
+
program
|
|
87
|
+
.command('config [action] [args...]')
|
|
88
|
+
.description('Manage settings (set/get api_key, model, etc.)')
|
|
89
|
+
.action(config);
|
|
90
|
+
|
|
69
91
|
program.parse(process.argv);
|
|
70
92
|
|
|
71
93
|
// If no args, show help
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brains-cli",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "🧠 Brains.io — Install AI-powered dev agents. Build, review, architect, and ship with one command.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"author": "Brains.io",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
+
"@anthropic-ai/sdk": "^0.39.0",
|
|
27
28
|
"chalk": "^4.1.2",
|
|
28
29
|
"commander": "^11.1.0",
|
|
29
30
|
"inquirer": "^8.2.6",
|
package/src/api.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const Anthropic = require('@anthropic-ai/sdk');
|
|
4
|
+
const { getApiKey, getModel } = require('./config');
|
|
5
|
+
|
|
6
|
+
let client = null;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Initialize or return existing Anthropic client
|
|
10
|
+
*/
|
|
11
|
+
function getClient() {
|
|
12
|
+
if (client) return client;
|
|
13
|
+
const apiKey = getApiKey();
|
|
14
|
+
if (!apiKey) {
|
|
15
|
+
throw new Error('NO_API_KEY');
|
|
16
|
+
}
|
|
17
|
+
client = new Anthropic({ apiKey });
|
|
18
|
+
return client;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Stream a Claude response to the terminal in real-time.
|
|
23
|
+
* Returns the full assistant message text.
|
|
24
|
+
*
|
|
25
|
+
* @param {Object} opts
|
|
26
|
+
* @param {string} opts.systemPrompt - System prompt
|
|
27
|
+
* @param {Array} opts.messages - Conversation history [{role, content}]
|
|
28
|
+
* @param {number} [opts.maxTokens] - Max tokens (default from config)
|
|
29
|
+
* @param {string} [opts.model] - Model override
|
|
30
|
+
* @param {Function} [opts.onText] - Callback for each text chunk
|
|
31
|
+
* @param {Function} [opts.onStart] - Called when streaming starts
|
|
32
|
+
* @param {Function} [opts.onEnd] - Called when streaming ends
|
|
33
|
+
* @returns {Promise<string>} Full response text
|
|
34
|
+
*/
|
|
35
|
+
async function streamMessage(opts) {
|
|
36
|
+
const {
|
|
37
|
+
systemPrompt,
|
|
38
|
+
messages,
|
|
39
|
+
maxTokens = 8096,
|
|
40
|
+
model,
|
|
41
|
+
onText = (text) => process.stdout.write(text),
|
|
42
|
+
onStart = () => {},
|
|
43
|
+
onEnd = () => {},
|
|
44
|
+
} = opts;
|
|
45
|
+
|
|
46
|
+
const anthropic = getClient();
|
|
47
|
+
const modelId = model || getModel();
|
|
48
|
+
|
|
49
|
+
let fullText = '';
|
|
50
|
+
|
|
51
|
+
const stream = await anthropic.messages.stream({
|
|
52
|
+
model: modelId,
|
|
53
|
+
max_tokens: maxTokens,
|
|
54
|
+
system: systemPrompt,
|
|
55
|
+
messages: messages,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
onStart();
|
|
59
|
+
|
|
60
|
+
for await (const event of stream) {
|
|
61
|
+
if (event.type === 'content_block_delta' && event.delta.type === 'text_delta') {
|
|
62
|
+
const text = event.delta.text;
|
|
63
|
+
fullText += text;
|
|
64
|
+
onText(text);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
onEnd();
|
|
69
|
+
return fullText;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Send a single message (non-streaming). Used for short tasks.
|
|
74
|
+
*/
|
|
75
|
+
async function sendMessage(opts) {
|
|
76
|
+
const {
|
|
77
|
+
systemPrompt,
|
|
78
|
+
messages,
|
|
79
|
+
maxTokens = 8096,
|
|
80
|
+
model,
|
|
81
|
+
} = opts;
|
|
82
|
+
|
|
83
|
+
const anthropic = getClient();
|
|
84
|
+
const modelId = model || getModel();
|
|
85
|
+
|
|
86
|
+
const response = await anthropic.messages.create({
|
|
87
|
+
model: modelId,
|
|
88
|
+
max_tokens: maxTokens,
|
|
89
|
+
system: systemPrompt,
|
|
90
|
+
messages: messages,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return response.content
|
|
94
|
+
.filter((block) => block.type === 'text')
|
|
95
|
+
.map((block) => block.text)
|
|
96
|
+
.join('');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
module.exports = {
|
|
100
|
+
getClient,
|
|
101
|
+
streamMessage,
|
|
102
|
+
sendMessage,
|
|
103
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const Table = require('cli-table3');
|
|
5
|
+
const { loadConfig, setConfigValue, getApiKey, maskApiKey, DEFAULTS } = require('../config');
|
|
6
|
+
const { showSuccess, showError, showInfo, ACCENT, DIM } = require('../utils/ui');
|
|
7
|
+
|
|
8
|
+
async function configCommand(action, args) {
|
|
9
|
+
if (!action) {
|
|
10
|
+
// Show all config
|
|
11
|
+
showCurrentConfig();
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (action === 'set') {
|
|
16
|
+
if (args.length < 2) {
|
|
17
|
+
showError('Usage: brains config set <key> <value>');
|
|
18
|
+
showInfo(`Example: ${ACCENT('brains config set api_key sk-ant-...')}`);
|
|
19
|
+
showInfo(`Example: ${ACCENT('brains config set model claude-sonnet-4-20250514')}`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const key = args[0];
|
|
24
|
+
let value = args.slice(1).join(' ');
|
|
25
|
+
|
|
26
|
+
// Validate known keys
|
|
27
|
+
const validKeys = ['api_key', 'model', 'max_tokens', 'theme', 'telemetry'];
|
|
28
|
+
if (!validKeys.includes(key)) {
|
|
29
|
+
showError(`Unknown config key "${key}".`);
|
|
30
|
+
showInfo(`Valid keys: ${validKeys.map(k => ACCENT(k)).join(', ')}`);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Type coercion
|
|
35
|
+
if (key === 'max_tokens') value = parseInt(value, 10);
|
|
36
|
+
if (key === 'telemetry') value = value === 'true';
|
|
37
|
+
|
|
38
|
+
setConfigValue(key, value);
|
|
39
|
+
const displayValue = key === 'api_key' ? maskApiKey(value) : value;
|
|
40
|
+
showSuccess(`${key} = ${displayValue}`);
|
|
41
|
+
console.log('');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (action === 'get') {
|
|
46
|
+
if (args.length < 1) {
|
|
47
|
+
showError('Usage: brains config get <key>');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const key = args[0];
|
|
52
|
+
const config = loadConfig();
|
|
53
|
+
let value = config[key];
|
|
54
|
+
|
|
55
|
+
if (key === 'api_key') {
|
|
56
|
+
value = maskApiKey(getApiKey());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (value === undefined) {
|
|
60
|
+
showInfo(`${key} is not set (default: ${DEFAULTS[key] || 'none'})`);
|
|
61
|
+
} else {
|
|
62
|
+
console.log(`\n ${chalk.bold(key)} = ${value}\n`);
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (action === 'reset') {
|
|
68
|
+
const { saveConfig } = require('../config');
|
|
69
|
+
saveConfig({ ...DEFAULTS });
|
|
70
|
+
showSuccess('Config reset to defaults.');
|
|
71
|
+
console.log('');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
showError(`Unknown action "${action}". Use: set, get, reset, or no action to view all.`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function showCurrentConfig() {
|
|
79
|
+
const config = loadConfig();
|
|
80
|
+
const apiKey = getApiKey();
|
|
81
|
+
|
|
82
|
+
console.log(`\n ${chalk.bold('Brains Configuration')}\n`);
|
|
83
|
+
|
|
84
|
+
const table = new Table({
|
|
85
|
+
style: { head: [], border: ['dim'] },
|
|
86
|
+
colWidths: [20, 46],
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
table.push(
|
|
90
|
+
[chalk.bold('api_key'), apiKey ? maskApiKey(apiKey) : chalk.red('(not set)')],
|
|
91
|
+
[chalk.bold('model'), config.model || DEFAULTS.model],
|
|
92
|
+
[chalk.bold('max_tokens'), String(config.max_tokens || DEFAULTS.max_tokens)],
|
|
93
|
+
[chalk.bold('theme'), config.theme || DEFAULTS.theme],
|
|
94
|
+
[chalk.bold('telemetry'), String(config.telemetry ?? DEFAULTS.telemetry)]
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
console.log(table.toString());
|
|
98
|
+
|
|
99
|
+
if (!apiKey) {
|
|
100
|
+
console.log('');
|
|
101
|
+
showInfo(`Set your API key: ${ACCENT('brains config set api_key sk-ant-...')}`);
|
|
102
|
+
showInfo(`Or set env var: ${ACCENT('export ANTHROPIC_API_KEY=sk-ant-...')}`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
console.log('');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
module.exports = { config: configCommand };
|
package/src/commands/install.js
CHANGED