Add negative test case for create-rsbuild pattern and fix overly permissive regex#33604
Merged
Merged
Conversation
6 tasks
Co-authored-by: shilman <488689+shilman@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update CLI init telemetry to address review feedback
Add negative test case for create-rsbuild pattern and fix overly permissive regex
Jan 21, 2026
shilman
approved these changes
Jan 21, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a regex pattern bug in the CLI integration detection logic. The previous regex was too permissive and would incorrectly match creatersbuild (without a separator) when it should only match create-rsbuild or create rsbuild.
Changes:
- Fixed regex pattern by making the separator character class
[\s\-]required instead of optional (removed?) - Added a negative test case to verify
npx creatersbuildis correctly rejected
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| code/lib/create-storybook/src/services/VersionService.ts | Fixed regex pattern from `/(?:^ |
| code/lib/create-storybook/src/services/VersionService.test.ts | Added negative test case to verify creatersbuild without separator is not matched |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The regex pattern for detecting
create-rsbuildcommands was too permissive, matchingcreatersbuild(no separator) when it should only matchcreate-rsbuildorcreate rsbuild.Changes
npx creatersbuildis NOT matchedgetCliIntegrationFromAncestry()by making separator required:Pattern now correctly matches:
create-rsbuild(dash)create rsbuild(space)creatersbuild(no separator)💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.