v0.2.13 : prompt avec emojis colores — 🗂️ repertoire, 🤖 catalogue, 🌐 externes, 📊 geres, ⚡ duree de la derniere commande, ⏲ session

This commit is contained in:
2026-08-16 10:43:26 -04:00
parent 93c32b60ba
commit 979875fa63
3 changed files with 37 additions and 24 deletions
Generated
+1 -1
View File
@@ -21,7 +21,7 @@ dependencies = [
[[package]] [[package]]
name = "agent-manager" name = "agent-manager"
version = "0.2.12" version = "0.2.13"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "agent-manager" name = "agent-manager"
version = "0.2.12" version = "0.2.13"
edition = "2021" edition = "2021"
description = "Manage local AI coding agents: list, install, start, stop, update — with automatic dependency handling and a YAML-driven catalog." description = "Manage local AI coding agents: list, install, start, stop, update — with automatic dependency handling and a YAML-driven catalog."
license = "MIT" license = "MIT"
+35 -22
View File
@@ -474,26 +474,39 @@ pub fn banner(app: &App, session: &ShellSession, session_id: &str) -> String {
text text
} }
/// One-line status shown before every prompt (Hermes-style status bar). /// Color an emoji glyph (style names: green, blue, yellow, cyan).
/// The second parameter is the duration of the previous command (None before fn emoji(glyph: &str, style: &str, color: bool) -> String {
if !color {
return glyph.to_string();
}
match style {
"green" => glyph.green().to_string(),
"blue" => glyph.blue().to_string(),
"yellow" => glyph.yellow().to_string(),
"cyan" => glyph.cyan().to_string(),
_ => glyph.to_string(),
}
}
/// One-line status shown before every prompt, with colored emojis:
/// ⚙ am v0.2.13 │ 🗂️ cwd │ 73 🤖 · 12 🌐 · 0 📊 │ ⚡ 97ms │ ⏲ 32s
/// The last parameter is the duration of the previous command (None before
/// the first one). /// the first one).
fn print_status(app: &App, session: &ShellSession, started: Instant, last: Option<Duration>) { fn print_status(app: &App, started: Instant, last: Option<Duration>) {
let color = app.color(); let color = app.color();
let sep = dim(" │ ", color); let sep = dim(" │ ", color);
let cwd = shorten_head(&current_dir_string(), 26); let cwd = shorten_head(&current_dir_string(), 30);
let shell_part = format!( let folder = format!("{} {}", emoji("🗂️", "cyan", color), dim(&cwd, color));
"{} {}", let counts = format!(
bold_cyan(session.current.name, color), "{} {} {} {} {} {} {} {}",
dim(&cwd, color) dim(&agent_count(app).to_string(), color),
); emoji("🤖", "green", color),
let counts = dim( dim("·", color),
&format!( dim(&external_count(app).to_string(), color),
"{} agents · {} external · {} managed", emoji("🌐", "blue", color),
agent_count(app), dim("·", color),
external_count(app), dim(&installed_count(app).to_string(), color),
installed_count(app) emoji("📊", "yellow", color),
),
color,
); );
let last_text = match last { let last_text = match last {
Some(d) if d.as_secs() >= 1 => format_elapsed(d), Some(d) if d.as_secs() >= 1 => format_elapsed(d),
@@ -501,10 +514,10 @@ fn print_status(app: &App, session: &ShellSession, started: Instant, last: Optio
Some(d) => format!("{}µs", d.as_micros()), Some(d) => format!("{}µs", d.as_micros()),
None => "—".to_string(), None => "—".to_string(),
}; };
let last_part = dim(&format!("⚡ {last_text}"), color); let last_part = format!("{} {}", emoji("⚡", "yellow", color), dim(&last_text, color));
let elapsed = dim(&format_elapsed(started.elapsed()), color); let elapsed = dim(&format!("⏲ {}", format_elapsed(started.elapsed())), color);
println!( println!(
"{}am v{}{sep}{shell_part}{sep}{counts}{sep}{last_part}{sep}⏲ {elapsed}", "{}am v{}{sep}{folder}{sep}{counts}{sep}{last_part}{sep}{elapsed}",
dim(" ⚙ ", color), dim(" ⚙ ", color),
env!("CARGO_PKG_VERSION"), env!("CARGO_PKG_VERSION"),
); );
@@ -705,7 +718,7 @@ fn run_with_editor(app: &App, session: &mut ShellSession) -> Result<i32> {
let mut last: Option<DataTable> = None; let mut last: Option<DataTable> = None;
let mut last_duration: Option<Duration> = None; let mut last_duration: Option<Duration> = None;
loop { loop {
print_status(app, session, started, last_duration); print_status(app, started, last_duration);
match rl.readline("❯ ") { match rl.readline("❯ ") {
Ok(line) => { Ok(line) => {
let trimmed = line.trim().to_string(); let trimmed = line.trim().to_string();
@@ -740,7 +753,7 @@ fn run_plain(app: &App, session: &mut ShellSession) -> Result<i32> {
let mut last: Option<DataTable> = None; let mut last: Option<DataTable> = None;
let mut last_duration: Option<Duration> = None; let mut last_duration: Option<Duration> = None;
loop { loop {
print_status(app, session, started, last_duration); print_status(app, started, last_duration);
eprint!("❯ "); eprint!("❯ ");
std::io::stderr().flush().ok(); std::io::stderr().flush().ok();
let mut line = String::new(); let mut line = String::new();