Skip to content

fix(Doctor): accept native binaries in the hook-interpreter probe - #2119

Open
Rubix-BNL wants to merge 1 commit into
danielmiessler:mainfrom
Rubix-BNL:fix/doctor-native-binary-hooks
Open

Rubix-BNL wants to merge 1 commit into
danielmiessler:mainfrom
Rubix-BNL:fix/doctor-native-binary-hooks

Conversation

@Rubix-BNL

Copy link
Copy Markdown

Problem

checkHookInterpreters in LIFEOS/TOOLS/Doctor.ts requires a #! shebang from every hook command given as a path. A compiled executable registered as a hook has no shebang, so Doctor --hooks flags it as broken:

cc-status: no #! shebang

Concrete case: iTerm2's ~/.config/iterm2/cc-status (a Mach-O binary) wired as a status-line/hook command. exec() runs it without issue; only scripts need an interpreter line.

Fix

Read the first four bytes of the resolved file and skip the shebang check when they are an ELF, Mach-O (32/64, either byte order) or fat/universal header. Everything else keeps the existing path (mode check, shebang check, interpreter lookup).

Verification

  • bun LIFEOS/TOOLS/Doctor.ts --hooks on an install with the iTerm2 binary hook: hook interpreters: every registered hook resolves ✅ (was needs attention before).
  • Script hooks unchanged: a hook without shebang still reports no #! shebang.

🤖 Generated with Claude Code

https://claude.ai/code/session_017w3q9FbuWxcW9fmh8G39NK

checkHookInterpreters demands a #! shebang from every hook command that is
given as a path. A compiled executable (e.g. iTerm2's Mach-O cc-status
status-line helper registered as a hook) has no shebang, so Doctor reported
it as broken even though exec() runs it fine. Sniff the first four bytes for
an ELF / Mach-O / fat header and skip the shebang check for those.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017w3q9FbuWxcW9fmh8G39NK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant