Skip to content

🎨 Mosaic: UI Polish for CLI Errors#613

Open
madmax983 wants to merge 1 commit into
trunkfrom
mosaic-ui-polish-cli-errors-9364451959914574599
Open

🎨 Mosaic: UI Polish for CLI Errors#613
madmax983 wants to merge 1 commit into
trunkfrom
mosaic-ui-polish-cli-errors-9364451959914574599

Conversation

@madmax983
Copy link
Copy Markdown
Owner

  • 🖌️ Before: CLI initialization errors and exits printed raw outcome_class: ... \n error: ... text to standard error without formatting, resembling a log file.
  • After: Error outputs are formatted using crossterm colors with a bold red error: prefix, and the outcome_class debug information is dimmed so it recedes into the visual hierarchy.
  • 🖼️ Visuals: Red colored error: tags and dimmed debug output for all CLI error exits.

PR created automatically by Jules for task 9364451959914574599 started by @madmax983

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>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/cli/mod.rs
Comment on lines +70 to +76
use crossterm::style::Stylize;
eprintln!(
"{} {}",
"outcome_class:".dim(),
ExitCode::UsageError.outcome_class().dim()
);
eprintln!("{} {e}", "error:".red().bold());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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}");
            }

Comment thread src/cli/mod.rs
Comment on lines +2135 to +2137
use crossterm::style::Stylize;
eprintln!("{} {}", "outcome_class:".dim(), code.outcome_class().dim());
eprintln!("{} {}", "error:".red().bold(), detail);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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}");
    }

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/cli/mod.rs
eprintln!("outcome_class: {}", code.outcome_class());
eprintln!("error: {detail}");
use crossterm::style::Stylize;
eprintln!("{} {}", "outcome_class:".dim(), code.outcome_class().dim());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant