@@ -40,6 +40,19 @@ vi.mock("./progress.js", () => {
4040 } ;
4141} ) ;
4242
43+ vi . mock ( "../runtime.js" , ( ) => {
44+ loaded . mark ( "default-runtime" ) ;
45+ return {
46+ defaultRuntime : {
47+ error : vi . fn ( ) ,
48+ exit : vi . fn ( ) ,
49+ log : vi . fn ( ) ,
50+ writeJson : vi . fn ( ) ,
51+ writeStdout : vi . fn ( ) ,
52+ } ,
53+ } ;
54+ } ) ;
55+
4356vi . mock ( "../commands/doctor.js" , ( ) => {
4457 loaded . mark ( "doctor-command" ) ;
4558 return { doctorCommand : vi . fn ( async ( ) => { } ) } ;
@@ -117,6 +130,26 @@ vi.mock("../commands/flows.js", () => {
117130 } ;
118131} ) ;
119132
133+ vi . mock ( "../commands/configure.commands.js" , ( ) => {
134+ loaded . mark ( "configure-command" ) ;
135+ return { configureCommandFromSectionsArg : vi . fn ( async ( ) => { } ) } ;
136+ } ) ;
137+
138+ vi . mock ( "../commands/configure.wizard.js" , ( ) => {
139+ loaded . mark ( "configure-wizard" ) ;
140+ return { runConfigureWizard : vi . fn ( async ( ) => { } ) } ;
141+ } ) ;
142+
143+ vi . mock ( "../commands/onboard.js" , ( ) => {
144+ loaded . mark ( "onboard-command" ) ;
145+ return { setupWizardCommand : vi . fn ( async ( ) => { } ) } ;
146+ } ) ;
147+
148+ vi . mock ( "../commands/setup.js" , ( ) => {
149+ loaded . mark ( "setup-command" ) ;
150+ return { setupCommand : vi . fn ( async ( ) => { } ) } ;
151+ } ) ;
152+
120153function makeProgram ( ) : Command {
121154 const program = new Command ( ) ;
122155 program . name ( "openclaw" ) ;
@@ -180,4 +213,39 @@ describe("subcommand help cold imports", () => {
180213 expect ( loaded . modules ) . not . toContain ( "tasks-command" ) ;
181214 expect ( loaded . modules ) . not . toContain ( "flows-command" ) ;
182215 } ) ;
216+
217+ it ( "keeps configure help out of configure action/wizard modules" , async ( ) => {
218+ const { registerConfigureCommand } = await import ( "./program/register.configure.js" ) ;
219+ const program = makeProgram ( ) ;
220+
221+ registerConfigureCommand ( program ) ;
222+ await expectHelpExit ( program , [ "configure" , "--help" ] ) ;
223+
224+ expect ( loaded . modules ) . not . toContain ( "configure-command" ) ;
225+ expect ( loaded . modules ) . not . toContain ( "configure-wizard" ) ;
226+ expect ( loaded . modules ) . not . toContain ( "default-runtime" ) ;
227+ } ) ;
228+
229+ it ( "keeps setup help out of setup and onboard action modules" , async ( ) => {
230+ const { registerSetupCommand } = await import ( "./program/register.setup.js" ) ;
231+ const program = makeProgram ( ) ;
232+
233+ registerSetupCommand ( program ) ;
234+ await expectHelpExit ( program , [ "setup" , "--help" ] ) ;
235+
236+ expect ( loaded . modules ) . not . toContain ( "setup-command" ) ;
237+ expect ( loaded . modules ) . not . toContain ( "onboard-command" ) ;
238+ expect ( loaded . modules ) . not . toContain ( "default-runtime" ) ;
239+ } ) ;
240+
241+ it ( "keeps onboard help out of onboard action modules" , async ( ) => {
242+ const { registerOnboardCommand } = await import ( "./program/register.onboard.js" ) ;
243+ const program = makeProgram ( ) ;
244+
245+ registerOnboardCommand ( program ) ;
246+ await expectHelpExit ( program , [ "onboard" , "--help" ] ) ;
247+
248+ expect ( loaded . modules ) . not . toContain ( "onboard-command" ) ;
249+ expect ( loaded . modules ) . not . toContain ( "default-runtime" ) ;
250+ } ) ;
183251} ) ;
0 commit comments