Follow-up to #141. OpenCode exposes a tool.execute.before plugin hook that can block or rewrite bash tool calls - same shape as the existing Claude (fence hooks install --claude) and Cursor (fence hooks install --cursor) integrations.
Current scope:
- Add
fence hooks {print,install,uninstall} --opencode and a --opencode-pre-tool-use hidden helper, paralleling cmd/fence/hooks_claude.go / hooks_cursor.go / hooks_runtime.go.
- Ship a small companion npm plugin (
@use-tusk/opencode-fence-plugin, ~50 LoC) that calls into the helper and rewrites the command to fence -c "<command>" (or throws on a hard deny).
- Add
--settings / --template support, mirroring the Claude/Cursor flags.
- Update
docs/agents.md hooks section to list OpenCode.
Future:
User-typed !-prefixed commands bypass tool.execute.before and only fire the post-hoc event hook (which can't block), see #141. Once OpenCode fixes that, the same plugin will cover both paths with no changes. Plugin README should clearly state the !-command caveat until then.
Follow-up to #141. OpenCode exposes a
tool.execute.beforeplugin hook that can block or rewritebashtool calls - same shape as the existing Claude (fence hooks install --claude) and Cursor (fence hooks install --cursor) integrations.Current scope:
fence hooks {print,install,uninstall} --opencodeand a--opencode-pre-tool-usehidden helper, parallelingcmd/fence/hooks_claude.go/hooks_cursor.go/hooks_runtime.go.@use-tusk/opencode-fence-plugin, ~50 LoC) that calls into the helper and rewrites the command tofence -c "<command>"(or throws on a hard deny).--settings/--templatesupport, mirroring the Claude/Cursor flags.docs/agents.mdhooks section to list OpenCode.Future:
User-typed
!-prefixed commands bypasstool.execute.beforeand only fire the post-hoceventhook (which can't block), see #141. Once OpenCode fixes that, the same plugin will cover both paths with no changes. Plugin README should clearly state the!-command caveat until then.