The review step runs `npm ci` inside an npm workspace package, silently deleting the rest of the monorepo's dependencies
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- tooling
Research direction
Start with src/programs/posthog-integration/agent/review.md at the frozen re-install instruction, then read the npm-specific install and workspace handling referenced in the issue. Check how the review step chooses its install command and whether the suggested npm ci --dry-run fits that flow. Done when the npm review check detects lockfile mismatches without removing dependencies from other workspace packages.
Written by the indexing model from the issue text.
Description
What happened
I ran the wizard (3.0.0) on an npm workspaces monorepo with --install-dir apps/web. The repo has one package-lock.json and one node_modules at the root, shared tools (typescript, @biomejs/biome, @playwright/test) as root devDependencies, and four workspace packages (apps/web, apps/server, apps/desktop, packages/shared).
During Verify and review the integration, the agent ran these from apps/web:
npm add posthog-js@1
npm ci # "npm's clean lockfile install check before compilation"
npm run build # passed
npm run typecheck # sh: tsc: command not found
Afterwards the root node_modules held only apps/web's dependency graph. typescript, @biomejs/biome, @playwright/test, electron and the other workspace links were gone. package-lock.json was unchanged, so git status showed nothing. Running npm install at the root restored everything.
The run summary said "verified a clean npm ci" and reported the typecheck as "unavailable because typescript is not declared in this package".
Why
src/programs/posthog-integration/agent/review.md asks for a frozen re-install after the last install:
After your last install, run the project's install once more without changing the lockfile (
pnpm install --frozen-lockfileor its equivalent)
On npm the equivalent is npm ci, and with cd unavailable it runs in the workspace package. There npm scopes the command to that one package. npm ci deletes node_modules, then reinstalls only that package's dependencies. pnpm and yarn install the whole workspace from a sub-folder, so they don't have this problem.
The agent couldn't have worked around it:
- The
integration-buildskill says to work only inside the project folder. bash-fence.tsrefuses directory flags that point outside it, sonpm --prefix <root> ciisn't possible.- The agent's own detection ran from
apps/weband saw a single-package repo, although the wizard's discovery had loggedrepoType=monorepoanddetect_package_managerreported "the workspace lockfile is in ".
Minimal reproduction (npm 11.19.0, Node 24, macOS)
mkdir repro && cd repro && git init -q
cat > package.json <<'EOF'
{ "name": "repro", "private": true, "workspaces": ["apps/*"], "devDependencies": { "is-number": "7.0.0" } }
EOF
mkdir -p apps/web apps/api
echo '{ "name": "@repro/web", "version": "1.0.0", "private": true, "dependencies": { "ms": "2.1.3" } }' > apps/web/package.json
echo '{ "name": "@repro/api", "version": "1.0.0", "private": true, "dependencies": { "left-pad": "1.3.0" } }' > apps/api/package.json
npm install
ls node_modules # @repro is-number left-pad ms
(cd apps/web && npm ci --dry-run) # "up to date", nothing removed
(cd apps/web && npm ci)
ls node_modules # @repro ms <- is-number, left-pad and @repro/api are gone
Suggested fix
On npm, use npm ci --dry-run for the frozen re-check. It runs the same lockfile sync check as npm ci: when package.json and package-lock.json disagree, it fails with EUSAGE … Missing: <pkg> from lock file. It never deletes node_modules, it is safe from any workspace folder, and the bash fence already allows it.
It is weaker than a real npm ci in one way: a dry run downloads nothing and runs no install scripts, so a package whose download or install script would fail on a fresh install gets past it. On npm that gap is small: the npm add just before it had already downloaded the same packages and run their scripts. npm 11's allowScripts policy, its counterpart to pnpm's ignored build scripts, applies to that npm add as well, so a refused install script would show up there rather than in the dry run. Closing the gap would take a real npm ci from the workspace root. bash-fence.ts refuses directory flags outside the project folder, and that command would reinstall the whole monorepo.
the project's install once more without changing the lockfile (`pnpm install
---frozen-lockfile` or its equivalent): if it fails on a package this run added, that package
+--frozen-lockfile`, `npm ci --dry-run` on npm, or its equivalent): if it fails on a package this run added, that package
does not fit.
Happy to test a fix against the same monorepo.
- Dominant language
- TypeScript
- Stars
- 208
- Forks
- 58
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 76
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PostHog/wizard
-
wizard --version prints unknown when run through npxPossibly taken @bryanlundberg claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
PostHog/wizard#1460 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 2 days
-
Self-driving setup: checkbox labels and Confirm button overlap wrapped description textMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PostHog/wizard#986 · 4 comments ·
Maintainers usually reply within 2 days
-
Intro shows "(detected)" after a manual pick from the detection-failed pickerPossibly taken @ShobhanKarthish claimed this 87 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ardia-browser/ardia#5810 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
SocialGouv/egapro#5329 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
activepieces/activepieces#17974 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
OHDSI/Data2Evidence#3777 ·
Maintainers usually reply within 3 days