Repository navigation
Conversation
…ent#1102) `NpmAdapter.install()` always shelled out to `npm install`, so in a pnpm project npm's Arborist walked pnpm's symlinked `node_modules/.pnpm` store and crashed (`Cannot read properties of null (reading 'matches')`). Detect a pnpm project by walking from cwd upward for `pnpm-workspace.yaml`, `pnpm-lock.yaml`, `node_modules/.pnpm` or a `packageManager` pin — a workspace member keeps its `package.json` while those markers sit at the root — and: - install with `pnpm add` (a workspace member's own cwd; `--workspace-root` when cwd is the workspace root, which pnpm otherwise rejects), global with `pnpm add -g`; - snapshot from `pnpm list --json --depth=0`, selecting the cwd project from the workspace array and merging dependencies, devDependencies and optionalDependencies instead of reading only package-lock.json. The npm path is unchanged for non-pnpm projects.
The PR description documents sufficient testing, including representative real-CLI verification with real pnpm. No testing-record finding. I only read the specified diff; I did not run, build, or install PR code. |
|
@potoior Codex flagged respecting an explicit npm pin before ancestor detection. Mind taking a look? |
…t#1102) A nested npm project (its own `packageManager: "npm@..."` and package-lock.json) inside a pnpm repository was still classified as pnpm, because detection ignored the npm pin and kept walking up to the pnpm root — so its install ran `pnpm add` and its snapshot skipped package-lock.json. Stop walking when a directory pins a manager explicitly: pnpm keeps it, any other manager ends the search as npm.
|
@potoior addressed in Added a unit test for the nested npm-in-pnpm case (21 pkg-adapters tests pass); |
|
No new findings in the specified diff.
I only read the specified diff. I did not run, build, or install PR code. |
|
@potoior This now has merge conflicts with main. Mind rebasing? |
|
@SaulMoro this is now redundant rather than conflicted: #1102 is closed by the merged #1211, Thanks for the reviews along the way. |
Summary
NpmAdapter.install()unconditionally shelled out tonpm install, soteamai packages installin a pnpm project ran npm into pnpm's symlinkednode_modules/.pnpmstore and crashed inside Arborist (Cannot read properties of null (reading 'matches'), exit 1).This detects a pnpm project and routes the install/snapshot through pnpm, leaving the npm path byte-for-byte unchanged for non-pnpm projects. Fixes #1102.
Detection
A pnpm workspace member usually has its own
package.jsonwhile the markers live at the root, so detection walks fromcwdupward and returns the nearest directory that carries:pnpm-workspace.yaml, orpnpm-lock.yaml, ornode_modules/.pnpm, orpackage.json#packageManagerpin starting withpnpm.Install / snapshot
pnpm add <specs>(run in the member's owncwd), adding--workspace-rootwhencwdis itself the workspace root — pnpm otherwise rejects a root install withERR_PNPM_ADDING_TO_ROOT. Global:pnpm add --global.pnpm list --json --depth=0, selecting thecwdproject from the workspace array (pnpm prints every workspace project) and merging dependencies + devDependencies + optionalDependencies — not justdependencies. Global:pnpm list --global --json --depth=0.dry-runspawns neither manager.Type of Change
Test Plan
npx tsc --noEmit— cleanoxlint --type-aware --deny-warnings) — cleanpkg-adapters,pkg-commands,pkg-manifest,pkg-hint,pkg-register-command,pkg-team-distribution): 52 passed. NewNpmAdapter (pnpm)cases cover member-dir detection from the root, the workspace-root flag, global install, and dev/optional snapshotting.npm run test:e2e -- machine-state-993— 7/7 passed, including the newroutes a pnpm project's packages install through pnpm, not npm (#1102)(stub pnpm records its args).teamai init/pullthenteamai packages install:Related Issues
Closes #1102. Supersedes the closed #1105 / #1116. Addresses their P1 findings: workspace-root install (
--workspace-root), pnpm detection in workspace ancestors, and snapshot coverage of dev/optional dependencies.