3 Commits

Author SHA1 Message Date
Yeachan-Heo
fb6828562c fix(hooks): improve Windows compatibility for hook scripts (#524)
Use pathToFileURL for dynamic imports instead of raw file paths, which
fixes "hook error" on Windows where backslash paths break ESM imports.
Add suppressOutput: true to empty hook responses to mitigate the known
Claude Code "hook error" display bug (#10936).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 00:36:22 +00:00
Yeachan-Heo
024ef5aec4 fix: use timeout-protected stdin in all hook scripts (fixes #459)
All 13 remaining hook scripts used `for await (process.stdin)` which
blocks indefinitely when the parent process doesn't close stdin. On
Windows 11 with Claude Code 2.1.27+, pipe behavior changed causing
every hook to hang until its timeout kills it, making CC appear frozen.

Migrate all scripts to the shared timeout-protected readStdin() from
scripts/lib/stdin.mjs (created for #240 but only applied to 2 scripts).
The CJS persistent-mode.cjs gets an inlined version since it can't use
ESM imports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 01:41:05 +00:00
Yeachan-Heo
39d22866a7 feat(hooks): add async hook lifecycle modules for Claude Code integration
Implement 5 new hook modules for Claude Code's async hook lifecycle:

- SubagentStart/SubagentStop: Track active subagents with parent mode context
- PreCompact: Preserve critical state before context compaction
- Setup: Directory structure initialization and periodic maintenance
- PermissionRequest: Smart auto-approval for safe commands during active modes
- SessionEnd: Record metrics, cleanup transient state, export summaries

Wire all hooks into bridge.ts routing and hooks.json configuration.
Add standalone .mjs entry scripts for each hook type.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 06:27:37 +00:00