[PR #9417] feat: allow output.preventDefault for command.before.execute #13103

Open
opened 2026-02-16 18:17:58 -05:00 by yindo · 0 comments
Owner

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

State: open
Merged: No


What does this PR do?

Just a small exploration but I wanted the ability to prevent the default navigation when invoking a command from a plugin so I asked claude to add it in and it seems like it did a good job. This adds an output property on command.execute.before where you can call output.preventDefault to prevent the navigation...i've also implemented it for the TUI (maybe we should implement it for the webapp and the desktop too but wanted to see what you think about this).

It's nice to give plugins the ability to create commands to do stuff rather than send a prompt (I could use this to allow the user to quickly enable/disable a feature in the svelte plugin for example).

How did you verify your code works?

Launched the version locally with a plugin that stops every command and show a toast.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9417 **State:** open **Merged:** No --- ### What does this PR do? Just a small exploration but I wanted the ability to prevent the default navigation when invoking a command from a plugin so I asked claude to add it in and it seems like it did a good job. This adds an output property on `command.execute.before` where you can call `output.preventDefault` to prevent the navigation...i've also implemented it for the TUI (maybe we should implement it for the webapp and the desktop too but wanted to see what you think about this). It's nice to give plugins the ability to create commands to do stuff rather than send a prompt (I could use this to allow the user to quickly enable/disable a feature in the svelte plugin for example). ### How did you verify your code works? Launched the version locally with a plugin that stops every command and show a toast.
yindo added the pull-request label 2026-02-16 18:17:58 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13103