opencode
opencode copied to clipboard
feat(opencode) plugin commands
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
-
commanddefaults tofalse, so existing tools remain AI-only - Feature is behind
experimental.pluginCommandsflag - Plugin tools are still registered in ToolRegistry regardless of
commandsetting
Related Issues
This PR also includes a fix for plugin tool registration timing (ToolRegistry.state() now initializes after Plugin.init() in bootstrap.ts).