Skip to content

Conversation

@shuv1337
Copy link
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
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