Skip to content

Commit cfc2672

Browse files
committed
fix(#752): cli_parse unrecognized-arg errors now emit non-null hint for all subcommands
1 parent ddc71b5 commit cfc2672

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

ROADMAP.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7669,3 +7669,5 @@ Original filing (2026-04-18): the session emitted `SessionStart hook (completed)
76697669
750. **`claw prompt --output-format json` (no text argument) returned `error_kind:"unknown"` and `hint: null`** — dogfooded 2026-05-26 on `2dfb7af6`. The error string `"prompt subcommand requires a prompt string"` had no prefix prefix for classifier and no `\n` for hint extraction. Fix: (a) prefix with `"missing_prompt: "` + newline before usage hint; (b) add `message.starts_with("missing_prompt:")` → `"missing_prompt"` classifier arm. Result: `error_kind:"missing_prompt"`, `hint:"Usage: claw prompt <text> or echo '<text>' | claw"`. Source: Jobdori dogfood on `2dfb7af6`, 2026-05-26.
76707670

76717671
751. **ROADMAP #750 has no regression test: `claw prompt --output-format json` no-arg `error_kind` and `hint` could silently regress** — confirmed by gaebal-gajae on `ac925ed4`. Fix: add `prompt_no_arg_json_error_kind_750` test asserting nonzero exit, `error_kind:"missing_prompt"`, non-empty `hint` mentioning `claw prompt` or `echo`. Source: gaebal-gajae dogfood on `ac925ed4`, 2026-05-26.
7672+
7673+
752. **`claw <subcommand> --output-format json <bogus-arg>` returned `hint: null` for all `cli_parse` errors when an unrecognized positional arg was supplied** — dogfooded 2026-05-26 on `ddc71b56`. Generic `unrecognized argument` format string had no `\n` so `split_error_hint` emitted null hint (only the `--json` special-case added a hint). Fix: add else-branch appending `\nRun `claw <verb> --help` for usage.` to the generic arm. Affected surfaces: `sandbox`, `doctor`, `version`, and any other subcommand routing through the same unrecognized-arg path. Source: Jobdori dogfood on `ddc71b56`, 2026-05-26.

rust/crates/rusty-claude-cli/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,9 @@ fn parse_single_word_command_alias(
13261326
// Hint at the correct flag so they don't have to re-read --help.
13271327
if rest[1] == "--json" {
13281328
msg.push_str("\nDid you mean `--output-format json`?");
1329+
} else {
1330+
// #752: generic fallback hint so cli_parse errors always have non-null hint
1331+
msg.push_str(&format!("\nRun `claw {} --help` for usage.", verb));
13291332
}
13301333
return Some(Err(msg));
13311334
}

0 commit comments

Comments
 (0)