● Interfaces

Command-Line Interface

4 min

The CLI is where DBSprout started and where most automation lives. It is a standard POSIX-style command with subcommands, structured exit codes, and --help available at every level.

The core loop

dbsprout init --db postgresql://user:pass@localhost/mydb
dbsprout generate --rows 500 --engine heuristic
dbsprout validate

init introspects the target and writes a dbsprout.toml and a schema snapshot under .dbsprout/. generate reads that snapshot and produces numbered seed files in ./seeds/ (e.g. 001_users.sql, 002_posts.sql) in FK-safe order. validate replays the generation and asserts 100% referential and structural integrity.

The same three commands work against a schema file instead of a live database:

dbsprout init --file schema.dbml
dbsprout generate --output-format csv
dbsprout validate

Commands at a glance

Core

CommandWhat it does
initIntrospect a database or schema file; write dbsprout.toml + snapshot
generateGenerate seed data from the current snapshot
validateCheck generated data for FK, UNIQUE, NOT NULL, CHECK violations
diffReport schema changes since the last init snapshot

Ops and diagnostics

CommandWhat it does
reportGenerate an HTML quality report from recorded generation runs
auditShow the LLM interaction audit log
doctorDiagnose the environment (Python version, drivers, models, disk, secrets, plugins)
modelsList, download, and inspect embedded GGUF models
pluginsInspect discovered DBSprout plugins

Surfaces

CommandWhat it does
tuiLaunch the Terminal UI — interactive schema browser and live progress
serveLaunch the Web Studio on localhost:8420

Advanced

CommandWhat it does
trainQLoRA fine-tuning pipeline — extract → serialize → run

Why use the CLI?

Pipe-friendly. All commands emit plain text or JSON (--format json on validate, diff). Pipe the output of dbsprout validate --format json into jq or into a CI assertion step without any extra tooling.

Shell history. Complex generation invocations (--rows 1000 --engine spec --privacy redacted --output-format direct --db ...) compose naturally as shell history entries or Makefile targets. They are repeatable with !! and diffable in code review.

CI-ready. Exit code 0 means success; non-zero means something failed. The --seed flag (default 42) makes output deterministic, so generated fixture files can be committed, diffed in PRs, and their changes reviewed. Add dbsprout generate && dbsprout validate to any CI step and you get guaranteed-correct seed data as an artefact.

Offline by default. Every command works without an internet connection. The [llm] extra adds an embedded 1.5 B parameter model for spec generation that runs entirely on device.

For the full option listing for every command, see the CLI Reference.