Table of Contents
- Code of Conduct
- Getting Started
- Project Structure
- Development Workflow
- Making Changes
- Pull Request Process
- Getting Help
Code of Conduct
Be respectful, inclusive, and constructive. We’re all here to make better tools together.Language Policy
English is the primary language for all communications in this repository. This includes:- Issues and bug reports
- Pull requests and code reviews
- Documentation and comments
- Discussions and community interactions
Need Help with English?If English isn’t your first language, don’t worry! We value your contributions regardless of perfect grammar. You can:
- Use translation tools to help compose messages
- Ask for help from other community members
- Focus on clear, simple communication rather than perfect prose
Getting Started
Prerequisites
- Bun (latest version) - The only supported package manager
- TypeScript 5.7.3+ - For type checking and declarations
- OpenCode 1.0.150+ - For testing the plugin
Development Setup
Testing Your Changes Locally
After making changes, you can test your local build in OpenCode:- Build the project:
- Update your OpenCode config (
~/.config/opencode/opencode.jsonoropencode.jsonc):
/Users/yourname/projects/oh-my-opencode:
- Restart OpenCode to load the changes.
- Verify the plugin is loaded by checking for OmO agent availability or startup messages.
Project Structure
Where to look for specific tasks
Where to look for specific tasks
| Task | Location | Notes |
|---|---|---|
| Add new agent | src/agents/ + src/agents/builtin-agents/ | Follow createXXXAgent factory pattern |
| Add new hook | src/hooks/{name}/ + register in src/plugin/hooks/create-*-hooks.ts | Match event type to tier |
| Add new tool | src/tools/{name}/ + register in src/plugin/tool-registry.ts | Follow createXXXTool factory |
| Add new feature module | src/features/{name}/ | Standalone module, wire in plugin/ |
| Add new MCP | src/mcp/ + register in createBuiltinMcps() | Remote HTTP only |
| Add new skill | src/features/builtin-skills/skills/ | Implement BuiltinSkill interface |
| Add new command | src/features/builtin-commands/ | Template in templates/ |
| Add new CLI command | src/cli/cli-program.ts | Commander.js subcommand |
| Modify config schema | src/config/schema/ + update root schema | Zod v4, add to OhMyOpenCodeConfigSchema |
Development Workflow
Build Commands
Code Style & Conventions
| Convention | Rule |
|---|---|
| Package Manager | Bun only (bun run, bun build, bunx) |
| Types | Use bun-types, not @types/node |
| Directory Naming | kebab-case (ast-grep/, claude-code-hooks/) |
| File Operations | Never use bash commands (mkdir/touch/rm) for file creation in code |
| Tool Structure | Each tool: index.ts, types.ts, constants.ts, tools.ts, utils.ts |
| Hook Pattern | createXXXHook(input: PluginInput) function naming |
| Exports | Barrel pattern (export * from "./module" in index.ts) |
| Tests | Given/When/Then style (not Arrange-Act-Assert) |
Making Changes
Adding a New Agent
- Create a new
.tsfile insrc/agents/ - Define the agent configuration following existing patterns
- Add to
builtinAgentsinsrc/agents/index.ts - Update
src/agents/types.tsif needed - Run
bun run build:schemato update the JSON schema
Adding a New Hook
- Create a new directory in
src/hooks/(kebab-case) - Implement
createXXXHook()function returning event handlers - Export from
src/hooks/index.ts - Register in appropriate
create-*-hooks.tsfile
Adding a New Tool
- Create a new directory in
src/tools/with required files:index.ts- Main exportstypes.ts- TypeScript interfacesconstants.ts- Constants and tool descriptionstools.ts- Tool implementationsutils.ts- Helper functions
- Add to
builtinToolsinsrc/tools/index.ts - Register in
src/plugin/tool-registry.ts
Adding a New MCP Server
- Create configuration in
src/mcp/ - Add to
src/mcp/index.ts - Document in README if it requires external setup
Built-in MCPs are remote HTTP servers only. For stdio MCPs, use skills or user configuration.
Pull Request Process
- Fork the repository and create your branch from
dev - Make changes following the conventions above
- Build and test locally:
- Test in OpenCode using the local build method described above
- Commit with clear, descriptive messages:
- Use present tense (“Add feature” not “Added feature”)
- Reference issues if applicable (“Fix #123”)
- Push to your fork and create a Pull Request
- Describe your changes clearly in the PR description
PR Checklist
- Code follows project conventions
-
bun run typecheckpasses -
bun run buildsucceeds -
bun testpasses - Tested locally with OpenCode
- Updated documentation if needed (README, AGENTS.md)
- No version changes in
package.json
The CI system runs tests in two modes:
- Isolated: Mock-heavy tests run separately
- Batch: All other tests run together
Publishing
Important: Publishing is handled exclusively through GitHub Actions. Maintainers use GitHub Actions workflow_dispatch:Getting Help
- Project Knowledge: Check
AGENTS.mdfor detailed project documentation - Code Patterns: Review existing implementations in
src/ - Issues: Open an issue for bugs or feature requests
- Discussions: Start a discussion for questions or ideas
- Discord: Join the community server for real-time help
Development Tips
Logger Usage
Logger writes to/tmp/oh-my-opencode.log. Check there for debugging:
Testing Strategy
The project uses Bun’s test framework with given/when/then style:Never use “Arrange-Act-Assert” comments. Use describe blocks with
#given/#when/#then prefixes instead.Multi-Level Config System
Configuration follows this priority:Model Resolution
3-step resolution process:- Override (in config)
- Category default
- Provider fallback
- System default
src/config/schema/ for full schema definition.