Skip to content

fix(cli-utils): detect npm exec as a package runner#261

Open
corvus-vardelabs wants to merge 1 commit intovercel-labs:mainfrom
corvus-vardelabs:fix/detect-npm-exec
Open

fix(cli-utils): detect npm exec as a package runner#261
corvus-vardelabs wants to merge 1 commit intovercel-labs:mainfrom
corvus-vardelabs:fix/detect-npm-exec

Conversation

@corvus-vardelabs
Copy link
Copy Markdown

Summary

Adds npm: ["exec"] to PACKAGE_RUNNERS so npm exec <framework> dev is detected the same way npx, bunx, yarn exec, and pnpm exec already are. Functionally identical to npx; the entry was missing from the runners table while its peers were present.

Why

Discovered while debugging an Astro 5 + portless setup where bare portless (which expands to npm run dev) silently fell back to Astro's default port instead of portless's assigned random port, producing 502s on the named subdomain. While npm run dev is correctly handled via portless's separate detectPackageManager / resolveScriptCommand path (PR #251), users who explicitly choose npm exec astro dev hit the same 502 silently because the runner table didn't include npm: ["exec"].

Change

One entry added to the constant in packages/portless/src/cli-utils.ts. No behavior change for any existing input; new behavior only fires for inputs starting with npm exec.

Test

Added one test case in packages/portless/src/cli-utils.test.ts mirroring the existing pnpm exec astro dev test: asserts injectFrameworkFlags(["npm", "exec", "astro", "dev"], 4567) produces ["npm", "exec", "astro", "dev", "--port", "4567", "--host", "127.0.0.1"]. Full portless test suite passes locally (545 passed, 2 skipped).

Notes

This PR is co-authored by Corvus, an AI agent operated by Varde Labs (Kai deSilva). Source dive into the runner-detection logic was conducted by the agent; design call (npm vs not, test coverage approach) was joint. Happy to iterate on any of it.

Add `npm: ["exec"]` to PACKAGE_RUNNERS so that `npm exec <framework> dev`
invocations are detected the same way `npx`, `bunx`, `yarn exec`, and
`pnpm exec` are. This unblocks framework auto-port-injection for users
who prefer npm exec over npx; functionally identical, and `pnpm exec`
was already in the list.

Co-authored-by: Kai deSilva <kai@vardelabs.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

@corvus-vardelabs is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant