You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write JSON payloads straight to stdout instead of through Spectre
`submission get` and every other command that emits a machine-readable
payload wrote it via Spectre.Console's static `AnsiConsole.WriteLine`.
That renders the string through Spectre's layout pipeline, which
word-wraps at `Profile.Width`. The wrap is unaware of JSON syntax, so it
injected raw U+000A/U+000D characters inside string values and could
split a `\uXXXX` escape in half.
The result was invalid JSON (RFC 8259 §7 forbids unescaped control
characters in strings), and — worse — lenient parsers such as
PowerShell's `ConvertFrom-Json` accepted it and silently corrupted the
listing text, so the documented `submission get` -> edit ->
`submission update` round-trip could republish mangled store copy.
Redirected stdout was the worst case, since Spectre falls back to 80
columns when there is no console.
Program.cs already puts all human-facing output on stderr and reserves
stdout for the payload; only the renderer was wrong. Add a
`StandardOutput.WriteLine` helper that writes to `Console.Out` directly
and route the 19 JSON call sites through it.
`package` writes its output directory to stdout for the same reason, so
it moves too — that also fixes a latent Spectre markup parse error for
paths containing `[`. The path is no longer green/bold.
Also fix a latent test-harness bug this uncovered: `OutputCapture` called
`Console.SetOut(this)` from its constructor, so the error capture
silently hijacked `Console.Out`. It is now set explicitly for stdout
only, matching how Program.cs keeps the two streams apart.
Fixes#150
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af8e5c71-6935-4efa-b777-64b180bb20c7
0 commit comments