Skip to content

CI inference: yarn install, pnpm install and flags inside a package.json script are read as script names #197

Closed

Description

@FredApps

What happens

infer.ts reads a top-level run: line with packageManagerCommand, so npm ci and yarn install are installs, not script references (the SEMANTIC_REPAIR_01 fix described near the top of infer.ts). Nested references inside a package.json script are found differently. resolveScript (src/ci-inference/resolve.ts) still uses

/\b(?:npm run|yarn(?: run)?|pnpm(?: run)?)\s+([A-Za-z0-9:_-]+)/g

That takes the next word after bare yarn/pnpm as a script name, even when the word is an install verb, a builtin, or a flag.

Repro

resolveScript(dir, "ci", …) on main (40aa308), with build: "tsc" declared:

ci script Result on main
yarn install && yarn run build install: UNRESOLVED — package.json declares no script named "install"
pnpm install --frozen-lockfile && pnpm build install: UNRESOLVED
yarn --frozen-lockfile && yarn build --frozen-lockfile: UNRESOLVED
pnpm -r build -r: UNRESOLVED — no script named "-r"
npm run -s build -s: UNRESOLVED

Each one leaves ci UNRESOLVED, so a step running npm run ci fails SCRIPTS_RESOLVED and is not executable.

Impact

False refusals for very common script bodies ("ci": "yarn install && yarn test", pnpm -r build). The receipt also blames a missing script named install or -r, which misleads anyone reading it.

Failing test

tests/ci-inference/script-pm-verbs.test.ts in the linked PR. Output on main:

✖ an install or builtin verb inside a script is not a script reference
  AssertionError [ERR_ASSERTION]: yarn install && yarn run build
  + [ 'install' ]
  - []
✖ a flag before the script name is not a script name
  + [ '-r' ]
  - []
✖ a missing nested script is still unresolved
  +   'install',

Activity

  1. added a commit that references this issue on Nov 18, 2026
    5b293ce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions