Output, Errors, and Color

Nodeup supports human output for operators and JSON output for automation.

Human Output

Human output is the default:

nodeup show active-runtime

Management commands write a concise human result to stdout. Human errors are written to stderr with this shape:

nodeup error: <cause>. Hint: <next action>.

JSON Output

Use JSON mode for scripts:

nodeup --output json show home
nodeup --output json toolchain list

Successful command payloads are pretty-printed JSON on stdout. Handled failures are JSON envelopes on stderr:

{
  "kind": "invalid-input",
  "message": "<cause>. Hint: <next action>.",
  "exit_code": 2
}

Stable envelope fields:

  • kind
  • message
  • exit_code

kind values include internal, invalid-input, unsupported-platform, network, not-found, conflict, and not-implemented.

ANSI styling is never injected into JSON stdout or stderr payloads.

Delegated Commands in JSON Mode

nodeup run --output json ... keeps stdout reserved for the final Nodeup response. Delegated command stdout is routed to stderr in JSON mode.

The final payload is:

{
  "runtime": "v22.1.0",
  "command": "node",
  "exit_code": 0
}

The Nodeup process exits with the delegated command's exit code.

Completion Output

nodeup completions always writes raw shell script text to stdout. It does not wrap output in JSON, even when --output json is supplied.

Human Color Precedence

Human stdout and stderr color controls use this precedence:

  1. --color auto|always|never
  2. NODEUP_COLOR=auto|always|never
  3. NO_COLOR
  4. stream-aware auto

auto enables ANSI styles only when the relevant stream is a terminal. Invalid NODEUP_COLOR values are ignored.

Examples:

nodeup --color never show active-runtime
NODEUP_COLOR=always nodeup show home
NO_COLOR=1 nodeup show home

Log Color

Logs use NODEUP_LOG_COLOR=always|auto|never. The default is colored logs unless NO_COLOR disables color. NODEUP_LOG_COLOR=always overrides NO_COLOR.

Logging Defaults

Default filters depend on context:

  • Managed alias dispatch: nodeup=warn
  • Human management commands: nodeup=info
  • JSON management commands: nodeup=off

Set RUST_LOG to override logging:

RUST_LOG=nodeup=debug nodeup show active-runtime

Keep RUST_LOG unset or off when a script needs clean JSON output.