Welcome Contributions
The following types of changes are commonly accepted:Bug Fixes
Help us squash bugs and improve stability
LSPs & Formatters
Add support for new language servers and formatters
LLM Performance
Improvements to AI model behavior and performance
Provider Support
Support for new AI providers
Environment Fixes
Platform-specific quirks and edge cases
Documentation
Improve docs, guides, and examples
Finding Issues
Looking for something to work on? Check out these labels:help wanted- Issues where we’d love community helpgood first issue- Great starting points for new contributorsbug- Known bugs that need fixingperf- Performance improvements
Adding New Providers
New providers shouldn’t require code changes to OpenCode. First make a PR to: https://github.com/anomalyco/models.devDevelopment Setup
Requirements
- Bun 1.3 or higher
Getting Started
Install dependencies and start the dev server from the repo root:Running Against Different Directories
By default,bun dev runs OpenCode in the packages/opencode directory. To run it against a different directory:
Building a Local Binary
To compile a standalone executable:<platform> with your platform (e.g., darwin-arm64, linux-x64).
Project Structure
Core pieces of the codebase:packages/opencode- OpenCode core business logic & serverpackages/opencode/src/cli/cmd/tui/- The TUI code, written in SolidJS with opentuipackages/app- The shared web UI components, written in SolidJSpackages/desktop- The native desktop app, built with Tauripackages/plugin- Source for@opencode-ai/plugin
Development Workflows
Understanding bun dev vs opencode
Understanding bun dev vs opencode
During development,
bun dev is the local equivalent of the built opencode command. Both run the same CLI interface:Running the API Server
Running the API Server
To start the OpenCode headless API server:This starts the headless server on port 4096 by default. You can specify a different port:
Running the Web App
Running the Web App
To test UI changes during development:
-
First, start the OpenCode server:
-
Then run the web app:
Running the Desktop App
Running the Desktop App
The desktop app is a native Tauri application that wraps the web UI.To run the native desktop app:This starts the web dev server on http://localhost:1420 and opens the native window.If you only want the web dev server (no native shell):To create a production build:
Running the desktop app requires additional Tauri dependencies (Rust toolchain, platform-specific libraries). See the Tauri prerequisites for setup instructions.
Setting up a Debugger
Setting up a Debugger
Bun debugging is currently rough around the edges. 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.Caveats:- If you want to debug server code with the TUI, you might need to run
bun dev spawninstead ofbun dev - You can debug the server separately:
- Debug server:
bun run --inspect=ws://localhost:6499/ --cwd packages/opencode ./src/index.ts serve --port 4096 - Then attach TUI:
opencode attach http://localhost:4096 - Debug TUI:
bun run --inspect=ws://localhost:6499/ --cwd packages/opencode --conditions=browser ./src/index.ts
- Debug server:
- Use
--inspect-waitor--inspect-brkfor different workflows - Set
export BUN_OPTIONS=--inspect=ws://localhost:6499/to avoid repeating the flag
.vscode/settings.example.json and .vscode/launch.example.json for example configurations.If you make changes to the API or SDK (e.g.
packages/opencode/src/server/server.ts), run ./script/generate.ts to regenerate the SDK and related files.Pull Request Guidelines
Issue First Policy
Before opening a PR, open an issue describing the bug or feature. This helps maintainers triage and prevents duplicate work.- Use
Fixes #123orCloses #123in your PR description to link the issue - For small fixes, a brief issue is fine - just enough context to understand the problem
General Requirements
- Keep pull requests small and focused
- Explain the issue and why your change fixes it
- Before adding new functionality, ensure it doesn’t already exist elsewhere in the codebase
UI Changes
If your PR includes UI changes, please include screenshots or videos showing the before and after. This helps maintainers review faster.Logic Changes
For non-UI changes (bug fixes, new features, refactors), explain how you verified it works:- What did you test?
- How can a reviewer reproduce/confirm the fix?
No AI-Generated Walls of Text
Respect the maintainers’ time:- Write short, focused descriptions
- Explain what changed and why in your own words
- If you can’t explain it briefly, your PR might be too large
PR Titles
PR titles should follow conventional commit standards:feat:new feature or functionalityfix:bug fixdocs:documentation or README changeschore:maintenance tasks, dependency updates, etc.refactor:code refactoring without changing behaviortest:adding or updating tests
feat(app):feature in the app packagefix(desktop):bug fix in the desktop packagechore(opencode):maintenance in the opencode package
docs: update contributing guidelinesfix: resolve crash on startupfeat: add dark mode supportfeat(app): add dark mode supportfix(desktop): resolve crash on startupchore: bump dependency versions
Style Preferences
These are general guidelines, not strictly enforced:- Functions: Keep logic within a single function unless breaking it out adds clear reuse or composition benefits
- Destructuring: Avoid unnecessary destructuring of variables
- Control flow: Avoid
elsestatements - Error handling: Prefer
.catch(...)instead oftry/catchwhen possible - Types: Use precise types and avoid
any - Variables: Stick to immutable patterns and avoid
let - Naming: Choose concise single-word identifiers when descriptive
- Runtime APIs: Use Bun helpers such as
Bun.file()when appropriate
Feature Requests
For net-new functionality, start with a design conversation. Open an issue describing:- The problem you’re trying to solve
- Your proposed approach (optional)
- Why it belongs in OpenCode
Trust & Vouch System
This project uses vouch to manage contributor trust. The vouch list is maintained in.github/VOUCHED.td.
How it works
- Vouched users are explicitly trusted contributors
- Denounced users are explicitly blocked. Issues and pull requests from denounced users are automatically closed
- Everyone else can participate normally — you don’t need to be vouched to open issues or PRs
For maintainers
Collaborators with write access can manage the vouch list by commenting on any issue:vouch— vouch for the issue authorvouch @username— vouch for a specific userdenounce— denounce the issue authordenounce @username— denounce a specific userdenounce @username <reason>— denounce with a reasonunvouch/unvouch @username— remove someone from the list
.github/VOUCHED.td.
Denouncement Policy
Denouncement is reserved for users who repeatedly submit low-quality AI-generated contributions, spam, or otherwise act in bad faith. It is not used for disagreements or honest mistakes.Issue Requirements
All issues must use one of our issue templates:- Bug report — for reporting bugs (requires a description)
- Feature request — for suggesting enhancements (requires verification checkbox and description)
- Question — for asking questions (requires the question)
- Not using a template
- Required fields left empty or filled with placeholder text
- AI-generated walls of text
- Missing meaningful content
Community
Join the OpenCode community:- Discord - Chat with the community and maintainers
- GitHub Discussions - Ask questions and share ideas
- Twitter - Stay updated with the latest news