fix: Claude Code hook commands break when the global hook path contains whitespace

Open Beginner friendly
#111 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
cli

Research direction

Start with claudeHookCommand in internal/agents/claude.go (around lines 244-249), then compare it with the single-quoted form in internal/agents/codex_pretooluse.go (lines 57-66) and the hook setup in internal/agents/claude_pretooluse.go (lines 44-49). Reproduce with HOME set to a path containing a space and run codegraph install --target claude --location global. Done when the global hook command is quoted, an existing unquoted entry is replaced rather than duplicated on install and upgrade, and tests cover a path with a space.

Written by the indexing model from the issue text.

Description

area:agents bug priority:low
What happens

For a global install, codegraph install registers Claude Code's SessionStart and PreToolUse hook commands as unquoted absolute paths. If $HOME contains whitespace, the shell splits the path before the guard runs, and Claude Code shows a hook error. Codex's command is single-quoted (shellSingleQuote), so it does not have this problem.

What you expected instead

The hook command is quoted (or uses exec form). An existing unquoted entry is recognised as codegraph's and replaced, not duplicated.

Steps to reproduce

With HOME="/tmp/a b", run codegraph install --target claude --location global, then start a Claude Code session.

Version

main at d384473e

Platform

any

How did you install it?

Built from source

Evidence
  • internal/agents/claude.go:244-249 (claudeHookCommand)
  • internal/agents/claude_pretooluse.go:44-49
  • internal/agents/codex_pretooluse.go:57-66 (the quoted form)
Acceptance criteria
  • Global hook commands are quoted; local ${CLAUDE_PROJECT_DIR} commands are checked as well.
  • install and upgrade replace a pre-existing unquoted entry; tests cover a path containing a space.

Source (GSD planning files, archived at d384473e): .planning/milestones/v0.14.0-MILESTONE-AUDIT.md (AR-06-08); .planning/STATE.md Blockers/Concerns (Phase 6)


🤖 Generated with Claude Code

https://claude.ai/code/session_01UNqdnC3q6U362BvyfxuKCF

Dominant language
Go
Stars
0
Forks
0
Avg merge
5h 16m
Merged PRs (30d)
107

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from seanb4t/codegraph-go

All issues in seanb4t/codegraph-go

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.