Skip to content

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

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

aeppling merged 7 commits into
rtk-ai:developfrom
KuSh:pnpx+dlx

Conversation

@KuSh

@KuSh KuSh commented Mar 6, 2026 •

Copy link
Copy Markdown
Collaborator
  • 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

KuSh commented Mar 6, 2026

Copy link
Copy Markdown
Collaborator Author

@pszymkowiak done!

@navidemad

Copy link
Copy Markdown
Contributor

Could you add bun and bunx format as well ?

@KuSh

KuSh commented Mar 6, 2026 •

Copy link
Copy Markdown
Collaborator Author

@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

KuSh commented Mar 13, 2026

Copy link
Copy Markdown
Collaborator Author

@pszymkowiak rebased on develop, should be ready to merge

@CLAassistant

CLAassistant commented Mar 20, 2026 •

Copy link
Copy Markdown

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

KuSh commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator Author

@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

KuSh commented Apr 11, 2026

Copy link
Copy Markdown
Collaborator Author

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 <[email protected]>
…npm test` commands as we don't know which test framework is used under the hood

Signed-off-by: Nicolas Le Cam <[email protected]>
…jest

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

Signed-off-by: Nicolas Le Cam <[email protected]>
This reverts commit 94a3532.
Build is no longer a pnpm command with specific handling.

Signed-off-by: Nicolas Le Cam <[email protected]>
@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
thehoff pushed a commit to thehoff/contextcrawler that referenced this pull request May 14, 2026
feat(discover): handle more npm/npx/pnpm/pnpx patterns
thehoff pushed a commit to thehoff/contextcrawler that referenced this pull request May 14, 2026
feat(discover): handle more npm/npx/pnpm/pnpx patterns
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.

5 participants