Skip to content

feat: inline --rule specs and rules YAML from stdin#6

Merged
SpollaL merged 1 commit into
masterfrom
feat/inline-rules-and-stdin
Apr 24, 2026
Merged

feat: inline --rule specs and rules YAML from stdin#6
SpollaL merged 1 commit into
masterfrom
feat/inline-rules-and-stdin

Conversation

@SpollaL
Copy link
Copy Markdown
Owner

@SpollaL SpollaL commented Apr 24, 2026

Summary

  • Adds repeatable --rule check:column[:args] flag to validate — covers not_null, not_empty, unique, min, max, between, regex. custom stays YAML-only (needs multi-line SQL).
  • Adds --rules - to read rules YAML from stdin. Combines with --rule; empty stdin is tolerated when inline rules are present.
  • Name collisions across YAML + inline are disambiguated with _2, _3, … suffixes.
  • Inline rules are always severity error (YAML remains required for warning, threshold, and custom).

Why

Coding agents calling sentinel via Bash can now compose quick checks inline without first writing a rules file to disk. YAML stays the path for the richer surface (severity/threshold/custom SQL).

Test plan

  • cargo fmt --check clean
  • cargo clippy -- -D warnings clean
  • cargo test — 100 tests pass (20 new parser + disambiguator tests)
  • Smoke-tested inline only, stdin YAML, empty stdin + inline, YAML + inline collision, no-rules (exit 3), invalid spec in both text and agent-mode output
  • --help shows multi-line arity examples

🤖 Generated with Claude Code

`sentinel validate` now accepts repeatable `--rule check:column[:args]`
flags and can read its rules YAML from stdin via `--rules -`. Inline
specs cover not_null, not_empty, unique, min, max, between, and regex;
the custom check stays YAML-only for multi-line SQL.

Enables coding agents to compose quick checks without writing a rules
file to disk, while still allowing composition with a YAML file when
warnings, thresholds, or custom SQL are needed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@SpollaL SpollaL merged commit 98ab9a6 into master Apr 24, 2026
1 check passed
@SpollaL SpollaL deleted the feat/inline-rules-and-stdin branch April 24, 2026 13:05
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