Prompt 13: Bridge Layer (VS Code / JetBrains IDE Integration)
- Source ID:
src-20260420-da49bd0f2551 - Kind:
code - Scope:
shared - Origin:
claude_code/prompts/13-bridge-ide.md - Raw path:
sources/raw/prompt-13-bridge-layer-vs-code-jetbrains-ide-integration__src-20260420-da49bd0f2551.md - Status:
active
Tags
internal-docs rebuild-prompt
Content
Prompt 13: Bridge Layer (VS Code / JetBrains IDE Integration)
Context
You are working in /workspaces/claude-code. The "Bridge" is the subsystem that connects Claude Code to IDE extensions (VS Code, JetBrains). It enables:
- Remote control of Claude Code from an IDE
- Sharing file context between IDE and CLI
- Permission approvals from the IDE UI
- Session management across IDE and terminal
The Bridge is gated behind feature('BRIDGE_MODE') and is the most complex optional subsystem (~30 files in src/bridge/).
Key Files
src/bridge/bridgeMain.ts— Main bridge orchestrationsrc/bridge/bridgeApi.ts— Bridge API endpointssrc/bridge/bridgeMessaging.ts— WebSocket/HTTP messagingsrc/bridge/bridgeConfig.ts— Bridge configurationsrc/bridge/bridgeUI.ts— Bridge UI renderingsrc/bridge/jwtUtils.ts— JWT authentication for bridge connectionssrc/bridge/types.ts— Bridge typessrc/bridge/initReplBridge.ts— REPL integrationsrc/bridge/replBridge.ts— REPL bridge handle
Task
Part A: Understand the bridge architecture
Read src/bridge/types.ts and src/bridge/bridgeMain.ts (first 100 lines). Document:
1. What protocols does the bridge use? (WebSocket, HTTP polling, etc.)
2. How does authentication work? (JWT)
3. What messages flow between IDE and CLI?
4. How is the bridge lifecycle managed?
Part B: Assess what's needed vs. what can be deferred
The bridge is a nice-to-have for initial build-out. Categorize:
1. Must work: Feature flag gate (feature('BRIDGE_MODE') returns false → bridge code is skipped)
2. Can defer: Full bridge functionality
3. Might break: Code paths that assume bridge is available even when disabled
Part C: Verify the feature gate works
Ensure that when CLAUDE_CODE_BRIDGE_MODE=false (or unset):
1. Bridge code is not imported
2. Bridge initialization is skipped
3. No bridge-related errors appear
4. The CLI works normally in terminal-only mode
Part D: Stub the bridge for safety
If any code paths reference bridge functionality outside the feature gate:
1. Create src/bridge/stub.ts with no-op implementations
2. Make sure imports from src/bridge/ resolve without crashing
3. Ensure the REPL works without bridge
Part E: Document bridge activation
For future work, document what would be needed to enable the bridge:
1. Set CLAUDE_CODE_BRIDGE_MODE=true
2. What IDE extension is needed?
3. What authentication setup is required?
4. What ports/sockets does it use?
Part F: Check the Chrome extension bridge
There's a --claude-in-chrome-mcp and --chrome-native-host mode referenced in src/entrypoints/cli.tsx. Read these paths and document what they do. These can be deferred — just make sure they don't crash when not in use.
Verification
- CLI works normally with bridge disabled (default)
- No bridge-related errors in stdout/stderr
feature('BRIDGE_MODE')correctly returnsfalse- Bridge architecture is documented for future enablement
- No dangling imports that crash when bridge is off