Skip to content

feat(opencode): add OpenCode plugin support#31

Open
growwithsmc wants to merge 1 commit into
TwoWells:mainfrom
growwithsmc:opencode-plugin
Open

feat(opencode): add OpenCode plugin support#31
growwithsmc wants to merge 1 commit into
TwoWells:mainfrom
growwithsmc:opencode-plugin

Conversation

@growwithsmc

Copy link
Copy Markdown

Summary

Adds Catenary LSP integration for OpenCode via a JavaScript plugin.

Changes

Rust source patches:

  • HostFormat::Opencode enum variant in src/cli/mod.rs — maps to --format=opencode CLI flag
  • OpenCode payload extractors in src/cli/hooks.rs — reads tool_name, tool_input, cwd, session_id from OpenCode's hook context shape
  • format_deny / format_stop_block / format_system_message for OpenCode JSON response shape
  • InstallHost::Opencode + run_install_opencode in src/main.rs and src/cli/install.rs — installs plugin to ~/.config/opencode/plugin/catenary.mjs

Plugin (plugins/catenary-opencode/catenary.mjs):

  • Hooks: tracks file edits via tool.execute.before, triggers diagnostics via tool.execute.after
  • catenary-grep — LSP-powered semantic search
  • catenary-glob — filesystem browse with LSP symbol outlines
  • catenary-sed — LSP-aware find-and-replace with preview
  • catenary-diagnostics — pull diagnostics for all session-tracked files
  • catenary-doctor — LSP server health check (works on all platforms including Windows without daemon)

Platform notes

  • Unix / WSL with daemon: full LSP features via catenary grep/glob/sed/diagnostics
  • Windows without daemon: hook IPC silently degrades; catenary-doctor always works; other tools show helpful fallback messages. Set CATENARY_WSL=true to route through WSL for full features.
  • Pre-built Windows binary: compatible — plugin uses --format=claude for hook IPC

Testing

  • cargo build --release succeeds on Linux (WSL)
  • Plugin syntax validated (node --check)
  • catenary doctor works on Windows (pre-built binary)
  • All 12 new unit tests pass (cargo test extract_shell_command_opencode*, etc.)

…num (src/cli/mod.rs)\n- Patch hook extractors: session_id, cwd, tool_name, file_path, shell command (src/cli/hooks.rs)\n- Patch format_deny, format_stop_block, format_system_message for OpenCode JSON shape\n- Add OpenCode to InstallHost enum (src/main.rs)\n- Add run_install_opencode: installs plugin to ~/.config/opencode/plugin/ (src/cli/install.rs)\n- Add plugins/catenary-opencode/catenary.mjs: LSP integration with catenary-grep, catenary-glob, catenary-sed, catenary-diagnostics, catenary-doctor tools\n- OpenCode plugin uses --format=claude for hook IPC (compatible with pre-built binary)\n- On Windows without WSL: grep/glob/sed/diagnostics fall back gracefully; catenary-doctor always works\n- On Unix or with CATENARY_WSL=true: full daemon-powered LSP features\n\nTested:\n- cargo build --release succeeds on Linux (WSL)\n- Plugin syntax validated with node --check\n- catenary doctor works on Windows (pre-built binary)\n
@github-actions

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


patch seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant