Skip to content

feat(cli): node selection for compile - #26

Merged
ihistand merged 1 commit into
mainfrom
feat/compile-node-selection
Jun 16, 2026
Merged

feat(cli): node selection for compile#26
ihistand merged 1 commit into
mainfrom
feat/compile-node-selection

Conversation

@ihistand

Copy link
Copy Markdown
Collaborator

Summary

Adds node selection to compile, mirroring dbt compile --select. compile now accepts the same selection flags as run/build--actions, --tags, --include-deps, --include-dependents — and filters the printed graph to just the selected action(s):

sqlanvil compile --actions my_model --json
sqlanvil compile --tags daily --include-deps --json

How it works

This is output filtering, not partial compilation. The whole project must still compile (ref() resolution and the dependency graph require every action registered), so we compile fully and then prune the result before printing — reusing the existing, battle-tested prune() that run/build already use, plus the shared yargs option definitions. No proto changes.

  • A clean graph is pruned when a selector is present.
  • On compile errors, the full graph + errors print unchanged (graph-level errors kept as-is).
  • A selector matching nothing emits an empty graph and exits 0, matching prune's run-side behavior.
  • --include-deps / --include-dependents retain their existing validation (only valid alongside --actions/--tags).

Tests

New compile node selection suite in cli/index_compile_test.ts over an upstream -> midstream -> downstream project, covering: full graph (no selector), --actions, --include-deps, --include-dependents, --tags, empty-match exits 0, and the no-selector validation error. //cli:index_compile_test passes (full suite + new tests).

Closes #25

🤖 Generated with Claude Code

…tions)

`compile` now accepts the same selection flags as `run`/`build`
(--actions, --tags, --include-deps, --include-dependents) and prunes the
compiled graph before printing, mirroring dbt's `compile --select`.

The whole project still compiles (ref() resolution needs every action
registered); this only filters the printed output. A clean graph is pruned
when a selector is present; on compile errors the full graph + errors print
unchanged. A selector matching nothing emits an empty graph and exits 0,
matching prune's run-side behavior. Reuses the existing prune() and the
shared yargs option definitions — no proto changes.

Adds a `compile node selection` test suite over an
upstream->midstream->downstream project covering each flag, empty matches,
and the "--include-deps without a selector is rejected" validation.

Closes #25

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

Node selection for compile (filter compiled output to selected actions)

1 participant