Skip to content

fix(generator): normalize error message consistency across generator surfaces - #273

Merged
dDevAhmed merged 1 commit into
DigiNodes:mainfrom
jbeloved700:fix/issue-140-sw-038-normalize-generator-error-messages
Oct 18, 2026
Merged

dDevAhmed merged 1 commit into
DigiNodes:mainfrom
jbeloved700:fix/issue-140-sw-038-normalize-generator-error-messages

Conversation

@jbeloved700

Copy link
Copy Markdown
Contributor

Summary

Aligns generator validation and generation error messages to use consistent, actionable wording: sentence case, ending with a period, and no raw user input reflected verbatim when sensitive.

What was implemented

Three targeted changes across the generator surface:

src/generator/validation.ts

  • Added missing trailing period to the destination "not a directory" message so all destination error messages end consistently with .
  • Before: Destination already exists and is not a directory: ${destination}
  • After: Destination already exists and is not a directory: ${destination}.

src/generator/template-registry.ts

  • Removed raw user-provided templateId from the rejection message to avoid reflecting unsafe input verbatim
  • Before: Unknown template '${templateId}'. Supported templates: ...
  • After: The requested template is not supported. Supported templates: ...
  • All test assertions that check for the Supported templates substring continue to pass

src/generator/template-sources.ts

  • Removed template ID from the unavailable-bundle message
  • Before: Template '${templateId}' is registered but is not bundled in this CLI version yet.
  • After: The selected template is not available in this CLI version.

Acceptance criteria verified

  • Path, collision, and substitution failures use consistent actionable wording ✅
  • Unsafe input is not reflected verbatim when sensitive ✅
  • Exit semantics (ValidationCliError → exit code 2) remain stable and unchanged ✅
  • All existing test substring assertions continue to match ✅

Closes #140

…surfaces

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.
@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 715075c5-5bf5-4f6b-9656-7f4ae95ef1e7
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dDevAhmed
dDevAhmed merged commit dec3374 into DigiNodes:main Oct 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SW-038 — Normalize generator error-message consistency

2 participants