fix(npm): strip leading "run" arg to prevent npm run run <script>#440
Closed
jackfreem wants to merge 1 commit intortk-ai:masterfrom
Closed
fix(npm): strip leading "run" arg to prevent npm run run <script>#440jackfreem wants to merge 1 commit intortk-ai:masterfrom
npm run run <script>#440jackfreem wants to merge 1 commit intortk-ai:masterfrom
Conversation
…e-invocation `npm_cmd::run()` unconditionally injects `"run"` before passing args to npm. When a user calls `rtk npm run build`, Clap captures args as ["run", "build"], which then becomes `npm run run build` — triggering "Missing script: run". Strip a leading "run" arg so both `rtk npm run build` and `rtk npm build` correctly invoke `npm run build`. Fixes rtk-ai#438
Author
|
Solved in #458 |
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.
Why
rtk npm run buildsilently invokesnpm run run buildbecausenpm_cmd::run()unconditionally injects"run"before forwarding args, but Clap already captures"run"as part of the trailing args. This produces npm's "Missing script: run" error (issue #438).What
"run"arg innpm_cmd::run()before building the command, so bothrtk npm run buildandrtk npm buildcorrectly invokenpm run buildReferences
Fixes #438.
This is a minimal fix (Path A). The long-term solution (Path B) is to introduce a structured
NpmCommandssub-enum withRun,Install,Build, etc. variants — enabling smart filter routing (npm run test→ vitest filter,npm run build→ next_cmd filter). PR #232 did exactly this for pnpm and is the direct precedent to follow.