From 1e9b21f4156a5ac4ef360d6c79277eb8110024d7 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Tue, 5 May 2026 05:32:51 +0900 Subject: [PATCH] fix(permissions): return guidance for multi-word forms instead of falling through to LLM claw permissions list / claw permissions allow / claw permissions deny all fell through to the prompt/LLM path because parse_subcommand had no arm for "permissions". The single-word bare form was already intercepted by bare_slash_command_guidance, but any form with rest.len() > 1 bypassed the single-word guard and landed in the _other => CliAction::Prompt branch. Fix: add a "permissions" arm in parse_subcommand that returns a structured guidance Err so all multi-word forms get the same exit:1 + JSON error as the bare single-word form, without any LLM call or session creation. Verified: all invocation forms (bare, list, read-only, workspace-write, allow/deny ) exit 1 with kind:unknown guidance JSON. Zero sessions. --- rust/crates/rusty-claude-cli/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs index 11539c9a..71f9c1de 100644 --- a/rust/crates/rusty-claude-cli/src/main.rs +++ b/rust/crates/rusty-claude-cli/src/main.rs @@ -926,6 +926,14 @@ fn parse_args(args: &[String]) -> Result { } Ok(CliAction::Diff { output_format }) } + // `claw permissions ` falls through to the LLM when called + // with a subcommand argument because parse_single_word_command_alias + // only intercepts the bare single-word form. Catch all multi-word + // forms here and return a structured guidance error so no network + // call or session is created. + "permissions" => Err(format!( + "`claw permissions` is a slash command. Start `claw` and run `/permissions` inside the REPL.\n Usage /permissions [read-only|workspace-write|danger-full-access]" + )), "skills" => { let args = join_optional_args(&rest[1..]); match classify_skills_slash_command(args.as_deref()) {