opencode
opencode copied to clipboard
feat: Add noReply option to command.execute.before hook
Problem
The command.execute.before plugin hook allows modifying command parts before execution, but there's no way to skip the LLM invocation entirely. This is needed for plugins that want to handle slash commands directly without invoking the LLM.
Currently, the only workaround is throwing an error in the hook, which is hacky.
Proposed Solution
Add an optional noReply field to the hook output object. When set to true, the command flow passes noReply: true to prompt(), which skips the LLM loop.
Changes:
-
packages/plugin/src/index.ts- AddnoReply?: booleanto hook output type -
packages/opencode/src/session/prompt.ts- PasshookOutput.noReplytoprompt()
Use Case
Plugins can implement custom slash commands (e.g., /tty list) that execute shell commands or other logic and display results without LLM involvement.