4 Commits

Author SHA1 Message Date
liamdmcgarrigle 207637a9e0 Merge main; rework OpenCode plugin for desktop/CLI loading and one-line install
Fixes Node (desktop app) loading, derives hook matchers from hooks.json, self-registers skills via the config hook, and splits install docs into CLI and desktop paths.
2026-08-21 18:22:52 -04:00
Wayne Simpson c16a13b83b fix: handle MCP tool output shape in tool.execute.after
OpenCode passes different output object shapes to tool.execute.after
depending on tool type: built-in tools get { output: string }, but MCP
tools get { content: [{type, text}] } (raw MCP CallResult).

The previous code used output.output += '...' which silently failed for
MCP tools because output.output is undefined. The fix adds:

- appendToOutput() helper that detects the shape and appends text to
  whichever field exists (output.output for built-in, output.content
  array for MCP)
- runHook() using spawnSync instead of BunShell ($) for reliable hook
  script execution inside OpenCode's plugin context
- realpathSync for symlink-safe path resolution
- Updated README with MCP output shape documentation

Tested: system prompt injection and tool result reminders both verified
working with n8n MCP tools (search_nodes, get_node_types).
2026-07-23 02:18:05 +01:00
Wayne Simpson ffd9f37548 fix: remove em-dashes per CLAUDE.md style rule
Replace all em-dashes in new files with colons or parentheses.
CLAUDE.md line 35 explicitly forbids em-dashes.

Reported by cubic-dev-ai bot on PR #39.
2026-07-23 01:20:00 +01:00
Wayne Simpson 3822e35ab9 feat: add OpenCode plugin support
Add an opencode/ directory with a TypeScript plugin that bridges the
existing bash hooks into OpenCode's plugin event system, achieving
feature parity with the Claude Code and Codex plugins.

- opencode/plugin.ts: bridges SessionStart, PreToolUse, and PostToolUse
  hooks into OpenCode's experimental.chat.system.transform,
  experimental.session.compacting, and tool.execute.after events
- opencode/README.md: installation instructions for OpenCode users
- README.md: add OpenCode section under Install
- CLAUDE.md: add opencode/ to repo structure

The plugin is glue code only. All hook logic (node-specific warnings,
antipattern detection, skill routing) stays in the existing hooks/ bash
scripts. Uses relative path resolution via import.meta.dir so it works
regardless of clone location. Tool name matching is flexible since MCP
server names are user-configurable in OpenCode.
2026-07-23 01:14:36 +01:00