speedrun-cli 2.7.0 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to create-nestjs-auth will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.7.1] - 2026-08-22
9
+
10
+ ### Fixed
11
+ - **Strict Input Validation for CLI Confirm Prompts** — Implemented `StrictConfirmPrompt` across all CLI interactive prompts. Previously, typing invalid characters (e.g. `'t'`) on boolean confirm prompts would silently default to `'no'`. Now, only valid inputs (`'y'`, `'n'`, `'yes'`, `'no'`, or pressing Enter for default) are accepted, and typing invalid characters displays `>> Invalid input. Please enter 'y' or 'n'.` and re-prompts the user.
12
+
13
+ ---
14
+
8
15
  ## [2.7.0] - 2026-08-22
9
16
 
10
17
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speedrun-cli",
3
- "version": "2.7.0",
3
+ "version": "2.7.3",
4
4
  "description": "CLI tool to scaffold a production-ready NestJS authentication system with JWT, refresh tokens, and RBAC",
5
5
  "keywords": [
6
6
  "nestjs",
@@ -7,6 +7,7 @@ const inquirer = require('inquirer');
7
7
  const fs = require('fs-extra');
8
8
  const path = require('path');
9
9
  const chalk = require('chalk');
10
+ require('./utils');
10
11
 
11
12
  function toPascalCase(str) {
12
13
  return str
package/src/postSetup.js CHANGED
@@ -37,7 +37,7 @@ async function handlePostSetup(targetDir, appName, options) {
37
37
  const { continueSetup } = await inquirer.prompt([{
38
38
  type: 'confirm',
39
39
  name: 'continueSetup',
40
- message: 'Would you like to complete the setup now? (JWT secrets, database, CRUD)',
40
+ message: 'Would you like to complete the setup now? (.env, databases)',
41
41
  default: true,
42
42
  }]);
43
43
 
package/src/utils.js CHANGED
@@ -102,6 +102,70 @@ function getRunPrefix(packageManager) {
102
102
  return packageManager === 'npm' ? 'npm run' : packageManager;
103
103
  }
104
104
 
105
+ /**
106
+ * Registers a strict confirm prompt in inquirer that enforces valid inputs ('y', 'n', 'yes', 'no', or empty for default).
107
+ * Invalid inputs like 't' will prompt a validation error instead of defaulting to 'no'.
108
+ * @param {object} [inquirerInstance] - Optional inquirer module instance
109
+ */
110
+ function registerStrictConfirmPrompt(inquirerInstance = require('inquirer')) {
111
+ try {
112
+ const InputPrompt = inquirerInstance.prompt.prompts['input'];
113
+ if (!InputPrompt) return;
114
+
115
+ class StrictConfirmPrompt extends InputPrompt {
116
+ constructor(questions, rl, answers) {
117
+ super(questions, rl, answers);
118
+ if (this.opt.default === undefined) {
119
+ this.opt.default = true;
120
+ }
121
+ }
122
+
123
+ render(answer) {
124
+ let message = this.getQuestion();
125
+
126
+ if (this.status === 'answered') {
127
+ message += chalk.cyan(answer !== undefined ? (answer ? 'Yes' : 'No') : (this.answer ? 'Yes' : 'No'));
128
+ } else {
129
+ message += chalk.dim(this.opt.default ? ' (Y/n)' : ' (y/N)');
130
+ }
131
+
132
+ let bottomContent = '';
133
+ if (this.error) {
134
+ bottomContent = chalk.red('>> ') + this.error;
135
+ }
136
+
137
+ this.screen.render(message, bottomContent);
138
+ }
139
+
140
+ validate(input) {
141
+ if (input === undefined || input === null || input.toString().trim() === '') {
142
+ return true;
143
+ }
144
+ const val = input.toString().trim().toLowerCase();
145
+ if (['y', 'yes', 'n', 'no'].includes(val)) {
146
+ return true;
147
+ }
148
+ return "Invalid input. Please enter 'y' or 'n'.";
149
+ }
150
+
151
+ filterInput(input) {
152
+ if (input === undefined || input === null || input.toString().trim() === '') {
153
+ return this.opt.default !== false;
154
+ }
155
+ const val = input.toString().trim().toLowerCase();
156
+ return ['y', 'yes'].includes(val);
157
+ }
158
+ }
159
+
160
+ inquirerInstance.registerPrompt('confirm', StrictConfirmPrompt);
161
+ } catch {
162
+ // Ignore error
163
+ }
164
+ }
165
+
166
+ // Auto-register strict confirm prompt upon requiring utils
167
+ registerStrictConfirmPrompt();
168
+
105
169
  module.exports = {
106
170
  validateAppName,
107
171
  checkNodeVersion,
@@ -109,4 +173,6 @@ module.exports = {
109
173
  getInstallCommand,
110
174
  generateJWTSecret,
111
175
  getRunPrefix,
176
+ registerStrictConfirmPrompt,
112
177
  };
178
+