feat(npm): structured NpmCommands sub-enum with smart script routing#443
Draft
jackfreem wants to merge 2 commits intortk-ai:masterfrom
Draft
feat(npm): structured NpmCommands sub-enum with smart script routing#443jackfreem wants to merge 2 commits intortk-ai:masterfrom
jackfreem wants to merge 2 commits intortk-ai:masterfrom
Conversation
Replace the flat `rtk npm <args>` catch-all with a proper subcommand enum matching the pnpm architecture (PR rtk-ai#232): rtk npm run build → next_cmd filter rtk npm run typecheck → tsc_cmd filter rtk npm run lint → lint_cmd filter rtk npm run <other> → boilerplate stripping (run_script) rtk npm install / ci … → raw passthrough (run_passthrough) Both `rtk npm run build` and `rtk npm build` now correctly invoke `npm run build`; the earlier double-run bug (rtk-ai#438) is structurally impossible with explicit subcommand parsing. Closes rtk-ai#438
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
The flat
rtk npm <args>design had no way to distinguishnpm run <script>from other npm subcommands (install,ci,audit, …), and provided no script-aware filter routing. PR #440 patched the immediate double-run bug; this PR replaces the design root-cause.What
NpmCommandssub-enum (Run { script, args }+Otherpassthrough), mirroring thePnpmCommandspattern from PR feat(pnpm): addrtk pnpm [run] <script>with smart filter routing #232main.rs:build→next_cmdtypecheck/tsc→tsc_cmdlint→lint_cmdnpm_cmd::run_script(boilerplate stripping)npm_cmd::run_passthroughfor non-runsubcommands (install,ci,audit, …)filter_npm_outputpubso it can be reused by other modulesnpm_cmd::runcatch-all that caused the double-runbugReferences
npm run run <script>#440 (minimal Path A fix)rtk pnpm [run] <script>with smart filter routing #232 is the direct pnpm precedent this implementation mirrors