Skip to content

Commit 414526c

Browse files
committed
fix(cli): exclude stub slash commands from help output — ROADMAP #39
The --help slash-command section was listing ~35 unimplemented commands alongside working ones. Combined with the completions fix (c55c510), the discovery surface now consistently shows only implemented commands. Changes: - commands crate: add render_slash_command_help_filtered(exclude: &[&str]) - move STUB_COMMANDS to module-level const in main.rs (reused by both completions and help rendering) - replace render_slash_command_help() with filtered variant at all help-rendering call sites 156 CLI tests pass, fmt clean.
1 parent 2a2e205 commit 414526c

File tree

2 files changed

+85
-49
lines changed

2 files changed

+85
-49
lines changed

rust/crates/commands/src/lib.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,6 +1938,42 @@ pub fn suggest_slash_commands(input: &str, limit: usize) -> Vec<String> {
19381938
}
19391939

19401940
#[must_use]
1941+
/// Render the slash-command help section, optionally excluding stub commands
1942+
/// (commands that are registered in the spec list but not yet implemented).
1943+
/// Pass an empty slice to include all commands.
1944+
pub fn render_slash_command_help_filtered(exclude: &[&str]) -> String {
1945+
let mut lines = vec![
1946+
"Slash commands".to_string(),
1947+
" Start here /status, /diff, /agents, /skills, /commit".to_string(),
1948+
" [resume] also works with --resume SESSION.jsonl".to_string(),
1949+
String::new(),
1950+
];
1951+
1952+
let categories = ["Session", "Tools", "Config", "Debug"];
1953+
1954+
for category in categories {
1955+
lines.push(category.to_string());
1956+
for spec in slash_command_specs()
1957+
.iter()
1958+
.filter(|spec| slash_command_category(spec.name) == category)
1959+
.filter(|spec| !exclude.contains(&spec.name))
1960+
{
1961+
lines.push(format_slash_command_help_line(spec));
1962+
}
1963+
lines.push(String::new());
1964+
}
1965+
1966+
lines
1967+
.into_iter()
1968+
.rev()
1969+
.skip_while(String::is_empty)
1970+
.collect::<Vec<_>>()
1971+
.into_iter()
1972+
.rev()
1973+
.collect::<Vec<_>>()
1974+
.join("\n")
1975+
}
1976+
19411977
pub fn render_slash_command_help() -> String {
19421978
let mut lines = vec![
19431979
"Slash commands".to_string(),

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

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ use commands::{
3535
classify_skills_slash_command, handle_agents_slash_command, handle_agents_slash_command_json,
3636
handle_mcp_slash_command, handle_mcp_slash_command_json, handle_plugins_slash_command,
3737
handle_skills_slash_command, handle_skills_slash_command_json, render_slash_command_help,
38-
resume_supported_slash_commands, slash_command_specs, validate_slash_command_input,
39-
SkillSlashDispatch, SlashCommand,
38+
render_slash_command_help_filtered, resume_supported_slash_commands, slash_command_specs,
39+
validate_slash_command_input, SkillSlashDispatch, SlashCommand,
4040
};
4141
use compat_harness::{extract_manifest, UpstreamPaths};
4242
use init::initialize_repo;
@@ -4711,7 +4711,7 @@ fn render_repl_help() -> String {
47114711
" Browse sessions /session list".to_string(),
47124712
" Show prompt history /history [count]".to_string(),
47134713
String::new(),
4714-
render_slash_command_help(),
4714+
render_slash_command_help_filtered(STUB_COMMANDS),
47154715
]
47164716
.join(
47174717
"
@@ -6925,58 +6925,58 @@ fn collect_prompt_cache_events(summary: &runtime::TurnSummary) -> Vec<serde_json
69256925
.collect()
69266926
}
69276927

6928+
/// Slash commands that are registered in the spec list but not yet implemented
6929+
/// in this build. Used to filter both REPL completions and help output so the
6930+
/// discovery surface only shows commands that actually work (ROADMAP #39).
6931+
const STUB_COMMANDS: &[&str] = &[
6932+
"login",
6933+
"logout",
6934+
"vim",
6935+
"upgrade",
6936+
"stats",
6937+
"share",
6938+
"feedback",
6939+
"files",
6940+
"fast",
6941+
"exit",
6942+
"summary",
6943+
"desktop",
6944+
"brief",
6945+
"advisor",
6946+
"stickers",
6947+
"insights",
6948+
"thinkback",
6949+
"release-notes",
6950+
"security-review",
6951+
"keybindings",
6952+
"privacy-settings",
6953+
"plan",
6954+
"review",
6955+
"tasks",
6956+
"theme",
6957+
"voice",
6958+
"usage",
6959+
"rename",
6960+
"copy",
6961+
"hooks",
6962+
"context",
6963+
"color",
6964+
"effort",
6965+
"branch",
6966+
"rewind",
6967+
"ide",
6968+
"tag",
6969+
"output-style",
6970+
"add-dir",
6971+
];
6972+
69286973
fn slash_command_completion_candidates_with_sessions(
69296974
model: &str,
69306975
active_session_id: Option<&str>,
69316976
recent_session_ids: Vec<String>,
69326977
) -> Vec<String> {
69336978
let mut completions = BTreeSet::new();
69346979

6935-
// Commands that are registered in the spec list but not yet implemented
6936-
// in this build. Exclude them from completions so the discovery surface
6937-
// matches what actually works (ROADMAP #39).
6938-
const STUB_COMMANDS: &[&str] = &[
6939-
"login",
6940-
"logout",
6941-
"vim",
6942-
"upgrade",
6943-
"stats",
6944-
"share",
6945-
"feedback",
6946-
"files",
6947-
"fast",
6948-
"exit",
6949-
"summary",
6950-
"desktop",
6951-
"brief",
6952-
"advisor",
6953-
"stickers",
6954-
"insights",
6955-
"thinkback",
6956-
"release-notes",
6957-
"security-review",
6958-
"keybindings",
6959-
"privacy-settings",
6960-
"plan",
6961-
"review",
6962-
"tasks",
6963-
"theme",
6964-
"voice",
6965-
"usage",
6966-
"rename",
6967-
"copy",
6968-
"hooks",
6969-
"context",
6970-
"color",
6971-
"effort",
6972-
"branch",
6973-
"rewind",
6974-
"ide",
6975-
"tag",
6976-
"output-style",
6977-
"add-dir",
6978-
];
6979-
69806980
for spec in slash_command_specs() {
69816981
if STUB_COMMANDS.contains(&spec.name) {
69826982
continue;
@@ -7874,7 +7874,7 @@ fn print_help_to(out: &mut impl Write) -> io::Result<()> {
78747874
)?;
78757875
writeln!(out)?;
78767876
writeln!(out, "Interactive slash commands:")?;
7877-
writeln!(out, "{}", render_slash_command_help())?;
7877+
writeln!(out, "{}", render_slash_command_help_filtered(STUB_COMMANDS))?;
78787878
writeln!(out)?;
78797879
let resume_commands = resume_supported_slash_commands()
78807880
.into_iter()

0 commit comments

Comments
 (0)