Skip to content

feat: plugin command execution hooks#6256

Closed
shuv1337 wants to merge 2 commits into
anomalyco:devfrom
Latitudes-Dev:plugin-slash-commands
Closed

feat: plugin command execution hooks#6256
shuv1337 wants to merge 2 commits into
anomalyco:devfrom
Latitudes-Dev:plugin-slash-commands

Conversation

@shuv1337

Copy link
Copy Markdown
Contributor

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

* feat(opencode): allow plugin commands without client changes

* test(opencode): cover plugin commands and session-only guard

* chore(sdk): keep command types aligned

* fix: only emit Command.Event.Executed when plugin creates new message
@shuv1337 shuv1337 closed this Jan 7, 2026
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