Skip to content

fix: Map short options in generate command to prevent silent exit#183

Merged
d-gubert merged 5 commits into
RocketChat:masterfrom
nayrbryanGaming:fix-generate-command
May 25, 2026
Merged

fix: Map short options in generate command to prevent silent exit#183
d-gubert merged 5 commits into
RocketChat:masterfrom
nayrbryanGaming:fix-generate-command

Conversation

@nayrbryanGaming
Copy link
Copy Markdown
Contributor

This PR addresses a bug in the rc-apps generate command where using the shorthand -o flags (a, b, or c) resulted in the CLI exiting silently without providing an error or generating the requested boilerplate files.

This has been resolved by mapping the valid single-character inputs from flags.options back to their full category equivalents before evaluating the switch block. This significantly improves the developer experience by ensuring boilerplate templates generate as expected when using the CLI arguments.

Changes Made

  • Updated src/commands/generate.ts to map the short-letter options (a, b, c) to the categories array strings.
    • Added a new unit test in test/commands/generate.test.ts to verify the execution of valid and invalid shorthand flags.

Copilot AI review requested due to automatic review settings March 22, 2026 16:48
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 22, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes rc-apps generate -o <value> so that shorthand option values (a, b, c) are mapped to the command’s full category strings before the switch executes, preventing a no-op/silent completion when using valid shorthand flags.

Changes:

  • Map -o a|b|c to Api Extension / Slash Command Extension / Settings Extension in generate command execution.
  • Add CLI tests intended to cover valid/invalid shorthand option values.
  • Update package-lock.json with additional "peer": true metadata for some packages.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/commands/generate.ts Adds shorthand-to-category mapping before the option switch.
test/commands/generate.test.ts Adds regression tests for shorthand option values (currently not asserting the fix’s behavior).
package-lock.json Adds "peer": true flags for several existing dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/commands/generate.ts Outdated
Comment thread test/commands/generate.test.ts Outdated
Comment thread test/commands/generate.test.ts Outdated
d-gubert added 4 commits May 25, 2026 16:03
Tests aren't running on new Node version, and this  test flow didn't match the current execution as it misses some assumptions
@d-gubert d-gubert merged commit 1abd905 into RocketChat:master May 25, 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.

4 participants