| .. | ||
| .pr/kilocode-2129 | ||
| host | ||
| plugin | ||
| resources | ||
| scripts | ||
| .gitignore | ||
| README.md | ||
JetBrains Integration for Roo-Code
This directory contains the JetBrains integration layer that allows Roo-Code to run as a plugin within JetBrains IDEs (IntelliJ IDEA, WebStorm, PyCharm, etc.).
Architecture Overview
The JetBrains integration consists of two main components:
1. Host Bridge (/jetbrains/host/)
A Node.js application that:
- Starts the VSCode extension host process
- Provides socket-based IPC communication between JetBrains and the extension
- Translates between JetBrains and VSCode APIs via RPC
- Manages the extension lifecycle
2. JetBrains Plugin (/jetbrains/plugin/)
A Kotlin/Java plugin that:
- Integrates with JetBrains IDE APIs
- Spawns the Node.js host process
- Handles UI integration within the IDE
- Maps IDE actions to extension commands
Setup Instructions
Prerequisites
- Node.js 18.x or higher
- Java 17 or higher
- JetBrains IDE (IntelliJ IDEA, WebStorm, etc.)
- Git with submodule support
Building the Host Bridge
- Install dependencies:
cd jetbrains/host
npm install
- Apply VSCode patches:
npm run deps:patch
- Build the host:
npm run build
Building the JetBrains Plugin
- Navigate to the plugin directory:
cd jetbrains/plugin
- Build the plugin:
./gradlew buildPlugin
- The plugin will be available in
build/distributions/
Development
Running in Development Mode
- Start the host in development mode:
cd jetbrains/host
npm run dev
- Open the plugin project in IntelliJ IDEA:
cd jetbrains/plugin
idea .
- Run the plugin using the "Run Plugin" configuration
Debugging
Enable debug logging by setting environment variables:
JETBRAINS_DEBUG_IPC=true- Logs IPC messagesJETBRAINS_RPC_DEBUG=true- Logs RPC protocol messages
Testing
Run tests for the host:
cd jetbrains/host
npm test
Run tests for the plugin:
cd jetbrains/plugin
./gradlew test
Configuration
Host Configuration
The host can be configured via jetbrains/host/src/config.ts:
DEFAULT_PORT: Default socket port (51234)SOCKET_TIMEOUT: Connection timeout in millisecondsMAX_RECONNECT_ATTEMPTS: Maximum reconnection attempts
Plugin Configuration
Plugin settings are in jetbrains/plugin/gradle.properties:
pluginVersion: Plugin versionplatformVersion: Target IDE versionplatformType: IDE type (IC for IntelliJ Community)
Architecture Details
Communication Flow
JetBrains IDE <-> Kotlin Plugin <-> Socket (TCP) <-> Node.js Host <-> VSCode Extension API <-> Roo-Code Extension
RPC Protocol
The RPC manager (host/src/rpcManager.ts) handles bidirectional communication:
- Incoming calls from JetBrains to VSCode APIs
- Outgoing calls from VSCode to JetBrains APIs
- Event subscriptions and notifications
API Translation
Main thread actors in the plugin map JetBrains APIs to VSCode equivalents:
MainThreadCommandsShape: Command executionMainThreadDocumentsShape: Document managementMainThreadTextEditorsShape: Editor operationsMainThreadTerminalServiceShape: Terminal integration- And many more...
Troubleshooting
Common Issues
- Port already in use: Change the socket port in the configuration
- VSCode patch fails: Ensure the VSCode submodule is at the correct version
- Plugin doesn't load: Check IDE compatibility in gradle.properties
- Extension not found: Verify the extension is built and in the correct location
Logs Location
- Host logs:
jetbrains/host/logs/ - Plugin logs: Check IDE's log directory
Contributing
When contributing to the JetBrains integration:
- Follow the existing code style
- Add tests for new functionality
- Update documentation as needed
- Test in multiple JetBrains IDEs if possible
License
This JetBrains integration follows the same license as Roo-Code.
Support
For issues specific to JetBrains integration:
- Check this README's troubleshooting section
- Search existing issues on GitHub
- Create a new issue with the "jetbrains" label
Credits
This integration is adapted from similar VSCode-to-JetBrains bridge implementations and modified for Roo-Code's specific requirements.