systemprompt-cli 0.2.1

Unified CLI for systemprompt.io AI governance: agent orchestration, MCP governance, analytics, profiles, cloud deploy, and self-hosted operations.
Documentation
use std::time::Duration;
use systemprompt_logging::services::cli::{
    BrandColors, ServiceStatus, ServiceTableEntry, render_phase_warning, render_service_table,
    render_startup_banner, render_startup_complete,
};
use systemprompt_traits::{ServiceInfo, ServiceState};

pub struct StartupBanner;

impl StartupBanner {
    pub fn render(subtitle: Option<&str>) {
        render_startup_banner(subtitle);
    }
}

pub fn render_warning(message: &str) {
    render_phase_warning(message, None);
}

pub struct ServiceTable;

impl ServiceTable {
    pub fn render(title: &str, services: &[ServiceInfo]) {
        let entries: Vec<ServiceTableEntry> = services
            .iter()
            .map(|s| {
                let status = match s.state {
                    ServiceState::Running => ServiceStatus::Running,
                    ServiceState::Starting => ServiceStatus::Starting,
                    ServiceState::Stopped => ServiceStatus::Stopped,
                    ServiceState::Failed => ServiceStatus::Failed,
                };
                ServiceTableEntry::new(&s.name, s.service_type.label(), s.port, status)
            })
            .collect();

        render_service_table(title, &entries);
    }
}

pub struct CompletionMessage;

impl CompletionMessage {
    pub fn render_success(duration: Duration, api_url: &str) {
        render_startup_complete(duration, api_url);
    }

    pub fn render_failure(duration: Duration, error: &str) {
        systemprompt_logging::CliService::info("");
        systemprompt_logging::CliService::info(&format!(
            "{} {} {}",
            BrandColors::stopped(""),
            BrandColors::white_bold("Startup failed"),
            BrandColors::dim(format!("after {:.1}s", duration.as_secs_f64()))
        ));
        systemprompt_logging::CliService::info(&format!("  {}", BrandColors::stopped(error)));
        systemprompt_logging::CliService::info("");
    }
}