feat(opencode): new plugin hook, command.execute.before
#7400
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.executedtocommand.execute.after, which makes squares this PR with what see see for tool hooks, which havetool.execute.before/tool.execute.after. I opted to retaincommand.executedas a hook too, for backwards compatibility stake, but "deprecated" it. This commit is in no way loadbearing, but I appreciate the symmetry it offers!