@@ -156,6 +156,19 @@ export const runCli = async () => {
156
156
157
157
// Explained below why this is in a try/catch block
158
158
try {
159
+ if (
160
+ process . env . SHELL ?. toLowerCase ( ) . includes ( "git" ) &&
161
+ process . env . SHELL ?. includes ( "bash" )
162
+ ) {
163
+ logger . warn ( ` WARNING: It looks like you are using Git Bash which is non-interactive. Please run create-t3-app with another
164
+ terminal such as Windows Terminal or PowerShell if you want to use the interactive CLI.` ) ;
165
+
166
+ const error = new Error ( "Non-interactive environment" ) ;
167
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
168
+ ( error as any ) . isTTYError = true ;
169
+ throw error ;
170
+ }
171
+
159
172
// if --CI flag is set, we are running in CI mode and should not prompt the user
160
173
// if --default flag is set, we should not prompt the user
161
174
if ( ! cliResults . flags . default && ! CIMode ) {
@@ -181,10 +194,24 @@ export const runCli = async () => {
181
194
// Otherwise we have to do some fancy namespace extension logic on the Error type which feels overkill for one line
182
195
// eslint-disable-next-line @typescript-eslint/no-explicit-any
183
196
if ( err instanceof Error && ( err as any ) . isTTYError ) {
184
- logger . warn (
185
- `${ CREATE_T3_APP } needs an interactive terminal to provide options` ,
186
- ) ;
187
- logger . info ( `Bootstrapping a default t3 app in ./${ cliResults . appName } ` ) ;
197
+ logger . warn ( `
198
+ ${ CREATE_T3_APP } needs an interactive terminal to provide options` ) ;
199
+
200
+ const { shouldContinue } = await inquirer . prompt < {
201
+ shouldContinue : boolean ;
202
+ } > ( {
203
+ name : "shouldContinue" ,
204
+ type : "confirm" ,
205
+ message : `Continue scaffolding a default T3 app?` ,
206
+ default : true ,
207
+ } ) ;
208
+
209
+ if ( ! shouldContinue ) {
210
+ logger . info ( "Exiting..." ) ;
211
+ process . exit ( 0 ) ;
212
+ }
213
+
214
+ logger . info ( `Bootstrapping a default T3 app in ./${ cliResults . appName } ` ) ;
188
215
} else {
189
216
throw err ;
190
217
}
0 commit comments