Skip to content

[FEATURE]: Add missing dbt commands or pass-through to native dbt CLI #897

@lgwacker

Description

@lgwacker

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Problem:

altimate-dbt provides a curated subset of dbt commands (16 total), but several standard and frequently-used dbt commands are missing. When a user tries to invoke one of these, the CLI returns a hard error instead of falling back to the already-configured dbt binary.

Current behavior:
bash
$ altimate-dbt seed
{ "error": "Unknown command: seed", "usage": { ... } }

$ altimate-dbt snapshot
{ "error": "Unknown command: snapshot", "usage": { ... } }


Missing commands (not in src/index.ts USAGE map):

| Command       | dbt reference                      | Typical use case            |
|---------------|------------------------------------|-----------------------------|
| seed          | dbt seed                           | Load CSV seed files         |
| snapshot      | dbt snapshot                       | SCD Type-2 snapshots        |
| source        | dbt source freshness               | Source freshness checks     |
| docs          | dbt docs generate / dbt docs serve | Documentation               |
| clean         | dbt clean                          | Clean target/ and packages  |
| debug         | dbt debug                          | Full connection diagnostics |
| list / ls     | dbt list                           | Resource listing            |
| parse         | dbt parse                          | Parse project only          |
| run-operation | dbt run-operation                  | Execute macros              |
| clone         | dbt clone                          | Clone models (1.6+)         |
| retry         | dbt retry                          | Retry failed models (1.6+)  |

Additionally: even for implemented commands (build, run, test, compile), only single-model --model is supported. Native dbt selectors (--select, --exclude, --selector, tags) are not exposed.

Proposed solutions:

Option A: Add native wrappers for all commands. High maintenance as dbt evolves.

Option B (Recommended): Pass-through to configured dbt CLI. For any command not in the USAGE map, instead of returning Unknown command, delegate the full argument vector to the dbt binary that altimate-dbt init already resolved.

Implementation sketch:
ts
// src/index.ts — after the switch(cmd) block
default:
  const dbt = getDbt() // from dbt-resolve.ts
  const result = await run([cmd, ...rest])
  return { stdout: result.stdout, stderr: result.stderr, passthrough: true }


Why this works well:
- altimate-dbt init already resolves the correct Python env and dbt binary (venv, conda, pyenv, pipx, uv, pdm, poetry, etc.)
- src/dbt-cli.ts already has run() and configure() for this purpose
- Users get full native dbt power for advanced commands, while still benefiting from structured output for the 16 curated commands
- No need to maintain JSON log parsers for every sub-command

Safety considerations:
- Could be gated behind a config flag (allowPassthrough: true)
- Or allowlisted to known-safe commands (seed, snapshot, docs, clean, source, debug, list, parse, run-operation, clone, retry)

Context:
- Source inspected: packages/dbt-tools/src/index.ts @ main (commit a490bd4)
- altimate-code version: 0.8.3
- dbt versions tested: 1.5, 1.7, 1.9, 1.11 (JSON log format changes across these already make the CLI fallback in dbt-cli.ts necessary for compile/execute/ls)

Would you accept a PR for Option B (pass-through with an allowlist)? If so, I can draft the implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions