1 Commits

  • fix(hooks): avoid Claude Code v2.1.116 argv-dup bug in settings.local.json (#1524)
    * fix: resolve Claude Code Bash hook "cannot execute binary file" on Windows
    
    Root cause in ~/.claude/settings.local.json (user-global):
    1. UTF-8 BOM + CRLF line endings left by patch_settings_cl_v2_simple.ps1
    2. Double-wrapped command "\"bash.exe\" \"wrapper.sh\"" broke Windows
       argument splitting on the space in "Program Files", making bash.exe
       try to execute itself as a script.
    
    Fix:
    - Rewrite settings.local.json as UTF-8 (no BOM), LF, with the hook command
      pointing directly at observe-wrapper.sh and passing "pre"/"post" as a
      positional arg so HOOK_PHASE is populated correctly in observe.sh.
    
    Docs:
    - docs/fixes/HOOK-FIX-20260421.md — full root-cause analysis.
    - docs/fixes/apply-hook-fix.sh — idempotent applier script.
    
    * docs: addendum for HOOK-FIX-20260421 (v2.1.116 argv duplication detail)
    
    - Documents Claude Code v2.1.116 argv duplication bug as the underlying
      cause of the bash.exe:bash.exe:cannot execute binary file error
    - Records night-session fix variant using explicit `bash <path>` prefix
      (matches hooks.json observer pattern, avoids EFTYPE on Node spawn)
    - Keeps morning commit 527c18b intact; both variants are now documented
    
    ---------
    
    Co-authored-by: suusuu0927 <sugi.go.go.gm@gmail.com>