mirror of
https://github.com/instructkr/claude-code.git
synced 2026-05-28 16:36:45 +00:00
fix(#743): plugins help --output-format json now emits usage envelope matching agents/mcp/skills help shape; resolves #420
This commit is contained in:
@@ -2334,6 +2334,13 @@ pub fn handle_plugins_slash_command(
|
||||
reload_runtime: false,
|
||||
})
|
||||
}
|
||||
// #743/#420: "help" was caught by Some(other) → unknown_plugins_action error with hint:null.
|
||||
// agents/mcp/skills all return a help envelope; plugins must match that parity.
|
||||
Some("help" | "-h" | "--help") => Ok(PluginsCommandResult {
|
||||
message: "Plugins\n Usage /plugins [list|show <id>|install <id>|enable <id>|disable <id>|uninstall <id>|update <id>|help]\n Subcommands list show install enable disable uninstall update help"
|
||||
.to_string(),
|
||||
reload_runtime: false,
|
||||
}),
|
||||
Some(other) => Err(PluginError::CommandFailed(format!(
|
||||
"unknown_plugins_action: '{other}' is not a supported /plugins action. Use list, show, install, enable, disable, uninstall, or update."
|
||||
))),
|
||||
|
||||
@@ -6108,6 +6108,23 @@ impl LiveCli {
|
||||
CliOutputFormat::Text => println!("{}", payload.message),
|
||||
CliOutputFormat::Json => {
|
||||
let action_str = action.unwrap_or("list");
|
||||
// #743/#420: plugins help must return a usage envelope matching agents/mcp/skills help shape.
|
||||
if matches!(action_str, "help" | "-h" | "--help") {
|
||||
let cwd_str = cwd.display().to_string();
|
||||
let obj = json!({
|
||||
"kind": "plugin",
|
||||
"action": "help",
|
||||
"status": "ok",
|
||||
"unexpected": null,
|
||||
"usage": {
|
||||
"direct_cli": "claw plugins [list|show <id>|install <id>|enable <id>|disable <id>|uninstall <id>|update <id>|help]",
|
||||
"slash_command": "/plugins [list|show <id>|install <id>|enable <id>|disable <id>|uninstall <id>|update <id>|help]",
|
||||
},
|
||||
"cwd": cwd_str,
|
||||
});
|
||||
println!("{}", serde_json::to_string_pretty(&obj)?);
|
||||
return Ok(());
|
||||
}
|
||||
// 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");
|
||||
|
||||
Reference in New Issue
Block a user