diff --git a/Cargo.lock b/Cargo.lock index 54ab05c..6e5fb80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,7 +21,7 @@ dependencies = [ [[package]] name = "agent-manager" -version = "0.2.12" +version = "0.2.13" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index b4e44e7..0b36b81 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "agent-manager" -version = "0.2.12" +version = "0.2.13" edition = "2021" description = "Manage local AI coding agents: list, install, start, stop, update โ€” with automatic dependency handling and a YAML-driven catalog." license = "MIT" diff --git a/src/repl.rs b/src/repl.rs index 68b7eac..0a74ad6 100644 --- a/src/repl.rs +++ b/src/repl.rs @@ -474,26 +474,39 @@ pub fn banner(app: &App, session: &ShellSession, session_id: &str) -> String { text } -/// One-line status shown before every prompt (Hermes-style status bar). -/// The second parameter is the duration of the previous command (None before +/// Color an emoji glyph (style names: green, blue, yellow, cyan). +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). -fn print_status(app: &App, session: &ShellSession, started: Instant, last: Option) { +fn print_status(app: &App, started: Instant, last: Option) { let color = app.color(); let sep = dim(" โ”‚ ", color); - let cwd = shorten_head(¤t_dir_string(), 26); - let shell_part = format!( - "{} {}", - bold_cyan(session.current.name, color), - dim(&cwd, color) - ); - let counts = dim( - &format!( - "{} agents ยท {} external ยท {} managed", - agent_count(app), - external_count(app), - installed_count(app) - ), - color, + let cwd = shorten_head(¤t_dir_string(), 30); + let folder = format!("{} {}", emoji("๐Ÿ—‚๏ธ", "cyan", color), dim(&cwd, color)); + let counts = format!( + "{} {} {} {} {} {} {} {}", + dim(&agent_count(app).to_string(), color), + emoji("๐Ÿค–", "green", color), + dim("ยท", color), + dim(&external_count(app).to_string(), color), + emoji("๐ŸŒ", "blue", color), + dim("ยท", color), + dim(&installed_count(app).to_string(), color), + emoji("๐Ÿ“Š", "yellow", color), ); let last_text = match last { 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()), None => "โ€”".to_string(), }; - let last_part = dim(&format!("โšก {last_text}"), color); - let elapsed = dim(&format_elapsed(started.elapsed()), color); + let last_part = format!("{} {}", emoji("โšก", "yellow", color), dim(&last_text, color)); + let elapsed = dim(&format!("โฒ {}", format_elapsed(started.elapsed())), color); 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), env!("CARGO_PKG_VERSION"), ); @@ -705,7 +718,7 @@ fn run_with_editor(app: &App, session: &mut ShellSession) -> Result { let mut last: Option = None; let mut last_duration: Option = None; loop { - print_status(app, session, started, last_duration); + print_status(app, started, last_duration); match rl.readline("โฏ ") { Ok(line) => { let trimmed = line.trim().to_string(); @@ -740,7 +753,7 @@ fn run_plain(app: &App, session: &mut ShellSession) -> Result { let mut last: Option = None; let mut last_duration: Option = None; loop { - print_status(app, session, started, last_duration); + print_status(app, started, last_duration); eprint!("โฏ "); std::io::stderr().flush().ok(); let mut line = String::new();