You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(agents): inject workspace root for VS Code MCP init (#156)
* feat(agents): inject workspace root for VS Code MCP init
VS Code / Copilot now get `--root ${workspaceFolder}` via agents init --mcp,
matching Cursor so Copilot indexes the open workspace when spawn cwd differs.
* test(agents): deepen VS Code MCP workspace-root coverage
Address PR review: registry assertion, vscode-only/merge/upgrade tests,
stale plan doc refresh, changeset migration note, CLI subprocess check.
* docs(plans): mark vscode MCP root fix as shipped (Option A)
Resolve plan doc contradiction post-implementation; rename CLI test title.
* fix(docs): drop invalid --target copilot from migration text
Copilot-only MCP wiring uses --interactive, not a --target flag.
* docs(plans): retire vscode MCP workspace-root plan
Lift migration + --root rationale into agents.md; delete shipped plan per
docs-governance (delete + lift, no slim-and-keep in plans/).
`codemap agents init --mcp` now includes `--root ${workspaceFolder}` in the VS Code / Copilot MCP config (`.vscode/mcp.json`), same as Cursor. Re-run `codemap agents init --mcp` to upgrade an existing `.vscode/mcp.json` from older init output (or `--interactive` and select Copilot only).
| Claude Code |`.mcp.json` + `.claude/settings.json` — `permissions.allow` includes `mcp__codemap__*`|
145
-
| VS Code / Copilot |`.vscode/mcp.json` — `servers.codemap` with `type: stdio`|
145
+
| VS Code / Copilot |`.vscode/mcp.json` — `servers.codemap` with `type: stdio`+ `mcp --watch --root ${workspaceFolder}` (PM-resolved spawn, same tail as Cursor)|
146
146
| Continue |`.continue/mcpServers/codemap-mcp.json` (JSON `mcpServers`; also accepted from Cursor/Cline exports) |
147
147
| Amazon Q Developer |**`.amazonq/default.json`** (IDE canonical) + **`.amazonq/mcp.json`** (legacy workspace; still read when global `useLegacyMcpJson` is true — AWS default). [AWS MCP IDE docs](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/mcp-ide.html)|
@@ -153,7 +153,7 @@ With **`--mcp`** and no `--target` filter, all **project-local** rows above are
153
153
154
154
Merge is idempotent: foreign MCP servers and existing settings keys are preserved; only the `codemap` server entry and permission pattern are upserted. **`command` / spawn args are resolved from the project** (when `@stainless-code/codemap` is listed in `package.json`, the local PM runner is used — e.g. `pnpm exec codemap`, `yarn exec codemap`, `bunx codemap`; otherwise PM dlx of `@stainless-code/codemap@latest` — e.g. `npx @stainless-code/codemap@latest`, `pnpm dlx @stainless-code/codemap@latest`, `yarn dlx @stainless-code/codemap@latest`; yarn classic may fall back to `npx` per `package-manager-detector`; Bun uses **`bunx`**, not `bun x`). Init logs the chosen invocation (`MCP CLI: …`).
155
155
156
-
**Side-effect-only re-runs:** When `.agents/` already exists, `codemap agents init --mcp`, **`--interactive`** target wiring (or any explicit integration targets), or `--git-hooks` still apply without `--force`. `codemap agents init --no-git-hooks --mcp` uninstalls hook blocks and writes MCP even when `.agents/` is absent. Template refresh still requires `--force`. Unparseable MCP JSON and invalid `mcpServers` / `servers`**shape** are **rejected** (fix the file manually — init never wipes or resets those maps, even with `--force`). Foreign MCP servers in a valid map are always preserved on merge.
156
+
**Side-effect-only re-runs:** When `.agents/` already exists, `codemap agents init --mcp`, **`--interactive`** target wiring (or any explicit integration targets), or `--git-hooks` still apply without `--force`. `codemap agents init --no-git-hooks --mcp` uninstalls hook blocks and writes MCP even when `.agents/` is absent. Template refresh still requires `--force`. Unparseable MCP JSON and invalid `mcpServers` / `servers`**shape** are **rejected** (fix the file manually — init never wipes or resets those maps, even with `--force`). Foreign MCP servers in a valid map are always preserved on merge. Re-runs upsert the codemap server entry in place (e.g. add `--root ${workspaceFolder}` on VS Code when an older `.vscode/mcp.json` omitted it). Cursor and VS Code get explicit `--root` because host docs do not guarantee stdio spawn `cwd` equals the workspace folder.
0 commit comments