Repository navigation
feat(cli): six-client MCP init with --dry-run - #153
PatrickSys wants to merge 1 commit into
Conversation
Configure Claude Code, Cursor, Codex, VS Code, Windsurf, and OpenCode in one pass with idempotent merges, user-scoped Windsurf paths, and explicit create/ update output. Add temp-HOME tests and document init in the README.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83698db785
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| filePath: string, | ||
| generatedContent: string, | ||
| client: Extract<Client, 'claude-code' | 'cursor' | 'opencode'> | ||
| client: Extract<Client, 'claude-code' | 'cursor' | 'opencode' | 'vscode' | 'windsurf'> |
There was a problem hiding this comment.
Accept JSONC when merging VS Code MCP configurations
When an existing .vscode/mcp.json contains comments or trailing commas, selecting VS Code now aborts setup with “existing JSON is invalid” because _buildMergedMcpContent uses JSON.parse. These are valid VS Code configurations: VS Code explicitly registers mcp.json as JSONC. Since all selected clients are prepared before any writes, this also prevents other selected tools from being configured. Use a JSONC-aware merge for the newly supported VS Code client, preserving unrelated configuration.
Useful? React with 👍 / 👎.
[Medium impact] The changes affect the CLI setup workflow and the client configs it creates. Fix commented VS Code config support and the shared Windsurf root before merging. Findings
SummaryAdds VS Code and Windsurf to
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Parse init options] --> B[Choose clients]
B --> C[Generate and merge every config]
C --> D{All checks pass?}
D -->|No| E[Report failure without writes]
D -->|Yes| F{Dry run?}
F -->|Yes| G[Print proposed changes]
F -->|No| H[Write changed configs]
H --> I[Print results]
Reviews (1) · Last reviewed commit: "feat(cli): extend init to six MCP client..." · Reviewed by Greptile |
| filePath: string, | ||
| generatedContent: string, | ||
| client: Extract<Client, 'claude-code' | 'cursor' | 'opencode'> | ||
| client: Extract<Client, 'claude-code' | 'cursor' | 'opencode' | 'vscode' | 'windsurf'> |
There was a problem hiding this comment.
VS Code allows comments and trailing commas in .vscode/mcp.json, but the new VS Code path passes that file to _buildMergedMcpContent, which uses strict JSON.parse. Either feature makes normal setup and --dry-run fail. Since every selected config is checked before any writes, this also stops setup for the other clients. Use a parser that accepts VS Code's config format and add a commented-file test.
| const paths = platform === 'win32' ? path.win32 : path.posix; | ||
| const home = resolveHome(env, platform); | ||
| if (client === 'codex') return path.join(rootPath, '.codex', 'config.toml'); | ||
| if (client === 'windsurf') return path.join(home, '.codeium', 'windsurf', 'mcp_config.json'); |
There was a problem hiding this comment.
Setup replaces another project's default
Windsurf now saves a project-specific launch in one user-wide file. Running init in project B after project A replaces A's saved root with B's: isGeneratedLaunch accepts any absolute root, and the merge replaces args. If a session does not announce workspace roots, later calls without an explicit project can use B while the user is working in A. Keep the shared registration project-neutral, or require confirmation before replacing a different saved root.
| if (tempHome) await fs.rm(tempHome, { recursive: true, force: true }); | ||
| tempHome = ''; | ||
| projectRoot = ''; |
There was a problem hiding this comment.
The new tests create a separate temporary projectRoot, but afterEach deletes only tempHome before clearing both paths. The VS Code test leaves a config behind on every run. Remove projectRoot before resetting it so repeated test runs do not accumulate temporary folders.
| if (tempHome) await fs.rm(tempHome, { recursive: true, force: true }); | |
| tempHome = ''; | |
| projectRoot = ''; | |
| if (tempHome) await fs.rm(tempHome, { recursive: true, force: true }); | |
| if (projectRoot) await fs.rm(projectRoot, { recursive: true, force: true }); | |
| tempHome = ''; | |
| projectRoot = ''; |
Summary
codebase-context initfrom four to six clients: Claude Code, Cursor, Codex, VS Code (Copilot workspace.vscode/mcp.json), Windsurf (user~/.codeium/windsurf/mcp_config.json), and OpenCode.--dry-runto printWould create/Would update/Unchangedwithout writing files (preview-before-write pattern aligned with MCP filesystem server docs).serversshape per @modelcontextprotocol/server-filesystem workspace examples.Tests
tests/cli-init.test.ts— VS Code/Windsurf config generation and six-client tabletests/cli-init-dry-run-home.test.ts— tempHOMEdry-run and VS Code mergepnpm run build)Docs
docs/cli.md,docs/client-setup.mdwizard sectionAvoids PR #145 embedding files and #68/#71 Ollama work.