Skip to content

feat(installer): GitHub Copilot targets — VS Code, Copilot CLI, JetBrains#1440

Open
colbymchenry wants to merge 4 commits into
mainfrom
feat/copilot-installer-targets
Open

feat(installer): GitHub Copilot targets — VS Code, Copilot CLI, JetBrains#1440
colbymchenry wants to merge 4 commits into
mainfrom
feat/copilot-installer-targets

Conversation

@colbymchenry

@colbymchenry colbymchenry commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Adds GitHub Copilot as a supported agent for codegraph install / uninstall, via three new installer targets:

  • copilot-vscode — Copilot Chat in VS Code. Writes the server entry to .vscode/mcp.json (local) or the VS Code User-dir mcp.json (global: ~/Library/Application Support/Code/User on macOS, %APPDATA%\Code\User on Windows, $XDG_CONFIG_HOME/~/.config/Code/User on Linux). Uses the servers key (not mcpServers) per VS Code's v1.102+ format, edits via jsonc-parser so user comments and sibling servers survive, and pins --path for local installs only. Global entries are deliberately variable-free (9769d6b): a user-level entry using ${workspaceFolder} makes VS Code toast "Variable workspaceFolder can not be resolved" in every folderless window; VS Code documents stdio cwd = workspace folder, and the server resolves the project via MCP roots with a cwd fallback, so no pin is needed.
  • copilot-cli — the GitHub Copilot CLI (~/.copilot/mcp-config.json).
  • copilot-jetbrains — the Copilot plugin in JetBrains IDEs (github-copilot config dir, XDG on Unix, %LOCALAPPDALOCAL%-fallback on Windows).

Also updates the TargetId union, registry, install/uninstall command descriptions, README, and CHANGELOG.

Testing

  • npx vitest run __tests__/installer-targets.test.ts — 215 passed, 3 skipped (the skips are it.runIf(platform) variants for OSes other than the host; run on macOS).
  • npx tsc --noEmit — clean.
  • Platform-specific path resolution (APPDATA / XDG_CONFIG_HOME / macOS Application Support, plus unset-env fallbacks) is unit-tested with it.runIf(platform) gates. Validated on all three platforms — macOS (dev machine), Linux (node:22-bookworm Docker, run with --init), and Windows 11 ARM (Parallels VM, fresh clone at C:\dev\codegraph): 215 passed / 3 skipped on each, where the skips are the other platforms' gated variants — every gated test executed on its target OS.
  • Note: this repo has no PR test CI, so these were manual runs against commit 490791c.
  • Live detection verified on macOS — and it caught a real bug: the VS Code Copilot Chat extension writes lock files into ~/.copilot/ide/, so the CLI's existsSync(~/.copilot) check false-positived on a machine with only the VS Code extension. Fixed in 234dfe6 (the dir now only counts as a CLI footprint when it holds something besides ide, and uninstalling a from-scratch install deletes mcp-config.json rather than leaving a {} husk that would re-trigger detection). After the fix, the prompt on the same machine shows VS Code detected, Copilot CLI not found, JetBrains not found — all correct. Suites re-run green on macOS, Linux, and Windows at 234dfe6 (217 passed / 3 skipped each).

Validation checklist for reviewers

  1. codegraph install --print-config copilot-vscode — inspect the snippet without writing files.
  2. In a scratch project with a .vscode/ dir: codegraph install --target=copilot-vscode --location=local --yes, confirm .vscode/mcp.json gains servers.codegraph and pre-existing servers/comments are untouched.
  3. Restart VS Code, check the server appears under MCP: List Servers.
  4. codegraph uninstall --target=copilot-vscode --location=local --yes, confirm only the codegraph entry is removed.

🤖 Generated with Claude Code

colbymchenry and others added 4 commits July 23, 2026 17:29
…ains

Adds three new installer targets so `codegraph install` can wire the
MCP server into GitHub Copilot surfaces:

- copilot-vscode: .vscode/mcp.json (local) or the VS Code User-dir
  mcp.json (global), JSONC-surgical edits, `--path` pinned via
  ${workspaceFolder} for global installs
- copilot-cli: ~/.copilot/mcp-config.json
- copilot-jetbrains: github-copilot config dir (XDG / %LOCALAPPDATA%)

Detection, install, uninstall, and --print-config are covered for all
three in installer-targets.test.ts, including platform-specific path
resolution.

Co-Authored-By: Claude Fable 5 <[email protected]>
….copilot/ide locks

The VS Code Copilot Chat extension writes MCP socket-handoff lock files
into ~/.copilot/ide/ on launch, so `existsSync(~/.copilot)` reported the
Copilot CLI as installed on any machine that merely has the VS Code
extension (caught live on the maintainer's Mac). Detection now counts
the dir as a CLI footprint only when it holds something besides `ide`.

Also: uninstalling a from-scratch install now deletes mcp-config.json
instead of leaving a `{}` husk that would keep detect() reporting the
CLI as installed.

Co-Authored-By: Claude Fable 5 <[email protected]>
… folder

VS Code refuses to start a user-level MCP server whose entry uses
${workspaceFolder} in a window with no folder open, surfacing only a
cryptic "Variable workspaceFolder can not be resolved" toast (hit live
during validation). Global installs now note this up front.

Co-Authored-By: Claude Fable 5 <[email protected]>
…— VS Code toasts an error in every folderless window

A user-level mcp.json entry using ${workspaceFolder} makes VS Code
refuse to start the server in ANY window without a folder open (loose
files, welcome tab), toasting "Variable workspaceFolder can not be
resolved" — recurring error-noise, hit live during validation.

The pin was never needed for VS Code: unlike Cursor, VS Code documents
stdio-server cwd as the workspace folder, and the codegraph server
resolves its project via roots/list with a cwd fallback. Global entries
are now variable-free (`serve --mcp`); local installs keep the absolute
--path. This supersedes the "open a folder" install note from the
previous commit, which is removed again.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant