Skip to main content

systemprompt_logging/services/cli/
startup.rs

1//! Startup-phase console rendering for the CLI sink.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use crate::services::cli::sink::stderr_writeln;
7use crate::services::cli::theme::BrandColors;
8
9pub fn render_startup_banner(subtitle: Option<&str>) {
10    stderr_writeln(format_args!(""));
11    stderr_writeln(format_args!(
12        "{}{}{}{}{}",
13        BrandColors::primary_bold("</"),
14        BrandColors::white_bold("SYSTEMPROMPT"),
15        BrandColors::primary_bold("."),
16        BrandColors::white("io"),
17        BrandColors::primary_bold(">")
18    ));
19    if let Some(text) = subtitle {
20        stderr_writeln(format_args!("{}", BrandColors::dim(text)));
21    }
22    stderr_writeln(format_args!(""));
23}
24
25pub fn render_phase_header(name: &str) {
26    stderr_writeln(format_args!(
27        "\n{} {}",
28        BrandColors::primary("\u{25b8}"),
29        BrandColors::white_bold(name)
30    ));
31}
32
33pub fn render_phase_item(icon: &str, message: &str, detail: Option<&str>) {
34    match detail {
35        Some(d) => stderr_writeln(format_args!(
36            "  {} {} {}",
37            icon,
38            message,
39            BrandColors::dim(format!("({})", d))
40        )),
41        None => stderr_writeln(format_args!("  {} {}", icon, message)),
42    }
43}
44
45pub fn render_phase_success(message: &str, detail: Option<&str>) {
46    render_phase_item(
47        &format!("{}", BrandColors::running("\u{2713}")),
48        message,
49        detail,
50    );
51}
52
53pub fn render_phase_info(message: &str, detail: Option<&str>) {
54    render_phase_item(
55        &format!("{}", BrandColors::highlight("\u{2139}")),
56        message,
57        detail,
58    );
59}
60
61pub fn render_phase_warning(message: &str, detail: Option<&str>) {
62    render_phase_item(
63        &format!("{}", BrandColors::starting("\u{26a0}")),
64        message,
65        detail,
66    );
67}