fix(#789): agents show and plugins show not-found now exit 1; parity with skills (#788) and mcp (#68)

This commit is contained in:
YeonGyu-Kim
2026-05-27 10:07:51 +09:00
parent abdbf61acf
commit e4c3c1aa80
3 changed files with 93 additions and 6 deletions

View File

@@ -6281,10 +6281,17 @@ impl LiveCli {
let cwd = env::current_dir()?;
match output_format {
CliOutputFormat::Text => println!("{}", handle_agents_slash_command(args, &cwd)?),
CliOutputFormat::Json => println!(
"{}",
serde_json::to_string_pretty(&handle_agents_slash_command_json(args, &cwd)?)?
),
CliOutputFormat::Json => {
let value = handle_agents_slash_command_json(args, &cwd)?;
// #789: parity with print_mcp/#788 print_skills — exit 1 when envelope
// reports an error so automation can rely on exit code instead of
// parsing the JSON status field.
let is_error = value.get("status").and_then(|v| v.as_str()) == Some("error");
println!("{}", serde_json::to_string_pretty(&value)?);
if is_error {
std::process::exit(1);
}
}
}
Ok(())
}
@@ -6428,7 +6435,8 @@ impl LiveCli {
"hint": "Run `claw plugins list` to see available plugins.",
});
println!("{}", serde_json::to_string_pretty(&obj)?);
return Ok(());
// #789: exit 1 on not-found so automation can rely on exit code
std::process::exit(1);
}
}
}