Hooks written to ~/.claude/settings.json are unquoted — break on Windows usernames containing a space
- Dominant language
- Shell
- Stars
- 28
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
**Environment**: Windows, Claude Code, JBContext installing hooks into user settings. Username contains a space (`C:\Users\With Space`).
**Symptom**: every Bash/Grep tool call emits
`PreToolUse:Bash hook error — Failed with non-blocking status code: /usr/bin/bash: line 1: C:/Users/With: No such file or directory`
**Cause**: four hook entries are written with the executable path unquoted, so bash splits it at the space:
`"command": "C:/Users/With Space/AppData/Local/JBContext/bin/jbcontext_binary.exe hook pre-tool-use"`
**Affected**: `PreToolUse` (`Bash`|`Grep`), `SessionStart`, `SessionEnd`, `UserPromptSubmit`. All four use `... jbcontext_binary.exe `.
**Reproduce**: `bash -c 'C:/Users/With Space/AppData/Local/JBContext/bin/jbcontext_binary.exe hook pre-tool-use'` → `No such file or directory`. Wrapping the path in quotes exits 0.
**Fix**: quote the executable path when writing the hook command:
`"command": "\"C:/Users/With Space/AppData/Local/JBContext/bin/jbcontext_binary.exe\" hook pre-tool-use"`
Contributor guide
No contributing guide indexed for this repository
Research direction
Locate the code that writes the four hook entries to ~/.claude/settings.json and inspect how each executable path is assembled. Reproduce on Windows with a username containing a space, then verify PreToolUse, SessionStart, SessionEnd, and UserPromptSubmit commands run successfully with the quoted path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100