Skip to content

feat: JSON Schema for .bec/rules.yaml — editor autocompletion and early validation#80

Merged
DataDave-Dev merged 2 commits into
mainfrom
feat/rules-json-schema
Jul 3, 2026
Merged

feat: JSON Schema for .bec/rules.yaml — editor autocompletion and early validation#80
DataDave-Dev merged 2 commits into
mainfrom
feat/rules-json-schema

Conversation

@DataDave-Dev

Copy link
Copy Markdown
Owner

What

Closes #29 (pulled forward from the v1.2 milestone — it is the highest-leverage rule-writing DX gap: today a typo in rules.yaml is invisible until a check runs).

  • schema/rules.schema.json (draft-07 for maximum editor compatibility): mirrors the frozen schema_version: 1 field set exactly — the nine rule fields, the severity/target enums, required: [id, check], and additionalProperties: false so pathss: or severity: blockng get flagged as you type instead of at commit time. Every field carries its doc description, so hover text in the editor teaches the format.
  • becwright init writes a # yaml-language-server: $schema=… first line — VS Code's YAML extension and JetBrains IDEs pick it up with zero setup. One hand-added line gives any pre-existing rules file the same.
  • usage.md (+es) documents it.

Dependency note (calling it out explicitly)

Runtime still depends on pyyaml alone. jsonschema>=4 is added as a test-only dev extra so CI validates the schema against real examples; the tests importorskip it, so the suite still passes without it. If even a dev-extra addition is unwanted, say so and I'll drop the dependency and keep only the structural tests.

Stability

Additive: the schema documents the existing frozen format; the generated file gains one comment line (comments are outside the stable contract). load_rules behavior unchanged.

Test plan

  • 8 new tests: schema self-check, valid file passes, commit-msg rule without paths passes, typo'd field / bad severity / missing check fail, init's generated output validates, this repo's own .bec/rules.yaml validates
  • Full suite green (261 passed), dogfood hook passed

@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: 40 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: db35c053-e6c9-40ce-8e9f-432e43ff821d

📥 Commits

Reviewing files that changed from the base of the PR and between 6b85e60 and 17b27ca.

📒 Files selected for processing (6)
  • documentation/usage.es.md
  • documentation/usage.md
  • pyproject.toml
  • schema/rules.schema.json
  • src/becwright/cli.py
  • tests/test_schema.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/rules-json-schema

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.

…ly validation

Closes #29.

- schema/rules.schema.json (draft-07): mirrors the frozen schema_version-1
  field set exactly — the nine rule fields, the severity/target enums, and
  additionalProperties: false so a typo (pathss:, severity: blockng) is
  flagged in the editor instead of surfacing at commit time.
- becwright init now writes a '# yaml-language-server: $schema=…' first line,
  so VS Code's YAML extension and JetBrains IDEs pick the schema up with zero
  setup; one hand-added line gives pre-existing files the same.
- Tests validate the schema itself, the starter rules init generates, this
  repo's own dogfood rules, and that the typo/enum/missing-check cases fail.
  jsonschema is a test-only dev extra (runtime still depends on pyyaml alone);
  the tests importorskip it.
- usage.md (+es) documents the editor setup.
@DataDave-Dev DataDave-Dev force-pushed the feat/rules-json-schema branch from e5ac000 to 141c758 Compare July 3, 2026 02:14
@DataDave-Dev DataDave-Dev merged commit 212d39a into main Jul 3, 2026
5 checks passed
@DataDave-Dev DataDave-Dev deleted the feat/rules-json-schema branch July 3, 2026 02:17
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.

Publish a JSON Schema for .bec/rules.yaml

1 participant