@@ -22,6 +22,7 @@ program
2222 . option ( "--force" , "Overwrite if directory exists and not empty" )
2323 . option ( "--package-manager <pm>" , "npm | pnpm | yarn | bun (default: npm)" )
2424 . option ( "--frontend-generator" , "Use create-next-app to scaffold the frontend instead of the bundled template" )
25+ . option ( "--yes" , "Skip confirmation (assume yes) for non-interactive use" )
2526 . action ( async ( projectNameArg , options ) => {
2627 try {
2728 // Collect interactive data if arguments / flags not provided
@@ -92,12 +93,23 @@ program
9293
9394 let answers = { } ;
9495 if ( interactiveQuestions . length ) {
95- answers = await prompts ( interactiveQuestions , {
96- onCancel : ( ) => {
97- console . log ( chalk . red ( '\n✖ Cancelled.' ) ) ;
98- process . exit ( 1 ) ;
96+ if ( options . yes ) {
97+ // Auto-fill defaults when --yes is used
98+ for ( const q of interactiveQuestions ) {
99+ if ( q . name === 'projectName' ) answers . projectName = projectNameArg || 'app' ;
100+ if ( q . name === 'services' ) answers . services = [ 'node' ] ;
101+ if ( q . name === 'preset' ) answers . preset = '' ;
102+ if ( q . name === 'packageManager' ) answers . packageManager = 'npm' ;
103+ if ( q . name === 'git' ) answers . git = false ;
99104 }
100- } ) ;
105+ } else {
106+ answers = await prompts ( interactiveQuestions , {
107+ onCancel : ( ) => {
108+ console . log ( chalk . red ( '\n✖ Cancelled.' ) ) ;
109+ process . exit ( 1 ) ;
110+ }
111+ } ) ;
112+ }
101113 }
102114
103115 projectName = projectName || answers . projectName ;
@@ -230,12 +242,16 @@ program
230242 console . table ( services . map ( s => ( { type : s . type , name : s . name , port : s . port } ) ) ) ;
231243 console . log ( `Preset: ${ options . preset || 'none' } ` ) ;
232244 console . log ( `Package Manager: ${ options . packageManager } ` ) ;
233- const { proceed } = await prompts ( {
234- type : 'confirm' ,
235- name : 'proceed' ,
236- message : 'Proceed with scaffold?' ,
237- initial : true
238- } ) ;
245+ let proceed = true ;
246+ if ( ! options . yes ) {
247+ const answer = await prompts ( {
248+ type : 'confirm' ,
249+ name : 'proceed' ,
250+ message : 'Proceed with scaffold?' ,
251+ initial : true
252+ } ) ;
253+ proceed = answer . proceed ;
254+ }
239255 if ( ! proceed ) {
240256 console . log ( chalk . red ( '✖ Aborted by user.' ) ) ;
241257 process . exit ( 1 ) ;
0 commit comments