rch-common 1.0.26

Shared types and utilities for Remote Compilation Helper
Documentation
//! 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
//!
//! ```ignore
//! 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();
//! ```

pub mod context;
pub mod display;
pub mod error;
pub mod errors;
pub mod icons;
pub mod progress;
pub mod theme;

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