Add omoa CLI command for simple toggle

This commit is contained in:
Twentyninehairs_bot 2026-05-03 21:42:53 -07:00
parent e1a965db4e
commit 8af5e523e6
Signed by: Twentyninehairs_bot
GPG Key ID: CC558AA42F05E387
2 changed files with 69 additions and 1 deletions

View File

@ -20,6 +20,7 @@ This approach:
## Files ## Files
- `omoa` — CLI command to toggle omoa on/off
- `opencode-start.sh` — Wrapper script that starts OpenCode with/without omoa - `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-post-upgrade.sh` — Removes omoa plugin from `opencode.json` after upstream install
- `omoa-toggle.mjs` — OpenCode skill for Telegram bot integration - `omoa-toggle.mjs` — OpenCode skill for Telegram bot integration
@ -30,11 +31,13 @@ This approach:
1. Copy files to `~/.config/opencode/` 1. Copy files to `~/.config/opencode/`
2. Make scripts executable: 2. Make scripts executable:
```bash ```bash
chmod +x ~/.config/opencode/omoa
chmod +x ~/.config/opencode/opencode-start.sh chmod +x ~/.config/opencode/opencode-start.sh
chmod +x ~/.config/opencode/omoa-post-upgrade.sh chmod +x ~/.config/opencode/omoa-post-upgrade.sh
``` ```
3. Symlink to PATH: 3. Symlink to PATH:
```bash ```bash
ln -sf ~/.config/opencode/omoa ~/.local/bin/omoa
ln -sf ~/.config/opencode/opencode-start.sh ~/.local/bin/opencode-start ln -sf ~/.config/opencode/opencode-start.sh ~/.local/bin/opencode-start
ln -sf ~/.config/opencode/omoa-post-upgrade.sh ~/.local/bin/omoa-post-upgrade ln -sf ~/.config/opencode/omoa-post-upgrade.sh ~/.local/bin/omoa-post-upgrade
``` ```
@ -56,7 +59,16 @@ This approach:
## Usage ## Usage
### Shell ### CLI Command (simplest)
```bash
omoa # Toggle on/off
omoa on # Enable
omoa off # Disable
omoa status # Check status
```
### Shell (start server directly)
```bash ```bash
# Start without omoa (vanilla) # Start without omoa (vanilla)

56
omoa Executable file
View File

@ -0,0 +1,56 @@
#!/bin/bash
# =============================================================================
# omoa — Toggle oh-my-openagent on/off
# =============================================================================
#
# PURPOSE:
# Simple CLI command to toggle oh-my-openagent on/off.
# Creates or deletes the state file, then restarts the OpenCode server.
#
# USAGE:
# omoa — Toggle omoa (enable if disabled, disable if enabled)
# omoa on — Enable omoa
# omoa off — Disable omoa
# omoa status — Check if omoa is enabled
#
# UPSTREAM REPO:
# https://git.hibbhome.com/Hibbhome/opencode-omoa-toggle
#
# CREATED: 2026-05-03
# =============================================================================
STATE_FILE="$HOME/.config/opencode/omoa-enabled"
case "${1:-toggle}" in
on|enable)
touch "$STATE_FILE"
systemctl --user restart opencode-serve.service
echo "oh-my-openagent ENABLED. Server restarting..."
;;
off|disable)
rm -f "$STATE_FILE"
systemctl --user restart opencode-serve.service
echo "oh-my-openagent DISABLED. Server restarting..."
;;
status)
if [ -f "$STATE_FILE" ]; then
echo "oh-my-openagent is ENABLED"
else
echo "oh-my-openagent is DISABLED"
fi
;;
toggle)
if [ -f "$STATE_FILE" ]; then
rm -f "$STATE_FILE"
systemctl --user restart opencode-serve.service
echo "oh-my-openagent DISABLED. Server restarting..."
else
touch "$STATE_FILE"
systemctl --user restart opencode-serve.service
echo "oh-my-openagent ENABLED. Server restarting..."
fi
;;
*)
echo "Usage: omoa [on|off|status|toggle]"
;;
esac