feat(init): detect Husky / pre-commit / core.hooksPath instead of installing a dead hook#79
Conversation
|
Warning Review limit reached
Next review available in: 44 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
✨ 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 |
…talling a dead hook Husky sets core.hooksPath, so a becwright hook written to .git/hooks is dead on arrival — git never runs it. Before this change `becwright init` on a Husky or pre-commit repo silently produced exactly that: a hook that looks installed and enforces nothing. - `init`: when a hook manager owns the hooks (Husky dir, pre-commit config, or any core.hooksPath override), skip the native hook and print the exact integration to add instead (the .husky/pre-commit line, or the .pre-commit-config.yaml block pinned to this version). Rules are still scaffolded as always. - `install`: refuses (exit 2) under a core.hooksPath override — the hook could never run; with a pre-commit config but no override it proceeds as asked, with a note about the double owner. - Builds on the hook_manager / hooks_path_override helpers from the doctor PR. - 7 new tests; README(+es) and usage(+es) updated.
14233a7 to
a258010
Compare
What
The silent failure this kills: Husky sets
core.hooksPath, so git ignores.git/hooksentirely. Before this change,becwright initon a Husky repo wrote a hook there anyway — it looks installed and enforces nothing. The same applies to any customcore.hooksPath.init: when a hook manager owns the hooks (.husky/,.pre-commit-config.yaml, or anycore.hooksPathoverride), skip the native hook and print the exact integration instead — thenpx becwright checkline for.husky/pre-commit, or the pinned.pre-commit-config.yamlblock. Rules are still scaffolded as always.install: refuses with exit 2 under acore.hooksPathoverride (the hook could never run — refusing beats half-installing). With a pre-commit config but no override, it proceeds as explicitly asked, with a note about the double owner.Stability
Additive/behavioral fix only. On a plain repo nothing changes; on a manager-owned repo the previous behavior (a dead hook) was a bug, not a contract.
Test plan
tests/test_hook_managers.py: init on plain / Husky / pre-commit / hooksPath repos; install refuses under override, proceeds-with-note under pre-commit config, stays quiet on plain repos