From e3c6666c8e2f02bad4b61686285c7bd1cbb688a9 Mon Sep 17 00:00:00 2001 From: Elaine Wang Date: Tue, 12 May 2026 10:53:48 +0800 Subject: [PATCH] fix: show history in top-level help --- src/cortex-cli/src/cli/args.rs | 19 +++++++++++++++---- src/cortex-cli/src/cli/styles.rs | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/cortex-cli/src/cli/args.rs b/src/cortex-cli/src/cli/args.rs index 641d63a4a..2e8892dd8 100644 --- a/src/cortex-cli/src/cli/args.rs +++ b/src/cortex-cli/src/cli/args.rs @@ -311,6 +311,11 @@ pub enum Commands { #[command(next_help_heading = categories::SESSION)] Delete(DeleteCommand), + /// View prompt history from past sessions + #[command(display_order = 15)] + #[command(next_help_heading = categories::SESSION)] + History(HistoryCommand), + // ======================================================================== // 🔐 Authentication (order 20-29) // ======================================================================== @@ -470,10 +475,6 @@ pub enum Commands { #[command(hide = true)] Servers(ServersCommand), - /// View prompt history from past sessions - #[command(hide = true)] - History(HistoryCommand), - /// Manage workspace/project settings #[command(visible_alias = "project", hide = true)] Workspace(WorkspaceCli), @@ -857,6 +858,7 @@ pub struct HistoryClearArgs { #[cfg(test)] mod tests { use super::*; + use clap::CommandFactory; use clap::Parser; // ========================================================================== @@ -1782,6 +1784,15 @@ mod tests { } } + #[test] + fn test_history_command_visible_in_help() { + let help = Cli::command().render_long_help().to_string(); + assert!( + help.contains("history"), + "top-level help should list the history command" + ); + } + #[test] fn test_history_command_with_limit() { let cli = Cli::try_parse_from(["cortex", "history", "-n", "50"]) diff --git a/src/cortex-cli/src/cli/styles.rs b/src/cortex-cli/src/cli/styles.rs index 4032f94e7..2321ca711 100644 --- a/src/cortex-cli/src/cli/styles.rs +++ b/src/cortex-cli/src/cli/styles.rs @@ -96,6 +96,7 @@ pub const HELP_TEMPLATE: &str = color_print::cstr!( export Export a session to JSON format import Import a session from JSON file or URL delete Delete a session + history View prompt history from past sessions 🔐 Authentication: login Authenticate with Cortex API