From e1b55628880235fba4f3fab71c1edc0d67719825 Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Fri, 21 Aug 2026 10:54:28 -0600 Subject: [PATCH] refactor: render .list agents and .list skills as comfy-tables Long agent/skill descriptions wrapped badly in the bullet-list format. Extract a shared asset_table helper (UTF8_FULL + dynamic arrangement, same style as the markdown renderer and .list macros) and use it for the agents, skills, and macros listings. The skills loaded marker keeps its color; comfy-table's custom_styling feature accounts for ANSI sequences in column widths. --- src/config/request_context.rs | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/config/request_context.rs b/src/config/request_context.rs index 7f19ad1..24597b6 100644 --- a/src/config/request_context.rs +++ b/src/config/request_context.rs @@ -112,6 +112,14 @@ fn print_asset_names(kind: &str, names: &[String]) -> Result<()> { Ok(()) } +fn asset_table(header: &[&str]) -> Table { + let mut table = Table::new(); + table.load_preset(UTF8_FULL); + table.set_content_arrangement(ContentArrangement::Dynamic); + table.set_header(header.to_vec()); + table +} + fn complete_skills_with_descriptions(names: Vec) -> Vec<(String, Option)> { names .into_iter() @@ -2593,10 +2601,8 @@ impl RequestContext { return Ok(()); } - let mut table = Table::new(); - table.load_preset(UTF8_FULL); - table.set_content_arrangement(ContentArrangement::Dynamic); - table.set_header(vec!["name", "source", "isolated", "state", "description"]); + let mut table = + asset_table(&["name", "source", "isolated", "state", "description"]); for row in &policy.macros { let source = macro_source_display(row.source); @@ -2627,15 +2633,13 @@ impl RequestContext { return Ok(()); } - println!("Agents:"); + let mut table = asset_table(&["name", "description"]); for (name, description) in entries { - if description.is_empty() { - println!(" • {name}"); - } else { - println!(" • {name} — {description}"); - } + table.add_row(vec![name, description]); } + println!("Agents:"); + println!("{table}"); Ok(()) } "skills" => { @@ -2681,16 +2685,18 @@ impl RequestContext { return Ok(()); } - println!("Skills:"); + let mut table = asset_table(&["loaded", "name", "description"]); for (name, description, loaded) in entries { let marker = if loaded { "✓".green().bold().to_string() } else { "✗".red().bold().to_string() }; - println!(" {marker} {name} — {description}"); + table.add_row(vec![marker, name, description]); } + println!("Skills:"); + println!("{table}"); Ok(()) } "tools" => {