[PR #7400] feat(opencode): new plugin hook, command.execute.before #12387

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

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

State: closed
Merged: No


What does this PR do?

This PR proposes a command.execute.before, which allows for plugins to perform dynamic behavior & modification of command runs, including stopping their regular execution flow.

I have opened a discussion on the discord for this as well:
https://discord.com/channels/1391832426048651334/1458986650184060978

How did you verify your code works?

I've been slow to go deep testing this, and doing so has kept me from making a PR or draft. But I saw a call to action, with Dex talking about skills and commands and even though it sort of seems un-wise / a sore topic at the moment, I wanted to share & get this out here.

I'm doing more testing now.

Bikeshed rename for symmetry

I also have a commit in here to rename command.executed to command.execute.after, which makes squares this PR with what see see for tool hooks, which have tool.execute.before / tool.execute.after. I opted to retain command.executed as a hook too, for backwards compatibility stake, but "deprecated" it. This commit is in no way loadbearing, but I appreciate the symmetry it offers!

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7400 **State:** closed **Merged:** No --- ### What does this PR do? This PR proposes a `command.execute.before`, which allows for plugins to perform dynamic behavior & modification of command runs, including stopping their regular execution flow. I have opened a discussion on the discord for this as well: https://discord.com/channels/1391832426048651334/1458986650184060978 ### How did you verify your code works? I've been slow to go deep testing this, and doing so has kept me from making a PR or draft. But I saw a call to action, with [Dex talking about skills and commands](https://bsky.app/profile/thdxr.com/post/3mbx7z4ulh32x) and even though it sort of seems un-wise / a sore topic at the moment, I wanted to share & get this out here. I'm doing more testing now. ### Bikeshed rename for symmetry I also have a commit in here to rename `command.executed` to `command.execute.after`, which makes squares this PR with what see see for tool hooks, which have `tool.execute.before` / `tool.execute.after`. I opted to retain `command.executed` as a hook too, for backwards compatibility stake, but "deprecated" it. This commit is in no way loadbearing, but I appreciate the symmetry it offers!
yindo added the pull-request label 2026-02-16 18:17:18 -05:00
yindo closed this issue 2026-02-16 18:17:18 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12387