systemprompt_logging/services/cli/
startup.rs1use std::io::Write;
7
8use crate::services::cli::theme::BrandColors;
9
10fn stderr_writeln(args: std::fmt::Arguments<'_>) {
11 let mut out = std::io::stderr();
12 writeln!(out, "{args}").ok();
13}
14
15pub fn render_startup_banner(subtitle: Option<&str>) {
16 stderr_writeln(format_args!(""));
17 stderr_writeln(format_args!(
18 "{}{}{}{}{}",
19 BrandColors::primary_bold("</"),
20 BrandColors::white_bold("SYSTEMPROMPT"),
21 BrandColors::primary_bold("."),
22 BrandColors::white("io"),
23 BrandColors::primary_bold(">")
24 ));
25 if let Some(text) = subtitle {
26 stderr_writeln(format_args!("{}", BrandColors::dim(text)));
27 }
28 stderr_writeln(format_args!(""));
29}
30
31pub fn render_phase_header(name: &str) {
32 stderr_writeln(format_args!(
33 "\n{} {}",
34 BrandColors::primary("\u{25b8}"),
35 BrandColors::white_bold(name)
36 ));
37}
38
39pub fn render_phase_item(icon: &str, message: &str, detail: Option<&str>) {
40 match detail {
41 Some(d) => stderr_writeln(format_args!(
42 " {} {} {}",
43 icon,
44 message,
45 BrandColors::dim(format!("({})", d))
46 )),
47 None => stderr_writeln(format_args!(" {} {}", icon, message)),
48 }
49}
50
51pub fn render_phase_success(message: &str, detail: Option<&str>) {
52 render_phase_item(
53 &format!("{}", BrandColors::running("\u{2713}")),
54 message,
55 detail,
56 );
57}
58
59pub fn render_phase_info(message: &str, detail: Option<&str>) {
60 render_phase_item(
61 &format!("{}", BrandColors::highlight("\u{2139}")),
62 message,
63 detail,
64 );
65}
66
67pub fn render_phase_warning(message: &str, detail: Option<&str>) {
68 render_phase_item(
69 &format!("{}", BrandColors::starting("\u{26a0}")),
70 message,
71 detail,
72 );
73}