Skip to content

chore(pnpm): pin the version where contributors read it, and reject npm - #5

Merged
pa-arth merged 1 commit into
mainfrom
chore/pnpm-guard
Aug 24, 2026
Merged

chore(pnpm): pin the version where contributors read it, and reject npm#5
pa-arth merged 1 commit into
mainfrom
chore/pnpm-guard

Conversation

@pa-arth

@pa-arth pa-arth commented Aug 24, 2026

Copy link
Copy Markdown
Owner

One of five repos in a cross-repo pnpm pass (cc-audit#34, promptster-hire#21, plus Promptster / promptster-teams / promptster-backend).

Why

This repo already used pnpm everywhere — scripts, CI, build-vsix.sh. Nothing said so to a package manager: npm install would have succeeded and written an untracked package-lock.json, i.e. a second, untested dependency set. And the version was pinned in ci.yml (version: 10.4.1), which is precisely where a contributor installing locally never looks.

Not hypothetical. This machine has a stale pnpm 8.14.0 ahead of pnpm 10 on PATH; in a sibling repo with no packageManager field, a plain pnpm install silently rewrote a lockfileVersion 9.0 lockfile with pnpm 8. The pin is what makes corepack fetch the right one.

What changed

  • packageManager: pnpm@10.4.1 — the same version CI already used, so the build is unchanged. version: removed from ci.yml, since pnpm/action-setup errors when both are set.
  • preinstall: node scripts/only-pnpm.mjs rejects npm/yarn/bun. Local rather than npx --yes only-allow pnpm, which runs an unpinned registry package with installer privileges on every install.
  • package-lock.json / yarn.lock gitignored.

The .vsix is unaffected

.vscodeignore already excludes scripts/**, and vsce package --no-dependencies never installs — no lifecycle script from this repo can reach a candidate's editor.

Verification (corepack pnpm@10.4.1)

Check Result
pnpm install --frozen-lockfile clean
pnpm exec tsc -p ./ --noEmit clean
pnpm exec vitest run 107/107 passing

🤖 Generated with Claude Code

…tor never reads it

Part of a cross-repo pass making every JS repo pnpm-only the same way.

This repo already used pnpm everywhere — scripts, CI, build-vsix.sh — but
nothing said so to a package manager. `npm install` here would have succeeded,
written a `package-lock.json` nobody tracks, and produced a second dependency
set. And the version lived in `.github/workflows/ci.yml` as
`pnpm/action-setup@v6 with: version: 10.4.1`, which a contributor installing
locally never sees.

Concretely why the pin matters: this machine has a stale pnpm 8.14.0 ahead of
pnpm 10 on PATH. In a sibling repo with no `packageManager` field, a plain
`pnpm install` silently REWROTE a lockfileVersion 9.0 lockfile with pnpm 8.
The pin is what makes corepack fetch the right one instead.

- `packageManager: pnpm@10.4.1` — same version CI already used, so nothing about
  the build changes. The `version:` input is removed from ci.yml, because
  action-setup errors when both are set; package.json is now the one source.
- `preinstall: node scripts/only-pnpm.mjs` rejects npm/yarn/bun. Local on
  purpose: `npx --yes only-allow pnpm` (the usual recipe) downloads and runs an
  unpinned registry package with installer privileges on every install.
- `package-lock.json` / `yarn.lock` gitignored.

The .vsix is unaffected. `.vscodeignore` already excludes `scripts/**`, and
`vsce package --no-dependencies` never installs, so no lifecycle script from
this repo can reach a candidate's editor.

Verified under corepack pnpm@10.4.1: `install --frozen-lockfile` clean,
`tsc -p ./ --noEmit` clean, `vitest run` 107/107 passing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown

Greptile Summary

The PR centralizes the pnpm 10.4.1 pin in package.json, makes CI consume that pin, and rejects installs initiated by other package managers.

  • Adds a local preinstall guard for npm, Yarn, Bun, and other non-pnpm clients.
  • Ignores alternate package-manager lockfiles and local Claude session state.
  • Removes the duplicate pnpm version input from the CI setup action.

Confidence Score: 4/5

The PR appears safe to merge, with only a non-blocking correction needed for the guard’s invalid documentation pointer.

The package-manager pin and CI setup are internally consistent, while the only accepted issue is that rejected installs receive recovery guidance pointing to nonexistent README content.

Files Needing Attention: scripts/only-pnpm.mjs

Important Files Changed

Filename Overview
package.json Adds the pnpm 10.4.1 package-manager declaration and wires in the preinstall guard.
scripts/only-pnpm.mjs Correctly rejects non-pnpm user agents, but its failure message points to contributor documentation that does not exist.
.github/workflows/ci.yml Removes the duplicate action input so CI obtains the pnpm version from the root package manifest.
.gitignore Ignores alternate lockfiles and repository-local Claude session state.

Fix all with Greploop Fix All in Claude Code Fix All in Cursor

Reviews (1): Last reviewed commit: "chore(pnpm): the pnpm version was pinned..." | Re-trigger Greptile

Comment thread scripts/only-pnpm.mjs
` corepack enable # once, pins the version from package.json\n` +
` pnpm install\n\n` +
`npm/yarn would write a second, unshared node_modules and a lockfile this\n` +
`repo does not track. See CONTRIBUTING notes in README.md.\n\n`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Invalid contributor documentation pointer

The rejection message directs contributors to “CONTRIBUTING notes in README.md,” but those notes do not exist, leaving users who encounter the new guard with an invalid documentation pointer.

Suggested change
`repo does not track. See CONTRIBUTING notes in README.md.\n\n`,
`repo does not track.\n\n`,

Fix in Claude Code Fix in Cursor

@pa-arth
pa-arth merged commit 652c8f5 into main Aug 24, 2026
2 checks passed
@pa-arth pa-arth mentioned this pull request Aug 26, 2026
pa-arth added a commit that referenced this pull request Aug 26, 2026
#4 and #5 have sat on main unreleased since 2026-08-23. #4 said so in its own
commit message — "No version bump: this changes packaging only and rides the
next release" — and there has not been one since.

That matters more than a packaging tidy usually would, because of how this
extension reaches anyone. There is no marketplace auto-update: `promptster
start` sideloads the embedded .vsix with --force on every run, so the version a
candidate gets is the version welded into the CLI they installed. An unreleased
fix here is not late, it is absent. This machine is the evidence — Cursor holds
promptster.promptster-0.3.1, and promptster-cli embeds promptster-0.3.1.vsix
with SourceTag v0.3.1.

Patch, not minor, and checked rather than assumed: `git diff v0.3.1..main`
touches .github/, .gitignore, .vscodeignore, package.json and a new
scripts/only-pnpm.mjs — no src/ at all. The compiled dist/ payload is identical
to 0.3.1's, so nothing about what the extension collects or emits changes.

Gates: pnpm install --frozen-lockfile, tsc -p ./, and vitest 107/107 across 7
files — including the 19-case published-exclusion-list gate #4 added, which is
what will fail if the .vsix ever starts carrying repository machinery again.

NOT run: `pnpm run lint`. eslint is not a devDependency and CI does not invoke
it, so the script references a tool this repo does not install. Left alone here
rather than fixed inside a release commit.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@pa-arth
pa-arth deleted the chore/pnpm-guard branch August 27, 2026 23:44
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