Skip to main content
ralphy writes in one of three modes — pretty, JSON, or auto — plus a quiet variant that suppresses chatter regardless of mode. The resolution order is fixed, the JSON shape is stable, and pretty output is just-readable enough that an agent can scrape it if it has to. Default behavior is right for both terminals and pipes; you only set a flag when you want to override.

Resolution order

The preAction hook in cli/index.ts runs once before every verb:
  1. --json → mode is json. Pretty primitives are silenced; out() emits canonical JSON.
  2. --pretty → mode is pretty. TTY check is bypassed; tables and spinners always render.
  3. Otherwise → mode is auto. Pretty when process.stdout.isTTY is true, JSON when piped.
--quiet is orthogonal. It suppresses progress, spinners, and ok/info/warn lines — the final result still prints, errors still print on stderr. --no-color strips ANSI codes. Compose it with --pretty for layout without colors.

JSON mode

Every verb’s success path writes a single JSON object (or array) to stdout. Errors go to stderr as { "error": { "code": "E_...", "message": "...", "hint": "..." } }.
The shape is verb-specific; the contract is that the top level is always a single object or array, with no banner, no logs, no trailing whitespace beyond a single newline. Pipe to jq without filtering noise.

Pretty mode

Pretty renders with cli/lib/ui.ts: a 256-color palette, Unicode icons (, , , ), cli-table3 for tables, ora spinners, sectioned key/value blocks.
Pretty mode is for humans. The agent can read it (it’s just text) but you should still set --json when scripting — the shape is more stable across versions.

NDJSON event streams

Long-running verbs (generate video, generate music, render, assets install) emit structured events while they run, in addition to the terminal summary. The stream uses one JSON object per line — Node’s CommandStream helper (cli/lib/stream/command.ts) handles serialization. Example events from ralphy render <id>:
Each verb’s summary line is still the final stdout payload — the event stream is supplemental.

Quiet mode

-q/--quiet suppresses everything except the final result:
isQuietMode() in cli/lib/ui.ts is what each ok/info/warn call checks. Errors on stderr always print regardless.

—no-color

Disables chalk color output. Pretty mode still uses Unicode icons and tables, just without ANSI codes. The CLI also honors the NO_COLOR env var (informally — chalk handles it automatically).

Piping recipes

The last one is the canonical CI guard: exit 0 means doctor is green, exit non-zero means a key or dep is missing.

Stderr is structured too

Errors always write a structured payload on stderr — even in pretty mode the JSON form still appears (formatted) so an agent can parse both:
See Error catalog for the full shape.