fix(#741): config unsupported_config_section error now populates hint field; list/show/help verbs get usage hint

This commit is contained in:
YeonGyu-Kim
2026-05-26 17:38:02 +09:00
parent 5d072d21e9
commit 6e78c1fc8b
2 changed files with 14 additions and 0 deletions

View File

@@ -7791,6 +7791,17 @@ fn render_config_json(
"skills" => runtime_config.get("skills").map(|v| v.render()),
"agents" => runtime_config.get("agents").map(|v| v.render()),
other => {
// #741: populate hint field for unsupported section errors so callers reading
// .hint get actionable guidance instead of null
let hint = if matches!(other, "list" | "show" | "help" | "info") {
format!(
"'claw config {other}' is not a subcommand. To list all config: `claw config`. To inspect a section: `claw config <section>` where section is one of: env, hooks, model, plugins, mcp, sandbox, permissions, skills, agents."
)
} else {
format!(
"'{other}' is not a config section. Supported: env, hooks, model, plugins, mcp, sandbox, permissions, skills, agents."
)
};
return Ok(serde_json::json!({
"kind": "config",
"action": "show",
@@ -7799,6 +7810,7 @@ fn render_config_json(
"section": other,
"ok": false,
"error": format!("Unsupported config section '{other}'. Use: env, hooks, model, plugins, mcp, sandbox, permissions, skills, or agents."),
"hint": hint,
"supported_sections": ["env", "hooks", "model", "plugins", "mcp", "sandbox", "permissions", "skills", "agents"],
"cwd": cwd.display().to_string(),
"loaded_files": loaded_paths.len(),