[PR #6256] feat: plugin command execution hooks #11802

Closed
opened 2026-02-16 18:16:44 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6256

State: closed
Merged: No


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
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6256 **State:** closed **Merged:** No --- <h3>Summary</h3> 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
yindo added the pull-request label 2026-02-16 18:16:44 -05:00
yindo closed this issue 2026-02-16 18:16:44 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11802