From 8af5e523e6d7efb77cab9a6d8540de9d41bca29f Mon Sep 17 00:00:00 2001 From: Twentyninehairs_bot Date: Sun, 3 May 2026 21:42:53 -0700 Subject: [PATCH] Add omoa CLI command for simple toggle --- README.md | 14 +++++++++++++- omoa | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100755 omoa diff --git a/README.md b/README.md index b948b7d..881de44 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ This approach: ## 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-toggle.mjs` — OpenCode skill for Telegram bot integration @@ -30,11 +31,13 @@ This approach: 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 ``` @@ -56,7 +59,16 @@ This approach: ## 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 # Start without omoa (vanilla) diff --git a/omoa b/omoa new file mode 100755 index 0000000..74df4ac --- /dev/null +++ b/omoa @@ -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