3.0 KiB
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:
- What protocols does the bridge use? (WebSocket, HTTP polling, etc.)
- How does authentication work? (JWT)
- What messages flow between IDE and CLI?
- 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:
- Must work: Feature flag gate (
feature('BRIDGE_MODE')returnsfalse→ bridge code is skipped) - Can defer: Full bridge functionality
- 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):
- Bridge code is not imported
- Bridge initialization is skipped
- No bridge-related errors appear
- 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:
- Create
src/bridge/stub.tswith no-op implementations - Make sure imports from
src/bridge/resolve without crashing - Ensure the REPL works without bridge
Part E: Document bridge activation
For future work, document what would be needed to enable the bridge:
- Set
CLAUDE_CODE_BRIDGE_MODE=true - What IDE extension is needed?
- What authentication setup is required?
- 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