We want to make it easy for you to contribute to OpenCode. Here are the most common type of changes that get merged:
However, any UI or core product feature must go through a design review with the core team before implementation.
If you are unsure if a PR would be accepted, feel free to ask a maintainer or look for issues with any of the following labels:
[!NOTE] PRs that ignore these guardrails will likely be closed.
Want to take on an issue? Leave a comment and a maintainer may assign it to you unless it is something we are already working on.
Install dependencies and start the dev server from the repo root:
bun install
bun dev
By default, bun dev runs OpenCode in the packages/opencode directory. To run it against a different directory or repository:
bun dev <directory>
To run OpenCode in the root of the opencode repo itself:
bun dev .
To compile a standalone executable:
./packages/opencode/script/build.ts --single
Then run it with:
./packages/opencode/dist/opencode-<platform>/bin/opencode
Replace <platform> with your platform (e.g., darwin-arm64, linux-x64).
packages/opencode: OpenCode core business logic & server.packages/opencode/src/cli/cmd/tui/: The TUI code, written in SolidJS with opentuipackages/plugin: Source for @opencode-ai/plugin[!NOTE] If you make changes to the API or SDK (e.g.
packages/opencode/src/server/server.ts), run./script/generate.tsto regenerate the SDK and related files.
Please try to follow the style guide
Bun debugging is currently rough around the edges. We hope this guide helps you get set up and avoid some pain points.
The most reliable way to debug OpenCode is to run it manually in a terminal via bun run --inspect=<url> dev ... and attach
your debugger via that URL. Other methods can result in breakpoints being mapped incorrectly, at least in VSCode (YMMV).
Caveats:
bun dev spawn instead of
the usual bun dev. This is because bun dev runs the server in a worker thread and breakpoints might not work there.spawn does not work for you, you can debug the server separately:
bun run --inspect=ws://localhost:6499/ ./src/index.ts serve --port 4096,
then attach TUI with opencode attach http://localhost:4096bun run --inspect=ws://localhost:6499/ --conditions=browser ./src/index.tsOther tips and tricks:
--inspect-wait or --inspect-brk instead of --inspect, depending on your workflow--inspect=ws://localhost:6499/ on every invocation can be tiresome, you may want to export BUN_OPTIONS=--inspect=ws://localhost:6499/ insteadIf you use VSCode, you can use our example configurations .vscode/settings.example.json and .vscode/launch.example.json.
Some debug methods that can be problematic:
"request": "launch" can have breakpoints incorrectly mapped and thus unusableJavaScript Debug TerminalWith that said, you may want to try these methods, as they might work for you.
These are not strictly enforced, they are just general guidelines:
else statements..catch(...) instead of try/catch when possible.any.let.Bun.file() when they fit the use case.For net-new functionality, start with a design conversation. Open an issue describing the problem, your proposed approach (optional), and why it belongs in OpenCode. The core team will help decide whether it should move forward; please wait for that approval instead of opening a feature PR directly.