opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: plugin command execution hooks

Open shuv1337 opened this issue 3 weeks ago • 0 comments

Summary

Added plugin command system that enables plugins to register custom slash commands accessible via /command in TUI/web.

Key changes:

  • Commands now have a type field ("template" or "plugin") to distinguish between template-based and plugin-provided commands
  • Plugin commands support aliases for alternate names, and sessionOnly flag to restrict commands to existing sessions
  • The Command.get() function now resolves aliases by searching through all commands
  • Plugin command execution happens directly via the plugin's execute function, with error handling and event publishing
  • Command.Event.Executed is only emitted when a plugin command creates a new message (checked by comparing message IDs before/after execution)
  • Added comprehensive test coverage for plugin commands including alias resolution, execution, error handling, and session-only guards

shuv1337 avatar Dec 27 '25 17:12 shuv1337