Skip to content

Commit caeac82

Browse files
authored
fix(permissions): return guidance for multi-word forms instead of falling through to LLM (ultraworkers#2994)
claw permissions list / claw permissions allow <tool> / claw permissions deny <tool> 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 <tool>) exit 1 with kind:unknown guidance JSON. Zero sessions.
1 parent 85435ad commit caeac82

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • rust/crates/rusty-claude-cli/src

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,14 @@ fn parse_args(args: &[String]) -> Result<CliAction, String> {
930930
}
931931
Ok(CliAction::Diff { output_format })
932932
}
933+
// `claw permissions <mode>` falls through to the LLM when called
934+
// with a subcommand argument because parse_single_word_command_alias
935+
// only intercepts the bare single-word form. Catch all multi-word
936+
// forms here and return a structured guidance error so no network
937+
// call or session is created.
938+
"permissions" => Err(format!(
939+
"`claw permissions` is a slash command. Start `claw` and run `/permissions` inside the REPL.\n Usage /permissions [read-only|workspace-write|danger-full-access]"
940+
)),
933941
"skills" => {
934942
let args = join_optional_args(&rest[1..]);
935943
match classify_skills_slash_command(args.as_deref()) {

0 commit comments

Comments
 (0)