@@ -87,9 +87,14 @@ interface CLIOptions {
87
87
cli
88
88
. command ( 'setup' , '🚀 Interactive setup for automated dependency updates (recommended)' )
89
89
. option ( '--verbose, -v' , 'Enable verbose logging' )
90
+ . option ( '--non-interactive' , 'Run setup without prompts (use defaults)' )
91
+ . option ( '--preset <type>' , 'Workflow preset: standard|high-frequency|security|minimal|testing' , { default : 'standard' } )
92
+ . option ( '--token-setup <type>' , 'Token setup: existing-secret|new-pat|default-token' , { default : 'default-token' } )
90
93
. example ( 'buddy-bot setup' )
91
94
. example ( 'buddy-bot setup --verbose' )
92
- . action ( async ( options : CLIOptions ) => {
95
+ . example ( 'buddy-bot setup --non-interactive' )
96
+ . example ( 'buddy-bot setup --non-interactive --preset testing --verbose' )
97
+ . action ( async ( options : CLIOptions & { nonInteractive ?: boolean , preset ?: string , tokenSetup ?: string } ) => {
93
98
const logger = options . verbose ? Logger . verbose ( ) : Logger . quiet ( )
94
99
95
100
try {
108
113
const existingTools = await migrator . detectExistingTools ( )
109
114
const migrationResults : any [ ] = [ ]
110
115
111
- if ( existingTools . length > 0 ) {
116
+ if ( existingTools . length > 0 && ! options . nonInteractive ) {
112
117
console . log ( `\n🔍 Configuration Migration Detection:` )
113
118
console . log ( `Found ${ existingTools . length } existing dependency management tool(s):` )
114
119
existingTools . forEach ( tool => console . log ( ` • ${ tool . name } (${ tool . configFile } )` ) )
148
153
}
149
154
}
150
155
}
156
+ else if ( existingTools . length > 0 && options . nonInteractive ) {
157
+ console . log ( `\n🔍 Found ${ existingTools . length } existing tool(s), skipping migration in non-interactive mode` )
158
+ }
151
159
152
160
// Plugin Discovery
153
161
updateProgress ( progress , 'Discovering integrations' , true )
156
164
const pluginManager = new PluginManager ( )
157
165
const availablePlugins = await pluginManager . discoverPlugins ( )
158
166
159
- if ( availablePlugins . length > 0 ) {
167
+ if ( availablePlugins . length > 0 && ! options . nonInteractive ) {
160
168
console . log ( `\n🔌 Integration Discovery:` )
161
169
console . log ( `Found ${ availablePlugins . length } available integration(s):` )
162
170
availablePlugins . forEach ( plugin => console . log ( ` • ${ plugin . name } v${ plugin . version } ` ) )
174
182
}
175
183
}
176
184
}
185
+ else if ( availablePlugins . length > 0 && options . nonInteractive ) {
186
+ console . log ( `\n🔌 Found ${ availablePlugins . length } integration(s), skipping in non-interactive mode` )
187
+ }
177
188
178
189
// Pre-flight checks
179
190
updateProgress ( progress , 'Running pre-flight checks' , true )
@@ -233,10 +244,30 @@ cli
233
244
console . log ( 'For full functionality, Buddy Bot needs appropriate GitHub permissions.' )
234
245
console . log ( 'This enables workflow file updates and advanced GitHub Actions features.\n' )
235
246
236
- const tokenSetup = await confirmTokenSetup ( )
237
-
238
- if ( tokenSetup . needsGuide ) {
239
- await guideTokenCreation ( repoInfo )
247
+ let tokenSetup
248
+ if ( options . nonInteractive ) {
249
+ // Use default token setup based on flag
250
+ switch ( options . tokenSetup ) {
251
+ case 'existing-secret' :
252
+ tokenSetup = { hasCustomToken : true , needsGuide : false }
253
+ console . log ( '✅ Using existing organization/repository secrets' )
254
+ break
255
+ case 'new-pat' :
256
+ tokenSetup = { hasCustomToken : true , needsGuide : true }
257
+ console . log ( '⚠️ Non-interactive mode: Will use custom token but skip setup guide' )
258
+ break
259
+ case 'default-token' :
260
+ default :
261
+ tokenSetup = { hasCustomToken : false , needsGuide : false }
262
+ console . log ( '✅ Using default GITHUB_TOKEN (limited functionality)' )
263
+ break
264
+ }
265
+ }
266
+ else {
267
+ tokenSetup = await confirmTokenSetup ( )
268
+ if ( tokenSetup . needsGuide ) {
269
+ await guideTokenCreation ( repoInfo )
270
+ }
240
271
}
241
272
242
273
// Step 3: Repository Settings
@@ -251,49 +282,56 @@ cli
251
282
displayProgress ( progress )
252
283
253
284
console . log ( '\n⚙️ Workflow Configuration' )
254
- const workflowResponse = await prompts ( [
255
- {
256
- type : 'select' ,
257
- name : 'useCase' ,
258
- message : 'What type of update schedule would you like?' ,
259
- choices : [
260
- {
261
- title : 'Standard Setup (Recommended)' ,
262
- description : 'Dashboard updates 3x/week, dependency updates on schedule' ,
263
- value : 'standard' ,
264
- } ,
265
- {
266
- title : 'High Frequency' ,
267
- description : 'Check for updates multiple times per day' ,
268
- value : 'high-frequency' ,
269
- } ,
270
- {
271
- title : 'Security Focused' ,
272
- description : 'Frequent patch updates with security-first approach' ,
273
- value : 'security' ,
274
- } ,
275
- {
276
- title : 'Minimal Updates' ,
277
- description : 'Weekly checks, lower frequency' ,
278
- value : 'minimal' ,
279
- } ,
280
- {
281
- title : 'Development/Testing' ,
282
- description : 'Manual triggers + frequent checks for testing' ,
283
- value : 'testing' ,
284
- } ,
285
- {
286
- title : 'Custom Configuration' ,
287
- description : 'Create your own schedule' ,
288
- value : 'custom' ,
289
- } ,
290
- ] ,
291
- } ,
292
- ] )
293
-
294
- if ( ! workflowResponse . useCase ) {
295
- console . log ( 'Setup cancelled.' )
296
- return
285
+ let workflowResponse
286
+ if ( options . nonInteractive ) {
287
+ workflowResponse = { useCase : options . preset }
288
+ console . log ( `✅ Using ${ options . preset } preset for workflow configuration` )
289
+ }
290
+ else {
291
+ workflowResponse = await prompts ( [
292
+ {
293
+ type : 'select' ,
294
+ name : 'useCase' ,
295
+ message : 'What type of update schedule would you like?' ,
296
+ choices : [
297
+ {
298
+ title : 'Standard Setup (Recommended)' ,
299
+ description : 'Dashboard updates 3x/week, dependency updates on schedule' ,
300
+ value : 'standard' ,
301
+ } ,
302
+ {
303
+ title : 'High Frequency' ,
304
+ description : 'Check for updates multiple times per day' ,
305
+ value : 'high-frequency' ,
306
+ } ,
307
+ {
308
+ title : 'Security Focused' ,
309
+ description : 'Frequent patch updates with security-first approach' ,
310
+ value : 'security' ,
311
+ } ,
312
+ {
313
+ title : 'Minimal Updates' ,
314
+ description : 'Weekly checks, lower frequency' ,
315
+ value : 'minimal' ,
316
+ } ,
317
+ {
318
+ title : 'Development/Testing' ,
319
+ description : 'Manual triggers + frequent checks for testing' ,
320
+ value : 'testing' ,
321
+ } ,
322
+ {
323
+ title : 'Custom Configuration' ,
324
+ description : 'Create your own schedule' ,
325
+ value : 'custom' ,
326
+ } ,
327
+ ] ,
328
+ } ,
329
+ ] )
330
+
331
+ if ( ! workflowResponse . useCase ) {
332
+ console . log ( 'Setup cancelled.' )
333
+ return
334
+ }
297
335
}
298
336
299
337
// Step 5: Generate Configuration File
310
348
console . log ( '\n🔄 Workflow Generation' )
311
349
const preset = getWorkflowPreset ( workflowResponse . useCase )
312
350
313
- if ( workflowResponse . useCase === 'custom' ) {
351
+ if ( workflowResponse . useCase === 'custom' && ! options . nonInteractive ) {
314
352
await setupCustomWorkflow ( preset , logger )
315
353
}
316
354
else {
0 commit comments