You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(npm): leave workspace script invocations with npm - #5276
npm run tsc -w backend currently rewrites to rtk tsc -w backend, turning npm's workspace selector into TypeScript's watch flag. Leave workspace script invocations unchanged so npm retains package selection and script execution. Apply the guard before transparent-prefix handling, which otherwise recreates the same problem. Fixes#2098.
Use the shared argument tokenizer for npm's atomic workspace options and run-script aliases, respecting the -- script-argument boundary. Ordinary npm script rewrites remain available. The regression fails on develop with the unwanted rtk tsc -w backend rewrite. It covers all six affected tool families, workspace spellings, aliases, quoting, environment prefixes and configured transparent prefixes.
Validation: root/proxy formatting, clippy and the full test suite passed. Real npm runs in a two-workspace fixture confirmed package selection, quoted paths, aliases and forwarded script arguments. The real Claude hook leaves these workspace commands unchanged and still rewrites ordinary npm run tsc invocations.
Earlier proposal: #2576 (closed). Prepared with Codex assistance.
Independent validation of this PR (Windows 11, Git Bash, MSVC toolchain), built from head d7d51293.
Repro on develop (97e68d53): with lint the workspace flag is not dropped, it is forwarded to ESLint. npm run lint -w web rewrites to rtk lint -w web, detect_linter picks ESLint and runs eslint -f json -w web ., so the workspace's lint script never runs. In a two-workspace npm fixture this printed ESLint output (JSON parse failed: EOF while parsing a value at line 1 column 0), while plain npm run lint -w web prints the script output.
With this PR (rtk rewrite, isolated config):
Command
develop
this PR
npm run lint -w web
rtk lint -w web
not rewritten
npm run lint -ws
rtk lint -ws
not rewritten
npm run lint --workspace web
rtk lint --workspace web
not rewritten
npm run lint --workspace=web
rtk lint --workspace=web
not rewritten
npm run lint --workspaces
rtk lint --workspaces
not rewritten
npm run lint -w web -- --fix
rtk lint -w web -- --fix
not rewritten
npm run-script lint -w web
—
not rewritten
npm run lint -- -w x
—
rtk lint -- -w x (script arg, expected)
npm run lint
rtk lint
rtk lint (unchanged)
In the fixture, npm run lint -w web now runs the workspace script as typed.
Checks on the PR head: cargo fmt --all -- --check and cargo clippy --all-targets -- -D warnings pass. cargo test -p rtk --lib -- --test-threads=1 reports 4861 passed and 1 failed, core::stream::tests::test_read_lines_lossy_preserves_lines_after_invalid_utf8, which also fails on a clean develop on this machine (Windows-specific, unrelated). I did not run proxy/ or tests/.
Minor, optional: test_npm_run_workspace_options_stay_with_npm exercises lint only with -w. The other spellings are covered with tsc, and the guard is script-agnostic, so this is not a behaviour gap.
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
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.
npm run tsc -w backendcurrently rewrites tortk tsc -w backend, turning npm's workspace selector into TypeScript's watch flag. Leave workspace script invocations unchanged so npm retains package selection and script execution. Apply the guard before transparent-prefix handling, which otherwise recreates the same problem. Fixes #2098.Use the shared argument tokenizer for npm's atomic workspace options and run-script aliases, respecting the
--script-argument boundary. Ordinary npm script rewrites remain available. The regression fails on develop with the unwantedrtk tsc -w backendrewrite. It covers all six affected tool families, workspace spellings, aliases, quoting, environment prefixes and configured transparent prefixes.Validation: root/proxy formatting, clippy and the full test suite passed. Real npm runs in a two-workspace fixture confirmed package selection, quoted paths, aliases and forwarded script arguments. The real Claude hook leaves these workspace commands unchanged and still rewrites ordinary
npm run tscinvocations.Earlier proposal: #2576 (closed). Prepared with Codex assistance.