This directory contains the JetBrains plugin implementation for Kilo Code, including both the IntelliJ plugin (Kotlin) and the Extension Host (Node.js/TypeScript).
Before building the JetBrains plugin, ensure all dependencies are properly configured. Use the provided dependency check script to verify your setup.
-
Required Version: Java 21 (LTS)
-
Why: The plugin build system requires Java 21 for compilation and runtime compatibility
-
Recommended Installation (SDKMAN - works on macOS/Linux):
# Install SDKMAN curl -s "https://get.sdkman.io" | bash source ~/.sdkman/bin/sdkman-init.sh # Install and use Java 21 sdk install java 21.0.5-tem sdk use java 21.0.5-tem
-
Alternative Installation:
- Location:
deps/vscode/ - Purpose: Provides VSCode runtime dependencies and APIs for the Extension Host
- Initialization: Must be initialized before building
- Node.js: Version 20.x (as specified in package.json)
- pnpm: For workspace management and dependency installation
The dependency check runs automatically as part of the build process, but you can also run it manually:
# Run dependency check manually
./jetbrains/scripts/check-dependencies.sh
# Or as part of JetBrains host build process
cd jetbrains/host && pnpm run deps:checkNote: The dependency check is automatically integrated into the Turbo build system and runs before JetBrains builds to ensure all dependencies are properly configured.
- "Unsupported class file major version 68": Install Java 21
- "slice is not valid mach-o file": Rebuild native modules
- "platform.zip file does not exist": Generate platform files
If you prefer to set up dependencies manually:
# From project root
git submodule update --init --recursivejava -version
# Should show Java 21.x.x
javac -version
# Should show javac 21.x.x# From project root
pnpm installjetbrains/
├── host/ # Extension Host (Node.js/TypeScript)
│ ├── src/ # TypeScript source code
│ ├── package.json # Node.js dependencies
│ ├── tsconfig.json # TypeScript configuration
│ └── turbo.json # Turbo build configuration
├── plugin/ # IntelliJ Plugin (Kotlin/Java)
│ ├── src/main/kotlin/ # Kotlin source code
│ ├── src/main/resources/ # Plugin resources and themes
│ ├── build.gradle.kts # Gradle build configuration
│ ├── gradle.properties # Plugin version and platform settings
│ ├── genPlatform.gradle # VSCode platform generation
│ └── scripts/ # Build and utility scripts
├── resources/ # Runtime resources (generated)
└── README.md # This file
The plugin supports three build modes controlled by the debugMode property:
./gradlew prepareSandbox -PdebugMode=idea- Used for local development and debugging
- Creates
.envfile for Extension Host - Copies theme resources to debug location
- Enables hot-reloading for VSCode plugin integration
./gradlew prepareSandbox -PdebugMode=release- Used for production builds
- Requires
platform.zipfile (generated viagenPlatformtask) - Creates fully self-contained deployment package
- Includes all runtime dependencies and node_modules
./gradlew prepareSandbox- Used for testing and CI
- Minimal resource preparation
- No VSCode runtime dependencies
- Suitable for static analysis and unit tests
# From project root
pnpm jetbrains:run
# Or manually:
cd jetbrains/plugin
./gradlew runIde -PdebugMode=idea# Generate platform files first (if needed)
cd jetbrains/plugin
./gradlew genPlatform
# Build plugin
./gradlew buildPlugin -PdebugMode=release# From jetbrains/host directory
pnpm build
# Or with Turbo from project root
pnpm --filter @kilo-code/jetbrains-host buildThe project uses Turborepo for efficient builds and caching:
jetbrains:bundle: Builds the complete plugin bundlejetbrains:run-bundle: Runs the plugin with bundle modejetbrains:run: Runs the plugin in development mode
Turbo automatically handles:
- VSCode submodule initialization (
deps:check) - Dependency patching (
deps:patch) - Build caching and parallelization
Problem: Build fails with "Unsupported class file major version 68" or similar Java version errors Root Cause: Running Java 24+ instead of required Java 21
Solution:
# Install SDKMAN if not already installed
curl -s "https://get.sdkman.io" | bash
source ~/.sdkman/bin/sdkman-init.sh
# Install and use Java 21
sdk install java 21.0.5-tem
sdk use java 21.0.5-tem
# Make Java 21 default (optional)
sdk default java 21.0.5-tem
# Verify version
java -version # Should show OpenJDK 21.x.x# Install Java 21
brew install openjdk@21
# Set JAVA_HOME for current session
export JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home
# Add to shell profile for persistence
echo 'export JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home' >> ~/.zshrc
# Verify version
java -version# Find Java 21 installation
/usr/libexec/java_home -V
# Set JAVA_HOME to Java 21 path
export JAVA_HOME=$(/usr/libexec/java_home -v 21)Problem: Build fails with missing VSCode dependencies Solution:
# Initialize submodule
git submodule update --init --recursive
# Verify submodule is populated
ls deps/vscode/src # Should contain VSCode source filesProblem: Release build fails with "platform.zip file does not exist" Solution:
cd jetbrains/plugin
./gradlew genPlatform # This will download and generate platform.zipProblem: Extension Host build fails with Node.js compatibility errors Solution:
# Use Node.js 20.x
nvm use 20 # if using nvm
# or
node --version # should show v20.x.xProblem: Plugin fails to load with "slice is not valid mach-o file" errors for native modules like @vscode/spdlog or native-watchdog
Root Cause: Native Node.js modules were compiled for wrong CPU architecture (e.g., x86_64 vs ARM64)
Solution:
# Navigate to resources directory and rebuild native modules
cd jetbrains/resources
# Clean existing modules
rm -rf node_modules package-lock.json
# Copy package.json from host
cp ../host/package.json .
# Install dependencies with npm (not pnpm to avoid workspace conflicts)
npm install
# Verify native modules are built for correct architecture
file node_modules/@vscode/spdlog/build/Release/spdlog.node
file node_modules/native-watchdog/build/Release/watchdog.node
# Should show "Mach-O 64-bit bundle arm64" on Apple Silicon or appropriate arch
# Update production dependency list
cd ../plugin
npm ls --omit=dev --all --parseable --prefix ../resources > ./prodDep.txt
# Rebuild plugin
./gradlew buildPlugin -PdebugMode=nonePrevention: When updating dependencies or switching architectures, always rebuild native modules in the jetbrains/resources/ directory.
Problem: Gradle tasks fail or hang Solution:
# Clean and rebuild
./gradlew clean
./gradlew build --refresh-dependencies
# Check Gradle daemon
./gradlew --stop
./gradlew build- Initial Setup: Dependencies are automatically checked when you run any JetBrains build command
- Development: Use
pnpm jetbrains:runfor live development (includes automatic dependency check) - Testing: Build with
debugMode=nonefor CI/testing - Release: Generate platform files and build with
debugMode=release
Automatic Dependency Management: The build system now automatically verifies and sets up all required dependencies (Java 21, VSCode submodule, Node.js, etc.) before each build, ensuring a smooth development experience.
The plugin respects these environment variables:
JAVA_HOME: Java installation directorydebugMode: Build mode (idea/release/none)vscodePlugin: Plugin name (default: kilocode)vscodeVersion: VSCode version for platform generation (default: 1.100.0)
The plugin supports multiple platforms through the platform generation system:
- Windows: x64
- macOS: x64 and ARM64 (Apple Silicon)
- Linux: x64
Platform-specific dependencies are automatically handled during the build process.
Multi-Architecture Support: The platform generation system now includes enhanced architecture-aware native module handling, automatically creating runtime loaders that detect the current platform and load the correct native modules for each architecture.
When making changes to the JetBrains plugin:
- Ensure all dependencies are properly set up
- Test in development mode first (
debugMode=idea) - Verify builds work in all three modes
- Update this README if adding new dependencies or requirements
- Run the dependency check script to validate setup
jetbrains/scripts/check-dependencies.sh: Comprehensive dependency verification and setupjetbrains/plugin/scripts/sync_version.js: Version synchronization utility
For more detailed build information, see the individual package.json and build.gradle.kts files in the respective directories.