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
fix: make piped output human-readable instead of raw CommonMark
Two problems are fixed:
1. FORCE_COLOR leaking ANSI to pipes: When FORCE_COLOR=1 is set (common
in VS Code terminals), ANSI escape codes leaked through to less/cat
because isPlainOutput() treated FORCE_COLOR as higher priority than
TTY detection. Now FORCE_COLOR only applies when stdout IS a TTY.
Users who truly want color in pipes can use SENTRY_PLAIN_OUTPUT=0.
2. Plain mode outputs raw CommonMark: When piped, the CLI produced raw
markdown syntax (| --- |, **bold**, [link](url), `code`) which is
unreadable in a pager. Now plain mode:
- renderMarkdown() parses and renders to structured plain text
(headings, aligned tables, blockquote indentation) then strips ANSI
- formatTable() uses renderTextTable() with box-drawing borders
instead of buildMarkdownTable() with raw CommonMark syntax
- renderInlineMarkdown() strips markdown syntax via stripMarkdownInline()
- terminalLink() returns plain text (no OSC 8 sequences) when piped
- divider() and footer/hint text use plainSafeMuted() to avoid ANSI
Architecture: isPlainOutput() extracted to plain-detect.ts to avoid
circular dependency between markdown.ts and colors.ts. Re-exported from
markdown.ts for backward compatibility.
Copy file name to clipboardExpand all lines: AGENTS.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -283,7 +283,8 @@ All non-trivial human output must use the markdown rendering pipeline:
283
283
- Build markdown strings with helpers: `mdKvTable()`, `colorTag()`, `escapeMarkdownCell()`, `renderMarkdown()`
284
284
-**NEVER** use raw `muted()` / chalk in output strings — use `colorTag("muted", text)` inside markdown
285
285
- Tree-structured output (box-drawing characters) that can't go through `renderMarkdown()` should use the `plainSafeMuted` pattern: `isPlainOutput() ? text : muted(text)`
0 commit comments