diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..4875072947 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "jetbrains/RunVSAgent"] + path = jetbrains/RunVSAgent + url = https://github.com/wecode-ai/RunVSAgent.git diff --git a/jetbrains/.gitignore b/jetbrains/.gitignore new file mode 100644 index 0000000000..fc2e797e6c --- /dev/null +++ b/jetbrains/.gitignore @@ -0,0 +1,23 @@ +# Build output +dist/ +RunVSAgent-RooCode.zip + +# RunVSAgent build artifacts (in submodule) +RunVSAgent/jetbrains_plugin/build/ +RunVSAgent/jetbrains_plugin/.gradle/ +RunVSAgent/extension_host/dist/ +RunVSAgent/extension_host/node_modules/ +RunVSAgent/deps/roo-code/bin/ +RunVSAgent/deps/roo-code/node_modules/ +RunVSAgent/jetbrains_plugin/prodDep.txt +RunVSAgent/jetbrains_plugin/src/main/resources/com/sina/weibo/agent/plugin/config/plugin.properties + +# IDE files +.idea/ +*.iml +*.ipr +*.iws + +# Temp files +RunVSAgent/tmp/ +RunVSAgent/build/ \ No newline at end of file diff --git a/jetbrains/README.md b/jetbrains/README.md new file mode 100644 index 0000000000..70de884c89 --- /dev/null +++ b/jetbrains/README.md @@ -0,0 +1,129 @@ +# Roo Code for JetBrains IDEs + +This directory contains the integration of Roo Code with [RunVSAgent](https://github.com/wecode-ai/RunVSAgent), enabling Roo Code to run seamlessly in JetBrains IDEs (IntelliJ IDEA, WebStorm, PyCharm, etc.). + +## 🎯 Overview + +RunVSAgent acts as a bridge between VSCode extensions and JetBrains IDEs, allowing you to use Roo Code's AI-powered development features in your favorite JetBrains IDE. + +## 🚀 Quick Start + +### Prerequisites + +- Node.js 18.0+ +- JDK 17+ +- JetBrains IDE 2023.1+ +- Git + +### Building + +```bash +# From the project root +cd jetbrains +./build.sh +``` + +This will: + +1. Update the RunVSAgent submodule +2. Build the Roo Code extension +3. Package everything for JetBrains +4. Create `dist/RunVSAgent-RooCode.zip` + +### Installation + +1. Open your JetBrains IDE +2. Go to **Settings/Preferences** → **Plugins** +3. Click the gear icon ⚙️ → **Install Plugin from Disk...** +4. Select `jetbrains/dist/RunVSAgent-RooCode.zip` +5. Restart your IDE + +## 📁 Project Structure + +``` +jetbrains/ +├── RunVSAgent/ # RunVSAgent submodule +│ ├── extension_host/ # Node.js runtime for VSCode APIs +│ ├── jetbrains_plugin/ # Kotlin-based JetBrains plugin +│ └── deps/ +│ └── roo-code/ # Roo Code extension files +├── build.sh # Main build script +├── build-dev.sh # Development build (faster) +├── README.md # This file +└── dist/ # Build output directory +``` + +## 🔧 Development + +For development, use the faster dev build: + +```bash +./build-dev.sh +``` + +This skips some optimization steps for quicker iteration. + +### Debugging + +1. **Extension Host Logs**: Check the IDE logs for Node.js runtime issues +2. **Plugin Logs**: Look in `Help → Show Log in Finder/Explorer` +3. **Enable Debug Mode**: Set `VSCODE_DEBUG=true` in environment + +## 🏗️ Architecture + +```mermaid +graph LR + A[JetBrains IDE] --> B[RunVSAgent Plugin] + B --> C[RPC Socket] + C --> D[Node.js Extension Host] + D --> E[VSCode API Layer] + E --> F[Roo Code Extension] +``` + +## 🤝 How It Works + +1. **RunVSAgent Plugin** runs in the JetBrains IDE (Kotlin) +2. **Extension Host** provides VSCode-compatible APIs (Node.js) +3. **RPC Communication** bridges the two environments +4. **Roo Code** runs unmodified using VSCode APIs + +## ⚙️ Configuration + +After installation, configure Roo Code: + +1. Open RunVSAgent panel in your IDE +2. Select "Roo Code" from available agents +3. Configure API keys and settings +4. Start using AI-powered development features + +## 🐛 Troubleshooting + +### Plugin doesn't load + +- Ensure JetBrains IDE version ≥ 2023.1 +- Check if JCEF is enabled (required for WebView) +- For Android Studio, [enable JCEF manually](https://github.com/wecode-ai/RunVSAgent/blob/main/docs/KNOWN_ISSUES.md#11-runtime-environment-does-not-support-jcef) + +### Node.js not found + +- Verify Node.js is in PATH: `node --version` +- Restart IDE after installing Node.js + +### Extension not activating + +- Check extension host logs +- Verify `deps/roo-code/` contains extension files +- Rebuild with `./build.sh` + +## 📚 Resources + +- [RunVSAgent Documentation](https://github.com/wecode-ai/RunVSAgent) +- [Roo Code Documentation](https://github.com/RooCodeInc/Roo-Code) +- [JetBrains Plugin Development](https://plugins.jetbrains.com/docs/intellij/welcome.html) + +## 📄 License + +This integration follows the licenses of both projects: + +- Roo Code: [Check main repository](https://github.com/RooCodeInc/Roo-Code) +- RunVSAgent: Apache License 2.0 diff --git a/jetbrains/RunVSAgent b/jetbrains/RunVSAgent new file mode 160000 index 0000000000..2d9e374b01 --- /dev/null +++ b/jetbrains/RunVSAgent @@ -0,0 +1 @@ +Subproject commit 2d9e374b01224c34062c376639c80ad8402dd5c5 diff --git a/jetbrains/build-dev.sh b/jetbrains/build-dev.sh new file mode 100755 index 0000000000..360c9385ce --- /dev/null +++ b/jetbrains/build-dev.sh @@ -0,0 +1,128 @@ +#!/bin/bash + +set -e + +echo "🚀 Building Roo Code for JetBrains IDEs (Development Mode)" +echo "=========================================================" + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Get the script directory +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PROJECT_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )" # Main Roo Code project root +RUNVSAGENT_DIR="$SCRIPT_DIR/RunVSAgent" + +echo -e "${BLUE}⚡ Development mode: Skipping full rebuild for faster iteration${NC}" +echo "" + +# Step 1: Quick build of Roo Code extension +echo -e "${YELLOW}📦 Step 1: Quick building Roo Code extension...${NC}" +cd "$PROJECT_ROOT" + +# Build the extension (dev mode - no minification) +echo "Building Roo Code bundle (dev mode)..." +NODE_ENV=development pnpm run bundle + +# Step 2: Update Roo Code in RunVSAgent +echo -e "${YELLOW}📦 Step 2: Updating Roo Code in RunVSAgent...${NC}" + +# Create the roo-code directory in deps +ROO_CODE_DIR="$RUNVSAGENT_DIR/deps/roo-code" +mkdir -p "$ROO_CODE_DIR" + +# Copy the built extension +echo "Copying extension files..." +cp "$PROJECT_ROOT/src/dist/extension.js" "$ROO_CODE_DIR/extension.cjs" + +# Copy assets if they exist +if [ -d "$PROJECT_ROOT/src/assets" ]; then + cp -r "$PROJECT_ROOT/src/assets" "$ROO_CODE_DIR/" +fi + +# Update extension.package.json +echo "Updating extension.package.json..." +cat > "$ROO_CODE_DIR/extension.package.json" << 'EOF' +{ + "name": "roo-code", + "displayName": "Roo Code (Dev)", + "description": "A whole dev team of AI agents in your editor - Development Build", + "publisher": "RooVeterinaryInc", + "version": "3.28.0-dev", + "engines": { + "vscode": "^1.84.0" + }, + "activationEvents": [ + "onStartupFinished", + "*" + ], + "main": "./extension.cjs", + "contributes": { + "commands": [ + { + "command": "roo-code.newTask", + "title": "Roo Code: New Task" + }, + { + "command": "roo-code.openSettings", + "title": "Roo Code: Open Settings" + } + ] + }, + "extensionDependencies": [] +} +EOF + +# Step 3: Quick build of extension host (if needed) +echo -e "${YELLOW}📦 Step 3: Checking extension host...${NC}" +cd "$RUNVSAGENT_DIR/extension_host" + +if [ ! -d "dist" ]; then + echo "Building extension host for first time..." + npm install + npm run build +else + echo "Extension host already built, skipping..." +fi + +# Step 4: Quick build of JetBrains plugin +echo -e "${YELLOW}📦 Step 4: Building JetBrains plugin (dev mode)...${NC}" +cd "$RUNVSAGENT_DIR/jetbrains_plugin" + +# Build with Gradle (skip tests for speed) +echo "Building JetBrains plugin..." +./gradlew buildPlugin -x test + +# Step 5: Package +echo -e "${YELLOW}📦 Step 5: Creating development package...${NC}" + +# Create output directory +OUTPUT_DIR="$SCRIPT_DIR/dist" +mkdir -p "$OUTPUT_DIR" + +# Copy the built plugin +PLUGIN_FILE=$(find "$RUNVSAGENT_DIR/jetbrains_plugin/build/distributions" -name "*.zip" | head -1) +if [ -f "$PLUGIN_FILE" ]; then + # Add timestamp to dev builds + TIMESTAMP=$(date +%Y%m%d-%H%M%S) + cp "$PLUGIN_FILE" "$OUTPUT_DIR/RunVSAgent-RooCode-dev-${TIMESTAMP}.zip" + # Also keep a latest dev version + cp "$PLUGIN_FILE" "$OUTPUT_DIR/RunVSAgent-RooCode-dev-latest.zip" + + echo -e "${GREEN}✅ Development build successful!${NC}" + echo -e "${GREEN}📦 Plugin package created at:${NC}" + echo -e " - $OUTPUT_DIR/RunVSAgent-RooCode-dev-latest.zip" + echo -e " - $OUTPUT_DIR/RunVSAgent-RooCode-dev-${TIMESTAMP}.zip" + echo "" + echo -e "${BLUE}💡 Tip: Use 'dev-latest.zip' for quick testing${NC}" +else + echo -e "${RED}❌ Error: Could not find built plugin file${NC}" + exit 1 +fi + +echo "" +echo -e "${GREEN}🎉 Development build complete!${NC}" \ No newline at end of file diff --git a/jetbrains/build.sh b/jetbrains/build.sh new file mode 100755 index 0000000000..9119c4f1bf --- /dev/null +++ b/jetbrains/build.sh @@ -0,0 +1,155 @@ +#!/bin/bash + +set -e + +echo "🚀 Building Roo Code for JetBrains IDEs with RunVSAgent" +echo "=========================================================" + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Get the script directory +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PROJECT_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )" # Main Roo Code project root +RUNVSAGENT_DIR="$SCRIPT_DIR/RunVSAgent" + +# Step 1: Update and setup RunVSAgent submodule +echo -e "${YELLOW}📦 Step 1: Setting up RunVSAgent...${NC}" +cd "$SCRIPT_DIR" +git submodule update --init --recursive + +# Run RunVSAgent setup to prepare VSCode dependencies +echo "Running RunVSAgent setup..." +cd "$RUNVSAGENT_DIR" +if [ -f "scripts/setup.sh" ]; then + ./scripts/setup.sh --skip-deps +else + echo -e "${RED}Warning: RunVSAgent setup script not found${NC}" +fi +cd "$SCRIPT_DIR" + +# Step 2: Build Roo Code extension +echo -e "${YELLOW}📦 Step 2: Building Roo Code extension...${NC}" +cd "$PROJECT_ROOT" + +# Install dependencies if needed +if [ ! -d "node_modules" ]; then + echo "Installing Roo Code dependencies..." + pnpm install +fi + +# Build the extension +echo "Building Roo Code bundle..." +pnpm run bundle + +# Step 3: Prepare Roo Code for RunVSAgent +echo -e "${YELLOW}📦 Step 3: Preparing Roo Code for RunVSAgent...${NC}" + +# Create the roo-code directory in deps +ROO_CODE_DIR="$RUNVSAGENT_DIR/deps/roo-code" +mkdir -p "$ROO_CODE_DIR" + +# Link to the main project's built extension +echo "Copying extension files from main project..." +if [ -f "$PROJECT_ROOT/src/dist/extension.js" ]; then + cp "$PROJECT_ROOT/src/dist/extension.js" "$ROO_CODE_DIR/extension.cjs" +else + echo -e "${RED}Error: extension.js not found. Make sure to build the main project first.${NC}" + exit 1 +fi + +# Copy assets from main project +if [ -d "$PROJECT_ROOT/src/assets" ]; then + cp -r "$PROJECT_ROOT/src/assets" "$ROO_CODE_DIR/" +fi + +# Copy package.json from main project for reference +if [ -f "$PROJECT_ROOT/src/package.json" ]; then + cp "$PROJECT_ROOT/src/package.json" "$ROO_CODE_DIR/package.json" +fi + +# Create extension.package.json for RunVSAgent +echo "Creating extension.package.json..." +cat > "$ROO_CODE_DIR/extension.package.json" << 'EOF' +{ + "name": "roo-code", + "displayName": "Roo Code", + "description": "A whole dev team of AI agents in your editor", + "publisher": "RooVeterinaryInc", + "version": "3.28.0", + "engines": { + "vscode": "^1.84.0" + }, + "activationEvents": [ + "onStartupFinished", + "*" + ], + "main": "./extension.cjs", + "contributes": { + "commands": [ + { + "command": "roo-code.newTask", + "title": "Roo Code: New Task" + }, + { + "command": "roo-code.openSettings", + "title": "Roo Code: Open Settings" + } + ] + }, + "extensionDependencies": [] +} +EOF + +# Step 4: Build RunVSAgent extension host +echo -e "${YELLOW}📦 Step 4: Building RunVSAgent extension host...${NC}" +cd "$RUNVSAGENT_DIR/extension_host" + +# Install dependencies if needed +if [ ! -d "node_modules" ]; then + echo "Installing extension host dependencies..." + npm install +fi + +# Build the extension host +echo "Building extension host..." +npm run build + +# Step 5: Build JetBrains plugin +echo -e "${YELLOW}📦 Step 5: Building JetBrains plugin...${NC}" +cd "$RUNVSAGENT_DIR/jetbrains_plugin" + +# Build with Gradle +echo "Building JetBrains plugin with Gradle..." +./gradlew clean buildPlugin + +# Step 6: Package everything +echo -e "${YELLOW}📦 Step 6: Creating final package...${NC}" + +# Create output directory +OUTPUT_DIR="$SCRIPT_DIR/dist" +mkdir -p "$OUTPUT_DIR" + +# Copy the built plugin +PLUGIN_FILE=$(find "$RUNVSAGENT_DIR/jetbrains_plugin/build/distributions" -name "*.zip" | head -1) +if [ -f "$PLUGIN_FILE" ]; then + cp "$PLUGIN_FILE" "$OUTPUT_DIR/RunVSAgent-RooCode.zip" + echo -e "${GREEN}✅ Build successful!${NC}" + echo -e "${GREEN}📦 Plugin package created at: $OUTPUT_DIR/RunVSAgent-RooCode.zip${NC}" + echo "" + echo "To install in JetBrains IDE:" + echo "1. Open your JetBrains IDE (IntelliJ, WebStorm, PyCharm, etc.)" + echo "2. Go to Settings/Preferences → Plugins" + echo "3. Click the gear icon ⚙️ → Install Plugin from Disk..." + echo "4. Select: $OUTPUT_DIR/RunVSAgent-RooCode.zip" + echo "5. Restart your IDE" +else + echo -e "${RED}❌ Error: Could not find built plugin file${NC}" + exit 1 +fi + +echo "" +echo -e "${GREEN}🎉 Build complete! Roo Code is ready for JetBrains IDEs!${NC}" \ No newline at end of file