Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
fix: let /wt-diff tool.call throws reach the hook engine; test the subagent path (#4689)
Yash Gautamc38723335c7c
diff --git a/plugins/worktrunk/hooks/register.tsx b/plugins/worktrunk/hooks/register.tsxindex af30237f4..a92db5959 100644--- a/plugins/worktrunk/hooks/register.tsx+++ b/plugins/worktrunk/hooks/register.tsx@@ -130,7 +130,7 @@ export const register: Register = on => {})}return ran- }).catch(($, e, next) => next(e))+ })on('turn.complete', async ($, e, next) => {const done = await next(e)diff --git a/plugins/worktrunk/tests/diff.test.tsx b/plugins/worktrunk/tests/diff.test.tsxindex 77501f719..cd0f13545 100644--- a/plugins/worktrunk/tests/diff.test.tsx+++ b/plugins/worktrunk/tests/diff.test.tsx@@ -270,6 +270,38 @@ test('the pane lists the worktrees the session worked in, and draws one diff', a])})+test('a subagent edit tracks its worktree and shows its diff', async ($, on) => {+ const runs: string[][] = []+ host(on, runs)++ await $.session.start({ cwd: HERE, surface: 'terminal', isInteractive: true })+ await $.tool.call({+ tool: 'Edit',+ agentId: 'agent-1',+ file_path: `${OTHER}/src/lib.rs`,+ old_string: 'b',+ new_string: 'c',+ })+ await $.command.run({ command: 'wt-diff', args: 'feature', ...TYPED })++ const ui = await $.ui.mount({ ...PANE, surface: 'terminal' })+ expect(await ui.find({ key: `wt:${OTHER}` })).toBeDefined()+ expect((await ui.find({ key: 'file:src/lib.rs' }))?.text).toMatch(/M src\/lib\.rs \+1 -1/)+ await ui.unmount()+ expect(runs).toContainEqual([+ 'wt',+ '-C',+ OTHER,+ 'step',+ 'diff',+ '--',+ '--no-color',+ '--no-ext-diff',+ '--src-prefix=a/',+ '--dst-prefix=b/',+ ])+})+test('a worktree is still listed after the directory edited in it is deleted', async ($, on) => {const runs: string[][] = []host(on, runs)