chore: add bun enforcement hook and local config patterns#1676
chore: add bun enforcement hook and local config patterns#167642tg wants to merge 1 commit intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Add *.local.*, **/coverage/, .playwright-mcp/ to .gitignore - Add PreToolUse hook that blocks npm/npx/yarn/pnpm in favor of bun
85f0d1e to
185abf0
Compare
ApprovabilityVerdict: Approved This PR adds developer tooling only - a Claude Code hook to enforce bun usage and gitignore patterns. No application runtime behavior is affected. The open review comment about regex edge cases is a valid improvement but doesn't block approval since it only affects completeness of the dev tool guard. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| fi | ||
|
|
||
| # Check for npm commands (including npx) | ||
| if echo "$COMMAND" | grep -qE '(^|[;&|][[:space:]]*)npm([[:space:]]|$)'; then |
There was a problem hiding this comment.
Regex misses env-var-prefixed and sudo-prefixed commands
Medium Severity
The grep pattern (^|[;&|][[:space:]]*)npm([[:space:]]|$) only matches npm at line-start or after shell operators (;, &, |), so commands prefixed with environment variables like NODE_ENV=production npm run build or prefix utilities like sudo npm install slip through undetected. The space before npm in these cases doesn't match [;&|], bypassing the hook entirely. The same gap applies to all four regex checks (npm, npx, yarn, pnpm). Adding [[:space:]] to the character class (e.g. (^|[;&|[:space:]])[[:space:]]*npm) would close this gap.


Summary
.claude/hooks/enforce-bun.shto prevent accidentalnpm/yarn/pnpmusage in this bun-based monorepo.claude/settings.jsonwith hook configuration.gitignoreTest plan
bun installstill works normallynpm installis blocked by the hookNote
Low Risk
Only adds a Claude Bash pre-hook and expands
.gitignore; no runtime application logic is affected, though the hook could block some developer workflows if it false-positives.Overview
Adds a Claude
PreToolUseBash hook that reads the tool command input and fails fast if it detectsnpm,npx,yarn, orpnpm, steering usage to bun (includingbunxfornpx).Registers this hook in
.claude/settings.jsonso it runs before Bash tool executions, and expands.gitignoreto exclude*.local.*,**/coverage/, and.playwright-mcp/artifacts.Written by Cursor Bugbot for commit 185abf0. This will update automatically on new commits. Configure here.
Note
Add bun enforcement hook to block npm, npx, yarn, and pnpm in Bash tool executions
jqand exits with code 2 if it detectsnpm,npx,yarn, orpnpmusage, printing guidance to stderr.*.local.*,**/coverage/, and.playwright-mcp/patterns to .gitignore.Macroscope summarized 185abf0.