feat: run becwright in CI (GitHub Action), query rule decisions (why), reposition as the enforcement layer#58
Conversation
The 0.4.0 release bumped pyproject.toml but left __version__ at 0.3.0, so `becwright --version` and the packaged metadata disagreed. Align them.
Adds a third scope to `becwright check`, alongside staged (default) and --all: --diff <base> checks only the files a branch changed vs <base>, using the three-dot range (base...HEAD) so it matches exactly what a pull request shows as 'Files changed'. Content is read from the working tree (in CI the checkout already is the committed code). An unknown base ref raises GitError -> exit 2 (a loud CI failure) instead of silently passing on an empty file list, e.g. on a shallow clone without the base ref. --all and --diff are mutually exclusive. This is the engine half of running becwright as a required CI check: a local hook can be skipped with 'git commit --no-verify', a required check cannot.
action.yml is a composite action that installs becwright, resolves the PR base ref, and runs 'becwright check --diff <base>' — checking only the files the PR changed. Making it a required check enforces the rules even when the local pre-commit hook is bypassed with --no-verify: infrastructure, not a suggestion. Pre-existing debt on the rest of the repo never fails the build, so it can be adopted on a large codebase without a red wall. Inputs: base, version, python-version, args (all optional). .github/workflows/becwright.yml dogfoods the action on this repo's own PRs via the local action with version: . (installs the checked-out becwright), which both verifies the action end-to-end and guards this repo the way we ask others to guard theirs.
…memory Every rule already carries its intent, the reason behind it and rejected alternatives (the BEC's Bound half), but so far they only surfaced when a commit was blocked. Now they can be read on demand: - 'becwright why' lists every rule with its intent; 'becwright why <id>' shows the full decision record; '--json' emits it for programmatic use. - The MCP server gains a 'list_rules' tool returning the same records, so an agent can read the decisions it must not violate *before* writing code and steer clear of a blocked commit instead of discovering the rule only when it fires. report.rule_record() is the shared serializer behind both. This turns the .bec/rules.yaml catalog into queryable architectural memory: you don't hand the model all the context, you hand it the decisions it can't break.
Leads every one-liner with the category instead of the mechanism — a piece of the stack, not a script. Consistent across the surfaces where the pitch appears: both README heroes, the PyPI (pyproject) and npm descriptions, and the Claude Code plugin (plugin.json + its README). The sign-vs-guard hook stays; the positioning line now sits above it and the mechanism (runs the rules, blocks the commit, any author) follows.
…json) The honest version of 'give the AI only what it needs': a blocked commit returns the one rule that broke, its why and the exact lines, so the agent fixes that precisely instead of re-reading the whole style guide into context — and the guarantee never depended on the model reading anything. Added to the AI-agents section of both READMEs.
|
Warning Review limit reached
Next review available in: 38 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 (16)
✨ 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 |
Summary
Three roadmap items from the "infrastructure, not utility" direction, plus a version fix. Each commit is atomic and leaves the suite green.
1. Run becwright in CI — the layer that can't be skipped (
95bda29,2d8a528)check --diff <base>scope: checks only the files a branch changed vs<base>, using the three-dot rangebase...HEADso it matches exactly what a PR shows as "Files changed".GitError→ exit 2 (a loud CI failure) instead of silently passing on an empty file list (e.g. a shallow clone without the base ref).action.yml: installs becwright, resolves the PR base branch, and runscheck --diff. Pre-existing debt on the rest of the repo never fails the build, so it can be adopted on a large codebase without a red wall..github/workflows/becwright.ymldogfoods the action on this repo's own PRs (local action,version: .,fetch-depth: 0).git commit --no-verify; a required CI check is not. This makes the rules infrastructure of the pipeline.2. Queryable decision memory (
cc58177)becwright why [id]surfaces each rule'sintent,why_it_mattersandrejected_alternativeson demand — not only when a commit is blocked.--jsonfor programmatic use.list_rulesreturns the same decision records, so an agent can read the decisions it must not violate before it writes code and steer clear of a broken commit.report.rule_record()is the shared serializer behind both.3. Positioning + lean-context copy (
70a6773,6c90a65)Fix (
04db382)__version__0.3.0→0.4.0to matchpyproject.toml(left behind by the 0.4.0 release, sobecwright --versiondisagreed with the package metadata).Test plan
pytest— 241 passed, coverage 93.14% (gate 80%).check --diff(5, incl. loud failure on a bad base and "ignores debt outside the diff"),becwright why(7), MCPlist_rules(2).check --diff main→ exit 0; bad base → exit 2;why/why <id>/why --json/ unknown id.becwrightGitHub Action check runs and goes green (validatesaction.ymlend-to-end).Follow-ups (intentionally not in this PR)
npm/becwright/package.jsonoptionalDependenciesare still pinned to0.3.0while the package is0.4.0— needs a per-platform bump at release time.@v1tag so consumers canuses: DataDave-Dev/becwright@v1; the README example currently pins@mainwith a note.