Developing Oh My OpenCode itself
Perfect! Since you're developing Oh My OpenCode itself and want to test it against your OpenCode dev branch, here's how to set up your local development environment:
Development Setup for Oh My OpenCode
1. Project Structure Setup
bash
复制
# Create your development workspace
mkdir -p ~/dev/opencode-ecosystem
cd ~/dev/opencode-ecosystem
# Clone both repositories (if you haven't already)
git clone https://github.com/opencode-ai/opencode.git
git clone https://github.com/code-yeongyu/oh-my-opencode.git2. Build Your OpenCode Dev Branch
bash
复制
cd ~/dev/opencode-ecosystem/opencode
git checkout your-dev-branch # Switch to your dev branch
bun install
bun run build
# Link your dev build globally (optional but recommended for testing)
bun link
# or use local path directly3. Prepare Oh My OpenCode for Development
bash
复制
cd ~/dev/opencode-ecosystem/oh-my-opencode
bun install
# Build the plugin
bun run build4. Link Oh My OpenCode to Your Dev OpenCode
Method A: File Path Reference (Recommended for active development)
Edit your OpenCode configuration to point directly to your local Oh My OpenCode source:
bash
复制
# Edit the global config
nano ~/.config/opencode/opencode.jsonAdd the absolute file path to your local Oh My OpenCode:
JSON
复制
{
"plugin": [
"file:///home/YOUR_USERNAME/dev/opencode-ecosystem/oh-my-opencode"
],
"model": {
"default": "claude-sonnet-4-20250514"
}
}⚠️ Important: Usefile://protocol with absolute path. Relative paths may not resolve correctly.
Method B: Bun Link (Alternative)
bash
复制
cd ~/dev/opencode-ecosystem/oh-my-opencode
bun link
cd ~/dev/opencode-ecosystem/opencode
bun link oh-my-opencode # Link to your dev opencode5. Hot Reload Development Workflow
Since you're actively developing, set up a watch mode:
bash
复制
# Terminal 1: Watch and rebuild Oh My OpenCode on changes
cd ~/dev/opencode-ecosystem/oh-my-opencode
bun run build --watch # or use chokidar-cli, etc.
# Terminal 2: Run OpenCode with your dev plugin
cd ~/dev/opencode-ecosystem/opencode
bun run start # or ./dist/cli.js6. Debugging Tips
Check plugin loading:
bash
复制
# Run with verbose logging to see plugin initialization
DEBUG=opencode:* opencodeVerify config:
bash
复制
cat ~/.config/opencode/opencode.json | jq '.plugin'Test plugin functionality:
bash
复制
# Start interactive session
opencode
# In the chat, test Oh My OpenCode features:
# - /commit command
# - Enhanced prompts
# - Custom agents7. Project-Level Testing (Isolated)
If you want to test without affecting your global OpenCode config, create a project-level config:
bash
复制
cd ~/dev/opencode-ecosystem/oh-my-opencode
mkdir -p test-project
cd test-project
# Create local opencode.json
cat > opencode.json << 'EOF'
{
"plugin": ["file:///home/YOUR_USERNAME/dev/opencode-ecosystem/oh-my-opencode"],
"model": {
"default": "claude-sonnet-4-20250514"
}
}
EOF
# Run opencode from this directory - it will use local config
opencode8. Publishing Workflow (When Ready)
When you're ready to test the npm package flow:
bash
复制
cd ~/dev/opencode-ecosystem/oh-my-opencode
# Bump version
npm version patch
# Pack locally to test
npm pack
# This creates oh-my-opencode-X.X.X.tgz
# Test install from tarball
cd ~/dev/test-project
opencode plugin install ./path/to/oh-my-opencode-X.X.X.tgzQuick Reference: File Paths
| Component | Path |
|---|---|
| OpenCode Dev Branch | ~/dev/opencode-ecosystem/opencode |
| Oh My OpenCode Source | ~/dev/opencode-ecosystem/oh-my-opencode |
| Global Config | ~/.config/opencode/opencode.json |
| Project Config | ./opencode.json (in any project dir) |
Troubleshooting
Plugin not loading?
- Ensure
bun run buildcompleted without errors in oh-my-opencode - Check that
file://path is absolute and correct - Verify OpenCode version supports plugins (≥1.0.150)
Changes not reflecting?
- OpenCode may cache plugins - restart the CLI
- Ensure you're running the dev build of OpenCode, not a globally installed stable version
Import errors?
- Check that
oh-my-opencode/dist/index.jsexists and exports correctly - Verify
package.jsonhas correctmain/exportsfields
Would you like me to elaborate on any specific part of the setup, such as the build configuration or testing workflow?