speedrun-cli 2.9.0 → 2.9.2

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,21 @@ 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.9.2] - 2026-08-22
9
+
10
+ ### Fixed & Enhanced
11
+ - **Strict Module & Field Exists Validation** — When running `speedrun-cli g [module]` and an existing module is detected (e.g. `orange`), the CLI displays a clear red error message detailing `field` & `config` hints and immediately cancels execution to prevent accidental overwrites.
12
+ - **Duplicate & System Field Validation** — Added prompt validation in both `speedrun-cli g` and `speedrun-cli f` to prevent adding duplicate fields or reserved system fields (`id`, `status`, `createdAt`, `updatedAt`, `deletedAt`, primary key), displaying `❌ Field "[name]" already exists in module "[module]"!`.
13
+
14
+ ---
15
+
16
+ ## [2.9.1] - 2026-08-22
17
+
18
+ ### Enhanced
19
+ - **Interactive Handoff Menu for Existing Modules** — When running `speedrun-cli g [module]` and an existing module is detected (e.g. `orders`), the CLI now prompts with an interactive action menu to seamlessly transition to Field Manager (`field`), Configurator (`config`), Seed Generator (`seed`), Overwrite (`overwrite`), or Cancel (`cancel`).
20
+
21
+ ---
22
+
8
23
  ## [2.9.0] - 2026-08-22
9
24
 
10
25
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speedrun-cli",
3
- "version": "2.9.0",
3
+ "version": "2.9.2",
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",
@@ -212,9 +212,19 @@ async function manageFields(providedModuleName, targetDir = process.cwd()) {
212
212
  default: initialValues.name,
213
213
  validate: (input) => {
214
214
  if (!input || !input.trim()) return 'Field name is required';
215
- if (!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(input.trim())) {
215
+ const name = input.trim();
216
+ if (!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(name)) {
216
217
  return 'Field name must be a valid identifier';
217
218
  }
219
+ if (initialValues.name && initialValues.name.toLowerCase() === name.toLowerCase()) {
220
+ return true;
221
+ }
222
+ if (['id', 'status', 'createdAt', 'updatedAt', 'deletedAt'].includes(name)) {
223
+ return `Field '${name}' is a system field. Please choose another field name.`;
224
+ }
225
+ if (fields.some((f) => f.name.toLowerCase() === name.toLowerCase())) {
226
+ return `Field '${name}' already exists in module '${kebabName}'. Please choose a different name.`;
227
+ }
218
228
  return true;
219
229
  },
220
230
  },
@@ -223,21 +223,11 @@ async function promptForModuleOptions(providedModuleName, detectedOrm = 'prisma'
223
223
 
224
224
  if (await fs.pathExists(moduleDir)) {
225
225
  const relPath = path.relative(targetDir, moduleDir);
226
- console.log(chalk.yellow(`\n⚠️ Module "${kebabName}" already exists at ${relPath}`));
227
- console.log(chalk.gray(` - Use "speedrun-cli field ${kebabName}" (alias: f) to add or edit fields.`));
228
- console.log(chalk.gray(` - Use "speedrun-cli config ${kebabName}" (alias: c) to configure guards & routes.\n`));
229
-
230
- const { overwrite } = await inquirer.prompt([{
231
- type: 'confirm',
232
- name: 'overwrite',
233
- message: `Do you still want to overwrite existing module "${kebabName}"?`,
234
- default: false,
235
- }]);
236
-
237
- if (!overwrite) {
238
- console.log(chalk.gray('Cancelled module generation. Existing module files preserved.\n'));
239
- return null;
240
- }
226
+ console.log(chalk.red(`\nModule "${kebabName}" already exists at ${relPath}!`));
227
+ console.log(chalk.gray(` 💡 Use "speedrun-cli field ${kebabName}" (alias: f) to add or edit fields.`));
228
+ console.log(chalk.gray(` 💡 Use "speedrun-cli config ${kebabName}" (alias: c) to configure guards & routes.\n`));
229
+ console.log(chalk.yellow(`Module generation cancelled because "${kebabName}" already exists.\n`));
230
+ return null;
241
231
  }
242
232
 
243
233
  const pascalName = toPascalCase(moduleName);
@@ -417,12 +407,19 @@ async function promptForModuleOptions(providedModuleName, detectedOrm = 'prisma'
417
407
  message: 'Enter field name (e.g., totalAmount, title):',
418
408
  validate: (input) => {
419
409
  if (!input || !input.trim()) return 'Field name is required';
420
- if (!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(input.trim())) {
410
+ const name = input.trim();
411
+ if (!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(name)) {
421
412
  return 'Field name must be a valid identifier (e.g., totalAmount)';
422
413
  }
423
- if (input.trim() === primaryKey) {
414
+ if (name === primaryKey) {
424
415
  return `Primary key '${primaryKey}' is already defined. Please choose another field name.`;
425
416
  }
417
+ if (['id', 'status', 'createdAt', 'updatedAt', 'deletedAt'].includes(name)) {
418
+ return `Field '${name}' is a system field. Please choose another field name.`;
419
+ }
420
+ if (fields.some((f) => f.name.toLowerCase() === name.toLowerCase())) {
421
+ return `Field '${name}' already exists in module '${moduleName}'. Please choose a different name.`;
422
+ }
426
423
  return true;
427
424
  },
428
425
  },