pub fn render_cli_error(
code: &str,
message: &str,
json_mode: bool,
details: Option<&Value>,
) -> (ErrorStream, String)Expand description
Decide the target stream and serialized line for a CLI error. Pure —
the routing decision is unit-testable without capturing process
streams. Under --json the {code, message, details} envelope goes
to stdout so the documented memstead <sub> … --json | jq -r .code
recipe works on the error path (a stdout-only pipe); the human
markdown form goes to stderr. code is the stable
UPPER_SNAKE_CASE token (matching the wire envelope agents see over
MCP); details carries the structured recovery payload under the
details key.