OpenCode plugin focused on one workflow: check backup logs over SSH and decide if an alert is a false positive.
yarn installyarn symlinkyarn symlink does all of this:
- rebuilds plugin (
dist/index.js) - links
src/agents/*.md->~/.config/opencode/agents/ - links
src/skills/*/->~/.config/opencode/skills/ - links
src/commands/*.md->~/.config/opencode/commands/ - copies project
opencode.jsonto~/.config/opencode/opencode.json - rewrites global
pluginpath to this repo build (file:///.../dist/index.js)
python3 -c "import json, pathlib; p=pathlib.Path.home()/'.config/opencode/opencode.json'; print('config:', p); print('plugin:', json.loads(p.read_text()).get('plugin'))"Expected: plugin path includes this repo and ends with /dist/index.js.
Define SSH aliases in ~/.ssh/config. Keep jump-chain logic in SSH config, not in prompts.
Example:
Host first-jump
HostName first.jump.company
User your-user
Host second-jump
HostName 20.76.46.5
User your-user
ProxyJump first-jump
Host db-prod-1
HostName 10.10.10.21
User your-user
ProxyJump second-jumpssh db-prod-1 'echo ok'Expected: command succeeds and prints ok.
Recommended launch command (ensures env var is present for that OpenCode process):
OPS_SSH_ALLOWED_TARGETS="db-prod-1,db-prod-2" opencodeIf you prefer a permanent shell variable instead:
echo 'export OPS_SSH_ALLOWED_TARGETS="db-prod-1,db-prod-2"' >> ~/.zshrc
source ~/.zshrc
opencodeTool name:
ops_check_backup_log
Example instruction:
- "Run
ops_check_backup_logwithsshTarget=db-prod-1andlogFilePath=/path/to/backup.log"
Arguments:
sshTarget(required): SSH alias from~/.ssh/configlogFilePath(required): absolute remote pathokPattern(optional): text meaning false alert (default:ok)timeoutMs(optional): SSH timeout in ms (default:15000)maxBytes(optional): max bytes read from log file (default:32768)
The tool returns one of:
false alert -> safe to closelog is empty -> continue incident processpattern not found -> needs manual review
It also returns a small log preview and SSH stderr (if available).
- No passwords or tokens are stored by this plugin.
- Authentication is delegated to your existing VPN + SSH setup.
- Access is restricted by
OPS_SSH_ALLOWED_TARGETSallowlist. - If allowlist is missing or target is not listed, the tool fails closed.
Target "..." is not allowed-> updateOPS_SSH_ALLOWED_TARGETSFailed to check backup log+ SSH error -> verify VPN, jump hosts, and SSH alias- Tool missing in OpenCode -> run
yarn symlinkagain, then repeat step 3
Follow your company and customer security rules before automating operations.