fix(comment-checker): handle apply_patch payloads
Accept apply_patch edits from nested result/metadata file lists and from raw patchText args when OpenCode does not provide direct metadata.files. Forward tool args through the after-hook pipeline so comment-checker can inspect raw apply_patch inputs while preserving existing write, edit, and multiedit routing. Tests: bun test src/hooks/comment-checker/hook.apply-patch.test.ts src/hooks/comment-checker/hook.before-after.test.ts src/plugin/tool-execute-after.test.ts Tests: bun test src/hooks/comment-checker Tests: bun run typecheck Tests: bun run build
This commit is contained in:
@@ -146,4 +146,30 @@ describe("createToolExecuteAfterHandler", () => {
|
||||
// then
|
||||
expect(output).toEqual({ title: "result", output: "read output", metadata: {} })
|
||||
})
|
||||
|
||||
it("#given after input includes tool args #when comment checker runs #then it receives the args", async () => {
|
||||
// given
|
||||
let seenArgs: Record<string, unknown> | undefined
|
||||
const handler = createToolExecuteAfterHandler({
|
||||
ctx: { directory: "/repo" } as never,
|
||||
hooks: {
|
||||
commentChecker: {
|
||||
"tool.execute.after": async (input) => {
|
||||
seenArgs = input.args
|
||||
},
|
||||
},
|
||||
} as never,
|
||||
})
|
||||
|
||||
const args = { patchText: "*** Begin Patch\n*** End Patch" }
|
||||
|
||||
// when
|
||||
await handler(
|
||||
{ tool: "apply_patch", sessionID: "ses_parent", callID: "call_patch", args },
|
||||
{ title: "result", output: "Success", metadata: {} },
|
||||
)
|
||||
|
||||
// then
|
||||
expect(seenArgs).toBe(args)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user