delta-forge-cli (interactive REPL)

Launch the interactive shell when stdin is a TTY; execute piped SQL as a script when stdin is not a TTY.

Category: commands

Syntax

delta-forge-cli [--profile <name>] [--control-url <url>] [--compute-url <url>] [--username <u>] [--password <p>] [--node <name>] [--format <fmt>] [--force] [--classic] [--resume [<path>]]

Description

## Overview With no subcommand, `delta-forge-cli` dispatches on whether stdin is a TTY. When a TTY is attached, the CLI launches the interactive shell (the default, or the legacy reedline REPL under `--classic`). When stdin is piped, the CLI reads the entire stream, splits it into statements, and runs each one as a script, printing results in the selected format. This single entry point means the same binary serves both human sessions and automation pipelines without a mode flag. ## Behavior - TTY detection uses `std::io::IsTerminal` on stdin. Any non-TTY stdin (pipe, redirected file, CI runner) routes to the stdin script path. - Interactive mode triggers credential collection. If neither `--username`/`--password` nor `DF_USERNAME`/`DF_PASSWORD` were supplied, the TUI login wizard prompts for control URL, username, and password. - After authentication, compute routing defaults to Auto: every SQL call consults the control plane's `/nodes/recommend` endpoint. Setting `--compute-url`, `DF_COMPUTE_URL`, or `/use-node <name>` inside the shell pins a specific worker. - The `--classic` flag selects the single-line reedline REPL. All other subcommands (`query`, `run`, `auth`, `health`, `demo-test`) ignore `--classic`. - `--resume` with no argument loads the most recent JSONL under `~/.deltaforge/sessions/`. With a path, it loads that file. The flag is ignored under `--classic`. - On exit the interactive shell flushes completed scrollback turns to a new JSONL in `~/.deltaforge/sessions/<YYYYMMDD-HHMMSS>.jsonl`. Pending turns are dropped. - Piped stdin mode prints results using `--format` (`table`, `compact`, or `json`). Failure of any statement halts execution and returns exit code 1. ## Compatibility - `--classic` exists for environments where the terminal UI rendering path is unsuitable (screen readers, constrained terminals). The classic REPL is feature-reduced: it has no slash menu, no completions popup, and no scrollback persistence, but it does retain history and safety prompts.

Examples

# Launch the interactive shell (default when stdin is a TTY)
delta-forge-cli
# Launch using a named profile from ~/.deltaforge/config.toml
delta-forge-cli --profile production
# Legacy single-line reedline REPL (used only by --classic)
delta-forge-cli --classic
# Rehydrate scrollback from the most recent session file
delta-forge-cli --resume
# Rehydrate from a specific session file
delta-forge-cli --resume ~/.deltaforge/sessions/20260419-140001.jsonl
# Piped SQL is detected when stdin is not a TTY and executed as a script
cat migrations/v2.sql | delta-forge-cli --format compact

Pitfalls

See Also

Open in interactive docs →   DeltaForge home →