Skip to content

feat: becwright doctor + validate — diagnose the setup, lint the rules file#78

Merged
DataDave-Dev merged 2 commits into
mainfrom
feat/doctor-validate
Jul 3, 2026
Merged

feat: becwright doctor + validate — diagnose the setup, lint the rules file#78
DataDave-Dev merged 2 commits into
mainfrom
feat/doctor-validate

Conversation

@DataDave-Dev

Copy link
Copy Markdown
Owner

What

Two additive commands from the external-adoption audit (P1 tier). Both resolve the most common 'it doesn't work' reports without a round-trip to an issue.

becwright validate

Validates .bec/rules.yaml without running any check — for editors, scripts and CI:

  • YAML parses and the schema loads (reuses the existing RulesError path)
  • no duplicate rule ids
  • every becwright run <name> resolves to a real built-in check
  • warns (without failing) on a files rule with no paths — it can never match

Exit codes follow the documented contract: 0 valid, 2 config problem.

becwright doctor

One command that answers 'why isn't becwright enforcing?':

  • rules-file findings (same set as validate)
  • hook state: becwright hook installed / foreign hook / missing
  • core.hooksPath detection — the silent killer: Husky sets it, git then ignores .git/hooks entirely, and a becwright hook there never runs. Doctor names it and gives the exact fix.
  • Husky: is becwright actually in .husky/pre-commit?
  • pre-commit framework: is the becwright hook actually in .pre-commit-config.yaml?
  • commit-msg rules present but no commit-msg hook

FAIL → exit 2; WARN → exit 0 with guidance; all green → >>> All good.

Groundwork

git.py grows hook_state / hooks_path_override / hook_manager — shared helpers that a follow-up PR uses so init stops installing a dead hook under Husky.

Stability

Additive only: two new subcommands, no change to existing commands, exit codes, rules.yaml, bundles or --json shapes.

Test plan

  • 20 new tests in tests/test_doctor_validate.py (validate ok/missing/unknown-check/dupes/bad-yaml/pathless; doctor healthy/foreign-hook/hooksPath/Husky±becwright/pre-commit-framework±becwright/commit-msg-gap/outside-repo; git helper units)
  • Full suite: 273 passed, coverage 93%
  • Dogfood hook passed on commit

…s file

- `becwright validate`: checks .bec/rules.yaml without running anything —
  YAML parses, no duplicate rule ids, every `becwright run <name>` resolves to
  a built-in check; warns on a files rule with no paths. Exit 0/2, consistent
  with the documented exit-code contract.
- `becwright doctor`: one command that answers 'why isn't it working?' —
  rules-file findings plus hook state: becwright hook installed / foreign hook
  / missing; detects core.hooksPath overrides (a becwright hook in .git/hooks
  that git will never run), Husky (.husky/pre-commit with or without
  becwright) and the pre-commit framework (config with or without the
  becwright hook), each with the exact fix. FAIL -> exit 2, WARN -> exit 0.
- git.py grows hook_state / hooks_path_override / hook_manager helpers (also
  the groundwork for init to stop installing a dead hook under Husky).
- 20 new tests; commands documented in README(+es) and usage(+es).
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@DataDave-Dev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 32ebabe2-deff-4d36-9610-cdfe12789257

📥 Commits

Reviewing files that changed from the base of the PR and between b24a58b and d8126cd.

📒 Files selected for processing (7)
  • README.es.md
  • README.md
  • documentation/usage.es.md
  • documentation/usage.md
  • src/becwright/cli.py
  • src/becwright/git.py
  • tests/test_doctor_validate.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/doctor-validate

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.

@DataDave-Dev DataDave-Dev merged commit 0793791 into main Jul 3, 2026
4 of 5 checks passed
@DataDave-Dev DataDave-Dev deleted the feat/doctor-validate branch July 3, 2026 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant