fix(#719): plugins list <filter> now applies substring filter on plugin id, matching agents/skills parity

This commit is contained in:
YeonGyu-Kim
2026-05-26 07:03:14 +09:00
parent 92539cad68
commit fe2b13a46a
3 changed files with 32 additions and 2 deletions

View File

@@ -5999,8 +5999,10 @@ impl LiveCli {
CliOutputFormat::Text => println!("{}", payload.message),
CliOutputFormat::Json => {
let action_str = action.unwrap_or("list");
// For show/info/describe, filter to the named plugin.
// For show/info/describe, filter to the named plugin (exact match).
// For list with a target, treat target as a substring filter.
let is_show_action = matches!(action_str, "show" | "info" | "describe");
let is_list_action = action_str == "list";
let filtered_plugins: Vec<_> = if is_show_action {
if let Some(name) = target {
let needle = name.to_lowercase();
@@ -6018,6 +6020,23 @@ impl LiveCli {
} else {
payload.plugins.clone()
}
} else if is_list_action {
if let Some(filter) = target {
let needle = filter.to_lowercase();
payload
.plugins
.iter()
.filter(|p| {
p.get("id")
.and_then(|v| v.as_str())
.map(|id| id.to_lowercase().contains(&needle))
.unwrap_or(false)
})
.cloned()
.collect()
} else {
payload.plugins.clone()
}
} else {
payload.plugins.clone()
};