diff --git a/cli/src/cli.ts b/cli/src/cli.ts index fda9049f50..79f7a331ab 100644 --- a/cli/src/cli.ts +++ b/cli/src/cli.ts @@ -43,6 +43,12 @@ const main = defineCommand({ description: 'Port to listen on', default: String(DEFAULT_PORT), }, + yes: { + type: 'boolean', + description: 'Skip warning message and accept prompt', + default: false, + alias: ['y'], + }, }, async run({ args }) { const port = Number.parseInt(args.port as string, 10) || DEFAULT_PORT @@ -51,18 +57,20 @@ const main = defineCommand({ initLogger() - // Warning message and accept prompt - logWarning( - `This allows ${styleText('underline', 'npmx.dev')} to access your npm cli and any authenticated contexts.`, - ) - const accept = await p.confirm({ - message: 'Do you accept?', - initialValue: true, - }) - - if (!accept || p.isCancel(accept)) { - logError('Connector setup cancelled.') - process.exit(0) + if (!args.yes) { + // Warning message and accept prompt + logWarning( + `This allows ${styleText('underline', 'npmx.dev')} to access your npm cli and any authenticated contexts.`, + ) + const accept = await p.confirm({ + message: 'Do you accept?', + initialValue: true, + }) + + if (!accept || p.isCancel(accept)) { + logError('Connector setup cancelled.') + process.exit(0) + } } // Check npm authentication before starting