Skip to content

Commit f105ceb

Browse files
committed
fix(hooks): handle todowrite todos passed as string instead of array
1 parent 5242f3d commit f105ceb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/hooks/claude-code-hooks/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,18 @@ export function createClaudeCodeHooksHook(
202202
input: { tool: string; sessionID: string; callID: string },
203203
output: { args: Record<string, unknown> }
204204
): Promise<void> => {
205+
if (input.tool === "todowrite" && typeof output.args.todos === "string") {
206+
try {
207+
const parsed = JSON.parse(output.args.todos as string)
208+
if (Array.isArray(parsed)) {
209+
output.args.todos = parsed
210+
log("todowrite: parsed todos string to array", { sessionID: input.sessionID })
211+
}
212+
} catch (e) {
213+
log("todowrite: failed to parse todos string", { sessionID: input.sessionID, error: String(e) })
214+
}
215+
}
216+
205217
const claudeConfig = await loadClaudeHooksConfig()
206218
const extendedConfig = await loadPluginExtendedConfig()
207219

0 commit comments

Comments
 (0)