@brainmcp/brainmcp 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -1,48 +1,85 @@
1
1
  # `@brainmcp/brainmcp`
2
2
 
3
- Safely configure [brain / brainmcp](https://www.brainmcp.ai) project guidance and MCP connections for agent clients.
3
+ Safely configure [brain / brainmcp](https://www.brainmcp.ai) guidance and MCP connections for agent clients.
4
4
 
5
- The binary name is `brainmcp`. Prefer `npx @brainmcp/brainmcp` so you always get the published package.
5
+ Requires Node.js 22 or newer. The recommended command runs the latest published CLI directly, so
6
+ there is no permanent global package to maintain.
6
7
 
7
8
  Full client walkthroughs: [Quickstart](https://www.brainmcp.ai/docs/quickstart) · [Claude Code](https://www.brainmcp.ai/docs/connect-claude-code) · [Cursor](https://www.brainmcp.ai/docs/connect-cursor) · [Codex](https://www.brainmcp.ai/docs/connect-codex) · [VS Code](https://www.brainmcp.ai/docs/connect-vscode)
8
9
 
9
- ## Quickstart
10
+ ## Quickstart — all projects, supported agents
10
11
 
11
- From your project root:
12
+ Preview one combined user-scope change for Claude Code, Cursor, Codex, and VS Code, then confirm once:
12
13
 
13
14
  ```bash
14
- npx @brainmcp/brainmcp init --client claude-code --yes
15
+ npx --yes @brainmcp/brainmcp@latest init --all --scope user
15
16
  ```
16
17
 
17
- Pin a workspace when this repo should default to one:
18
+ The `--yes` before the package name belongs to `npx`: it suppresses npm's package-download prompt.
19
+ It does **not** skip BrainMCP's file preview or confirmation. To automate both prompts only after
20
+ reviewing the targets, add a second `--yes` at the very end.
21
+
22
+ Only pin a workspace at user scope when that same workspace should be the default in **every**
23
+ project. Otherwise omit it and use the OAuth authorization default or a project-scope override:
24
+
25
+ ```bash
26
+ npx --yes @brainmcp/brainmcp@latest init --all --workspace <workspace-id> --scope user
27
+ ```
28
+
29
+ After setup:
30
+
31
+ 1. Restart each configured client you use.
32
+ 2. Start a session, open its `brain` connection, and complete browser OAuth. Select the workspaces
33
+ that client may reach.
34
+ 3. Ask: `use brain to give me an overview of the workspace`.
35
+ 4. Confirm the [dashboard Connect view](https://dash.brainmcp.ai/connect) changes from
36
+ *waiting for first call* to **Agent seen ... ago**.
37
+
38
+ No API keys or OAuth secrets are written to config files.
39
+
40
+ Check one client's file placement, managed guidance, endpoint, and public OAuth discovery:
18
41
 
19
42
  ```bash
20
- npx @brainmcp/brainmcp init --client cursor --workspace <workspace-id> --yes
43
+ npx --yes @brainmcp/brainmcp@latest doctor --client cursor --scope user
21
44
  ```
22
45
 
23
- Then complete OAuth in the client browser flow. No API keys or OAuth secrets are written to config files.
46
+ `--all` intentionally excludes `generic`: an unknown client has no universal global config path. Prefer a maintained plugin when Claude Code or Cursor offers one; use the CLI when you want reviewable filesystem configuration or no plugin is available.
24
47
 
25
- Verify the install:
48
+ ## Project-local alternative
49
+
50
+ For a single repository only, omit `--scope user` (or pass `--scope project`) and run from that repo root:
51
+
52
+ ```bash
53
+ npx --yes @brainmcp/brainmcp@latest init --client claude-code
54
+ ```
55
+
56
+ ## Optional persistent CLI
57
+
58
+ If you prefer a `brainmcp` binary on your `PATH` for repeated administration, install it globally:
26
59
 
27
60
  ```bash
28
- npx @brainmcp/brainmcp doctor --client cursor
61
+ npm install --global @brainmcp/brainmcp@latest
62
+ brainmcp init --all --scope user
29
63
  ```
30
64
 
31
- Ask the agent: `use brain to give me an overview of the workspace`. In the [dashboard Connect view](https://dash.brainmcp.ai/connect), status should flip from *waiting for first call* to **Agent seen … ago**.
65
+ The setup result is the same. The `npx` path avoids global package permissions and version drift;
66
+ the global path makes later `doctor`, `print`, and `remove` commands shorter.
32
67
 
33
68
  ## Commands
34
69
 
35
70
  | Command | What it does |
36
71
  | --- | --- |
37
72
  | `init` | Preview and write MCP config + instruction file for a client |
73
+ | `init --all` | Preview one combined change for Claude Code, Cursor, Codex, and VS Code |
38
74
  | `doctor` | Check placement, endpoint, managed markers, and OAuth discovery |
39
75
  | `print` | Print the canonical config and guidance without writing |
40
76
  | `remove` | Preview and remove BrainMCP-managed blocks |
41
77
 
42
- Every mutation shows a diff and asks for confirmation unless you pass `--yes`.
78
+ Every mutation shows a diff and asks for confirmation unless you append a trailing CLI `--yes`.
43
79
 
44
80
  ```text
45
81
  brainmcp init [--client <client>] [--workspace <id>] [--scope project|user] [--yes]
82
+ brainmcp init --all [--workspace <id>] [--scope project|user] [--yes]
46
83
  brainmcp doctor [--client <client>] [--workspace <id>] [--scope project|user]
47
84
  brainmcp print [--client <client>] [--workspace <id>] [--scope project|user]
48
85
  brainmcp remove [--client <client>] [--scope project|user] [--yes]
@@ -50,52 +87,49 @@ brainmcp remove [--client <client>] [--scope project|user] [--yes]
50
87
 
51
88
  ### Clients
52
89
 
53
- | `--client` | MCP config | Guidance file |
90
+ | `--client` | User-scope paths (`--scope user`) | Project-scope paths (default) |
54
91
  | --- | --- | --- |
55
- | `claude-code` | `.mcp.json` | `CLAUDE.md` |
56
- | `cursor` | `.cursor/mcp.json` | `.cursor/rules/brainmcp-workspace.mdc` |
57
- | `codex` | `.codex/config.toml` | `AGENTS.md` |
58
- | `vscode` | `.vscode/mcp.json` | `AGENTS.md` |
59
- | `generic` | `.mcp.json` | `AGENTS.md` |
92
+ | `claude-code` | `~/.claude.json`, `~/.claude/CLAUDE.md` | `.mcp.json`, `CLAUDE.md` |
93
+ | `cursor` | `~/.cursor/mcp.json`, `~/.cursor/rules/brainmcp-workspace.mdc` | `.cursor/mcp.json`, `.cursor/rules/brainmcp-workspace.mdc` |
94
+ | `codex` | `$CODEX_HOME/config.toml`, `$CODEX_HOME/AGENTS.md` (default `~/.codex`) | `.codex/config.toml`, `AGENTS.md` |
95
+ | `vscode` | Default VS Code profile `mcp.json`; `~/.copilot/instructions/brainmcp.instructions.md` | `.vscode/mcp.json`, `AGENTS.md` |
96
+ | `generic` | Conventional `~/.mcp.json`, `~/AGENTS.md` (only when your host recognizes them) | `.mcp.json`, `AGENTS.md` |
60
97
 
61
- If you omit `--client`, the CLI detects a single obvious client from the project. Multiple matches require an explicit `--client`.
98
+ If you omit `--client`, the CLI detects a single obvious client from the project. Multiple matches require an explicit `--client`. VS Code user scope targets the platform’s default local profile; named profiles, Insiders, remote SSH, WSL, and dev containers need their own setup in that environment.
62
99
 
63
100
  ### Scope
64
101
 
65
- - `project` (default) — write under the current repository
66
- - `user` — write under your home directory (explicit opt-in)
102
+ - `user` — write to the selected host’s supported per-user locations so brain is available across that host’s projects
103
+ - `project` (default) — write only under the current repository
67
104
 
68
105
  ### Workspace
69
106
 
70
- `--workspace <id>` embeds the workspace id in the managed guidance block so agents orient to that workspace. Without it, `brain_workspace_overview` may use the authorization’s default workspace; agents should call `brain_workspaces_list` when the target is unclear.
107
+ `--workspace <id>` embeds the workspace id in the managed guidance block so agents orient to that workspace. Prefer this at project scope. At user scope it affects every project for that host, so use it only for a genuinely global default. Without it, `brain_workspace_overview` may use the authorization’s default workspace; agents should call `brain_workspaces_list` when the target is unclear.
71
108
 
72
109
  ## Examples
73
110
 
74
111
  ```bash
75
- # Claude Code — project-local
76
- npx @brainmcp/brainmcp init --client claude-code --yes
112
+ # Cursor for all projects
113
+ npx --yes @brainmcp/brainmcp@latest init --client cursor --scope user
77
114
 
78
- # Cursor — with workspace pin
79
- npx @brainmcp/brainmcp init --client cursor --workspace ws_abc --yes
115
+ # Codex user-scope with workspace pin
116
+ npx --yes @brainmcp/brainmcp@latest init --client codex --workspace ws_abc --scope user
80
117
 
81
- # Codex
82
- npx @brainmcp/brainmcp init --client codex --yes
118
+ # Single-repo only
119
+ npx --yes @brainmcp/brainmcp@latest init --client vscode
83
120
 
84
- # Preview only
85
- npx @brainmcp/brainmcp print --client vscode
86
-
87
- # Remove managed config
88
- npx @brainmcp/brainmcp remove --client cursor --yes
121
+ # Preview / remove
122
+ npx --yes @brainmcp/brainmcp@latest print --client vscode --scope user
123
+ npx --yes @brainmcp/brainmcp@latest remove --client cursor --scope user
89
124
  ```
90
125
 
91
126
  ## What gets written
92
127
 
93
128
  - Canonical MCP endpoint: `https://mcp.brainmcp.ai/mcp` (server name `brain`)
94
129
  - Managed instruction markers (`brainmcp:managed:start` / `end`) so later `init` / `remove` can update safely
130
+ - Backups for changed files; existing modes and symlinked dotfiles are preserved, and stale previews are refused
95
131
  - No embedded OAuth secrets — tokens come from the browser consent flow
96
132
 
97
- Prefer a maintained plugin when your client offers one (Claude Code / Cursor). Use this CLI for project-local, reviewable setup or clients without a plugin.
98
-
99
133
  ## Requirements
100
134
 
101
135
  - Node.js 22+
@@ -57,7 +57,7 @@ export const MCP_CLIENT_PROFILES = {
57
57
  supportsProjectInstructions: true,
58
58
  supportsPlugins: false,
59
59
  supportsHooks: false,
60
- notes: 'URL-only setup requires Dynamic Client Registration (or Client ID Metadata Documents). Prefer the static generic-mcp client id when the client supports it.',
60
+ notes: 'Prefer the static generic-mcp client id. BrainCP temporarily supports deprecated Dynamic Client Registration for URL-only clients; Client ID Metadata Documents are not advertised yet.',
61
61
  },
62
62
  };
63
63
  export const CANONICAL_WORKFLOW_STEPS = [
@@ -150,6 +150,16 @@ export function renderClaudeMdBlock(options) {
150
150
  export function renderAgentsMdBlock(options) {
151
151
  return buildProjectInstructionBlock(options);
152
152
  }
153
+ export const VSCODE_USER_INSTRUCTIONS_FRONTMATTER = [
154
+ '---',
155
+ 'name: BrainMCP',
156
+ 'description: Use brain as persistent, reviewable memory across projects.',
157
+ 'applyTo: "**"',
158
+ '---',
159
+ ].join('\n');
160
+ export function renderVscodeUserInstructions(options) {
161
+ return `${VSCODE_USER_INSTRUCTIONS_FRONTMATTER}\n\n${buildProjectInstructionBlock(options)}`;
162
+ }
153
163
  export function renderCursorMdc(options) {
154
164
  const alwaysApply = options?.alwaysApply ?? true;
155
165
  return [
@@ -181,9 +191,10 @@ export function buildCursorMcpJson(options) {
181
191
  });
182
192
  }
183
193
  /**
184
- * Claude Code `.mcp.json` server entry. URL-only: Claude Code registers itself
185
- * via DCR with its exact loopback callback. (A pre-configured client id would
186
- * need the `oauth: { clientId }` shape plus a fixed callback port.)
194
+ * Claude Code `.mcp.json` server entry. URL-only: Claude Code currently uses
195
+ * BrainCP's deprecated DCR compatibility path with its exact loopback callback.
196
+ * (A pre-configured client id needs the `oauth: { clientId }` shape plus a
197
+ * fixed callback port.)
187
198
  */
188
199
  export function buildClaudeCodeMcpJson() {
189
200
  return JSON.stringify({
@@ -194,7 +205,8 @@ export function buildClaudeCodeMcpJson() {
194
205
  }
195
206
  /**
196
207
  * VS Code project `.vscode/mcp.json` — VS Code uses a top-level `servers` map
197
- * (not `mcpServers`). URL-only; the client completes OAuth via DCR.
208
+ * (not `mcpServers`). URL-only clients currently depend on deprecated DCR
209
+ * compatibility because BrainCP does not advertise CIMD yet.
198
210
  */
199
211
  export function buildVscodeMcpJson() {
200
212
  return JSON.stringify({
@@ -215,8 +227,9 @@ export function buildCodexConfigToml() {
215
227
  * Canonical Claude Code registration. URL-only on purpose: Claude Code's OAuth
216
228
  * callback is `http://localhost:<random-port>/callback`, and the authorization
217
229
  * server gives registered `localhost` redirects no port flexibility (RFC 8252
218
- * §8.3), so Dynamic Client Registration — which registers the exact callback —
219
- * is the reliable path. Use the static fallback only when DCR is unavailable.
230
+ * §8.3), so the current URL-only command depends on deprecated DCR
231
+ * compatibility to register the exact callback. Prefer the static fixed-port
232
+ * fallback where the host supports an explicit client id.
220
233
  */
221
234
  export function buildClaudeCodeMcpAddCommand() {
222
235
  return `claude mcp add --transport http ${BRAIN_MCP_SERVER_NAME} ${BRAIN_MCP_ENDPOINT}`;
@@ -229,25 +242,75 @@ export const CLAUDE_CODE_STATIC_FALLBACK_CALLBACK_PORT = 8765;
229
242
  export function buildClaudeCodeStaticFallbackCommand() {
230
243
  return `claude mcp add --transport http ${BRAIN_MCP_SERVER_NAME} ${BRAIN_MCP_ENDPOINT} --client-id ${MCP_OAUTH_CLIENT_IDS.claudeCode} --callback-port ${CLAUDE_CODE_STATIC_FALLBACK_CALLBACK_PORT}`;
231
244
  }
232
- /** npm package name for the publishable setup CLI (`npx @brainmcp/brainmcp`). */
245
+ /** npm package name for the publishable setup CLI. */
233
246
  export const BRAINMCP_CLI_PACKAGE = '@brainmcp/brainmcp';
247
+ /** Explicit npm dist-tag used by copy/paste setup commands. */
248
+ export const BRAINMCP_CLI_PACKAGE_SPEC = `${BRAINMCP_CLI_PACKAGE}@latest`;
249
+ /** Clients the CLI can configure. Run once per client you use. */
250
+ export const BRAINMCP_CLI_CLIENTS = [
251
+ 'claude-code',
252
+ 'cursor',
253
+ 'codex',
254
+ 'vscode',
255
+ 'generic',
256
+ ];
257
+ /** Named agent hosts configured by `brainmcp init --all`. */
258
+ export const BRAINMCP_GLOBAL_CLIENTS = [
259
+ 'claude-code',
260
+ 'cursor',
261
+ 'codex',
262
+ 'vscode',
263
+ ];
264
+ function brainmcpCliBinary(invoke = 'npx') {
265
+ return invoke === 'global'
266
+ ? 'brainmcp'
267
+ : `npx --yes ${BRAINMCP_CLI_PACKAGE_SPEC}`;
268
+ }
269
+ /** Install the CLI once on your PATH (`brainmcp` available in every shell). */
270
+ export function buildBrainmcpGlobalInstallCommand() {
271
+ return `npm install -g ${BRAINMCP_CLI_PACKAGE_SPEC}`;
272
+ }
234
273
  export function buildBrainmcpInitCommand(options) {
235
- const parts = [`npx ${BRAINMCP_CLI_PACKAGE} init`];
236
- if (options?.client)
274
+ if (options?.all && options.client) {
275
+ throw new Error('buildBrainmcpInitCommand cannot combine client and all.');
276
+ }
277
+ const parts = [`${brainmcpCliBinary(options?.invoke)} init`];
278
+ if (options?.all)
279
+ parts.push('--all');
280
+ else if (options?.client)
237
281
  parts.push(`--client ${options.client}`);
238
282
  if (options?.workspaceId)
239
283
  parts.push(`--workspace ${options.workspaceId}`);
240
- parts.push('--yes');
284
+ if (options?.scope === 'user')
285
+ parts.push('--scope user');
286
+ if (options?.yes === true)
287
+ parts.push('--yes');
241
288
  return parts.join(' ');
242
289
  }
243
290
  export function buildBrainmcpDoctorCommand(options) {
244
- const parts = [`npx ${BRAINMCP_CLI_PACKAGE} doctor`];
291
+ const parts = [`${brainmcpCliBinary(options?.invoke)} doctor`];
245
292
  if (options?.workspaceId)
246
293
  parts.push(`--workspace ${options.workspaceId}`);
247
294
  if (options?.client)
248
295
  parts.push(`--client ${options.client}`);
296
+ if (options?.scope === 'user')
297
+ parts.push('--scope user');
249
298
  return parts.join(' ');
250
299
  }
300
+ /**
301
+ * One-shot setup: run the latest CLI without a permanent global install, then
302
+ * preview one combined user-scope change for every supported named agent.
303
+ * `npx --yes` skips npm's package-download prompt; the CLI still asks before
304
+ * writing because the generated command intentionally omits its trailing `--yes`.
305
+ */
306
+ export function buildBrainmcpUserScopeSetupScript(options) {
307
+ return buildBrainmcpInitCommand({
308
+ all: true,
309
+ workspaceId: options?.workspaceId,
310
+ scope: 'user',
311
+ yes: false,
312
+ });
313
+ }
251
314
  export function buildServerInstructions() {
252
315
  return [
253
316
  'brain is this project\'s shared, persistent, reviewable memory MCP. It is also called brainmcp; every tool is prefixed brain_. When the user says "use brain", "check brain", "save this to brain", or "use brainmcp", they mean this server.',
@@ -5,6 +5,12 @@ export type CommandOptions = {
5
5
  workspace?: string;
6
6
  scope: Scope;
7
7
  yes: boolean;
8
+ /** Test/embedding override. The CLI defaults to `os.homedir()`. */
9
+ home?: string;
10
+ /** Test/embedding override. The CLI defaults to `process.env`. */
11
+ env?: NodeJS.ProcessEnv;
12
+ /** Test/embedding override. The CLI defaults to `process.platform`. */
13
+ platform?: NodeJS.Platform;
8
14
  fetch?: typeof fetch;
9
15
  confirm?: (message: string) => Promise<boolean>;
10
16
  output: (message: string) => void;
@@ -12,6 +18,7 @@ export type CommandOptions = {
12
18
  export declare function detectClients(root: string): Promise<ClientId[]>;
13
19
  export declare function chooseClient(options: CommandOptions): Promise<ClientId>;
14
20
  export declare function init(options: CommandOptions): Promise<void>;
21
+ export declare function initAll(options: CommandOptions): Promise<void>;
15
22
  export declare function remove(options: CommandOptions): Promise<void>;
16
23
  export declare function printConfig(options: CommandOptions): Promise<void>;
17
24
  export declare function doctor(options: CommandOptions): Promise<void>;
@@ -1,7 +1,7 @@
1
1
  import { homedir } from 'node:os';
2
2
  import { join, resolve } from 'node:path';
3
- import { BRAIN_MCP_ENDPOINT } from '../agent-config.js';
4
- import { clientLabel, renderGuidance, resolveWorkspace, targetFor } from '../lib/config.js';
3
+ import { BRAIN_DOCS_URL, BRAIN_MCP_ENDPOINT, BRAINMCP_GLOBAL_CLIENTS, buildBrainmcpDoctorCommand, } from '../agent-config.js';
4
+ import { clientLabel, guidancePreamble, renderGuidance, resolveWorkspace, targetFor, } from '../lib/config.js';
5
5
  import { applyChanges, exists, readText, renderDiff, toAbsolute } from '../lib/files.js';
6
6
  import { parseJsonc, removeJsonServer, removeMarkdownBlock, removeTomlBlock, upsertJsonServer, upsertMarkdownBlock, upsertTomlBlock } from '../lib/managed.js';
7
7
  export async function detectClients(root) {
@@ -31,13 +31,37 @@ export async function chooseClient(options) {
31
31
  export async function init(options) {
32
32
  const client = await chooseClient(options);
33
33
  const workspace = resolveWorkspace(options.workspace);
34
- const changes = await plannedChanges(options.root, client, options.scope, workspace, 'init');
34
+ const changes = await plannedChanges(options, client, workspace, 'init');
35
35
  await previewAndApply(changes, options);
36
- options.output(`BrainMCP configured for ${clientLabel(client)}. OAuth is discovered at first client connection; no OAuth secret was written.`);
36
+ options.output(`BrainMCP configured for ${clientLabel(client)}.`);
37
+ options.output(renderSetupNextSteps([client], options.scope, workspace));
38
+ }
39
+ export async function initAll(options) {
40
+ const workspace = resolveWorkspace(options.workspace);
41
+ const groups = await Promise.all(BRAINMCP_GLOBAL_CLIENTS.map((client) => plannedChanges(options, client, workspace, 'init')));
42
+ await previewAndApply(mergeFileChanges(groups.flat()), options);
43
+ options.output(`BrainMCP configured for ${BRAINMCP_GLOBAL_CLIENTS.map(clientLabel).join(', ')}.`);
44
+ options.output(renderSetupNextSteps(BRAINMCP_GLOBAL_CLIENTS, options.scope, workspace));
45
+ }
46
+ function renderSetupNextSteps(clients, scope, workspace) {
47
+ const clientList = clients.map(clientLabel).join(', ');
48
+ const doctorCommands = clients.map((client) => ` ${buildBrainmcpDoctorCommand({ client, scope, workspaceId: workspace })}`);
49
+ return [
50
+ '',
51
+ 'Next steps:',
52
+ `1. Restart or reopen ${clientList}.`,
53
+ '2. Start a session, open the brain connection, and complete browser OAuth. Review the scopes and select the workspaces this client may reach.',
54
+ '3. Ask: "Use brain to give me an overview of this workspace."',
55
+ '4. Check local configuration and public service discovery if needed:',
56
+ ...doctorCommands,
57
+ `Guide: ${BRAIN_DOCS_URL}/quickstart`,
58
+ '',
59
+ 'No API keys or OAuth secrets were written to configuration files.',
60
+ ].join('\n');
37
61
  }
38
62
  export async function remove(options) {
39
63
  const client = await chooseClient(options);
40
- const changes = await plannedChanges(options.root, client, options.scope, undefined, 'remove');
64
+ const changes = await plannedChanges(options, client, undefined, 'remove');
41
65
  if (changes.every((change) => change.before === change.after)) {
42
66
  options.output('No BrainMCP-managed configuration found.');
43
67
  return;
@@ -48,12 +72,12 @@ export async function remove(options) {
48
72
  export async function printConfig(options) {
49
73
  const client = await chooseClient(options);
50
74
  const workspace = resolveWorkspace(options.workspace);
51
- const target = resolveTarget(options.root, targetFor(client, options.scope), options.scope);
52
- options.output(`# ${clientLabel(client)} (${options.scope} scope)\n\nMCP configuration: ${target.configPath}\n\n${target.format === 'toml' ? upsertTomlBlock(undefined, client) : upsertJsonServer(undefined, client, target.rootKey)}\nGuidance: ${target.guidancePath}\n\n${renderGuidance(client, workspace)}`);
75
+ const target = resolveTarget(options, targetFor(client, options.scope));
76
+ options.output(`# ${clientLabel(client)} (${options.scope} scope)\n\nMCP configuration: ${target.configPath}\n\n${target.format === 'toml' ? upsertTomlBlock(undefined, client) : upsertJsonServer(undefined, client, target.rootKey)}\nGuidance: ${target.guidancePath}\n\n${upsertGuidance(undefined, client, options.scope, workspace)}`);
53
77
  }
54
78
  export async function doctor(options) {
55
79
  const client = await chooseClient(options);
56
- const target = resolveTarget(options.root, targetFor(client, options.scope), options.scope);
80
+ const target = resolveTarget(options, targetFor(client, options.scope));
57
81
  const checks = [];
58
82
  const config = await readText(target.configPath);
59
83
  const guidance = await readText(target.guidancePath);
@@ -76,8 +100,17 @@ export async function doctor(options) {
76
100
  }
77
101
  if (guidance !== undefined) {
78
102
  const occurrences = (guidance.match(/brainmcp:managed:start/g) ?? []).length;
79
- checks.push(['managed guidance markers', occurrences === 1 || client === 'cursor', occurrences === 1 ? 'one managed block' : `${occurrences} managed blocks`]);
103
+ checks.push(['managed guidance markers', occurrences === 1, occurrences === 1 ? 'one managed block' : `${occurrences} managed blocks`]);
80
104
  checks.push(['workspace binding', !options.workspace || guidance.includes(`Workspace id: ${resolveWorkspace(options.workspace)}`), options.workspace ? 'requested workspace binding' : 'no workspace requested']);
105
+ if (client === 'vscode' && options.scope === 'user') {
106
+ checks.push([
107
+ 'user instruction frontmatter',
108
+ guidance.startsWith('---\n') &&
109
+ /^applyTo:\s*["']\*\*["']$/m.test(guidance) &&
110
+ guidance.includes('\n---\n'),
111
+ 'always-on VS Code user instruction',
112
+ ]);
113
+ }
81
114
  }
82
115
  const fetchImpl = options.fetch ?? fetch;
83
116
  try {
@@ -94,15 +127,13 @@ export async function doctor(options) {
94
127
  catch (error) {
95
128
  checks.push(['endpoint challenge', false, error instanceof Error ? error.message : String(error)]);
96
129
  }
97
- const duplicate = await duplicateGuidance(options.root);
98
- checks.push(['duplicate guidance', duplicate.length <= 1, duplicate.length ? duplicate.join(', ') : 'none found']);
99
130
  for (const [name, passed, detail] of checks)
100
131
  options.output(`${passed ? '✓' : '✗'} ${name}: ${detail}`);
101
132
  if (checks.some(([, passed]) => !passed))
102
133
  throw new Error('BrainMCP doctor found configuration issues.');
103
134
  }
104
- async function plannedChanges(root, client, scope, workspace, mode) {
105
- const target = resolveTarget(root, targetFor(client, scope), scope);
135
+ async function plannedChanges(options, client, workspace, mode) {
136
+ const target = resolveTarget(options, targetFor(client, options.scope));
106
137
  const [config, guidance] = await Promise.all([readText(target.configPath), readText(target.guidancePath)]);
107
138
  return [
108
139
  {
@@ -115,20 +146,87 @@ async function plannedChanges(root, client, scope, workspace, mode) {
115
146
  {
116
147
  path: target.guidancePath,
117
148
  before: guidance,
118
- after: mode === 'init' ? upsertMarkdownBlock(guidance, renderGuidance(client, workspace)) : removeMarkdownBlock(guidance),
149
+ after: mode === 'init'
150
+ ? upsertGuidance(guidance, client, options.scope, workspace)
151
+ : removeGuidance(guidance, client, options.scope),
119
152
  },
120
153
  ];
121
154
  }
122
- function resolveTarget(root, target, scope) {
123
- const base = scope === 'user' ? homedir() : root;
155
+ function resolveTarget(options, target) {
156
+ const home = options.home ?? homedir();
157
+ if (options.scope === 'user' && target.client === 'codex') {
158
+ const configuredCodexHome = (options.env ?? process.env).CODEX_HOME?.trim();
159
+ const codexHome = configuredCodexHome ? resolve(configuredCodexHome) : join(home, '.codex');
160
+ return {
161
+ ...target,
162
+ configPath: join(codexHome, 'config.toml'),
163
+ guidancePath: join(codexHome, 'AGENTS.md'),
164
+ format: target.configFormat,
165
+ rootKey: target.configRootKey,
166
+ };
167
+ }
168
+ const base = options.scope === 'user' ? home : options.root;
124
169
  return {
125
170
  ...target,
126
- configPath: toAbsolute(base, target.configPath),
171
+ configPath: options.scope === 'user' && target.client === 'vscode'
172
+ ? vscodeUserConfigPath(home, options.env ?? process.env, options.platform ?? process.platform)
173
+ : toAbsolute(base, target.configPath),
127
174
  guidancePath: toAbsolute(base, target.guidancePath),
128
175
  format: target.configFormat,
129
176
  rootKey: target.configRootKey,
130
177
  };
131
178
  }
179
+ function vscodeUserConfigPath(home, env, platform) {
180
+ if (platform === 'win32') {
181
+ return join(env.APPDATA?.trim() || join(home, 'AppData', 'Roaming'), 'Code', 'User', 'mcp.json');
182
+ }
183
+ if (platform === 'darwin') {
184
+ return join(home, 'Library', 'Application Support', 'Code', 'User', 'mcp.json');
185
+ }
186
+ return join(env.XDG_CONFIG_HOME?.trim() || join(home, '.config'), 'Code', 'User', 'mcp.json');
187
+ }
188
+ function upsertGuidance(existing, client, scope, workspace) {
189
+ const preamble = guidancePreamble(client, scope);
190
+ const normalized = preamble && existing
191
+ ? collapseGeneratedPreambles(existing, preamble)
192
+ : existing;
193
+ const managed = upsertMarkdownBlock(normalized, renderGuidance(client, workspace));
194
+ if (!preamble || normalized !== undefined)
195
+ return managed;
196
+ return `${preamble}\n\n${managed}`;
197
+ }
198
+ function removeGuidance(existing, client, scope) {
199
+ const preamble = guidancePreamble(client, scope);
200
+ const removed = removeMarkdownBlock(existing);
201
+ const normalized = preamble && removed
202
+ ? collapseGeneratedPreambles(removed, preamble)
203
+ : removed;
204
+ return preamble && normalized?.trim() === preamble.trim() ? undefined : normalized;
205
+ }
206
+ function collapseGeneratedPreambles(text, preamble) {
207
+ const prefix = `${preamble.trimEnd()}\n\n`;
208
+ let remainder = text;
209
+ let count = 0;
210
+ while (remainder.startsWith(prefix)) {
211
+ remainder = remainder.slice(prefix.length);
212
+ count += 1;
213
+ }
214
+ return count > 0 ? `${prefix}${remainder}` : text;
215
+ }
216
+ function mergeFileChanges(changes) {
217
+ const merged = new Map();
218
+ for (const change of changes) {
219
+ const previous = merged.get(change.path);
220
+ if (!previous) {
221
+ merged.set(change.path, change);
222
+ continue;
223
+ }
224
+ if (previous.before !== change.before || previous.after !== change.after) {
225
+ throw new Error(`Conflicting planned changes for ${change.path}. Configure clients individually.`);
226
+ }
227
+ }
228
+ return [...merged.values()];
229
+ }
132
230
  async function previewAndApply(changes, options) {
133
231
  const changed = changes.filter((change) => change.before !== change.after);
134
232
  if (!changed.length) {
@@ -140,14 +238,8 @@ async function previewAndApply(changes, options) {
140
238
  throw new Error('Aborted. Re-run with --yes after reviewing the preview.');
141
239
  }
142
240
  const backups = await applyChanges(changed);
143
- options.output(backups.length ? `Backups: ${backups.join(', ')}` : 'Applied new files atomically.');
144
- }
145
- async function duplicateGuidance(root) {
146
- const paths = ['CLAUDE.md', 'AGENTS.md', '.cursor/rules/brainmcp-workspace.mdc'];
147
- const matches = [];
148
- for (const path of paths)
149
- if ((await readText(join(root, path)))?.includes('brainmcp:managed:start'))
150
- matches.push(path);
151
- return matches;
241
+ options.output(backups.length
242
+ ? `Applied changes with atomic per-file writes. Backups: ${backups.join(', ')}`
243
+ : 'Applied changes with atomic per-file writes.');
152
244
  }
153
245
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAuB,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAA6B,MAAM,kBAAkB,CAAC;AACvH,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAmB,MAAM,iBAAiB,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAa/J,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAY;IAC9C,MAAM,UAAU,GAAgC;QAC9C,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;QAC3C,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAC3C,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;QAC3C,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;KAC5C,CAAC;IACF,MAAM,QAAQ,GAAe,EAAE,CAAC;IAChC,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,UAAU,EAAE,CAAC;QACzC,IAAI,M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