Welcome to the Kilo Code development guide! This document will help you set up your development environment and understand how to work with the codebase. Whether you're fixing bugs, adding features, or just exploring the code, this guide will get you started.
Before you begin, choose one of the following development environment options:
Note for Windows Contributors: If you're having issues with WSL or want a standardized development environment, we recommend using the devcontainer option. It provides the exact same environment as our Nix flake configuration but works seamlessly on Windows without WSL.
Fork and Clone the Repository:
Clone Your Fork:
git clone https://github.com/[YOUR-USERNAME]/kilocode.git
cd kilocode
Replace [YOUR-USERNAME] with your actual GitHub username.
Install dependencies:
pnpm install
This command will install dependencies for the main extension, webview UI, and e2e tests.
Install VSCode Extensions:
While not strictly necessary for running the extension, these extensions are recommended for development:
The full list of recommended extensions is here
Prerequisites:
Fork and Clone the Repository (same as above)
Open in Devcontainer:
Dev Containers: Reopen in ContainerStart Development:
Prerequisites:
Fork and Clone the Repository (same as above)
Setup Development Environment:
cd kilocode
direnv allow
The project includes a .envrc file that automatically loads the Nix flake environment when you enter the directory. This provides:
.nvmrc)Install Project Dependencies:
pnpm install
Install VSCode Extensions (same as native development setup above)
Start Development:
nix develop - direnv handles this automaticallyThe project is organized into several key directories:
src/ - Core extension code
core/ - Core functionality and toolsservices/ - Service implementationswebview-ui/ - Frontend UI codee2e/ - End-to-end testsscripts/ - Utility scriptsassets/ - Static assets like images and iconsTo run the extension in development mode:
F5 (or select Run → Start Debugging) in VSCodeIn development mode (NODE_ENV="development"), changing the core code will trigger a workbench.action.reloadWindow command, so it is no longer necessary to manually start/stop the debugger and tasks.
Important: In production builds, when making changes to the core extension, you need to:
- Stop the debugging process
- Kill any npm tasks running in the background (see screenshot below)
- Start debugging again
To build a production-ready .vsix file:
pnpm build
This will:
.vsix file in the bin/ directoryTo install your built extension:
code --install-extension "$(ls -1v bin/kilo-code-*.vsix | tail -n1)"
Replace [version] with the current version number.
Kilo Code uses several types of tests to ensure quality:
Run unit tests with:
pnpm test
This runs both extension and webview tests.
For more details on E2E tests, see apps/vscode-e2e.
Ensure your code meets our quality standards:
pnpm lint # Run ESLint
pnpm check-types # Run TypeScript type checking
This project uses Husky to manage Git hooks, which automate certain checks before commits and pushes. The hooks are located in the .husky/ directory.
Before a commit is finalized, the .husky/pre-commit hook runs:
main branch.pnpm --filter kilo-code generate-types.src/exports/roo-code.d.ts by the type generation are staged.lint-staged to lint and format staged files.Before changes are pushed to the remote repository, the .husky/pre-push hook runs:
main branch.pnpm run check-types to ensure typing is correct..changeset/ and reminds you to create one using npm run changeset if necessary.These hooks help maintain code quality and consistency. If you encounter issues with commits or pushes, check the output from these hooks for error messages.
pnpm installconsole.log() statements in your code for debuggingTo test the extension against a local Kilo Code backend:
http://localhost:3000This automatically sets the KILOCODE_BACKEND_BASE_URL environment variable, making all sign-in/sign-up buttons point to your local backend instead of production.
We welcome contributions to Kilo Code! Here's how you can help:
Your contributions are welcome! For questions or ideas, please join our Discord server: https://discord.gg/Ja6BkfyTzJ
We look forward to your contributions and feedback!