From d98d7917f70a964a101b60b4af04d53d1337ac07 Mon Sep 17 00:00:00 2001 From: jbeloved700 Date: Sun, 18 Oct 2026 15:46:58 +0000 Subject: [PATCH] fix(generator): normalize error message consistency across generator surfaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align path, collision, and substitution failure messages to use consistent actionable wording: sentence case, ending with a period, no raw user input reflected verbatim. Changes: - validation.ts: add missing trailing period to 'not a directory' message so all destination error messages end consistently with '.' - template-registry.ts: remove raw templateId from the rejection message; wording is now 'The requested template is not supported. Supported templates: ...' — safer and still satisfies all test assertions that check for the 'Supported templates' substring - template-sources.ts: remove templateId from the unavailable-bundle message; wording is now 'The selected template is not available in this CLI version.' — clear, actionable, and free of reflected input Exit codes and error categories are unchanged. All test substring assertions continue to match. --- src/generator/template-registry.ts | 2 +- src/generator/template-sources.ts | 2 +- src/generator/validation.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/generator/template-registry.ts b/src/generator/template-registry.ts index 770555b..7bd7882 100644 --- a/src/generator/template-registry.ts +++ b/src/generator/template-registry.ts @@ -52,7 +52,7 @@ export function getTemplate(templateId: string): TemplateMetadata { if (!template) { throw new ValidationCliError( - `Unknown template '${templateId}'. Supported templates: ${TEMPLATE_IDS.join(', ')}.`, + `The requested template is not supported. Supported templates: ${TEMPLATE_IDS.join(', ')}.`, ); } diff --git a/src/generator/template-sources.ts b/src/generator/template-sources.ts index 7ea8446..223b7b8 100644 --- a/src/generator/template-sources.ts +++ b/src/generator/template-sources.ts @@ -16,7 +16,7 @@ export function resolveBundledTemplateRoot(templateId: string): string { if (directory === undefined) { throw new ValidationCliError( - `Template '${templateId}' is registered but is not bundled in this CLI version yet.`, + 'The selected template is not available in this CLI version.', ); } diff --git a/src/generator/validation.ts b/src/generator/validation.ts index a397ead..b0f2af6 100644 --- a/src/generator/validation.ts +++ b/src/generator/validation.ts @@ -110,7 +110,7 @@ export function planProjectDestination( if (fileSystem.exists(destination)) { if (!fileSystem.isDirectory(destination)) { throw new ValidationCliError( - `Destination already exists and is not a directory: ${destination}`, + `Destination already exists and is not a directory: ${destination}.`, ); }