opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(opencode) plugin commands

Open dev4s opened this issue 5 days ago • 3 comments

feat: Plugin Commands - Allow plugin tools to be exposed as slash commands

Summary

This PR adds a new experimental feature that allows plugin tools to optionally appear as slash commands in the autocomplete, with support for direct execution (without AI processing).

Problem

Currently, plugin tools can only be invoked by the AI. Users cannot directly invoke plugin functionality from the command input without going through the AI, which:

  • Adds latency and token costs for simple operations
  • Requires AI involvement for tasks that don't need it
  • Limits plugin utility for status checks, statistics, and other quick queries

Backwards Compatibility

  • Fully backwards compatible - Existing plugins work unchanged
  • command defaults to false, so existing tools remain AI-only
  • Feature is behind experimental.pluginCommands flag
  • Plugin tools are still registered in ToolRegistry regardless of command setting

Related Issues

This PR also includes a fix for plugin tool registration timing (ToolRegistry.state() now initializes after Plugin.init() in bootstrap.ts).

dev4s avatar Jan 10 '26 03:01 dev4s