🎨 Mosaic: UI Polish for CLI Errors#613
Conversation
CLI initialization errors and exits were printing raw debug text to standard error without formatting, which made them look like log files rather than a polished dashboard output. This commit formats the generic error output in `exit_with_outcome` and the `clap::Error` handler using `crossterm` colors to enforce visual hierarchy: - A bold red `error:` prefix ensures critical failures pop. - The `outcome_class:` debug information is dimmed to recede from the user's primary focus. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request introduces terminal styling using the crossterm library for error and outcome class messages printed to stderr. The review feedback recommends checking if stderr is a terminal (using std::io::stderr().is_terminal()) before applying these styles to prevent polluting log files or breaking downstream parsers when output is redirected.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| use crossterm::style::Stylize; | ||
| eprintln!( | ||
| "{} {}", | ||
| "outcome_class:".dim(), | ||
| ExitCode::UsageError.outcome_class().dim() | ||
| ); | ||
| eprintln!("{} {e}", "error:".red().bold()); |
There was a problem hiding this comment.
Unconditional ANSI escape codes are printed to stderr even when it is redirected to a file or a pipe (non-TTY). This can pollute log files and break downstream parsers. It is recommended to check if stderr is a terminal using std::io::stderr().is_terminal() before applying colors and styles.
if std::io::stderr().is_terminal() {
use crossterm::style::Stylize;
eprintln!(
"{} {}",
"outcome_class:".dim(),
ExitCode::UsageError.outcome_class().dim()
);
eprintln!("{} {e}", "error:".red().bold());
} else {
eprintln!("outcome_class: {}", ExitCode::UsageError.outcome_class());
eprintln!("error: {e}");
}| use crossterm::style::Stylize; | ||
| eprintln!("{} {}", "outcome_class:".dim(), code.outcome_class().dim()); | ||
| eprintln!("{} {}", "error:".red().bold(), detail); |
There was a problem hiding this comment.
Unconditional ANSI escape codes are printed to stderr even when it is redirected to a file or a pipe (non-TTY). This can pollute log files and break downstream parsers. It is recommended to check if stderr is a terminal using std::io::stderr().is_terminal() before applying colors and styles.
if std::io::stderr().is_terminal() {
use crossterm::style::Stylize;
eprintln!("{} {}", "outcome_class:".dim(), code.outcome_class().dim());
eprintln!("{} {}", "error:".red().bold(), detail);
} else {
eprintln!("outcome_class: {}", code.outcome_class());
eprintln!("error: {detail}");
}There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b7467bcff4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| eprintln!("outcome_class: {}", code.outcome_class()); | ||
| eprintln!("error: {detail}"); | ||
| use crossterm::style::Stylize; | ||
| eprintln!("{} {}", "outcome_class:".dim(), code.outcome_class().dim()); |
There was a problem hiding this comment.
Preserve the plain outcome label for scripts
When these exits run under CI or with stderr captured/piped, Stylize::dim() writes ANSI reset/style bytes around both tokens, so the documented outcome_class: <class> line is no longer present as plain text (for example, tests such as bench_calibrate check for outcome_class: calibration_optimistic, and simple parsers using that prefix will miss it). Please keep the stable label unstyled, or only add color on a TTY while preserving a parseable plain line.
Useful? React with 👍 / 👎.
outcome_class: ... \n error: ...text to standard error without formatting, resembling a log file.crosstermcolors with a bold rederror:prefix, and theoutcome_classdebug information is dimmed so it recedes into the visual hierarchy.error:tags and dimmed debug output for all CLI error exits.PR created automatically by Jules for task 9364451959914574599 started by @madmax983