Skip to content

feat(discover): handle more npm/npx/pnpm/pnpx patterns#355

Merged
aeppling merged 7 commits intortk-ai:developfrom
KuSh:pnpx+dlx
Apr 13, 2026
Merged

feat(discover): handle more npm/npx/pnpm/pnpx patterns#355
aeppling merged 7 commits intortk-ai:developfrom
KuSh:pnpx+dlx

Conversation

@KuSh
Copy link
Copy Markdown
Contributor

@KuSh KuSh commented Mar 6, 2026

  • handle npm exec|run and their aliases
  • handle pnpm exec|run and their aliases like npm
  • handle pnpx and its alias like npx
  • handle all forms of js script/package execution

Also don't blindly rewrite npm test to vitest and distinguish between jest and vitest

@pszymkowiak
Copy link
Copy Markdown
Collaborator

LGTM — solid coverage of npm/npx/pnpm/pnpx patterns with thorough tests (622 pass, fmt + clippy clean).

One thing needed before merge: rebase on master — there's a conflict (master has moved since v0.25.0).

git fetch origin master && git rebase origin/master

Once rebased, this is ready to merge.

@KuSh
Copy link
Copy Markdown
Contributor Author

KuSh commented Mar 6, 2026

@pszymkowiak done!

@navidemad
Copy link
Copy Markdown
Contributor

Could you add bun and bunx format as well ?

@KuSh
Copy link
Copy Markdown
Contributor Author

KuSh commented Mar 6, 2026

@navidemad could that be done in another PR? I'm not giving up and will try to propose something but I don't know bun nor use it, I'll have to read the doc a little bit before having something ready

@KuSh KuSh changed the base branch from master to develop March 12, 2026 22:59
@KuSh
Copy link
Copy Markdown
Contributor Author

KuSh commented Mar 13, 2026

@pszymkowiak rebased on develop, should be ready to merge

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 20, 2026

CLA assistant check
All committers have signed the CLA.

@pszymkowiak
Copy link
Copy Markdown
Collaborator

Rebased on latest develop — all existing fixes preserved (redirect stripping #530, find-pipe protection #563, Ruby support #724) alongside your new npm/pnpm/pnpx patterns.

1115 tests passing (4 new from this PR). No conflicts, no regressions.

14/14 rewrite commands tested: all npm/npx/pnpm/pnpx patterns working correctly.

Ready to merge. Thanks @KuSh!

@aeppling
Copy link
Copy Markdown
Contributor

Hey

We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes src/ from a flat layout into subfolders.

No logic changes — only file moves and import path updates.

What you need to do

Rebase your branch on develop when receiving this comment:

git fetch origin && git rebase origin/develop

Git detects renames automatically. If you get import conflicts, update the paths:

use crate::git;        // now: use crate::cmds::git::git;
use crate::tracking;   // now: use crate::core::tracking;
use crate::config;     // now: use crate::core::config;
use crate::init;       // now: use crate::hooks::init;
use crate::gain;       // now: use crate::analytics::gain;

Need help rebasing? Tag @aeppling

@KuSh
Copy link
Copy Markdown
Contributor Author

KuSh commented Apr 4, 2026

@aeppling rebased! ready for review

@aeppling
Copy link
Copy Markdown
Contributor

Hey @KuSh

Bug found: npm test / npm t / npm tst → rtk vitest

npm test -- --coverage → rtk vitest -- --coverage
pnpm test → rtk vitest
pnpm t → rtk vitest

Problem: npm test runs whatever is in package.json#scripts.test — could be jest, mocha, ava, tap, anything. The PR blindly rewrites it to rtk vitest. If the project uses jest, the hook will intercept npm test and run vitest instead, silently breaking the test suite.

Reproduced: rtk vitest runs package_manager_exec("vitest") → executes vitest run --reporter=json. This is NOT what npm test does. A jest project would get vitest invoked instead. Proxy contract violation.

@KuSh
Copy link
Copy Markdown
Contributor Author

KuSh commented Apr 11, 2026

Hey @KuSh

Bug found: npm test / npm t / npm tst → rtk vitest

This is a pre-existing bug as original rewrite already contains that:

pattern: r"^(pnpm\s+|npx\s+)?(vitest|jest|test)(\s|$)",

It's also the case for jest, they're mostly compatible but the user request to run jest and rtk runs vitest instead. I can see to fix that but it will require to discuss what we want to achieve before

@KuSh KuSh force-pushed the pnpx+dlx branch 2 times, most recently from 5364de2 to 9b1e1bb Compare April 12, 2026 00:29
KuSh added 7 commits April 12, 2026 22:03
- handle npm exec|run and their aliases
- handle pnpm exec|run and their aliases like npm
- handle pnpx and its alias like npx
- handle all forms of js script/package execution

Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
…npm test` commands as we don't know which test framework is used under the hood

Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
…jest

Also remove duration computation as there's no endTime attribute in json output

Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
This reverts commit 94a3532.
Build is no longer a pnpm command with specific handling.

Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
@aeppling
Copy link
Copy Markdown
Contributor

All is ready for merge ! @KuSh

Thanks for addressing reviews and already existing issues :)
We already started next release full review so i will merge this for next one.

@aeppling aeppling self-assigned this Apr 13, 2026
@aeppling aeppling added enhancement New feature or request ready-for-merge labels Apr 13, 2026
@aeppling aeppling merged commit 9e96caa into rtk-ai:develop Apr 13, 2026
10 checks passed
@KuSh KuSh deleted the pnpx+dlx branch April 13, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants