Skip to content

chore: add bun enforcement hook and local config patterns#1676

Open
42tg wants to merge 1 commit intopingdotgg:mainfrom
42tg:chore/bun-enforcement-hook
Open

chore: add bun enforcement hook and local config patterns#1676
42tg wants to merge 1 commit intopingdotgg:mainfrom
42tg:chore/bun-enforcement-hook

Conversation

@42tg
Copy link
Copy Markdown

@42tg 42tg commented Apr 2, 2026

Summary

  • Add .claude/hooks/enforce-bun.sh to prevent accidental npm/yarn/pnpm usage in this bun-based monorepo
  • Add .claude/settings.json with hook configuration
  • Add local config patterns to .gitignore

Test plan

  • Verify bun install still works normally
  • Verify npm install is blocked by the hook

Note

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 PreToolUse Bash hook that reads the tool command input and fails fast if it detects npm, npx, yarn, or pnpm, steering usage to bun (including bunx for npx).

Registers this hook in .claude/settings.json so it runs before Bash tool executions, and expands .gitignore to 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

  • Adds enforce-bun.sh, a PreToolUse hook that parses the Bash tool's command input via jq and exits with code 2 if it detects npm, npx, yarn, or pnpm usage, printing guidance to stderr.
  • Registers the hook in .claude/settings.json so it runs automatically before every Bash tool invocation in this environment.
  • Adds *.local.*, **/coverage/, and .playwright-mcp/ patterns to .gitignore.

Macroscope summarized 185abf0.

@github-actions github-actions bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Apr 2, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ce3afcd2-9355-44c0-bb89-01abb5bd4741

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- Add *.local.*, **/coverage/, .playwright-mcp/ to .gitignore
- Add PreToolUse hook that blocks npm/npx/yarn/pnpm in favor of bun
@42tg 42tg force-pushed the chore/bun-enforcement-hook branch from 85f0d1e to 185abf0 Compare April 2, 2026 10:39
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 2, 2026

Approvability

Verdict: 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.

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block bun test as well, in favor of bun run test. agents love messing this one up. we have a sentence for it in agents.md which usually helps but might as well have it here too

@juliusmarminge
Copy link
Copy Markdown
Member

we should already have this from the packageManager field in package.json though, or doesn't all package managers respect this?

CleanShot 2026-04-02 at 11 52 42@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants