# Output formats

Source: https://libtmux.org/en/ts/latest/workspace/reference/output/

> Read JSON results, NDJSON events and diagnostics from the workspace command.

**Workspace Manager concept example** A working example of the core library. It can change without notice.



Every command accepts `--json` and `--ndjson`. JSON writes one document to
stdout. NDJSON writes one JSON record per line and takes precedence if both
flags are present. Machine output contains no terminal styling.

## Choose a stream

```console
$ tmux-workspace ls --json
```

The shape depends on the operation: listing and search describe workspace
records; conversion and import can return the translated document; loading
describes completed work and failures. Saving a document returns information
about that save. The file's YAML/JSON encoding is controlled separately by
`--workspace-format`.

Use [automation](https://libtmux.org/en/ts/latest/workspace/guides/automation/) for a detached load and streamed
progress. Read stdout as results and stderr as diagnostics. Check the exit
status even when stdout contains valid data.

## Partial work and interrupted streams

Load results can contain completed inputs, created IDs and retained effects.
Treat a failed operation as partial until its result tells you what remains.
A creation event alone does not establish that the workspace finished.

An output failure or interruption can leave a final record unwritten or
incomplete. A consumer must handle EOF and parse errors. Preserve the exit
status and inspect the private server before retrying mutations.

## Child output and logging

Machine calls encode captured child text so it cannot be confused with result
records. The optional [inspection shell](https://libtmux.org/en/ts/latest/workspace/cli/shell/) reports its child
status along with captured output. A nonzero editor status is propagated.

Captured child results retain up to 64 KiB of source bytes per stream and mark
truncation. NDJSON forwards child output as it arrives.

[`load --log-file PATH`](https://libtmux.org/en/ts/latest/workspace/cli/load/) appends diagnostics to a separate file. `--log-level`
selects advisory detail. A later log-file failure reports a diagnostic and
preserves the operation's result; the log can end with an incomplete record.

## Human output

`--color auto|always|never` selects styling; nonempty `NO_COLOR` disables color.
Human progress uses the terminal. `--no-progress` disables drawing without
hiding errors. Redirected or machine output avoids the progress display.

[CLI source](https://github.com/libtmux/libtmux-ts/blob/f36d692552bb9a373b45338bb5fece854e57cc3d/packages/workspace-cli/README.md).
