brain-tree-ai 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/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.js +246 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/logout.d.ts +1 -0
- package/dist/commands/logout.js +32 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +52 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/config.d.ts +27 -0
- package/dist/config.js +107 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import * as http from 'node:http';
|
|
2
|
+
import * as crypto from 'node:crypto';
|
|
3
|
+
import open from 'open';
|
|
4
|
+
import { readConfig, writeConfig, installMcpConfig, installCommands, } from '../config.js';
|
|
5
|
+
const DEFAULT_API_URL = 'https://brain-tree.ai';
|
|
6
|
+
const DEFAULT_MCP_URL = 'https://mcp.brain-tree.ai/sse';
|
|
7
|
+
// Brain commands that get installed to ~/.claude/commands/
|
|
8
|
+
const BRAIN_COMMANDS = [
|
|
9
|
+
{
|
|
10
|
+
name: 'init-vault.md',
|
|
11
|
+
content: `# Initialize Vault
|
|
12
|
+
|
|
13
|
+
Create a new brain vault for your project using BrainTree MCP tools.
|
|
14
|
+
|
|
15
|
+
## Steps
|
|
16
|
+
|
|
17
|
+
1. Ask the user what they're building (project name, description, tech stack)
|
|
18
|
+
2. Use MCP \`write_file\` to create VAULT-INDEX.md
|
|
19
|
+
3. Use MCP \`write_file\` to create department index files
|
|
20
|
+
4. Use MCP \`write_file\` to create Execution-Plan.md
|
|
21
|
+
5. Use MCP \`create_handoff\` to log the initialization session
|
|
22
|
+
6. Print summary of created vault structure
|
|
23
|
+
`,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'brain-resume.md',
|
|
27
|
+
content: `# Resume Work
|
|
28
|
+
|
|
29
|
+
Resume development from where you left off using BrainTree MCP tools.
|
|
30
|
+
|
|
31
|
+
## Steps
|
|
32
|
+
|
|
33
|
+
1. Use MCP \`get_latest_handoff\` to understand last session context
|
|
34
|
+
2. Use MCP \`list_unblocked_steps\` to find available work
|
|
35
|
+
3. Use MCP \`get_execution_plan\` for overall progress
|
|
36
|
+
4. Present status summary and ask what to work on
|
|
37
|
+
`,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'brain-wrap-up.md',
|
|
41
|
+
content: `# Wrap Up Session
|
|
42
|
+
|
|
43
|
+
End your work session and create a handoff using BrainTree MCP tools.
|
|
44
|
+
|
|
45
|
+
## Steps
|
|
46
|
+
|
|
47
|
+
1. Summarize what was done this session
|
|
48
|
+
2. Use MCP \`update_step\` to mark completed steps
|
|
49
|
+
3. Use MCP \`create_handoff\` with session summary
|
|
50
|
+
4. List recommended next steps
|
|
51
|
+
`,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'brain-status.md',
|
|
55
|
+
content: `# Project Status
|
|
56
|
+
|
|
57
|
+
Check overall project progress using BrainTree MCP tools.
|
|
58
|
+
|
|
59
|
+
## Steps
|
|
60
|
+
|
|
61
|
+
1. Use MCP \`get_execution_plan\` for phase progress
|
|
62
|
+
2. Use MCP \`list_departments\` for department overview
|
|
63
|
+
3. Use MCP \`list_handoffs\` for recent session history
|
|
64
|
+
4. Present dashboard with progress bars and stats
|
|
65
|
+
`,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'brain-plan.md',
|
|
69
|
+
content: `# Plan Step
|
|
70
|
+
|
|
71
|
+
Plan implementation for a specific execution plan step using BrainTree MCP tools.
|
|
72
|
+
|
|
73
|
+
## Steps
|
|
74
|
+
|
|
75
|
+
1. Use MCP \`get_execution_plan\` to get the step details
|
|
76
|
+
2. Use MCP \`read_file\` to read relevant vault files
|
|
77
|
+
3. Break down the step into concrete implementation tasks
|
|
78
|
+
4. Use MCP \`update_step\` to set status to in_progress
|
|
79
|
+
`,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'brain-sprint.md',
|
|
83
|
+
content: `# Sprint Planning
|
|
84
|
+
|
|
85
|
+
Plan the week's work using BrainTree MCP tools.
|
|
86
|
+
|
|
87
|
+
## Steps
|
|
88
|
+
|
|
89
|
+
1. Use MCP \`list_unblocked_steps\` to find available work
|
|
90
|
+
2. Use MCP \`get_execution_plan\` for context
|
|
91
|
+
3. Group steps by parallel opportunity
|
|
92
|
+
4. Assign priorities and estimate effort
|
|
93
|
+
`,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'brain-sync.md',
|
|
97
|
+
content: `# Vault Sync
|
|
98
|
+
|
|
99
|
+
Sync vault files with the latest project state using BrainTree MCP tools.
|
|
100
|
+
|
|
101
|
+
## Steps
|
|
102
|
+
|
|
103
|
+
1. Use MCP \`list_files\` to see current vault contents
|
|
104
|
+
2. Use MCP \`list_departments\` for department overview
|
|
105
|
+
3. Update any stale files using MCP \`write_file\`
|
|
106
|
+
4. Verify wikilinks are consistent using MCP \`get_graph\`
|
|
107
|
+
`,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'brain-feature.md',
|
|
111
|
+
content: `# New Feature
|
|
112
|
+
|
|
113
|
+
Plan and implement a new feature using BrainTree MCP tools.
|
|
114
|
+
|
|
115
|
+
## Steps
|
|
116
|
+
|
|
117
|
+
1. Use MCP \`read_file\` to read relevant existing files
|
|
118
|
+
2. Create a feature spec using MCP \`write_file\`
|
|
119
|
+
3. Update execution plan using MCP \`update_step\`
|
|
120
|
+
4. Implement the feature
|
|
121
|
+
5. Create handoff using MCP \`create_handoff\`
|
|
122
|
+
`,
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
function startLocalServer() {
|
|
126
|
+
return new Promise((resolve) => {
|
|
127
|
+
let authResolve;
|
|
128
|
+
const authPromise = new Promise((res) => {
|
|
129
|
+
authResolve = res;
|
|
130
|
+
});
|
|
131
|
+
const server = http.createServer((req, res) => {
|
|
132
|
+
const url = new URL(req.url ?? '/', `http://localhost`);
|
|
133
|
+
if (url.pathname === '/callback') {
|
|
134
|
+
const token = url.searchParams.get('token');
|
|
135
|
+
const email = url.searchParams.get('email') ?? undefined;
|
|
136
|
+
const userId = url.searchParams.get('user_id') ?? undefined;
|
|
137
|
+
if (token) {
|
|
138
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
139
|
+
res.end(`
|
|
140
|
+
<!DOCTYPE html>
|
|
141
|
+
<html>
|
|
142
|
+
<head><title>BrainTree CLI</title></head>
|
|
143
|
+
<body style="font-family: system-ui; display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; background: #FAFAF5;">
|
|
144
|
+
<div style="text-align: center; padding: 2rem;">
|
|
145
|
+
<h1 style="color: #2B2A25;">Authenticated!</h1>
|
|
146
|
+
<p style="color: #6B6A63;">You can close this tab and return to your terminal.</p>
|
|
147
|
+
</div>
|
|
148
|
+
</body>
|
|
149
|
+
</html>
|
|
150
|
+
`);
|
|
151
|
+
authResolve({ token, email, userId });
|
|
152
|
+
setTimeout(() => server.close(), 500);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
res.writeHead(400, { 'Content-Type': 'text/plain' });
|
|
156
|
+
res.end('Missing token parameter');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
res.writeHead(404);
|
|
161
|
+
res.end();
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
// Listen on random available port
|
|
165
|
+
server.listen(0, '127.0.0.1', () => {
|
|
166
|
+
const addr = server.address();
|
|
167
|
+
const port = typeof addr === 'object' && addr ? addr.port : 0;
|
|
168
|
+
resolve({ port, waitForAuth: () => authPromise });
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
export async function initCommand(options) {
|
|
173
|
+
const apiUrl = options.apiUrl ?? DEFAULT_API_URL;
|
|
174
|
+
const mcpUrl = options.mcpUrl ?? DEFAULT_MCP_URL;
|
|
175
|
+
console.log();
|
|
176
|
+
console.log(' BrainTree - AI-native project management');
|
|
177
|
+
console.log(' brain-tree.ai');
|
|
178
|
+
console.log();
|
|
179
|
+
// Check if already authenticated
|
|
180
|
+
const existing = readConfig();
|
|
181
|
+
if (existing?.token) {
|
|
182
|
+
console.log(' Already authenticated.');
|
|
183
|
+
console.log(` Token stored at ~/.braintree/config.json`);
|
|
184
|
+
console.log();
|
|
185
|
+
console.log(' Run "braintree logout" first to re-authenticate.');
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
// Start local server for OAuth callback
|
|
189
|
+
const state = crypto.randomBytes(16).toString('hex');
|
|
190
|
+
const { port, waitForAuth } = await startLocalServer();
|
|
191
|
+
const callbackUrl = `http://127.0.0.1:${port}/callback`;
|
|
192
|
+
// Build auth URL
|
|
193
|
+
const authUrl = new URL('/auth/cli', apiUrl);
|
|
194
|
+
authUrl.searchParams.set('callback', callbackUrl);
|
|
195
|
+
authUrl.searchParams.set('state', state);
|
|
196
|
+
console.log(' Opening browser for authentication...');
|
|
197
|
+
console.log();
|
|
198
|
+
try {
|
|
199
|
+
await open(authUrl.toString());
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
console.log(' Could not open browser automatically.');
|
|
203
|
+
console.log(' Please open this URL manually:');
|
|
204
|
+
console.log();
|
|
205
|
+
console.log(` ${authUrl.toString()}`);
|
|
206
|
+
}
|
|
207
|
+
console.log(' Waiting for authentication...');
|
|
208
|
+
// Wait for callback
|
|
209
|
+
const authData = await waitForAuth();
|
|
210
|
+
console.log();
|
|
211
|
+
console.log(' Authenticated successfully!');
|
|
212
|
+
if (authData.email) {
|
|
213
|
+
console.log(` Signed in as: ${authData.email}`);
|
|
214
|
+
}
|
|
215
|
+
// Save config
|
|
216
|
+
const config = {
|
|
217
|
+
token: authData.token,
|
|
218
|
+
email: authData.email,
|
|
219
|
+
userId: authData.userId,
|
|
220
|
+
apiUrl,
|
|
221
|
+
mcpUrl,
|
|
222
|
+
createdAt: new Date().toISOString(),
|
|
223
|
+
};
|
|
224
|
+
writeConfig(config);
|
|
225
|
+
console.log(' Config saved to ~/.braintree/config.json');
|
|
226
|
+
// Install MCP config into Claude Code settings
|
|
227
|
+
console.log();
|
|
228
|
+
console.log(' Configuring Claude Code MCP server...');
|
|
229
|
+
installMcpConfig(mcpUrl, authData.token);
|
|
230
|
+
console.log(' MCP config written to ~/.claude/settings.json');
|
|
231
|
+
// Install global commands
|
|
232
|
+
console.log();
|
|
233
|
+
console.log(' Installing brain commands...');
|
|
234
|
+
installCommands(BRAIN_COMMANDS);
|
|
235
|
+
console.log(` Installed ${BRAIN_COMMANDS.length} commands to ~/.claude/commands/`);
|
|
236
|
+
// Done
|
|
237
|
+
console.log();
|
|
238
|
+
console.log(' Setup complete!');
|
|
239
|
+
console.log();
|
|
240
|
+
console.log(' Next steps:');
|
|
241
|
+
console.log(' 1. Open Claude Code in your project directory');
|
|
242
|
+
console.log(' 2. Type /init-vault to create your brain');
|
|
243
|
+
console.log(' 3. Start building with AI-powered project management');
|
|
244
|
+
console.log();
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EACL,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,eAAe,GAEhB,MAAM,cAAc,CAAC;AAEtB,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAChD,MAAM,eAAe,GAAG,+BAA+B,CAAC;AAExD,2DAA2D;AAC3D,MAAM,cAAc,GAAG;IACrB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,OAAO,CAAC,GAAG,CAAC,eAAe,cAAc,CAAC,MAAM,kCAAkC,CAAC,CAAC;IAEpF,OAAO;IACP,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;IACxE,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function logoutCommand(): Promise<void>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { readConfig, deleteConfig, removeMcpConfig, removeCommands } from '../config.js';
|
|
2
|
+
const BRAIN_COMMAND_FILES = [
|
|
3
|
+
'init-vault.md',
|
|
4
|
+
'brain-resume.md',
|
|
5
|
+
'brain-wrap-up.md',
|
|
6
|
+
'brain-status.md',
|
|
7
|
+
'brain-plan.md',
|
|
8
|
+
'brain-sprint.md',
|
|
9
|
+
'brain-sync.md',
|
|
10
|
+
'brain-feature.md',
|
|
11
|
+
];
|
|
12
|
+
export async function logoutCommand() {
|
|
13
|
+
console.log();
|
|
14
|
+
const config = readConfig();
|
|
15
|
+
if (!config) {
|
|
16
|
+
console.log(' Not currently authenticated.');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// Remove MCP config from Claude Code
|
|
20
|
+
removeMcpConfig();
|
|
21
|
+
console.log(' Removed BrainTree MCP from ~/.claude/settings.json');
|
|
22
|
+
// Remove commands
|
|
23
|
+
removeCommands(BRAIN_COMMAND_FILES);
|
|
24
|
+
console.log(' Removed brain commands from ~/.claude/commands/');
|
|
25
|
+
// Remove config
|
|
26
|
+
deleteConfig();
|
|
27
|
+
console.log(' Removed ~/.braintree/config.json');
|
|
28
|
+
console.log();
|
|
29
|
+
console.log(' Logged out successfully.');
|
|
30
|
+
console.log();
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=logout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../src/commands/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEzF,MAAM,mBAAmB,GAAG;IAC1B,eAAe;IACf,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;IACjB,eAAe;IACf,iBAAiB;IACjB,eAAe;IACf,kBAAkB;CACnB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,OAAO,CAAC,GAAG,EAAE,CAAC;IAEd,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAC9C,OAAO;IACT,CAAC;IAED,qCAAqC;IACrC,eAAe,EAAE,CAAC;IAClB,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;IAEpE,kBAAkB;IAClB,cAAc,CAAC,mBAAmB,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IAEjE,gBAAgB;IAChB,YAAY,EAAE,CAAC;IACf,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IAElD,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function statusCommand(): Promise<void>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import { readConfig, getConfigPath, getCommandsDir } from '../config.js';
|
|
3
|
+
export async function statusCommand() {
|
|
4
|
+
console.log();
|
|
5
|
+
console.log(' BrainTree Status');
|
|
6
|
+
console.log(' ----------------');
|
|
7
|
+
const config = readConfig();
|
|
8
|
+
if (!config) {
|
|
9
|
+
console.log();
|
|
10
|
+
console.log(' Auth: Not authenticated');
|
|
11
|
+
console.log(' Config: No config file found');
|
|
12
|
+
console.log();
|
|
13
|
+
console.log(' Run "braintree init" to get started.');
|
|
14
|
+
console.log();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
console.log();
|
|
18
|
+
console.log(` Auth: Authenticated${config.email ? ` (${config.email})` : ''}`);
|
|
19
|
+
console.log(` Config: ${getConfigPath()}`);
|
|
20
|
+
console.log(` API: ${config.apiUrl}`);
|
|
21
|
+
console.log(` MCP: ${config.mcpUrl}`);
|
|
22
|
+
console.log(` Since: ${config.createdAt}`);
|
|
23
|
+
// Check if commands are installed
|
|
24
|
+
const commandsDir = getCommandsDir();
|
|
25
|
+
let commandCount = 0;
|
|
26
|
+
try {
|
|
27
|
+
if (fs.existsSync(commandsDir)) {
|
|
28
|
+
const files = fs.readdirSync(commandsDir).filter(f => f.startsWith('brain-') || f === 'init-vault.md');
|
|
29
|
+
commandCount = files.length;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// ignore
|
|
34
|
+
}
|
|
35
|
+
console.log(` Commands: ${commandCount} installed`);
|
|
36
|
+
// Verify token by pinging API
|
|
37
|
+
console.log();
|
|
38
|
+
try {
|
|
39
|
+
const res = await fetch(`${config.mcpUrl.replace('/sse', '/health')}`);
|
|
40
|
+
if (res.ok) {
|
|
41
|
+
console.log(' MCP server: reachable');
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
console.log(' MCP server: unreachable (HTTP ' + res.status + ')');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
console.log(' MCP server: unreachable');
|
|
49
|
+
}
|
|
50
|
+
console.log();
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEzE,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAElC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAE5B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAChD,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,4BAA4B,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACpF,OAAO,CAAC,GAAG,CAAC,eAAe,aAAa,EAAE,EAAE,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,MAAM,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
|
+
token: string;
|
|
3
|
+
email?: string;
|
|
4
|
+
userId?: string;
|
|
5
|
+
apiUrl: string;
|
|
6
|
+
mcpUrl: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function getConfigPath(): string;
|
|
10
|
+
export declare function readConfig(): BraintreeConfig | null;
|
|
11
|
+
export declare function writeConfig(config: BraintreeConfig): void;
|
|
12
|
+
export declare function deleteConfig(): boolean;
|
|
13
|
+
interface ClaudeSettings {
|
|
14
|
+
mcpServers?: Record<string, unknown>;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
export declare function readClaudeSettings(): ClaudeSettings;
|
|
18
|
+
export declare function writeClaudeSettings(settings: ClaudeSettings): void;
|
|
19
|
+
export declare function installMcpConfig(mcpUrl: string, token: string): void;
|
|
20
|
+
export declare function removeMcpConfig(): void;
|
|
21
|
+
export declare function getCommandsDir(): string;
|
|
22
|
+
export declare function installCommands(commands: Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
content: string;
|
|
25
|
+
}>): void;
|
|
26
|
+
export declare function removeCommands(commandNames: string[]): void;
|
|
27
|
+
export {};
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import * as os from 'node:os';
|
|
4
|
+
const CONFIG_DIR = path.join(os.homedir(), '.braintree');
|
|
5
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
6
|
+
export function getConfigPath() {
|
|
7
|
+
return CONFIG_FILE;
|
|
8
|
+
}
|
|
9
|
+
export function readConfig() {
|
|
10
|
+
try {
|
|
11
|
+
if (!fs.existsSync(CONFIG_FILE))
|
|
12
|
+
return null;
|
|
13
|
+
const raw = fs.readFileSync(CONFIG_FILE, 'utf8');
|
|
14
|
+
return JSON.parse(raw);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function writeConfig(config) {
|
|
21
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
22
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2) + '\n', 'utf8');
|
|
23
|
+
fs.chmodSync(CONFIG_FILE, 0o600); // restrict permissions
|
|
24
|
+
}
|
|
25
|
+
export function deleteConfig() {
|
|
26
|
+
try {
|
|
27
|
+
if (fs.existsSync(CONFIG_FILE)) {
|
|
28
|
+
fs.unlinkSync(CONFIG_FILE);
|
|
29
|
+
}
|
|
30
|
+
// Clean up empty dir
|
|
31
|
+
if (fs.existsSync(CONFIG_DIR)) {
|
|
32
|
+
const remaining = fs.readdirSync(CONFIG_DIR);
|
|
33
|
+
if (remaining.length === 0) {
|
|
34
|
+
fs.rmdirSync(CONFIG_DIR);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Claude Code settings management
|
|
44
|
+
const CLAUDE_DIR = path.join(os.homedir(), '.claude');
|
|
45
|
+
const CLAUDE_SETTINGS = path.join(CLAUDE_DIR, 'settings.json');
|
|
46
|
+
export function readClaudeSettings() {
|
|
47
|
+
try {
|
|
48
|
+
if (!fs.existsSync(CLAUDE_SETTINGS))
|
|
49
|
+
return {};
|
|
50
|
+
const raw = fs.readFileSync(CLAUDE_SETTINGS, 'utf8');
|
|
51
|
+
return JSON.parse(raw);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export function writeClaudeSettings(settings) {
|
|
58
|
+
fs.mkdirSync(CLAUDE_DIR, { recursive: true });
|
|
59
|
+
fs.writeFileSync(CLAUDE_SETTINGS, JSON.stringify(settings, null, 2) + '\n', 'utf8');
|
|
60
|
+
}
|
|
61
|
+
export function installMcpConfig(mcpUrl, token) {
|
|
62
|
+
const settings = readClaudeSettings();
|
|
63
|
+
if (!settings.mcpServers) {
|
|
64
|
+
settings.mcpServers = {};
|
|
65
|
+
}
|
|
66
|
+
settings.mcpServers['braintree'] = {
|
|
67
|
+
type: 'sse',
|
|
68
|
+
url: mcpUrl,
|
|
69
|
+
headers: {
|
|
70
|
+
Authorization: `Bearer ${token}`,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
writeClaudeSettings(settings);
|
|
74
|
+
}
|
|
75
|
+
export function removeMcpConfig() {
|
|
76
|
+
const settings = readClaudeSettings();
|
|
77
|
+
if (settings.mcpServers && typeof settings.mcpServers === 'object') {
|
|
78
|
+
delete settings.mcpServers['braintree'];
|
|
79
|
+
}
|
|
80
|
+
writeClaudeSettings(settings);
|
|
81
|
+
}
|
|
82
|
+
// Global commands management
|
|
83
|
+
const CLAUDE_COMMANDS_DIR = path.join(CLAUDE_DIR, 'commands');
|
|
84
|
+
export function getCommandsDir() {
|
|
85
|
+
return CLAUDE_COMMANDS_DIR;
|
|
86
|
+
}
|
|
87
|
+
export function installCommands(commands) {
|
|
88
|
+
fs.mkdirSync(CLAUDE_COMMANDS_DIR, { recursive: true });
|
|
89
|
+
for (const cmd of commands) {
|
|
90
|
+
const filePath = path.join(CLAUDE_COMMANDS_DIR, cmd.name);
|
|
91
|
+
fs.writeFileSync(filePath, cmd.content, 'utf8');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export function removeCommands(commandNames) {
|
|
95
|
+
for (const name of commandNames) {
|
|
96
|
+
const filePath = path.join(CLAUDE_COMMANDS_DIR, name);
|
|
97
|
+
try {
|
|
98
|
+
if (fs.existsSync(filePath)) {
|
|
99
|
+
fs.unlinkSync(filePath);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// ignore
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0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AM,UAAU,cAAc,CAAC,YAAsB;IACnD,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;QACtD,IAAI,CAAC;YACH,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC5B,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { initCommand } from './commands/init.js';
|
|
4
|
+
import { logoutCommand } from './commands/logout.js';
|
|
5
|
+
import { statusCommand } from './commands/status.js';
|
|
6
|
+
const program = new Command();
|
|
7
|
+
program
|
|
8
|
+
.name('braintree')
|
|
9
|
+
.description('BrainTree CLI - AI-native project management')
|
|
10
|
+
.version('0.1.0');
|
|
11
|
+
program
|
|
12
|
+
.command('init')
|
|
13
|
+
.description('Authenticate and set up BrainTree for Claude Code')
|
|
14
|
+
.option('--api-url <url>', 'API URL override')
|
|
15
|
+
.option('--mcp-url <url>', 'MCP server URL override')
|
|
16
|
+
.action(async (options) => {
|
|
17
|
+
try {
|
|
18
|
+
await initCommand({
|
|
19
|
+
apiUrl: options.apiUrl,
|
|
20
|
+
mcpUrl: options.mcpUrl,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
console.error('Init failed:', err instanceof Error ? err.message : err);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
program
|
|
29
|
+
.command('logout')
|
|
30
|
+
.description('Remove BrainTree auth, MCP config, and commands')
|
|
31
|
+
.action(async () => {
|
|
32
|
+
try {
|
|
33
|
+
await logoutCommand();
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
console.error('Logout failed:', err instanceof Error ? err.message : err);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
program
|
|
41
|
+
.command('status')
|
|
42
|
+
.description('Check BrainTree authentication and configuration status')
|
|
43
|
+
.action(async () => {
|
|
44
|
+
try {
|
|
45
|
+
await statusCommand();
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
console.error('Status check failed:', err instanceof Error ? err.message : err);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
program.parse();
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,WAAW,CAAC;KACjB,WAAW,CAAC,8CAA8C,CAAC;KAC3D,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,mDAAmD,CAAC;KAChE,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;KAC7C,MAAM,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;KACpD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,IAAI,CAAC;QACH,MAAM,WAAW,CAAC;YAChB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAA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|
2
|
+
"name": "brain-tree-ai",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI to set up BrainTree (brain-tree.ai) for Claude Code — AI-native project management",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"brain-tree-ai": "dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"dev": "tsc --watch",
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
18
|
+
},
|
|
19
|
+
"keywords": ["braintree", "brain-tree", "ai", "project-management", "brain", "cli", "claude", "mcp", "obsidian"],
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/brain-tree-dev/brain-tree"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://brain-tree.ai",
|
|
26
|
+
"author": "BrainTree <dev@brain-tree.ai>",
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18.0.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"commander": "^13.0.0",
|
|
32
|
+
"open": "^10.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^22.0.0",
|
|
36
|
+
"typescript": "^5.7.0"
|
|
37
|
+
}
|
|
38
|
+
}
|