55use clap:: { Args , Parser , Subcommand } ;
66use std:: path:: PathBuf ;
77
8- use super :: styles:: { AFTER_HELP , BEFORE_HELP , categories, get_styles} ;
8+ use super :: styles:: { AFTER_HELP , BEFORE_HELP , HELP_TEMPLATE , categories, get_styles} ;
99use crate :: acp_cmd:: AcpCli ;
1010use crate :: agent_cmd:: AgentCli ;
1111use crate :: alias_cmd:: AliasCli ;
@@ -115,7 +115,8 @@ pub enum ColorMode {
115115 subcommand_negates_reqs = true ,
116116 override_usage = "cortex [OPTIONS] [PROMPT]\n cortex [OPTIONS] <COMMAND> [ARGS]" ,
117117 before_help = BEFORE_HELP ,
118- after_help = AFTER_HELP
118+ after_help = AFTER_HELP ,
119+ help_template = HELP_TEMPLATE
119120) ]
120121pub struct Cli {
121122 #[ clap( flatten) ]
@@ -229,9 +230,9 @@ pub struct InteractiveArgs {
229230/// CLI subcommands.
230231#[ derive( Subcommand ) ]
231232pub enum Commands {
232- /// Initialize AGENTS.md in the current directory.
233- Init ( InitCommand ) ,
234-
233+ // ========================================================================
234+ // 🚀 Execution (order 1-9)
235+ // ========================================================================
235236 /// Run Cortex non-interactively with advanced options
236237 #[ command( visible_alias = "r" , display_order = 1 ) ]
237238 #[ command( next_help_heading = categories:: EXECUTION ) ]
@@ -242,6 +243,9 @@ pub enum Commands {
242243 #[ command( next_help_heading = categories:: EXECUTION ) ]
243244 Exec ( ExecCli ) ,
244245
246+ // ========================================================================
247+ // 📋 Session Management (order 10-19)
248+ // ========================================================================
245249 /// Resume a previous interactive session
246250 #[ command( display_order = 10 ) ]
247251 #[ command( next_help_heading = categories:: SESSION ) ]
@@ -267,6 +271,9 @@ pub enum Commands {
267271 #[ command( next_help_heading = categories:: SESSION ) ]
268272 Delete ( DeleteCommand ) ,
269273
274+ // ========================================================================
275+ // 🔐 Authentication (order 20-29)
276+ // ========================================================================
270277 /// Authenticate with Cortex API
271278 #[ command( display_order = 20 ) ]
272279 #[ command( next_help_heading = categories:: AUTH ) ]
@@ -282,6 +289,9 @@ pub enum Commands {
282289 #[ command( next_help_heading = categories:: AUTH ) ]
283290 Whoami ,
284291
292+ // ========================================================================
293+ // 🔌 Extensibility (order 30-39)
294+ // ========================================================================
285295 /// Manage agents (list, create, show)
286296 #[ command( display_order = 30 ) ]
287297 #[ command( next_help_heading = categories:: EXTENSION ) ]
@@ -302,6 +312,9 @@ pub enum Commands {
302312 #[ command( next_help_heading = categories:: EXTENSION ) ]
303313 Acp ( AcpCli ) ,
304314
315+ // ========================================================================
316+ // ⚙️ Configuration (order 40-49)
317+ // ========================================================================
305318 /// Show or edit configuration
306319 #[ command( display_order = 40 ) ]
307320 #[ command( next_help_heading = categories:: CONFIG ) ]
@@ -317,6 +330,14 @@ pub enum Commands {
317330 #[ command( next_help_heading = categories:: CONFIG ) ]
318331 Features ( FeaturesCommand ) ,
319332
333+ /// Initialize AGENTS.md in the current directory
334+ #[ command( display_order = 43 ) ]
335+ #[ command( next_help_heading = categories:: CONFIG ) ]
336+ Init ( InitCommand ) ,
337+
338+ // ========================================================================
339+ // 🛠️ Utilities (order 50-59)
340+ // ========================================================================
320341 /// GitHub integration (actions, workflows)
321342 #[ command( visible_alias = "gh" , display_order = 50 ) ]
322343 #[ command( next_help_heading = categories:: UTILITIES ) ]
@@ -342,79 +363,88 @@ pub enum Commands {
342363 #[ command( next_help_heading = categories:: UTILITIES ) ]
343364 Completion ( CompletionCommand ) ,
344365
345- /// Run commands within a Cortex-provided sandbox
346- #[ command( visible_alias = "sb" , display_order = 60 ) ]
347- #[ command( next_help_heading = categories:: ADVANCED ) ]
348- Sandbox ( SandboxArgs ) ,
349-
350- /// Run the HTTP API server (for desktop/web integration)
351- #[ command( display_order = 61 ) ]
352- #[ command( next_help_heading = categories:: ADVANCED ) ]
353- Serve ( ServeCommand ) ,
354-
355- /// Discover Cortex servers on the local network
356- #[ command( display_order = 62 ) ]
357- #[ command( next_help_heading = categories:: ADVANCED ) ]
358- Servers ( ServersCommand ) ,
359-
360- /// View prompt history from past sessions
361- #[ command( display_order = 63 ) ]
362- #[ command( next_help_heading = categories:: ADVANCED ) ]
363- History ( HistoryCommand ) ,
364-
366+ // ========================================================================
367+ // 🔧 Maintenance (order 60-69)
368+ // ========================================================================
365369 /// Check for and install updates
366- #[ command( display_order = 70 ) ]
367- #[ command( next_help_heading = categories:: ADVANCED ) ]
370+ #[ command( display_order = 60 ) ]
371+ #[ command( next_help_heading = categories:: MAINTENANCE ) ]
368372 Upgrade ( UpgradeCli ) ,
369373
370374 /// Uninstall Cortex CLI
371- #[ command( display_order = 71 ) ]
372- #[ command( next_help_heading = categories:: ADVANCED ) ]
375+ #[ command( display_order = 61 ) ]
376+ #[ command( next_help_heading = categories:: MAINTENANCE ) ]
373377 Uninstall ( UninstallCli ) ,
374378
375- /// Debug and diagnostic commands
376- #[ command( display_order = 99 ) ]
377- #[ command( next_help_heading = categories:: ADVANCED ) ]
378- Debug ( DebugCli ) ,
379+ /// Data compaction and cleanup (logs, sessions, history)
380+ #[ command( visible_aliases = [ "gc" , "cleanup" ] , display_order = 62 ) ]
381+ #[ command( next_help_heading = categories:: MAINTENANCE ) ]
382+ Compact ( CompactCli ) ,
379383
380- /// Manage plugins
381- #[ command( visible_alias = "plugins" ) ]
382- Plugin ( PluginCli ) ,
384+ /// Manage cache
385+ #[ command( display_order = 63 ) ]
386+ #[ command( next_help_heading = categories:: MAINTENANCE ) ]
387+ Cache ( CacheCli ) ,
388+
389+ /// View application logs
390+ #[ command( display_order = 64 ) ]
391+ #[ command( next_help_heading = categories:: MAINTENANCE ) ]
392+ Logs ( LogsCli ) ,
383393
384394 /// Submit feedback and bug reports
385- #[ command( visible_alias = "report" ) ]
395+ #[ command( visible_alias = "report" , display_order = 65 ) ]
396+ #[ command( next_help_heading = categories:: MAINTENANCE ) ]
386397 Feedback ( FeedbackCli ) ,
387398
388399 /// Lock/protect sessions from deletion
389- #[ command( visible_alias = "protect" ) ]
400+ #[ command( visible_alias = "protect" , display_order = 66 ) ]
401+ #[ command( next_help_heading = categories:: MAINTENANCE ) ]
390402 Lock ( LockCli ) ,
391403
392404 /// Manage command aliases
393- #[ command( visible_alias = "aliases" ) ]
405+ #[ command( visible_alias = "aliases" , display_order = 67 ) ]
406+ #[ command( next_help_heading = categories:: MAINTENANCE ) ]
394407 Alias ( AliasCli ) ,
395408
396- /// Manage cache
397- Cache ( CacheCli ) ,
398-
399- /// Data compaction and cleanup (logs, sessions, history)
400- #[ command( visible_aliases = [ "gc" , "cleanup" ] ) ]
401- Compact ( CompactCli ) ,
409+ /// Manage plugins
410+ #[ command( visible_alias = "plugins" , display_order = 68 ) ]
411+ #[ command( next_help_heading = categories:: MAINTENANCE ) ]
412+ Plugin ( PluginCli ) ,
402413
403- /// View application logs
404- Logs ( LogsCli ) ,
414+ // ========================================================================
415+ // Hidden commands (internal/debug/advanced)
416+ // ========================================================================
417+ /// Debug and diagnostic commands
418+ #[ command( display_order = 99 , hide = true ) ]
419+ Debug ( DebugCli ) ,
405420
406421 /// Start interactive shell/REPL mode
407- #[ command( visible_aliases = [ "interactive" , "repl" ] ) ]
422+ #[ command( visible_aliases = [ "interactive" , "repl" ] , hide = true ) ]
408423 Shell ( ShellCli ) ,
409424
425+ /// Execute and manage task DAGs (dependency graphs)
426+ #[ command( visible_alias = "tasks" , hide = true ) ]
427+ Dag ( DagCli ) ,
428+
429+ /// Discover Cortex servers on the local network
430+ #[ command( hide = true ) ]
431+ Servers ( ServersCommand ) ,
432+
433+ /// View prompt history from past sessions
434+ #[ command( hide = true ) ]
435+ History ( HistoryCommand ) ,
436+
410437 /// Manage workspace/project settings
411- #[ command( visible_alias = "project" ) ]
438+ #[ command( visible_alias = "project" , hide = true ) ]
412439 Workspace ( WorkspaceCli ) ,
413440
414- /// Execute and manage task DAGs (dependency graphs)
415- #[ command( visible_alias = "tasks" , display_order = 55 ) ]
416- #[ command( next_help_heading = categories:: UTILITIES ) ]
417- Dag ( DagCli ) ,
441+ /// Run commands within a Cortex-provided sandbox
442+ #[ command( visible_alias = "sb" , hide = true ) ]
443+ Sandbox ( SandboxArgs ) ,
444+
445+ /// Run the HTTP API server (for desktop/web integration)
446+ #[ command( hide = true ) ]
447+ Serve ( ServeCommand ) ,
418448}
419449
420450// ============================================================================
0 commit comments