Twentyninehairs_bot e1a965db4e
Consolidate to single code path with state file approach
- opencode-start.sh: checks for state file, injects omoa via OPENCODE_CONFIG_CONTENT
- omoa-post-upgrade.sh: removes omoa plugin from opencode.json after upstream install
- omoa-toggle.mjs: single Telegram skill to toggle on/off/status
- No file mutation of opencode.json, compatible with upstream updates
2026-05-03 21:37:33 -07:00

94 lines
2.5 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
- `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-toggle.mjs` — OpenCode skill for Telegram bot integration
- `README.md` — This file
## Installation
1. Copy files to `~/.config/opencode/`
2. Make scripts executable:
```bash
chmod +x ~/.config/opencode/opencode-start.sh
chmod +x ~/.config/opencode/omoa-post-upgrade.sh
```
3. Symlink to PATH:
```bash
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-toggle": {
"description": "Toggle oh-my-openagent on/off",
"path": "/home/kenny/.config/opencode/skills/omoa-toggle.mjs"
}
}
```
6. Restart services
## Usage
### Shell
```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_toggle`:
- `on` — Enable omoa (creates state file, restarts server)
- `off` — Disable omoa (deletes state file, restarts server)
- `status` — Check if omoa is enabled
### 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