diff --git a/src/cortex-cli/src/agent_cmd/tests.rs b/src/cortex-cli/src/agent_cmd/tests.rs index e2ff07f9f..18f7ba753 100644 --- a/src/cortex-cli/src/agent_cmd/tests.rs +++ b/src/cortex-cli/src/agent_cmd/tests.rs @@ -3,10 +3,9 @@ #[cfg(test)] mod tests { use crate::agent_cmd::cli::{CopyArgs, ExportArgs}; - use crate::agent_cmd::loader::{ - load_builtin_agents, parse_frontmatter, read_file_with_encoding, - }; + use crate::agent_cmd::loader::{load_builtin_agents, parse_frontmatter}; use crate::agent_cmd::types::AgentMode; + use crate::utils::file::read_file_with_encoding; #[test] fn test_read_file_with_utf8() { diff --git a/src/cortex-cli/src/cli/args.rs b/src/cortex-cli/src/cli/args.rs index 641d63a4a..670649988 100644 --- a/src/cortex-cli/src/cli/args.rs +++ b/src/cortex-cli/src/cli/args.rs @@ -805,6 +805,9 @@ pub struct ServersRefreshArgs { /// History command - view past prompts and sessions. #[derive(Args)] +#[command( + after_help = "With no subcommand, list recent prompts. Use search to filter history or clear to delete it." +)] pub struct HistoryCommand { #[command(subcommand)] pub action: Option, @@ -857,7 +860,7 @@ pub struct HistoryClearArgs { #[cfg(test)] mod tests { use super::*; - use clap::Parser; + use clap::{CommandFactory, Parser}; // ========================================================================== // LogLevel tests @@ -1782,6 +1785,18 @@ mod tests { } } + #[test] + fn test_history_help_documents_default_list_behavior() { + let mut cmd = Cli::command(); + let help = cmd + .find_subcommand_mut("history") + .expect("history subcommand should exist") + .render_help() + .to_string(); + + assert!(help.contains("With no subcommand, list recent prompts.")); + } + #[test] fn test_history_command_with_limit() { let cli = Cli::try_parse_from(["cortex", "history", "-n", "50"])