Fix slash-only verbs with extra args falling through to Prompt - #1
Fix slash-only verbs with extra args falling through to Prompt#1fvegiard wants to merge 1 commit into
Conversation
When users invoke known slash commands with trailing arguments (e.g. `claw hooks --help`, `claw plan list`), the CLI now returns structured slash-command guidance instead of silently dispatching a billable Prompt. Prompt shorthand is preserved when an explicit --model flag is present (e.g. `claw --model opus explain this`). Also updates unit tests for the think_mode field on CliAction::Prompt/Repl and fixes build_runtime_plugin_state_with_loader call sites. Co-authored-by: fvegiard <fvegiard@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Blocks valid multi-word CLI subcommands
- Added an
is_known_top_level_subcommandguard so multi-word invocations likesession listandmodel listfall through to their dedicatedparse_argshandlers instead of being rejected early bybare_slash_command_guidance.
- Added an
Or push these changes by commenting:
@cursor push ba8a3b028a
Preview (ba8a3b028a)
diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs
--- a/rust/crates/rusty-claude-cli/src/main.rs
+++ b/rust/crates/rusty-claude-cli/src/main.rs
@@ -2473,7 +2473,7 @@
// Prompt shorthand like `claw --model opus explain this` should keep
// flowing to Prompt dispatch even when the first token is also a
// slash-command name.
- if model_flag_raw.is_none() {
+ if model_flag_raw.is_none() && !is_known_top_level_subcommand(first) {
if let Some(guidance) = bare_slash_command_guidance(first) {
let extra = rest[1..].join(" ");
return Some(Err(format!(You can send follow-ups to the cloud agent here.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 319357a. Configure here.
| ))); | ||
| } | ||
| } | ||
| return None; |
There was a problem hiding this comment.
Blocks valid multi-word CLI subcommands
High Severity
Multi-arg invocations whose first token is both a slash spec name and a real top-level subcommand (e.g. session list, model list) now fail early with slash-command guidance in parse_single_word_command_alias, so they never reach the later match arms that dispatch CliAction::SessionList or CliAction::Models.
Reviewed by Cursor Bugbot for commit 319357a. Configure here.



Problem
Known slash-only verbs (
hooks,plan,theme,tokens, etc.) only returned helpful "use--resume" guidance when invoked with exactly one argument (claw hooks). Any trailing args (claw hooks --help,claw plan list,claw tokens --json) silently fell through toCliAction::Promptand could trigger a billable LLM call with a nonsensical prompt likehooks --help.This is ROADMAP #119 — a parser gate that was too narrow (
rest.len() != 1caused earlyreturn None).Fix
Widen
parse_single_word_command_aliasso that when the first token is a known slash command and extra args are present, the CLI returns structured slash-command guidance (including which extra args were not recognized) instead of falling through to Prompt.Prompt shorthand is preserved: when
--modelis explicitly set (e.g.claw --model opus explain this), multi-word input still routes to Prompt even if the first token happens to match a slash-command name.Test updates
hooks --help,plan list,theme dark,tokens --json, andcost listthink_modefield onCliAction::Prompt/Replbuild_runtime_plugin_state_with_loadertest call sites missing thethink_modeargumentVerification