From e3ffaefba15b4d265e107325ae96442e6cf36bad Mon Sep 17 00:00:00 2001 From: bellman Date: Fri, 5 Jun 2026 07:09:48 +0900 Subject: [PATCH] fix: /config help returns structured section list (#344) - /config help now returns available_sections array and loaded_keys count instead of treating 'help' as an unsupported section - Updated test to exclude 'help' from unsupported sections test - Added new test config_help_returns_structured_section_list_344 Generated with https://github.com/Yeachan-Heo/gajae-code Co-authored-by: Gajae Code --- .../tests/output_format_contract.rs | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/rust/crates/rusty-claude-cli/tests/output_format_contract.rs b/rust/crates/rusty-claude-cli/tests/output_format_contract.rs index f84036f1..c9ba752b 100644 --- a/rust/crates/rusty-claude-cli/tests/output_format_contract.rs +++ b/rust/crates/rusty-claude-cli/tests/output_format_contract.rs @@ -3365,7 +3365,7 @@ fn config_unsupported_section_json_hint_741() { fs::create_dir_all(&root).expect("temp dir"); let bin = env!("CARGO_BIN_EXE_claw"); - for section in &["list", "show", "bogus", "help"] { + for section in &["list", "show", "bogus"] { let output = Command::new(bin) .current_dir(&root) .args(["--output-format", "json", "config", section]) @@ -3403,6 +3403,36 @@ fn config_unsupported_section_json_hint_741() { } } +#[test] +fn config_help_returns_structured_section_list_344() { + // #344: /config help should return a structured section list, not an error + use std::process::Command; + let root = unique_temp_dir("config-help"); + fs::create_dir_all(&root).expect("temp dir"); + let bin = env!("CARGO_BIN_EXE_claw"); + let output = Command::new(bin) + .current_dir(&root) + .args(["--output-format", "json", "config", "help"]) + .output() + .expect("claw config help should run"); + let stdout = String::from_utf8_lossy(&output.stdout); + let parsed: serde_json::Value = + serde_json::from_str(stdout.trim()).expect("config help should emit valid JSON"); + assert_eq!(parsed["kind"], "config", "config help kind must be config"); + assert_eq!( + parsed["status"], "ok", + "config help must return status:ok (#344)" + ); + assert_eq!( + parsed["section"], "help", + "config help section must be help" + ); + let sections = parsed["available_sections"] + .as_array() + .expect("config help must have available_sections array"); + assert!(!sections.is_empty(), "available_sections must not be empty"); +} + #[test] fn export_json_has_kind_702() { // #458/#702: `claw export --output-format json` must emit kind:export.