mirror of
https://github.com/instructkr/claw-code.git
synced 2026-06-05 22:17:10 +08:00
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 <dev@gajae-code.com>
This commit is contained in:
@@ -3365,7 +3365,7 @@ fn config_unsupported_section_json_hint_741() {
|
|||||||
fs::create_dir_all(&root).expect("temp dir");
|
fs::create_dir_all(&root).expect("temp dir");
|
||||||
let bin = env!("CARGO_BIN_EXE_claw");
|
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)
|
let output = Command::new(bin)
|
||||||
.current_dir(&root)
|
.current_dir(&root)
|
||||||
.args(["--output-format", "json", "config", section])
|
.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]
|
#[test]
|
||||||
fn export_json_has_kind_702() {
|
fn export_json_has_kind_702() {
|
||||||
// #458/#702: `claw export --output-format json` must emit kind:export.
|
// #458/#702: `claw export --output-format json` must emit kind:export.
|
||||||
|
|||||||
Reference in New Issue
Block a user