v0.4.1 : Phase 1 complete (17/17) - dashboard TUI (#33), favoris/notes/tags (#39), profils d'environnement (#40), completions dynamiques + man pages (#41), packaging officiel + CI (#42), self-update Gitea, state v3, 212 tests
release / linux (push) Failing after 23s
release / windows (push) Canceled after 0s
release / macos (push) Canceled after 0s

This commit is contained in:
2026-08-17 10:50:13 -04:00
parent 4f4cd034b2
commit 56732d672b
93 changed files with 9412 additions and 1270 deletions
+37
View File
@@ -0,0 +1,37 @@
//! _agents (hidden): list agent names for shell completions (issue #41).
//! Prints one name per line; --installed restricts to what can actually be
//! launched: installed agents (managed + external), aliases and groups.
use super::*;
/// The completion pool: installed agents (managed + external), aliases and
/// groups when installed is true, the whole catalog otherwise.
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);
for a in app.catalog.agents() {
if app.state.get(&a.name).ok().flatten().is_some()
|| probe.path_of(&a.name).is_some()
{
names.push(a.name.clone());
}
}
names.extend(app.config.aliases.keys().cloned());
for g in app.config.groups.keys() {
names.push(format!("group:{g}"));
}
} else {
names.extend(app.catalog.agents().iter().map(|a| a.name.clone()));
}
names.sort();
names.dedup();
names
}
pub fn run(app: &App, installed: bool) -> Result<i32> {
for n in agent_names(app, installed) {
println!("{n}");
}
Ok(0)
}