mirror of
https://github.com/instructkr/claude-code.git
synced 2026-06-05 12:06:43 +00:00
fix: add structured command list to top-level help JSON (#325)
Top-level 'claw --output-format json help' now includes a 'commands' array with name, summary, and resume_supported for each registered slash command, plus 'total_commands' count. Generated with https://github.com/Yeachan-Heo/gajae-code Co-authored-by: Gajae Code <dev@gajae-code.com>
This commit is contained in:
@@ -13930,15 +13930,30 @@ fn print_help(output_format: CliOutputFormat) -> Result<(), Box<dyn std::error::
|
||||
let message = String::from_utf8(buffer)?;
|
||||
match output_format {
|
||||
CliOutputFormat::Text => print!("{message}"),
|
||||
CliOutputFormat::Json => println!(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&json!({
|
||||
"kind": "help",
|
||||
"action": "help",
|
||||
"status": "ok",
|
||||
"message": message,
|
||||
}))?
|
||||
),
|
||||
CliOutputFormat::Json => {
|
||||
// #325: include structured command list in top-level help JSON
|
||||
let commands: Vec<serde_json::Value> = commands::slash_command_specs()
|
||||
.iter()
|
||||
.map(|spec| {
|
||||
serde_json::json!({
|
||||
"name": spec.name,
|
||||
"summary": spec.summary,
|
||||
"resume_supported": spec.resume_supported,
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&json!({
|
||||
"kind": "help",
|
||||
"action": "help",
|
||||
"status": "ok",
|
||||
"message": message,
|
||||
"commands": commands,
|
||||
"total_commands": commands.len(),
|
||||
}))?
|
||||
);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user