OXYGENHUB

Coverage / src/cli/marks.rs 20.0%

4 of 20 lines run, 1 of 4 functions · run #5 on main · run missed

1
//! Spectra's own marks, in the style of `oxy`'s (`ui.rs` stays exactly
2
//! `oxy`'s, so the two tools look the same): presence and agent health.
3
4
use super::ui::{dim, glyph, ok, warn};
5
use console::style;
6
7
/// An agent's presence (spec §8.1) as a coloured glyph and word.
8
#[allow(dead_code)] // Used by agent list once presence lands (#5).
90×
pub fn presence(state: &str) -> String {
100×
    let (g, a) = match state {
110×
        "online" => ("●", "*"),
120×
        "busy" => ("◆", "+"),
130×
        "idle" => ("◌", "o"),
140×
        "blocked" => ("‼", "!"),
150×
        "paused" => ("⏸", "="),
160×
        _ => ("○", "-"),
17
    };
180×
    let text = format!("{} {state:<7}", glyph(g, a));
190×
    match state {
200×
        "online" => ok(text),
210×
        "busy" => style(text).cyan().to_string(),
220×
        "blocked" | "paused" => warn(text),
230×
        _ => dim(text),
24
    }
250×
}
26
27
/// Whether an agent may act: a tick, or a warning with the reason.
281×
pub fn health(state: &str) -> String {
291×
    if state == "ok" {
300×
        ok(glyph("✔", "ok"))
31
    } else {
321×
        warn(glyph("⚠", "!"))
33
    }
341×
}