Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions cli/compile.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ sqb --project-dir <path> compile [flags]
3. **SQL validation** - validates SQL syntax (when SQL analysis is enabled)
4. **Column lineage** - analyzes column-level dependencies across models (fast mode by default)
5. **Contract validation** - checks declared column contracts against inferred query output
6. **Artifact write** - writes compiled SQL to `target/compiled/`
6. **Rules** - evaluates selected native built-ins, then selected custom Python Rules
7. **Artifact write** - writes compiled SQL to `target/compiled/` when Rules pass

## Focused compilation

Expand Down Expand Up @@ -65,9 +66,9 @@ When SQL analysis is enabled (default), compile performs static analysis on your
- **Column lineage**: Traces which source columns flow into each output column, including transform classification. See [Column Lineage](/concepts/column-lineage) for details

<Note>
`sqb compile` checks SQL correctness, contracts, and lineage. [`sqb kata`](/cli/kata) compiles the
project and then applies its separately configured architecture policy. Kata is not run
automatically by `compile`.
`sqb compile` is authoritative for mandatory correctness, contracts, lineage, and configured Rules.
Rules findings block artifact completion. Use [`sqb rules run`](/cli/rules) to focus on one exact
code or family without changing project configuration.
</Note>

### Contract diagnostics
Expand Down
30 changes: 0 additions & 30 deletions cli/fix.mdx

This file was deleted.

4 changes: 2 additions & 2 deletions cli/format.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ sqb format --check
sqb format --diff --select tag:marts
```

Formatting owns presentation. Use [`sqb lint`](/cli/lint) for diagnostics and [`sqb fix`](/cli/fix)
for safe semantic cleanups.
Formatting owns presentation and source rewriting. Compiler-integrated diagnostics belong to
configured [Rules](/concepts/rules), which never mutate source.
177 changes: 0 additions & 177 deletions cli/kata.mdx

This file was deleted.

28 changes: 0 additions & 28 deletions cli/lint.mdx

This file was deleted.

49 changes: 49 additions & 0 deletions cli/rules.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: "rules"
description: "List, inspect, or run compiler-integrated Rules and generate project guidance."
---

# sqb rules

Configured Rules run automatically through `sqb compile` and build planning. The `rules` command
provides focused catalogue, inspection, execution, and guidance operations.

## Usage

```bash
sqb rules list
sqb rules show <rule-code>
sqb rules run <rule-code-or-family> [--select <selector>] [--exclude <selector>]
sqb rules skills [--check]
```

Add `--json` after `rules` for machine-readable list or run output:

```bash
sqb rules --json list
sqb rules --json run SQBRSQL
```

Lifecycle progress is written to stderr so stdout remains valid JSON.

## Commands

- `list`: print built-in and repository-defined Rules.
- `show`: print metadata for one exact code.
- `run`: compile and evaluate only one exact code or family prefix.
- `skills`: install guidance derived from configured Rules; `--check` verifies freshness without writing.

`run` accepts normal SQLBuild model selectors. Native built-ins execute before custom Python Rules.

## Exit codes

| Command | Code | Meaning |
|---|---:|---|
| `rules list` | 0 | Catalogue printed |
| `rules show` | 0 | Exact code found |
| `rules show` | 2 | Unknown code |
| `rules run` | 0 | No findings |
| `rules run` | 1 | Findings reported or compilation failed |
| `rules run` | 2 | Unknown code or family |
| `rules skills --check` | 0 | Guidance is fresh |
| `rules skills --check` | 1 | Guidance is missing or stale |
18 changes: 9 additions & 9 deletions cli/skills.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,17 @@ cd waffle-shop
# Agent skill files are already installed
```

## Kata policy skills
## Project Rules skills

`sqb skills` installs general SQLBuild framework guidance. `sqb kata skills` generates
project-specific guidance from the active Kata rules, options, thresholds, naming vocabulary, and
scoped deviations:
`sqb skills` installs general SQLBuild framework guidance. `sqb rules skills` generates
project-specific guidance from the active Rules, options, thresholds, naming vocabulary, and scoped
deviations:

```bash
sqb kata skills
sqb kata skills --check
sqb rules skills
sqb rules skills --check
```

Use `--check` in CI to detect missing or stale policy guidance without rewriting files. Kata uses
the separate `sqlbuild-kata` skill path and refuses to overwrite divergent or unowned content. See
[Kata SQL Architecture Checks](/concepts/kata) and the [Kata CLI reference](/cli/kata).
Use `--check` in CI to detect missing or stale Rules guidance without rewriting files. Rules use
the separate `sqlbuild-rules` skill path and refuse to overwrite divergent or unowned content. See
[Compiler-integrated Rules](/concepts/rules) and the [Rules CLI reference](/cli/rules).
2 changes: 1 addition & 1 deletion concepts/incremental.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ max_batches = 100
action = "error" # or "warn"
```

Project limits support only `error` and `warn`; they never silently cap work. When a model has a nested `microbatch_limit`, the project policy checks the full resolved range first and the model policy then applies.
Project limits support only `error` and `warn`; they never silently cap work. When a model has a nested `microbatch_limit`, the project limit checks the full resolved range first and the model policy then applies.

`--max-microbatches N` is an invocation-wide, hard `error` ceiling and an explicit one-run authorization. It takes precedence over project and model limits, applies to models without a declared limit, and never inherits `cap_from_start` or `cap_from_end`. For example, passing a value large enough for an intentional backfill authorizes the full range instead of retaining the model's ordinary-run cap.

Expand Down
Loading
Loading