110 lines
3.1 KiB
Markdown

# OpenCode omoa Toggle
Toggle the [oh-my-openagent](https://github.com/code-yeongyu/oh-my-openagent) plugin for OpenCode.
## Purpose
oh-my-openagent adds multi-model orchestration, LSP tools, and other advanced features to OpenCode. However, it can interfere with normal operation. This tool provides a simple way to enable/disable it **without modifying the config file**.
## How It Works
The solution uses:
1. **State file** (`~/.config/opencode/omoa-enabled`) — determines if omoa should be active
2. **`OPENCODE_CONFIG_CONTENT` environment variable** — injects the plugin at runtime (higher precedence than config file)
3. **Post-upgrade script** — removes plugin entry from `opencode.json` after running upstream installer
This approach:
- Keeps `opencode.json` clean (no plugin entry)
- Is compatible with upstream install script
- No file mutation, no backups, no restore
## Files
- `omoa` — CLI command to toggle omoa on/off
- `opencode-start.sh` — Wrapper script that starts OpenCode with/without omoa
- `omoa-post-upgrade.sh` — Removes omoa plugin from `opencode.json` after upstream install
- `omoa.mjs` — Unified OpenCode skill for all omoa operations (toggle, status, post-upgrade)
- `git-ops.mjs` — OpenCode skill for git operations with Hibbhome Gitea server
- `opencode-setup.mjs` — OpenCode skill documenting the full system architecture
- `README.md` — This file
## Installation
1. Copy files to `~/.config/opencode/`
2. Make scripts executable:
```bash
chmod +x ~/.config/opencode/omoa
chmod +x ~/.config/opencode/opencode-start.sh
chmod +x ~/.config/opencode/omoa-post-upgrade.sh
```
3. Symlink to PATH:
```bash
ln -sf ~/.config/opencode/omoa ~/.local/bin/omoa
ln -sf ~/.config/opencode/opencode-start.sh ~/.local/bin/opencode-start
ln -sf ~/.config/opencode/omoa-post-upgrade.sh ~/.local/bin/omoa-post-upgrade
```
4. Update systemd service to use wrapper:
```ini
[Service]
ExecStart=/home/kenny/.config/opencode/opencode-start.sh
```
5. Add skill to `opencode.json`:
```json
"skills": {
"omoa": {
"description": "Manage oh-my-openagent (toggle, status, post-upgrade)",
"path": "/home/kenny/.config/opencode/skills/omoa.mjs"
}
}
```
6. Restart services
## Usage
### CLI Command (simplest)
```bash
omoa # Toggle on/off
omoa on # Enable
omoa off # Disable
omoa status # Check status
```
### Shell (start server directly)
```bash
# Start without omoa (vanilla)
opencode-start
# Start with omoa enabled
opencode-start --omoa
# After running upstream install script
omoa-post-upgrade
```
### Telegram Bot
Use `/commands` → `omoa`:
- `omoa_status` — Check if omoa is enabled
- `omoa_enable` — Enable omoa
- `omoa_disable` — Disable omoa
- `omoa_toggle` — Toggle omoa on/off
- `omoa_post_upgrade` — Clean opencode.json after upstream install
### After Upstream Updates
When you run the upstream install script:
```bash
npx oh-my-openagent@latest install
omoa-post-upgrade # Clean the plugin entry from opencode.json
```
## Author
Kenny Hibbhome
## Created
2026-05-03