.claude/settings.json: hook commands break when the checkout path contains a space

Open Beginner friendly
#31,369 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
90/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
tooling

Research direction

Open .claude/settings.json and inspect the three hook commands at lines 9, 20, and 30. Quote each $CLAUDE_PROJECT_DIR shell expansion as shown in the issue, then verify the commands work when the checkout path contains spaces. Done means all three hooks can find and run their scripts from such a path.

Written by the indexing model from the issue text.

Description

bug/1-unconfirmed kind/bug
Package and version

None: repo dev tooling (.claude/settings.json on main, 8e90ba30636745c2b7521c8cf1b7ef8395ab1b60), not a published package

What happened?

The three hook commands in .claude/settings.json pass $CLAUDE_PROJECT_DIR unquoted:

https://github.com/prisma/orm/blob/8e90ba30636745c2b7521c8cf1b7ef8395ab1b60/.claude/settings.json#L9
https://github.com/prisma/orm/blob/8e90ba30636745c2b7521c8cf1b7ef8395ab1b60/.claude/settings.json#L20
https://github.com/prisma/orm/blob/8e90ba30636745c2b7521c8cf1b7ef8395ab1b60/.claude/settings.json#L30

"command": "node $CLAUDE_PROJECT_DIR/.claude/scripts/enforce-tools.mjs"

When the checkout path contains a space (e.g. ~/My Projects/orm, common on macOS and Windows), the shell splits the path and node exits 1 with MODULE_NOT_FOUND. Claude Code treats exit 1 as a non-blocking hook error, so nothing fails loudly. The hooks just stop running:

  • enforce-tools.mjs: the npm/npx block and the full-test-suite guard are off
  • format-ts.mjs: edited .ts files are not formatted
  • worktree-create.mjs: worktree setup does not run
What did you expect to happen?

The hooks run whatever the checkout path is. The Claude Code hooks docs say: "In shell form, wrap each placeholder in double quotes."

Minimal reproduction
  1. Clone into a path without a space and ask Claude Code to run npx --version. The hook blocks it: "Use pnpm, not npx".
  2. Clone into a path with a space (mkdir "/tmp/my dir" && git clone https://github.com/prisma/orm "/tmp/my dir/orm"), open Claude Code there and repeat. npx runs, and the hook prints a MODULE_NOT_FOUND error.
Environment

Claude Code 2.1.x, Node 22, Linux (also applies to macOS/Windows paths with spaces). No database involved.

Additional context

Suggested fix, applied to all three commands:

"command": "node \"$CLAUDE_PROJECT_DIR\"/.claude/scripts/enforce-tools.mjs"

It's a three-line change. I'm happy to open the PR (with DCO sign-off) if you want it.

Dominant language
TypeScript
Stars
47.8k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
227

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 prisma/orm

All issues in prisma/orm

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.