Skip to content

Add OpenCode plugin integration #143

Description

@jy-tan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions