diff options
| author | Spoon <[email protected]> | 2026-01-18 20:11:22 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-18 13:11:22 -0600 |
| commit | bfd2f91d5b4b7ee28346bfcfd1481a8c0370574c (patch) | |
| tree | cf2b2422bd7b6b432b23c0a2c20834a813ce78e5 /packages | |
| parent | dac099a4892689d11abedb0fcc1098b50e0958c8 (diff) | |
| download | opencode-bfd2f91d5b4b7ee28346bfcfd1481a8c0370574c.tar.gz opencode-bfd2f91d5b4b7ee28346bfcfd1481a8c0370574c.zip | |
feat(hook): command execute before hook (#9267)
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/opencode/src/session/prompt.ts | 10 | ||||
| -rw-r--r-- | packages/plugin/src/index.ts | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts index 0d3d25feb..f4793d1a7 100644 --- a/packages/opencode/src/session/prompt.ts +++ b/packages/opencode/src/session/prompt.ts @@ -1702,6 +1702,16 @@ NOTE: At any point in time through this workflow you should feel free to ask the : await lastModel(input.sessionID) : taskModel + await Plugin.trigger( + "command.execute.before", + { + command: input.command, + sessionID: input.sessionID, + arguments: input.arguments, + }, + { parts }, + ) + const result = (await prompt({ sessionID: input.sessionID, messageID: input.messageID, diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts index e57eff579..36a4657d7 100644 --- a/packages/plugin/src/index.ts +++ b/packages/plugin/src/index.ts @@ -173,6 +173,10 @@ export interface Hooks { output: { temperature: number; topP: number; topK: number; options: Record<string, any> }, ) => Promise<void> "permission.ask"?: (input: Permission, output: { status: "ask" | "deny" | "allow" }) => Promise<void> + "command.execute.before"?: ( + input: { command: string; sessionID: string; arguments: string }, + output: { parts: Part[] }, + ) => Promise<void> "tool.execute.before"?: ( input: { tool: string; sessionID: string; callID: string }, output: { args: any }, |
