fix: target multi-word guard for CLI subcommands only

Only fire the slash-command guard for multi-word commands when the
first token is a known CLI subcommand (help, version, status, etc.).
Slash commands with additional arguments (explain this, cost list)
are treated as prompts.

Generated with https://github.com/Yeachan-Heo/gajae-code
Co-authored-by: Gajae Code <dev@gajae-code.com>
This commit is contained in:
bellman
2026-06-05 01:46:11 +09:00
parent ad76389b31
commit b3a5a74237

View File

@@ -2350,10 +2350,17 @@ fn parse_single_word_command_alias(
return Some(Ok(CliAction::Help { output_format }));
}
// #453: fire guard for multi-word commands too (claw cost list, claw model list, etc.)
// #453: fire guard for multi-word CLI subcommands too (claw cost list, claw model list, etc.)
// For slash commands that are commonly used as prompts (explain, cost, tokens, etc.),
// only fire the guard when there's exactly one token.
if rest.is_empty() {
return None;
}
// Known CLI subcommands that don't accept additional arguments
const CLI_SUBCOMMANDS: &[&str] = &["help", "version", "status", "sandbox", "doctor", "state", "config", "diff"];
if rest.len() > 1 && !CLI_SUBCOMMANDS.contains(&rest[0].as_str()) {
return None;
}
match rest[0].as_str() {
"help" => Some(Ok(CliAction::Help { output_format })),