|
|
4 maanden geleden | |
|---|---|---|
| .. | ||
| host | 5 maanden geleden | |
| plugin | 4 maanden geleden | |
| scripts | 5 maanden geleden | |
| .gitignore | 5 maanden geleden | |
| README.md | 5 maanden geleden | |
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.
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 17
sdk install java 17.0.12-tem
sdk use java 17.0.12-tem
Alternative Installation:
deps/vscode/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:check
Note: The dependency check is automatically integrated into the Turbo build system and runs before JetBrains builds to ensure all dependencies are properly configured.
If you prefer to set up dependencies manually:
# From project root
git submodule update --init --recursive
java -version
# Should show Java 17.x.x
javac -version
# Should show javac 17.x.x
# From project root
pnpm install
jetbrains/
├── 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:
debugMode=idea)./gradlew prepareSandbox -PdebugMode=idea
.env file for Extension HostdebugMode=release)./gradlew prepareSandbox -PdebugMode=release
platform.zip file (generated via genPlatform task)debugMode=none, default)./gradlew prepareSandbox
# 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 build
The 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 modeTurbo automatically handles:
deps:check)deps:patch)Problem: Build fails with "Unsupported class file major version 68" or similar Java version errors Root Cause: Running Java 24+ instead of required Java 17
Solution:
# Install SDKMAN if not already installed
curl -s "https://get.sdkman.io" | bash
source ~/.sdkman/bin/sdkman-init.sh
# Install and use Java 17
sdk install java 17.0.12-tem
sdk use java 17.0.12-tem
# Make Java 17 default (optional)
sdk default java 17.0.12-tem
# Verify version
java -version # Should show OpenJDK 17.x.x
# Install Java 17
brew install openjdk@17
# Set JAVA_HOME for current session
export JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home
# Add to shell profile for persistence
echo 'export JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home' >> ~/.zshrc
# Verify version
java -version
# Find Java 17 installation
/usr/libexec/java_home -V
# Set JAVA_HOME to Java 17 path
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
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 files
Problem: Release build fails with "platform.zip file does not exist" Solution:
cd jetbrains/plugin
./gradlew genPlatform # This will download and generate platform.zip
Problem: 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.x
Problem: 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=none
Prevention: 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
pnpm jetbrains:run for live development (includes automatic dependency check)debugMode=none for CI/testingdebugMode=releaseAutomatic Dependency Management: The build system now automatically verifies and sets up all required dependencies (Java 17, 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:
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:
debugMode=idea)jetbrains/scripts/check-dependencies.sh: Comprehensive dependency verification and setupjetbrains/plugin/scripts/sync_version.js: Version synchronization utilityFor more detailed build information, see the individual package.json and build.gradle.kts files in the respective directories.