mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-23 10:33:32 +08:00
- Use PATH-resolved `bash` as first token instead of quoted `.exe` path so Claude Code v2.1.116 argv duplication does not feed a binary to bash as its $0 (repro: exit 126 "cannot execute binary file"). - Point the command at `observe-wrapper.sh` and pass distinct `pre` / `post` positional arguments so PreToolUse and PostToolUse are registered as separate entries. - Normalize the wrapper path to forward slashes before embedding in the hook command to avoid MSYS backslash surprises. - Write UTF-8 (no BOM) with CRLF normalized to LF so downstream JSON parsers never see mixed line endings. - Preserve existing hooks (legacy `observe.sh`, third-party entries) by appending only when the canonical command string is not already registered. Re-runs are idempotent ([SKIP] both phases). - Keep the script compatible with Windows PowerShell 5.1: fall back to a manual PSCustomObject → Hashtable conversion when `ConvertFrom-Json -AsHashtable` is unavailable, and materialize hook arrays as `System.Collections.ArrayList` so single-element arrays survive PS 5.1 `ConvertTo-Json` serialization. Companion to PR #1524 (settings.local.json shape fix) and PR #1540 (install_hook_wrapper.ps1 argv-dup fix).
7.3 KiB
7.3 KiB