opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: Add noReply option to command.execute.before hook

Open arismoko opened this issue 1 day ago • 1 comments

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:

  1. packages/plugin/src/index.ts - Add noReply?: boolean to hook output type
  2. packages/opencode/src/session/prompt.ts - Pass hookOutput.noReply to prompt()

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.

arismoko avatar Jan 18 '26 23:01 arismoko