Skip to main content

Module ui

Module ui 

Source
Expand description

UI utilities for RCH terminal output.

This module provides context-aware output utilities that automatically adapt to the current environment (interactive terminal, hook mode, piped, etc.).

§Key Components

  • OutputContext: Detects and represents the current output context
  • Icons: Unicode icons with automatic ASCII fallbacks
  • RchTheme: Brand colors and semantic styles

§Design Philosophy

  • stdout is for DATA (JSON, compilation output, etc.)
  • stderr is for DIAGNOSTICS (status, progress, errors)

Rich output goes to stderr so that:

  1. Agents can parse stdout reliably
  2. Piping rch status | jq works correctly
  3. Compilation output passthrough is unaffected

§Example

ⓘ
use rch_common::ui::{Icons, OutputContext, RchTheme};

let ctx = OutputContext::detect();
eprintln!("{} Build successful", Icons::check(ctx));

// With rich-ui feature enabled:
let style = RchTheme::success();

Re-exports§

pub use context::OutputContext;
pub use display::IntoErrorPanel;
pub use display::ResultExt;
pub use display::anyhow_to_json;
pub use display::anyhow_to_panel;
pub use display::display_anyhow_error;
pub use display::display_error;
pub use display::display_error_with_code;
pub use display::error_to_json;
pub use display::error_to_panel;
pub use error::ErrorContext;
pub use error::ErrorPanel;
pub use error::ErrorSeverity;
pub use error::show_error;
pub use error::show_info;
pub use error::show_warning;
pub use errors::NetworkErrorDisplay;
pub use icons::Icons;
pub use progress::AnimatedSpinner;
pub use progress::ArtifactSummary;
pub use progress::BuildPhase;
pub use progress::BuildProfile;
pub use progress::CelebrationSummary;
pub use progress::CompilationProgress;
pub use progress::CompletionCelebration;
pub use progress::CrateInfo;
pub use progress::PipelineProgress;
pub use progress::PipelineStage;
pub use progress::ProgressContext;
pub use progress::RateLimiter;
pub use progress::SpinnerResult;
pub use progress::SpinnerStyle;
pub use progress::StageStatus;
pub use progress::TransferDirection;
pub use progress::TransferProgress;
pub use theme::RchTheme;

Modules§

context
Output context detection for RCH.
display
Error display utilities for unified error handling.
error
ErrorPanel - Consistent, actionable error display for RCH.
errors
Specialized error display components for RCH.
icons
Icons with automatic Unicode/ASCII fallback for terminals.
progress
Progress context for safe, rate-limited terminal updates.
theme
RCH brand colors and semantic styles.