mirror of
https://github.com/instructkr/claude-code.git
synced 2026-05-31 09:46:44 +00:00
fix: unknown single-word subcommand emits command_not_found (#825/#826)
Single-word all-alpha/dash tokens that don't match any known subcommand now always emit command_not_found (with or without fuzzy suggestions). Multi-word cases fall through to CliAction::Prompt (natural language prompt passthrough like 'claw explain this' must still work). The multi-word gap is documented as ROADMAP #826 (known limitation). Tests: - unknown_subcommand_json_emits_command_not_found (new) - unknown_subcommand_text_emits_command_not_found_on_stderr (new) - unknown_subcommand_typo_with_suggestions_json_emits_command_not_found (new) - multi_word_unknown_subcommand_falls_through_to_prompt_826 (documents gap) 572 tests pass, 1 pre-existing worker_boot failure unrelated.
This commit is contained in:
@@ -1381,9 +1381,9 @@ fn parse_args(args: &[String]) -> Result<CliAction, String> {
|
||||
// #825: always emit a command_not_found error for
|
||||
// single-word all-alpha/dash tokens that don't match any
|
||||
// known subcommand — with or without close suggestions.
|
||||
// Previously, no-suggestion cases fell through silently to
|
||||
// CliAction::Prompt and triggered a misleading
|
||||
// `missing_credentials` error after provider startup.
|
||||
// Multi-word cases fall through to CliAction::Prompt so
|
||||
// natural language prompts like `claw explain this` work.
|
||||
// (#826 documents the multi-word gap as a known limitation.)
|
||||
let mut message = format!("command_not_found: unknown subcommand: {other}.");
|
||||
if let Some(suggestions) = suggest_similar_subcommand(other) {
|
||||
if let Some(line) = render_suggestion_line("Did you mean", &suggestions) {
|
||||
|
||||
Reference in New Issue
Block a user