feat: am tip cheat sheet + readable man pages + REPL completion refresh

This commit is contained in:
2026-08-17 21:50:48 -04:00
parent 53893f2967
commit 98c0b30f68
10 changed files with 1402 additions and 63 deletions
+17 -3
View File
@@ -3,6 +3,7 @@
//! launched: installed agents (managed + external), aliases and groups.
use super::*;
use std::collections::HashSet;
/// The completion pool: installed agents (managed + external), aliases and
/// groups when installed is true, the whole catalog otherwise.
@@ -10,16 +11,29 @@ pub fn agent_names(app: &App, installed: bool) -> Vec<String> {
let mut names: Vec<String> = Vec::new();
if installed {
let probe = crate::probe::detect_externals(app);
let mut launchable: HashSet<String> = HashSet::new();
for a in app.catalog.agents() {
if app.state.get(&a.name).ok().flatten().is_some()
|| probe.path_of(&a.name).is_some()
{
launchable.insert(a.name.clone());
names.push(a.name.clone());
}
}
names.extend(app.config.aliases.keys().cloned());
for g in app.config.groups.keys() {
names.push(format!("group:{g}"));
for (alias, target) in &app.config.aliases {
let is_launchable = app
.catalog
.resolve(alias)
.map(|agent| launchable.contains(&agent.name))
.unwrap_or_else(|| launchable.contains(target));
if is_launchable {
names.push(alias.clone());
}
}
for (group, members) in &app.config.groups {
if members.iter().any(|m| launchable.contains(m)) {
names.push(format!("group:{group}"));
}
}
} else {
names.extend(app.catalog.agents().iter().map(|a| a.name.clone()));