Skip to content

[Bug]: claude-code hooks in settings.json shall not contain absolute paths to the repo #558

@zeroisnan

Description

@zeroisnan

code-review-graph version

Built on branch: main Built at commit: 06161b4f7f55

Operating system

Linux

Python version

3.12.3

AI platform

claude-code

Output of code-review-graph status

Nodes: 420
Edges: 2936
Files: 91
Languages: cpp, python
Last updated: 2026-06-14T02:42:17
Built on branch: main
Built at commit: 06161b4f7f55

Steps to reproduce

code-review-graph install --platform claude-code

Expected vs actual behavior

Expected:
.claude/settings.json is a repository level file impacying all collaborators on the repository, as such it should not contain user level aspects, such as paths to the repo

Actual: PostToolUse and SessionStart both contains a hard coded absolute path to the repo, making it not possible to share settings.json with other users/setups

Example:

     {
        "matcher": "Edit|Write|Bash",
        "hooks": [
          {
            "type": "command",
            "command": "cat >/dev/null || true; git rev-parse --git-dir >/dev/null 2>&1 && code-review-graph update --skip-flows --repo \"/home/username/work/some/path/to/depot\" || true",
            "timeout": 30
          }
        ]
      }

Further to that, the install command will not replace existing hooks installed by previous versions of the tool, but add to the list instead

Additional context

Here is a possible rewrite of the PostToolUse. The path to the depot is captured on the fly in a variable and used for the tool invocation

            "command": "repo_root=$(git rev-parse --show-toplevel 2>/dev/null) && [ -n \"$repo_root\" ] && code-review-graph update --skip-flows --repo \"$repo_root\" || true",

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions