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.
- package/.claude/skills/founder/SKILL.md +316 -0
- package/README.md +190 -0
- package/bin/brains.js +74 -0
- package/package.json +43 -0
- package/src/commands/create.js +171 -0
- package/src/commands/explore.js +137 -0
- package/src/commands/install.js +139 -0
- package/src/commands/list.js +71 -0
- package/src/commands/publish.js +65 -0
- package/src/commands/run.js +487 -0
- package/src/registry.js +659 -0
- package/src/utils/ui.js +144 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
You are building Brains.io — an npm CLI tool that is the "npm for AI agents." Users install, run, and publish AI-powered developer agents called "Brains" from their terminal. Each Brain is a specialized AI agent with a unique system prompt, personality, methodology, and expertise.
|
|
2
|
+
Project Overview
|
|
3
|
+
What it is: A globally installable npm CLI (npm install -g brains-cli) that lets developers:
|
|
4
|
+
|
|
5
|
+
Browse a registry of AI agent "Brains" (like an app store in the terminal)
|
|
6
|
+
Install Brains to ~/.brains/
|
|
7
|
+
Run Brains interactively — they ask questions, then generate real code/projects/reviews
|
|
8
|
+
Stack multiple Brains together for complex tasks
|
|
9
|
+
Create and publish their own Brains
|
|
10
|
+
|
|
11
|
+
Tech stack:
|
|
12
|
+
|
|
13
|
+
Node.js CLI (CommonJS, Node 16+)
|
|
14
|
+
Commander.js for command parsing
|
|
15
|
+
Inquirer.js for interactive prompts
|
|
16
|
+
Chalk 4.x, Ora 5.x, Boxen 5.x, cli-table3 for terminal UI
|
|
17
|
+
Figlet + gradient-string for the banner
|
|
18
|
+
Anthropic Claude API (@anthropic-ai/sdk) for AI generation
|
|
19
|
+
Local file system (~/.brains/) for installed brain storage
|
|
20
|
+
|
|
21
|
+
Project Structure
|
|
22
|
+
brains-cli/
|
|
23
|
+
├── bin/
|
|
24
|
+
│ └── brains.js # CLI entry point, shebang, commander setup
|
|
25
|
+
├── src/
|
|
26
|
+
│ ├── registry.js # Brain definitions (id, name, category, systemPrompt, etc.)
|
|
27
|
+
│ ├── config.js # Global config management (~/.brains/config.json)
|
|
28
|
+
│ ├── api.js # Claude API wrapper (streaming, conversation management)
|
|
29
|
+
│ ├── utils/
|
|
30
|
+
│ │ ├── ui.js # Terminal UI helpers (banner, tables, colors, spinners)
|
|
31
|
+
│ │ ├── files.js # File generation utilities (write project trees)
|
|
32
|
+
│ │ └── template.js # Template engine for code generation
|
|
33
|
+
│ └── commands/
|
|
34
|
+
│ ├── explore.js # Browse brains with interactive TUI
|
|
35
|
+
│ ├── install.js # Download and save brain to ~/.brains/
|
|
36
|
+
│ ├── run.js # Execute a brain (THE CORE — calls Claude API)
|
|
37
|
+
│ ├── list.js # Show installed brains
|
|
38
|
+
│ ├── create.js # Scaffold a new brain (interactive wizard)
|
|
39
|
+
│ └── publish.js # Publish brain to registry
|
|
40
|
+
├── package.json
|
|
41
|
+
├── README.md
|
|
42
|
+
└── .env.example # ANTHROPIC_API_KEY=sk-ant-...
|
|
43
|
+
Commands to Implement
|
|
44
|
+
1. brains explore
|
|
45
|
+
Interactive terminal browser for the brain registry.
|
|
46
|
+
|
|
47
|
+
Shows a styled table of all available brains
|
|
48
|
+
Filter by category: brains explore -c builder
|
|
49
|
+
Search: brains explore -s "nextjs"
|
|
50
|
+
Select a brain to see full details (description, capabilities, reviews, price)
|
|
51
|
+
Option to install directly from explore view
|
|
52
|
+
Categories: builder, role, reviewer, domain (each with its own color)
|
|
53
|
+
|
|
54
|
+
2. brains install <brain-id>
|
|
55
|
+
Downloads a brain and saves it locally.
|
|
56
|
+
|
|
57
|
+
Validates brain exists in registry
|
|
58
|
+
Shows price (or "Free")
|
|
59
|
+
Animated installation progress (ora spinners)
|
|
60
|
+
Saves brain config to ~/.brains/<brain-id>/brain.json
|
|
61
|
+
Saves human-readable docs to ~/.brains/<brain-id>/BRAIN.md
|
|
62
|
+
Tracks installation in ~/.brains/installed.json
|
|
63
|
+
Prevents duplicate installs
|
|
64
|
+
|
|
65
|
+
3. brains run <brain-id> ⭐ THIS IS THE CORE FEATURE
|
|
66
|
+
This is where the magic happens. When a user runs a brain, the CLI:
|
|
67
|
+
Step 1 — Checks installation. If not installed, offers to install.
|
|
68
|
+
Step 2 — Loads the brain's system prompt from ~/.brains/<brain-id>/brain.json.
|
|
69
|
+
Step 3 — Runs the brain's interview (defined questions from the brain config). Uses Inquirer.js to ask each question conversationally.
|
|
70
|
+
Step 4 — Calls the Claude API with:
|
|
71
|
+
|
|
72
|
+
The brain's system prompt as the system parameter
|
|
73
|
+
The user's answers formatted as context
|
|
74
|
+
For builder brains: instructions to generate a complete project
|
|
75
|
+
For reviewer brains: the code/files to review (read from cwd)
|
|
76
|
+
For role/domain brains: enter a conversational REPL loop
|
|
77
|
+
|
|
78
|
+
Step 5 — Handles the response:
|
|
79
|
+
|
|
80
|
+
Builder brains: Parse Claude's response, extract code blocks, write files to disk, show the project tree, give next-steps instructions
|
|
81
|
+
Reviewer brains: Read files from cwd, send to Claude for review, display the formatted review report with severity levels (🔴🟡🟢📝)
|
|
82
|
+
Role brains: Enter a REPL loop where the user can keep chatting with the brain, maintaining conversation history
|
|
83
|
+
Domain brains: Same as role — conversational REPL with the domain expert
|
|
84
|
+
|
|
85
|
+
Brain stacking: brains run mvp --with stripe supabase
|
|
86
|
+
|
|
87
|
+
Load system prompts from all specified brains
|
|
88
|
+
Merge them into a combined system prompt with clear sections
|
|
89
|
+
Run as a single agent with combined expertise
|
|
90
|
+
|
|
91
|
+
Claude API integration:
|
|
92
|
+
javascriptconst Anthropic = require('@anthropic-ai/sdk');
|
|
93
|
+
|
|
94
|
+
// Initialize (reads ANTHROPIC_API_KEY from env or ~/.brains/config.json)
|
|
95
|
+
const client = new Anthropic();
|
|
96
|
+
|
|
97
|
+
// Stream responses for real-time output
|
|
98
|
+
const stream = await client.messages.stream({
|
|
99
|
+
model: 'claude-sonnet-4-20250514',
|
|
100
|
+
max_tokens: 8096,
|
|
101
|
+
system: brain.systemPrompt, // The brain's personality
|
|
102
|
+
messages: conversationHistory,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Stream to terminal with nice formatting
|
|
106
|
+
for await (const event of stream) {
|
|
107
|
+
if (event.type === 'content_block_delta' && event.delta.type === 'text_delta') {
|
|
108
|
+
process.stdout.write(event.delta.text);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
4. brains list
|
|
112
|
+
Shows installed brains in a formatted table with name, category, version, install date.
|
|
113
|
+
5. brains create [name]
|
|
114
|
+
Interactive wizard to create a new brain:
|
|
115
|
+
|
|
116
|
+
Ask for name, description, category, stack, price
|
|
117
|
+
Open $EDITOR for the system prompt
|
|
118
|
+
Scaffold brain.json, BRAIN.md, README.md in a new directory
|
|
119
|
+
Provide instructions for testing and publishing
|
|
120
|
+
|
|
121
|
+
6. brains publish
|
|
122
|
+
Reads brain.json from cwd, validates, and "publishes" (for now, just validates and shows success — real registry comes later).
|
|
123
|
+
7. brains config
|
|
124
|
+
Manage settings:
|
|
125
|
+
|
|
126
|
+
brains config set api_key <key> — save Anthropic API key
|
|
127
|
+
brains config set model <model> — set preferred model
|
|
128
|
+
brains config get api_key — show current key (masked)
|
|
129
|
+
|
|
130
|
+
Brain Registry
|
|
131
|
+
Define these 11 brains in src/registry.js. Each brain MUST have:
|
|
132
|
+
javascript{
|
|
133
|
+
id: 'resume', // Unique slug
|
|
134
|
+
name: 'Resume Builder', // Display name
|
|
135
|
+
category: 'builder', // builder | role | reviewer | domain
|
|
136
|
+
shortDesc: '...', // One-liner for tables
|
|
137
|
+
description: '...', // Full description
|
|
138
|
+
capabilities: ['...'], // What it can do
|
|
139
|
+
stack: ['Next.js', '...'], // Technologies
|
|
140
|
+
price: 0, // 0 = free
|
|
141
|
+
rating: 4.9,
|
|
142
|
+
installs: 24500,
|
|
143
|
+
tags: ['resume', '...'],
|
|
144
|
+
usage: 'brains run resume', // Example command
|
|
145
|
+
systemPrompt: `...`, // THE CORE — detailed system prompt
|
|
146
|
+
questions: [ // Interview questions
|
|
147
|
+
{ key: 'name', question: 'What is your name?' },
|
|
148
|
+
],
|
|
149
|
+
}
|
|
150
|
+
Builder Brains (3):
|
|
151
|
+
|
|
152
|
+
resume — FREE — Builds a complete Next.js resume/portfolio site. Asks about experience, skills, projects, theme preference. Generates full project with components, styles, SEO.
|
|
153
|
+
mvp — $9.99 — Turns a product idea into a full-stack MVP. Asks about the idea, audience, features, auth needs. Generates Next.js + Prisma + auth + landing page + dashboard.
|
|
154
|
+
landing — FREE — Generates high-converting landing pages. Asks about product, benefits, tone. Generates hero, features, social proof, pricing, FAQ sections.
|
|
155
|
+
|
|
156
|
+
Role Brains (3):
|
|
157
|
+
4. frontend — $4.99 — Senior frontend engineer. Thinks in components, a11y, performance. Conversational REPL mode.
|
|
158
|
+
5. backend — $4.99 — Backend architect. Designs APIs, schemas, auth flows. Conversational REPL mode.
|
|
159
|
+
6. architect — $9.99 — System architect. Creates Mermaid diagrams, ADRs, trade-off analysis. Conversational REPL mode.
|
|
160
|
+
Reviewer Brains (2):
|
|
161
|
+
7. reviewer — FREE — Deep code review. Reads files from cwd, outputs 🔴🟡🟢📝 categorized feedback.
|
|
162
|
+
8. security — $4.99 — Security auditor. OWASP Top 10, auth audit, injection detection, dependency scanning.
|
|
163
|
+
Domain Brains (3):
|
|
164
|
+
9. nextjs — FREE — Next.js 14+ expert. App Router, RSC, caching, middleware. Conversational REPL.
|
|
165
|
+
10. supabase — $4.99 — Supabase expert. RLS, auth, edge functions, real-time.
|
|
166
|
+
11. stripe — $4.99 — Stripe payments expert. Checkout, subscriptions, webhooks, billing.
|
|
167
|
+
System Prompt Guidelines
|
|
168
|
+
Each brain's system prompt should be detailed and specific (200-500 words). Include:
|
|
169
|
+
|
|
170
|
+
Identity: "You are the [Name] Brain. You are a [role] with [X] years of experience."
|
|
171
|
+
Personality: How it communicates (direct, conversational, formal, etc.)
|
|
172
|
+
Methodology: Step-by-step workflow it follows
|
|
173
|
+
Principles: Core rules and preferences
|
|
174
|
+
Output format: How it structures its responses
|
|
175
|
+
Tech preferences: Specific technologies and patterns it favors
|
|
176
|
+
|
|
177
|
+
The REPL Loop (for role/domain brains)
|
|
178
|
+
After the initial context questions, role and domain brains enter a conversational loop:
|
|
179
|
+
┌─────────────────────────────────────────────────────
|
|
180
|
+
│ 🧠 Frontend Engineer — role
|
|
181
|
+
│ Stack: React, Next.js, TypeScript, Tailwind CSS
|
|
182
|
+
└─────────────────────────────────────────────────────
|
|
183
|
+
|
|
184
|
+
You: Build me a data table component with sorting and pagination
|
|
185
|
+
|
|
186
|
+
[Frontend Engineer]: I'll design this as a composable component...
|
|
187
|
+
(streams Claude's response in real-time)
|
|
188
|
+
|
|
189
|
+
You: Can you add virtual scrolling for large datasets?
|
|
190
|
+
|
|
191
|
+
[Frontend Engineer]: Great idea. Here's how I'd approach that...
|
|
192
|
+
|
|
193
|
+
You: exit
|
|
194
|
+
|
|
195
|
+
Session ended. Conversation saved to ~/.brains/sessions/frontend-1709...json
|
|
196
|
+
Implementation:
|
|
197
|
+
|
|
198
|
+
Use inquirer or readline for the input loop
|
|
199
|
+
Maintain full conversation history in memory
|
|
200
|
+
Send entire history with each API call
|
|
201
|
+
Stream responses to terminal in real-time
|
|
202
|
+
Save session transcript on exit
|
|
203
|
+
Support exit, quit, clear (reset history), save commands
|
|
204
|
+
|
|
205
|
+
Builder Brain File Generation
|
|
206
|
+
When a builder brain generates a project, Claude's response will contain code blocks. The CLI should:
|
|
207
|
+
|
|
208
|
+
Parse the response for code blocks with file paths (e.g., ````typescript:app/page.tsx`)
|
|
209
|
+
Create the directory structure
|
|
210
|
+
Write each file
|
|
211
|
+
Show a tree view of what was generated
|
|
212
|
+
Provide next-steps commands
|
|
213
|
+
|
|
214
|
+
The system prompt for builder brains should instruct Claude to format output as:
|
|
215
|
+
FILE: app/layout.tsx
|
|
216
|
+
\`\`\`typescript
|
|
217
|
+
// file contents here
|
|
218
|
+
\`\`\`
|
|
219
|
+
|
|
220
|
+
FILE: app/page.tsx
|
|
221
|
+
\`\`\`typescript
|
|
222
|
+
// file contents here
|
|
223
|
+
\`\`\`
|
|
224
|
+
Then the CLI parses this and writes the files.
|
|
225
|
+
Reviewer Brain File Reading
|
|
226
|
+
When running a reviewer brain:
|
|
227
|
+
|
|
228
|
+
Scan the current directory for source files (respect .gitignore)
|
|
229
|
+
Read file contents (limit to reasonable size — skip node_modules, .git, binaries)
|
|
230
|
+
Send file contents to Claude with the reviewer system prompt
|
|
231
|
+
Display the formatted review
|
|
232
|
+
|
|
233
|
+
javascript// Pseudo-code for file collection
|
|
234
|
+
const files = glob.sync('**/*.{ts,tsx,js,jsx,py,go,rs}', {
|
|
235
|
+
ignore: ['node_modules/**', '.git/**', 'dist/**', 'build/**'],
|
|
236
|
+
cwd: process.cwd(),
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// Send to Claude
|
|
240
|
+
const messages = [{
|
|
241
|
+
role: 'user',
|
|
242
|
+
content: `Review the following codebase:\n\n${files.map(f =>
|
|
243
|
+
`### ${f}\n\`\`\`\n${fs.readFileSync(f, 'utf-8')}\n\`\`\``
|
|
244
|
+
).join('\n\n')}\n\nFocus: ${answers.focus || 'general review'}`
|
|
245
|
+
}];
|
|
246
|
+
Config Management
|
|
247
|
+
Store config at ~/.brains/config.json:
|
|
248
|
+
json{
|
|
249
|
+
"api_key": "sk-ant-...",
|
|
250
|
+
"model": "claude-sonnet-4-20250514",
|
|
251
|
+
"default_dir": ".",
|
|
252
|
+
"theme": "dark",
|
|
253
|
+
"telemetry": false
|
|
254
|
+
}
|
|
255
|
+
API key resolution order:
|
|
256
|
+
|
|
257
|
+
ANTHROPIC_API_KEY environment variable
|
|
258
|
+
~/.brains/config.json → api_key
|
|
259
|
+
Prompt user to enter it (and offer to save)
|
|
260
|
+
|
|
261
|
+
Terminal UI Design
|
|
262
|
+
|
|
263
|
+
Banner: Figlet "brains.io" with gradient (purple → pink)
|
|
264
|
+
Colors: Purple (#7B2FFF) for accents, Pink (#FF3366) for builders, Blue (#00AAFF) for reviewers, Green (#00CC88) for domain, White for text
|
|
265
|
+
Spinners: ora with dots12 spinner, magenta color
|
|
266
|
+
Tables: cli-table3 with dim borders, bold headers
|
|
267
|
+
Success: Green checkmark ✓
|
|
268
|
+
Error: Red cross ✗
|
|
269
|
+
Info: Purple arrow →
|
|
270
|
+
|
|
271
|
+
Error Handling
|
|
272
|
+
|
|
273
|
+
If no API key is set when running brains run, prompt user to enter one
|
|
274
|
+
If API call fails, show friendly error with retry option
|
|
275
|
+
If brain is not found, suggest similar brains
|
|
276
|
+
If network is unavailable, show offline message
|
|
277
|
+
Rate limit handling with exponential backoff
|
|
278
|
+
|
|
279
|
+
Testing the Build
|
|
280
|
+
After building, I should be able to:
|
|
281
|
+
bash# From the project root
|
|
282
|
+
node bin/brains.js --help # Shows all commands
|
|
283
|
+
node bin/brains.js explore # Interactive browser
|
|
284
|
+
node bin/brains.js install resume # Install a brain
|
|
285
|
+
node bin/brains.js run resume # Run it (needs API key)
|
|
286
|
+
node bin/brains.js list # See installed brains
|
|
287
|
+
node bin/brains.js create # Create a new brain
|
|
288
|
+
Important Notes
|
|
289
|
+
|
|
290
|
+
Use CommonJS (require), not ESM — chalk 4.x, ora 5.x, boxen 5.x are the last CommonJS versions
|
|
291
|
+
All file operations should be sync for simplicity (this is a CLI, not a server)
|
|
292
|
+
The Claude API streaming is the only async operation that matters
|
|
293
|
+
Always gracefully handle Ctrl+C (clean up spinners, save state)
|
|
294
|
+
Make the terminal output BEAUTIFUL — this is a product, not a script
|
|
295
|
+
Every brain's system prompt should be thoughtful and detailed — these are the product
|
|
296
|
+
Use process.env.ANTHROPIC_API_KEY or ~/.brains/config.json for the API key
|
|
297
|
+
Default model should be claude-sonnet-4-20250514
|
|
298
|
+
Add .env.example with ANTHROPIC_API_KEY=your-key-here
|
|
299
|
+
|
|
300
|
+
What to Build Now
|
|
301
|
+
Build the complete, working CLI. Start with:
|
|
302
|
+
|
|
303
|
+
Project setup (package.json, bin entry, directory structure)
|
|
304
|
+
UI utilities (banner, colors, tables, spinners)
|
|
305
|
+
Brain registry (all 11 brains with full system prompts)
|
|
306
|
+
Config management (API key, model preferences)
|
|
307
|
+
Claude API wrapper (streaming, conversation management)
|
|
308
|
+
All 6 commands (explore, install, run, list, create, publish)
|
|
309
|
+
The config command for API key management
|
|
310
|
+
File parser for builder brain output
|
|
311
|
+
File reader for reviewer brains
|
|
312
|
+
REPL loop for role/domain brains
|
|
313
|
+
README.md
|
|
314
|
+
.env.example
|
|
315
|
+
|
|
316
|
+
Make it production-grade. Make it beautiful. Make it work.
|
package/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# 🧠 Brains.io
|
|
2
|
+
|
|
3
|
+
> **Install the world's greatest brains.** AI-powered dev agents you can browse, install, and run from your terminal.
|
|
4
|
+
|
|
5
|
+
Brains are intelligent, conversational AI agents that act as specialized team members. Unlike dumb templates or scaffolders, Brains **talk to you**, understand your context, and generate production-grade output tailored to your specific needs.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install globally
|
|
11
|
+
npm install -g brains-cli
|
|
12
|
+
|
|
13
|
+
# Explore available brains
|
|
14
|
+
brains explore
|
|
15
|
+
|
|
16
|
+
# Install a brain
|
|
17
|
+
brains install resume
|
|
18
|
+
|
|
19
|
+
# Run it
|
|
20
|
+
brains run resume
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## What are Brains?
|
|
24
|
+
|
|
25
|
+
A Brain is an AI agent with a specific personality, methodology, and expertise. Think of it as hiring a world-class specialist for any dev task — but they live in your terminal.
|
|
26
|
+
|
|
27
|
+
### 🔨 Builder Brains — Generate entire projects
|
|
28
|
+
|
|
29
|
+
| Brain | Description | Price |
|
|
30
|
+
|-------|-------------|-------|
|
|
31
|
+
| `resume` | Build a stunning developer resume/portfolio site | Free |
|
|
32
|
+
| `mvp` | Turn a product idea into a full-stack MVP | $9.99 |
|
|
33
|
+
| `landing` | Generate high-converting landing pages | Free |
|
|
34
|
+
|
|
35
|
+
### 👤 Role Brains — Act as team members
|
|
36
|
+
|
|
37
|
+
| Brain | Description | Price |
|
|
38
|
+
|-------|-------------|-------|
|
|
39
|
+
| `frontend` | Senior frontend engineer (React, Next.js, a11y) | $4.99 |
|
|
40
|
+
| `backend` | Backend architect (APIs, databases, infra) | $4.99 |
|
|
41
|
+
| `architect` | System design, diagrams, and technical decisions | $9.99 |
|
|
42
|
+
|
|
43
|
+
### 🔍 Reviewer Brains — Analyze & improve code
|
|
44
|
+
|
|
45
|
+
| Brain | Description | Price |
|
|
46
|
+
|-------|-------------|-------|
|
|
47
|
+
| `reviewer` | Deep, senior-level code review | Free |
|
|
48
|
+
| `security` | Find vulnerabilities and harden your app | $4.99 |
|
|
49
|
+
|
|
50
|
+
### ⚡ Domain Brains — Deep tech expertise
|
|
51
|
+
|
|
52
|
+
| Brain | Description | Price |
|
|
53
|
+
|-------|-------------|-------|
|
|
54
|
+
| `nextjs` | Next.js 14+ expert (App Router, RSC, etc.) | Free |
|
|
55
|
+
| `supabase` | Supabase expert (auth, RLS, edge functions) | $4.99 |
|
|
56
|
+
| `stripe` | Payments, subscriptions, webhooks | $4.99 |
|
|
57
|
+
|
|
58
|
+
## Commands
|
|
59
|
+
|
|
60
|
+
### `brains explore`
|
|
61
|
+
|
|
62
|
+
Browse and discover available Brains with an interactive terminal UI.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
brains explore # Browse all
|
|
66
|
+
brains explore -c builder # Filter by category
|
|
67
|
+
brains explore -s "nextjs" # Search
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### `brains install <brain>`
|
|
71
|
+
|
|
72
|
+
Download and configure a Brain.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
brains install resume # Install resume builder
|
|
76
|
+
brains install mvp # Install MVP generator
|
|
77
|
+
brains i reviewer # Short alias
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### `brains run <brain>`
|
|
81
|
+
|
|
82
|
+
Activate a Brain in conversational mode.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
brains run resume # Start resume builder
|
|
86
|
+
brains run reviewer # Review current project
|
|
87
|
+
brains run mvp --with stripe supabase # Stack multiple brains
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### `brains list`
|
|
91
|
+
|
|
92
|
+
Show all installed Brains.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
brains list # or: brains ls
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### `brains create [name]`
|
|
99
|
+
|
|
100
|
+
Author a new Brain from scratch.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
brains create my-brain
|
|
104
|
+
brains create --template builder # Start from a template
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### `brains publish`
|
|
108
|
+
|
|
109
|
+
Publish your Brain to the Brains.io registry.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
cd my-brain/
|
|
113
|
+
brains publish # Public
|
|
114
|
+
brains publish --private # Private (team only)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Brain Stacking
|
|
118
|
+
|
|
119
|
+
Combine multiple Brains for complex tasks:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Build an MVP with Stripe payments and Supabase backend
|
|
123
|
+
brains run mvp --with stripe supabase
|
|
124
|
+
|
|
125
|
+
# Review code with security focus
|
|
126
|
+
brains run reviewer --with security
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Creating Your Own Brain
|
|
130
|
+
|
|
131
|
+
Every Brain is defined by three files:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
my-brain/
|
|
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
|
+
```
|
|
159
|
+
|
|
160
|
+
## Architecture
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
~/.brains/ ← Global brains directory
|
|
164
|
+
├── installed.json ← Registry of installed brains
|
|
165
|
+
├── resume/
|
|
166
|
+
│ ├── brain.json ← Brain config + system prompt
|
|
167
|
+
│ └── BRAIN.md ← Human-readable docs
|
|
168
|
+
├── reviewer/
|
|
169
|
+
│ ├── brain.json
|
|
170
|
+
│ └── BRAIN.md
|
|
171
|
+
└── ...
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Pricing
|
|
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
|
|
185
|
+
|
|
186
|
+
Want to contribute a Brain to the registry? See [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
MIT © Brains.io
|
package/bin/brains.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const { program } = require('commander');
|
|
6
|
+
const { version } = require('../package.json');
|
|
7
|
+
const { explore } = require('../src/commands/explore');
|
|
8
|
+
const { install } = require('../src/commands/install');
|
|
9
|
+
const { run } = require('../src/commands/run');
|
|
10
|
+
const { list } = require('../src/commands/list');
|
|
11
|
+
const { create } = require('../src/commands/create');
|
|
12
|
+
const { publish } = require('../src/commands/publish');
|
|
13
|
+
const { showBanner } = require('../src/utils/ui');
|
|
14
|
+
|
|
15
|
+
showBanner();
|
|
16
|
+
|
|
17
|
+
program
|
|
18
|
+
.name('brains')
|
|
19
|
+
.description('🧠 Brains.io — AI-powered dev agents. Build, review, architect, and ship.')
|
|
20
|
+
.version(version, '-v, --version');
|
|
21
|
+
|
|
22
|
+
// ─── Explore: Browse the Brain registry ───
|
|
23
|
+
program
|
|
24
|
+
.command('explore')
|
|
25
|
+
.description('Browse and discover available Brains')
|
|
26
|
+
.option('-c, --category <category>', 'Filter by category (builder, role, reviewer, domain)')
|
|
27
|
+
.option('-s, --search <query>', 'Search brains by name or keyword')
|
|
28
|
+
.action(explore);
|
|
29
|
+
|
|
30
|
+
// ─── Install: Download a Brain ───
|
|
31
|
+
program
|
|
32
|
+
.command('install <brain>')
|
|
33
|
+
.alias('i')
|
|
34
|
+
.description('Install a Brain (e.g., brains install resume)')
|
|
35
|
+
.option('--global', 'Install globally for use in any project')
|
|
36
|
+
.action(install);
|
|
37
|
+
|
|
38
|
+
// ─── Run: Execute a Brain ───
|
|
39
|
+
program
|
|
40
|
+
.command('run <brain>')
|
|
41
|
+
.alias('r')
|
|
42
|
+
.description('Run an installed Brain in conversational mode')
|
|
43
|
+
.option('-w, --with <brains...>', 'Stack multiple brains together')
|
|
44
|
+
.option('-d, --dir <directory>', 'Target directory (default: current)')
|
|
45
|
+
.option('--no-interactive', 'Run without interactive prompts')
|
|
46
|
+
.action(run);
|
|
47
|
+
|
|
48
|
+
// ─── List: Show installed Brains ───
|
|
49
|
+
program
|
|
50
|
+
.command('list')
|
|
51
|
+
.alias('ls')
|
|
52
|
+
.description('List all installed Brains')
|
|
53
|
+
.action(list);
|
|
54
|
+
|
|
55
|
+
// ─── Create: Author a new Brain ───
|
|
56
|
+
program
|
|
57
|
+
.command('create [name]')
|
|
58
|
+
.description('Create a new Brain from scratch')
|
|
59
|
+
.option('-t, --template <template>', 'Start from a template (builder, role, reviewer, domain)')
|
|
60
|
+
.action(create);
|
|
61
|
+
|
|
62
|
+
// ─── Publish: Share your Brain ───
|
|
63
|
+
program
|
|
64
|
+
.command('publish')
|
|
65
|
+
.description('Publish your Brain to the Brains.io registry')
|
|
66
|
+
.option('--private', 'Publish as a private Brain')
|
|
67
|
+
.action(publish);
|
|
68
|
+
|
|
69
|
+
program.parse(process.argv);
|
|
70
|
+
|
|
71
|
+
// If no args, show help
|
|
72
|
+
if (!process.argv.slice(2).length) {
|
|
73
|
+
program.outputHelp();
|
|
74
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "brains-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "🧠 Brains.io — Install AI-powered dev agents. Build, review, architect, and ship with one command.",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"brains": "./bin/brains.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "node bin/brains.js",
|
|
11
|
+
"test": "node bin/brains.js --help"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"ai",
|
|
15
|
+
"cli",
|
|
16
|
+
"brains",
|
|
17
|
+
"agents",
|
|
18
|
+
"claude",
|
|
19
|
+
"developer-tools",
|
|
20
|
+
"scaffolding",
|
|
21
|
+
"code-review",
|
|
22
|
+
"ai-agents"
|
|
23
|
+
],
|
|
24
|
+
"author": "Brains.io",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"chalk": "^4.1.2",
|
|
28
|
+
"commander": "^11.1.0",
|
|
29
|
+
"inquirer": "^8.2.6",
|
|
30
|
+
"ora": "^5.4.1",
|
|
31
|
+
"boxen": "^5.1.2",
|
|
32
|
+
"cli-table3": "^0.6.3",
|
|
33
|
+
"figlet": "^1.7.0",
|
|
34
|
+
"gradient-string": "^2.0.2"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=16.0.0"
|
|
38
|
+
},
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/brains-io/brains-cli"
|
|
42
|
+
}
|
|
43
|
+
}
|