Skip to main content

Output

How the CLI shapes what you see — output kinds, prompt config, watch modes, fill notifications, connection dots.


Output kinds

Every line the CLI prints carries a PrintKind. Listener cmd:output frames expose the same kind to web clients.

KindColorListener fieldGoes to log file?
printdefaultprintterminal only
successgreensuccessterminal only
infograyinfoterminal only
warnyellowwarnterminal only
errorrederrorterminal only
  • logger.info / warn / error / debug~/.tealstreet/cli.log only.
  • console.log / error / warn → both terminal (rate-limited 5/sec, 10 s dedup) and the log file.

Source: apps/cli/src/listener/adapter-context.ts:13, apps/cli/src/logger.ts.

Hook output

Each cmd:output frame produced by a webhook fire is also mirrored to the local REPL with a [hook:<name>] prefix in the matching chalk color.


Prompt

The REPL prompt is fully configurable. View it with prompt, set it with prompt set "<format>".

prompt # show current
prompt list # show all named presets
prompt preset <name> # switch to a preset
prompt set "{symbol} ${price} > "
prompt prefix <p> # change the leading "> " marker
prompt preview # render the current format with live data

Tokens

TokenRenders
{symbol}Focused symbol
{account}Account name
{price}Last price for focused symbol
{side}Position side (L / S / )
{size}Position size
{entry}Entry price
{pnl}Unrealized PnL (currency)
{pnl%}Unrealized PnL (percent)
{liq}Liquidation price
{leverage}Current leverage
{orders}Open order count
{conn}Connection health glyph (see below)

Alias ps works for prompt. Source: PromptCommand.ts.


Watch modes   (standalone-only)

Live, full-screen views that refresh every 1000 ms.

AliasLong formsShows
wawatch account, watch accMargin + positions + orders combo
wpwatch positions, watch posLive positions table
wowatch orders, watch ordLive orders table
wmwatch margin, watch balance, watch balLive margin
watch chart   (shorthand watch c <args>)Live ASCII candlestick
watch chaseLive chaser status panel

wa, wp, wo, wm all accept --all / -a for the multi-account view.

Exit keys

ContextKeys
REPL modeEscape, Ctrl+X
One-shot CLICtrl+C, Escape, Ctrl+X

(In the REPL, Ctrl+C is reserved for readline line-cancel.)

Terminal recovery

Watch modes use the alt screen + raw mode. On exit the CLI runs recreateReadline() because readline state can corrupt across raw-mode toggles. There's a 200 ms cooldown (MONITOR_EXIT_COOLDOWN_MS) where prompt updates are skipped — that's intentional, not a freeze. Source: apps/cli/src/repl.ts:280-330.

Web parity

Watch modes are standalone-only. The web app has its own live panels (positions table, orders panel, etc.) rendered as components, not as a terminal canvas.


Connection health

The {conn} prompt token and accounts listings render colored dots:

ColorMeaning
GreenHealthy
YellowWarning / initializing
RedError / disconnected
GrayNot connected

Driven by getConnectionStatus(exchange) from ConnectionMonitor. Force a fresh socket with conn reconnect.


Fill notifications

Every fill on the active exchange produces a one-liner:

✓ Fill: Bought 0.01 BTC-PERP @ $50,124.5

When you're inside a watch mode, the fill is appended via addWatchMessage to whichever panel is up. Source: apps/cli/src/repl.ts:850-858.


Critical error suppression

Per-account critical errors (geo-blocked, invalid API key, etc.) are classified by HealthMonitor and only printed once per category. If your error scrolled by an hour ago, check cli.log — it's still in there. Source: apps/cli/src/repl.ts:872-884.


Network monitor + rate limiting

The CLI's console interceptor (apps/cli/src/logger.ts) is rate-limited to 5 messages / second with a 10 s dedup window. print() and the unwrapped originalConsoleLog() bypass rate limiting and are what command handlers use for primary output. The interceptor is mainly defense against runaway third-party logging.