11use std:: fmt:: Write ;
22
33use crate :: services;
4- use services:: style:: { command_name, heading , status_implemented , status_placeholder } ;
4+ use services:: style:: { command_name, example_command , heading } ;
55
66#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
77pub enum ImplementationStatus {
@@ -14,58 +14,69 @@ pub struct CommandContract {
1414 pub name : & ' static str ,
1515 pub status : ImplementationStatus ,
1616 pub purpose : & ' static str ,
17+ pub show_in_top_level_help : bool ,
1718}
1819
1920pub const COMMANDS : & [ CommandContract ] = & [
2021 CommandContract {
2122 name : "help" ,
2223 status : ImplementationStatus :: Implemented ,
23- purpose : "Print the current placeholder command surface" ,
24+ purpose : "Show help for the current CLI surface" ,
25+ show_in_top_level_help : true ,
2426 } ,
2527 CommandContract {
2628 name : services:: config:: NAME ,
2729 status : ImplementationStatus :: Implemented ,
2830 purpose : "Inspect and validate resolved CLI configuration" ,
31+ show_in_top_level_help : true ,
2932 } ,
3033 CommandContract {
3134 name : services:: setup:: NAME ,
3235 status : ImplementationStatus :: Implemented ,
3336 purpose : "Prepare local repository/workspace prerequisites" ,
37+ show_in_top_level_help : true ,
3438 } ,
3539 CommandContract {
3640 name : services:: doctor:: NAME ,
3741 status : ImplementationStatus :: Implemented ,
3842 purpose : "Inspect SCE operator health and explicit repair readiness" ,
43+ show_in_top_level_help : true ,
3944 } ,
4045 CommandContract {
4146 name : services:: auth_command:: NAME ,
4247 status : ImplementationStatus :: Implemented ,
4348 purpose : "Authenticate with WorkOS and inspect local auth state" ,
49+ show_in_top_level_help : false ,
4450 } ,
4551 CommandContract {
4652 name : services:: hooks:: NAME ,
4753 status : ImplementationStatus :: Implemented ,
4854 purpose : "Run git-hook runtime entrypoints for local Agent Trace flows" ,
55+ show_in_top_level_help : false ,
4956 } ,
5057 CommandContract {
5158 name : services:: trace:: NAME ,
5259 status : ImplementationStatus :: Implemented ,
5360 purpose : "Inspect persisted Agent Trace records and captured prompts" ,
61+ show_in_top_level_help : false ,
5462 } ,
5563 CommandContract {
5664 name : services:: sync:: NAME ,
5765 status : ImplementationStatus :: Placeholder ,
5866 purpose : "Coordinate future cloud sync workflows" ,
67+ show_in_top_level_help : false ,
5968 } ,
6069 CommandContract {
6170 name : services:: version:: NAME ,
6271 status : ImplementationStatus :: Implemented ,
6372 purpose : "Print deterministic runtime version metadata" ,
73+ show_in_top_level_help : true ,
6474 } ,
6575 CommandContract {
6676 name : services:: completion:: NAME ,
6777 status : ImplementationStatus :: Implemented ,
6878 purpose : "Generate deterministic shell completion scripts" ,
79+ show_in_top_level_help : true ,
6980 } ,
7081] ;
7182
@@ -76,20 +87,14 @@ pub fn is_known_command(name: &str) -> bool {
7687pub fn help_text ( ) -> String {
7788 let mut command_rows = String :: new ( ) ;
7889 for command in COMMANDS {
79- let status_text = match command. status {
80- ImplementationStatus :: Implemented => "implemented" ,
81- ImplementationStatus :: Placeholder => "placeholder" ,
82- } ;
83- let styled_status = match command. status {
84- ImplementationStatus :: Implemented => status_implemented ( status_text) ,
85- ImplementationStatus :: Placeholder => status_placeholder ( status_text) ,
86- } ;
90+ if !command. show_in_top_level_help {
91+ continue ;
92+ }
8793
8894 writeln ! (
8995 command_rows,
90- " {:<10} {:<12} { }" ,
96+ " {:<10} {}" ,
9197 command_name( command. name) ,
92- styled_status,
9398 command. purpose
9499 )
95100 . unwrap ( ) ;
@@ -101,31 +106,29 @@ pub fn help_text() -> String {
101106 {}:\n {} <show|validate> [--format <text|json>] [options]\n \n \
102107 {}:\n {} [--opencode|--claude|--both] [--non-interactive] [--hooks] [--repo <path>]\n \n \
103108 {}:\n {} [--fix] [--all-databases] [--format <text|json>]\n \n \
104- {}:\n {} <login|logout|status> [--format <text|json>]\n \n \
105109 {}:\n {} --shell <bash|zsh|fish>\n \n \
106- {}:\n {} prompts <commit-sha> [--format <text|json>|--json]\n \n \
107110 {}:\n Supported commands accept --format <text|json>\n \n \
108- {}:\n sce setup\n sce setup --opencode --non-interactive --hooks\n sce setup --hooks --repo ../demo-repo\n sce auth status\n sce auth login --format json\n sce trace prompts abc1234\n sce trace prompts abc1234 --json\n sce doctor --format json\n sce doctor --all-databases --format json\n sce doctor --fix\n sce version --format json\n \n \
109- {}:\n {command_rows}\n \
110- Setup defaults to interactive target selection when no setup target flag is passed, and installs hooks in the same run.\n \
111- Use '--hooks' to install required git hooks for the current repository or '--repo <path>' for a specific repository.\n \
112- `setup`, `doctor`, `auth`, `hooks`, `trace`, `version`, and `completion` are implemented; `sync` remains placeholder-oriented.\n ",
113- heading( "sce - Shared Context Engineering CLI (placeholder foundation)" ) ,
111+ {}:\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n \n \
112+ {}:\n {command_rows}",
113+ heading( "sce - Shared Context Engineering CLI" ) ,
114114 heading( "Usage" ) ,
115115 heading( "Config usage" ) ,
116116 command_name( "sce config" ) ,
117117 heading( "Setup usage" ) ,
118118 command_name( "sce setup" ) ,
119119 heading( "Doctor usage" ) ,
120120 command_name( "sce doctor" ) ,
121- heading( "Auth usage" ) ,
122- command_name( "sce auth" ) ,
123121 heading( "Completion usage" ) ,
124122 command_name( "sce completion" ) ,
125- heading( "Trace usage" ) ,
126- command_name( "sce trace" ) ,
127123 heading( "Output format contract" ) ,
128124 heading( "Examples" ) ,
125+ example_command( "sce setup" ) ,
126+ example_command( "sce setup --opencode --non-interactive --hooks" ) ,
127+ example_command( "sce setup --hooks --repo ../demo-repo" ) ,
128+ example_command( "sce doctor --format json" ) ,
129+ example_command( "sce doctor --all-databases --format json" ) ,
130+ example_command( "sce doctor --fix" ) ,
131+ example_command( "sce version --format json" ) ,
129132 heading( "Commands" ) ,
130133 )
131134}
@@ -151,7 +154,6 @@ mod tests {
151154 assert ! ( help. contains(
152155 "sce setup [--opencode|--claude|--both] [--non-interactive] [--hooks] [--repo <path>]"
153156 ) ) ;
154- assert ! ( help. contains( "installs hooks in the same run" ) ) ;
155157 assert ! ( help. contains( "sce setup --opencode --non-interactive --hooks" ) ) ;
156158 }
157159
@@ -173,11 +175,25 @@ mod tests {
173175 }
174176
175177 #[ test]
176- fn help_text_mentions_auth_usage_examples ( ) {
178+ fn hidden_commands_remain_known_even_when_not_shown_in_top_level_help ( ) {
179+ for hidden_command in [
180+ crate :: services:: auth_command:: NAME ,
181+ crate :: services:: hooks:: NAME ,
182+ crate :: services:: trace:: NAME ,
183+ crate :: services:: sync:: NAME ,
184+ ] {
185+ assert ! ( crate :: command_surface:: is_known_command( hidden_command) ) ;
186+ }
187+ }
188+
189+ #[ test]
190+ fn help_text_hides_selected_commands_from_top_level_help ( ) {
177191 let help = help_text ( ) ;
178- assert ! ( help. contains( "sce auth <login|logout|status> [--format <text|json>]" ) ) ;
179- assert ! ( help. contains( "sce auth status" ) ) ;
180- assert ! ( help. contains( "sce auth login --format json" ) ) ;
192+
193+ assert ! ( !help. contains( "auth" ) ) ;
194+ assert ! ( !help. contains( "hooks" ) ) ;
195+ assert ! ( !help. contains( "trace" ) ) ;
196+ assert ! ( !help. contains( "sync" ) ) ;
181197 }
182198
183199 #[ test]
@@ -188,11 +204,14 @@ mod tests {
188204 }
189205
190206 #[ test]
191- fn help_text_mentions_trace_command ( ) {
207+ fn help_text_drops_placeholder_and_status_copy ( ) {
192208 let help = help_text ( ) ;
193- assert ! ( help. contains( "trace" ) ) ;
194- assert ! ( help. contains( "sce trace prompts <commit-sha>" ) ) ;
195- assert ! ( help. contains( "sce trace prompts abc1234 --json" ) ) ;
209+
210+ assert ! ( !help. contains( "placeholder foundation" ) ) ;
211+ assert ! ( !help. contains( "implemented" ) ) ;
212+ assert ! ( !help. contains( "placeholder-oriented" ) ) ;
213+ assert ! ( !help. contains( "Setup defaults to interactive target selection" ) ) ;
214+ assert ! ( !help. contains( "Use '--hooks' to install required git hooks" ) ) ;
196215 }
197216
198217 #[ test]
0 commit comments