@@ -32,6 +32,23 @@ Environment Variables:
3232 TUI elements, which works better with screen readers.
3333`
3434
35+ // Help groups for the root command. AddGroup order is display order.
36+ // Visible commands without a GroupID render under "Additional Commands"
37+ // (version, labs, agent-help, help) — that placement is intentional.
38+ const (
39+ groupSetup = "setup"
40+ groupSessions = "sessions"
41+ groupAccount = "account"
42+ groupControlPlane = "controlplane"
43+ )
44+
45+ // inGroup assigns a help group to a command at registration time so all
46+ // grouping stays visible in NewRootCmd rather than spread across constructors.
47+ func inGroup (c * cobra.Command , groupID string ) * cobra.Command {
48+ c .GroupID = groupID
49+ return c
50+ }
51+
3552func NewRootCmd () * cobra.Command {
3653 cmd := & cobra.Command {
3754 Use : "entire" ,
@@ -85,39 +102,47 @@ func NewRootCmd() *cobra.Command {
85102 },
86103 }
87104
105+ // Help groups; AddGroup order is display order in `entire --help`.
106+ cmd .AddGroup (
107+ & cobra.Group {ID : groupSetup , Title : "Entire Setup:" },
108+ & cobra.Group {ID : groupSessions , Title : "Sessions & Checkpoints:" },
109+ & cobra.Group {ID : groupAccount , Title : "Account:" },
110+ & cobra.Group {ID : groupControlPlane , Title : "Control Plane:" },
111+ )
112+
88113 // Noun groups (canonical homes for subcommands).
89- cmd .AddCommand (newSessionsCmd ()) // 'session' (with 'sessions' as Cobra alias)
90- cmd .AddCommand (newCheckpointGroupCmd ()) // 'checkpoint' / 'cp' / 'checkpoints'
91- experimental .Register (cmd , newTokensGroupCmd ()) // 'tokens' (experimental)
92- cmd .AddCommand (newAgentGroupCmd ()) // 'agent'
93- cmd .AddCommand (newAuthCmd ()) // 'auth'
94- cmd .AddCommand (newDoctorCmd ()) // 'doctor' (group: trace/logs/bundle)
95- cmd .AddCommand (newLabsCmd ()) // 'labs' (experimental workflow discovery)
96- cmd .AddCommand (newPluginGroupCmd ()) // 'plugin' (managed install/list/remove)
97- experimental .Register (cmd , newImportCmd ()) // 'import' (experimental; import pre-existing agent history)
98- cmd .AddCommand (newOrgCmd ()) // 'org' — control-plane org management
99- cmd .AddCommand (newProjectCmd ()) // 'project' — control-plane project management
100- cmd .AddCommand (newRepoCmd ()) // 'repo' — control-plane repo lifecycle
101- cmd .AddCommand (newGrantCmd ()) // 'grant' — control-plane access grants
114+ cmd .AddCommand (inGroup ( newSessionsCmd (), groupSessions )) // 'session' (with 'sessions' as Cobra alias)
115+ cmd .AddCommand (inGroup ( newCheckpointGroupCmd (), groupSessions )) // 'checkpoint' / 'cp' / 'checkpoints'
116+ experimental .Register (cmd , newTokensGroupCmd ()) // 'tokens' (experimental)
117+ cmd .AddCommand (inGroup ( newAgentGroupCmd (), groupSetup )) // 'agent'
118+ cmd .AddCommand (inGroup ( newAuthCmd (), groupAccount )) // 'auth'
119+ cmd .AddCommand (inGroup ( newDoctorCmd (), groupSetup )) // 'doctor' (group: trace/logs/bundle)
120+ cmd .AddCommand (newLabsCmd ()) // 'labs' (experimental workflow discovery)
121+ cmd .AddCommand (inGroup ( newPluginGroupCmd (), groupSetup )) // 'plugin' (managed install/list/remove)
122+ experimental .Register (cmd , newImportCmd ()) // 'import' (experimental; import pre-existing agent history)
123+ cmd .AddCommand (inGroup ( newOrgCmd (), groupControlPlane )) // 'org' — control-plane org management
124+ cmd .AddCommand (inGroup ( newProjectCmd (), groupControlPlane )) // 'project' — control-plane project management
125+ cmd .AddCommand (inGroup ( newRepoCmd (), groupControlPlane )) // 'repo' — control-plane repo lifecycle
126+ cmd .AddCommand (inGroup ( newGrantCmd (), groupControlPlane )) // 'grant' — control-plane access grants
102127
103128 // Top-level lifecycle and standalone commands.
104129 experimental .Register (cmd , cliReview .NewCommand (buildReviewDeps ())) // `review` (experimental)
105130 experimental .Register (cmd , investigate .NewCommand (buildInvestigateDeps ())) // `investigate` (experimental); multi-agent investigation
106- cmd .AddCommand (newCleanCmd ())
107- cmd .AddCommand (newSetupCmd ()) // 'configure' — non-agent settings; agent CRUD lives under 'agent'
108- cmd .AddCommand (newEnableCmd ())
109- cmd .AddCommand (newDisableCmd ())
110- cmd .AddCommand (newStatusCmd ())
131+ cmd .AddCommand (inGroup ( newCleanCmd (), groupSetup ))
132+ cmd .AddCommand (inGroup ( newSetupCmd (), groupSetup )) // 'configure' — non-agent settings; agent CRUD lives under 'agent'
133+ cmd .AddCommand (inGroup ( newEnableCmd (), groupSetup ))
134+ cmd .AddCommand (inGroup ( newDisableCmd (), groupSetup ))
135+ cmd .AddCommand (inGroup ( newStatusCmd (), groupSetup ))
111136 experimental .Register (cmd , newBlameCmd ()) // 'blame' (experimental)
112137 experimental .Register (cmd , newWhyCmd ()) // 'why' (experimental)
113- cmd .AddCommand (newLoginCmd ())
114- cmd .AddCommand (newLogoutCmd ())
138+ cmd .AddCommand (inGroup ( newLoginCmd (), groupAccount ))
139+ cmd .AddCommand (inGroup ( newLogoutCmd (), groupAccount ))
115140 cmd .AddCommand (newVersionCmd ())
116- cmd .AddCommand (newDispatchCmd ())
117- cmd .AddCommand (newActivityCmd ())
118- cmd .AddCommand (newRecapCmd ())
119- cmd .AddCommand (newAPICmd ()) // authenticated passthrough to core/cell APIs
120- cmd .AddCommand (newAgentHelpCmd (cmd )) // visible: agents on transports without context injection discover it via `entire help`
141+ cmd .AddCommand (inGroup ( newDispatchCmd (), groupSessions ))
142+ cmd .AddCommand (inGroup ( newActivityCmd (), groupSessions ))
143+ cmd .AddCommand (inGroup ( newRecapCmd (), groupSessions ))
144+ cmd .AddCommand (inGroup ( newAPICmd (), groupControlPlane )) // authenticated passthrough to core/cell APIs
145+ cmd .AddCommand (newAgentHelpCmd (cmd )) // visible: agents on transports without context injection discover it via `entire help`
121146
122147 // Hidden top-level shortcuts. Functional but print a deprecation hint.
123148 cmd .AddCommand (hideAsAlias (newResumeCmd (), "entire session resume" ))
0 commit comments