mirror of
https://github.com/lWolvesl/claw-code.git
synced 2026-04-02 07:41:52 +08:00
Tighten help and clear messaging across the CLI surface
Refresh shared slash help and REPL help wording so the command surface reads more like an integrated console, and make successful /clear output match the newer structured reporting style. This keeps discoverability consistent now that status, model, permissions, config, and cost all use richer operator-oriented copy. Constraint: Help text must stay synchronized with the actual implemented command surface and resume behavior Rejected: Larger README/doc pass in the same commit | keeping the slice limited to runtime help/output makes it easier to review and revert Confidence: high Scope-risk: narrow Reversibility: clean Directive: Prefer shared help-copy changes in commands crate first, then layer REPL-specific additions in the CLI binary Tested: cargo fmt --manifest-path ./rust/Cargo.toml --all; cargo clippy --manifest-path ./rust/Cargo.toml --workspace --all-targets -- -D warnings; cargo test --manifest-path ./rust/Cargo.toml --workspace Not-tested: Manual comparison of help wording against upstream Claude Code terminal screenshots
This commit is contained in:
@@ -174,8 +174,8 @@ pub fn resume_supported_slash_commands() -> Vec<&'static SlashCommandSpec> {
|
|||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn render_slash_command_help() -> String {
|
pub fn render_slash_command_help() -> String {
|
||||||
let mut lines = vec![
|
let mut lines = vec![
|
||||||
"Available commands:".to_string(),
|
"Slash commands".to_string(),
|
||||||
" (resume-safe commands are marked with [resume])".to_string(),
|
" [resume] means the command also works with --resume SESSION.json".to_string(),
|
||||||
];
|
];
|
||||||
for spec in slash_command_specs() {
|
for spec in slash_command_specs() {
|
||||||
let name = match spec.argument_hint {
|
let name = match spec.argument_hint {
|
||||||
@@ -288,7 +288,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn renders_help_from_shared_specs() {
|
fn renders_help_from_shared_specs() {
|
||||||
let help = render_slash_command_help();
|
let help = render_slash_command_help();
|
||||||
assert!(help.contains("resume-safe commands"));
|
assert!(help.contains("works with --resume SESSION.json"));
|
||||||
assert!(help.contains("/help"));
|
assert!(help.contains("/help"));
|
||||||
assert!(help.contains("/status"));
|
assert!(help.contains("/status"));
|
||||||
assert!(help.contains("/compact"));
|
assert!(help.contains("/compact"));
|
||||||
@@ -340,7 +340,7 @@ mod tests {
|
|||||||
let result = handle_slash_command("/help", &session, CompactionConfig::default())
|
let result = handle_slash_command("/help", &session, CompactionConfig::default())
|
||||||
.expect("help command should be handled");
|
.expect("help command should be handled");
|
||||||
assert_eq!(result.session, session);
|
assert_eq!(result.session, session);
|
||||||
assert!(result.message.contains("Available commands:"));
|
assert!(result.message.contains("Slash commands"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -623,7 +623,14 @@ impl LiveCli {
|
|||||||
true,
|
true,
|
||||||
permission_mode_label(),
|
permission_mode_label(),
|
||||||
)?;
|
)?;
|
||||||
println!("Cleared local session history.");
|
println!(
|
||||||
|
"Session cleared
|
||||||
|
Mode fresh session
|
||||||
|
Preserved model {}
|
||||||
|
Permission mode {}",
|
||||||
|
self.model,
|
||||||
|
permission_mode_label()
|
||||||
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,10 +692,16 @@ impl LiveCli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn render_repl_help() -> String {
|
fn render_repl_help() -> String {
|
||||||
format!(
|
[
|
||||||
"{}
|
"REPL".to_string(),
|
||||||
/exit Quit the REPL",
|
" /exit Quit the REPL".to_string(),
|
||||||
render_slash_command_help()
|
" /quit Quit the REPL".to_string(),
|
||||||
|
String::new(),
|
||||||
|
render_slash_command_help(),
|
||||||
|
]
|
||||||
|
.join(
|
||||||
|
"
|
||||||
|
",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1351,9 +1364,17 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn shared_help_uses_resume_annotation_copy() {
|
||||||
|
let help = commands::render_slash_command_help();
|
||||||
|
assert!(help.contains("Slash commands"));
|
||||||
|
assert!(help.contains("works with --resume SESSION.json"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn repl_help_includes_shared_commands_and_exit() {
|
fn repl_help_includes_shared_commands_and_exit() {
|
||||||
let help = render_repl_help();
|
let help = render_repl_help();
|
||||||
|
assert!(help.contains("REPL"));
|
||||||
assert!(help.contains("/help"));
|
assert!(help.contains("/help"));
|
||||||
assert!(help.contains("/status"));
|
assert!(help.contains("/status"));
|
||||||
assert!(help.contains("/model [model]"));
|
assert!(help.contains("/model [model]"));
|
||||||
|
|||||||
Reference in New Issue
Block a user