Fix CLI argument parsing for /dist/cli/cli.js entry point - #1758
Merged
Conversation
Mingholy
requested review from
DennisYu07,
LaZzyMan,
gwinthis,
pomelo-nwu and
tanzhenxin
as code owners
February 8, 2026 14:18
Contributor
📋 Review SummaryThis PR addresses a CLI argument parsing issue where the new build output path 🔍 General Feedback
🎯 Specific FeedbackNo specific issues identified in this review. ✅ Highlights
|
Contributor
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
xaelistic
pushed a commit
to xaelistic/qwen-code
that referenced
this pull request
Jun 7, 2026
Fix CLI argument parsing for /dist/cli/cli.js entry point
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.
TLDR
Adds
/dist/cli/cli.jsto the list of recognized CLI entry point paths to fix argument parsing when the CLI is invoked from this location.Background / Context
When Electron integrates the SDK to use qwen-code, the default invocation uses
dist/cli/cli.jsfrom the SDK package as the script path. Because this path was not in the recognized CLI entry list,parseArgumentstreated it as the first user argument and incorrectly parsed it as the question/query. As a result:This PR fixes the above by recognizing
dist/cli/cli.jsas a valid CLI entry so the script path is stripped fromargvand the real user input is parsed correctly in SDK mode.Dive Deeper
The CLI argument parsing logic strips out the script path from
rawArgvwhen it matches known CLI entry point patterns. A new build output path/dist/cli/cli.jswas not included in the existing patterns, causing the argument parsing to fail to properly handle the first argument when the CLI is invoked from this location.The fix adds a check for
rawArgv[0].endsWith('/dist/cli/cli.js')alongside the existing checks for/dist/qwen-cli/cli.jsand/dist/cli.js.Reviewer Test Plan
npm run build/dist/cli/cli.jspathTesting Matrix
Linked issues / bugs