[codex] keep scoped package references as text#4167
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
ApprovabilityVerdict: Needs human review This PR changes how scoped package references are parsed in the composer, but an unresolved review comment identifies that the new regex may incorrectly treat legitimate file paths like You can customize Macroscope's approvability policy. Learn more. |
PR: pingdotgg#4167 Co-authored-by: codex <codex@users.noreply.github.com>
e535195 to
dd78482
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dd78482. Configure here.
| const quotedPath = match[2]; | ||
| const path = quotedPath !== undefined ? quotedPath.replace(/\\(.)/g, "$1") : (match[3] ?? ""); | ||
| if (!path) { | ||
| if (!path || (quotedPath === undefined && SCOPED_PACKAGE_REFERENCE_REGEX.test(path))) { |
There was a problem hiding this comment.
Bare path mentions still expected
Medium Severity
SCOPED_PACKAGE_REFERENCE_REGEX treats common repo paths like src/index.ts as scoped packages, so bare @src/index.ts no longer becomes a mention. An existing cursor collapse/expand regression in composer-logic.test.ts still assumes that path is a mention, and unlike the segmentation tests it was not updated for the new rule.
Reviewed by Cursor Bugbot for commit dd78482. Configure here.


Fixes #4142.
What changed
@scope/packagereferences as plain composer text instead of file-mention pills@scope/Why
The shared inline-token grammar treated every whitespace-delimited
@valueas a file mention. The paste handler appends a virtual delimiter before parsing, so pasting a command such asyarn expo install @expo/uiimmediately converted the package reference into a folder pill.Scoped package syntax is ambiguous with a bare relative path. Current file autocomplete already serializes selected paths as canonical Markdown file links, so leaving the ambiguous bare form as package text fixes the paste behavior without weakening selected file mentions. The shared tokenizer is used by web and native mobile composers.
Verification
vp check(passes with 10 existing warnings outside this diff)vp run typecheckvp test: 608 files and 4,829 tests passed; 2 files and 7 tests skipped by the existing suitegit diff --checkNote
Keep scoped package references (e.g.
@scope/pkg) as plain text instead of mentionsSCOPED_PACKAGE_REFERENCE_REGEXincomposerInlineTokens.tsto detect unquoted@scope/pkgpatterns and skip them during mention token collection.@-prefixed text matching a scoped package pattern (e.g. fromyarn add @scope/pkgorimport @scope/pkg) no longer becomes a mention.Macroscope summarized dd78482.
Note
Low Risk
Localized composer parsing change with broad test coverage; no auth, data, or API surface changes.
Overview
Unquoted
@scope/packagetext no longer becomes file-mention pills in the shared composer inline-token grammar (collectMentionTokensincomposerInlineTokens.ts). ASCOPED_PACKAGE_REFERENCE_REGEXguard skips bare paths that look like npm scoped packages (e.g.@expo/ui), which fixes paste flows such asyarn expo install @expo/uiturning into folder mentions.Explicit and autocomplete paths still mention: canonical Markdown file links like
[sub](@scope/pkg/sub)and quoted mentions (@"expo/ui") continue to produce mention tokens; ordinary file mentions (e.g.@README.md) are unchanged.Regression tests were added at the shared tokenizer, web
splitPromptIntoComposerSegments, and LexicalregisterComposerInlineTokenPasteboundaries.Reviewed by Cursor Bugbot for commit dd78482. Bugbot is set up for automated code reviews on this repo. Configure here.