Skip to content

Fix slash-only verbs with extra args falling through to Prompt - #1

Draft
fvegiard wants to merge 1 commit into
mainfrom
cursor/fix-slash-command-extra-args-4951
Draft

Fix slash-only verbs with extra args falling through to Prompt#1
fvegiard wants to merge 1 commit into
mainfrom
cursor/fix-slash-command-extra-args-4951

Conversation

@fvegiard

@fvegiard fvegiard commented Jul 9, 2026

Copy link
Copy Markdown
Owner

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 to CliAction::Prompt and could trigger a billable LLM call with a nonsensical prompt like hooks --help.

This is ROADMAP #119 — a parser gate that was too narrow (rest.len() != 1 caused early return None).

Fix

Widen parse_single_word_command_alias so 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 --model is 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

  • Added regressions for hooks --help, plan list, theme dark, tokens --json, and cost list
  • Fixed unit tests broken by the think_mode field on CliAction::Prompt / Repl
  • Fixed build_runtime_plugin_state_with_loader test call sites missing the think_mode argument

Verification

cargo test -p rusty-claude-cli slash_only_verbs -- --nocapture
cargo test -p rusty-claude-cli --bin claw resolves_model_aliases -- --nocapture
cargo test -p rusty-claude-cli --test output_format_contract slash_only
cargo build -p rusty-claude-cli
Open in Web Open in Cursor 

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>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

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_subcommand guard so multi-word invocations like session list and model list fall through to their dedicated parse_args handlers instead of being rejected early by bare_slash_command_guidance.

Create PR

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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 319357a. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants