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