chore(gate): pnpm-gated node_modules freshness preflight - #50
Merged
Conversation
Abort a gate early with a clear STDERR message when node_modules is behind pnpm-lock.yaml (resolved lockfile at node_modules/.pnpm/lock.yaml differs), instead of letting TS builds fail with opaque 'Cannot find module' errors on STDOUT that surface to Stop hooks as an unhelpful 'No stderr output'. Guarded by the presence of a root pnpm-lock.yaml, so non-pnpm projects are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DxMR5ytP8qpDAKX6gyVC9d
robercano
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a pnpm-gated dependency-freshness preflight to
.claude/scripts/gate.sh.Before running any gate, it compares the working
pnpm-lock.yamlagainst theresolved copy pnpm writes to
node_modules/.pnpm/lock.yaml. If they differ (or theinstalled copy is missing), it aborts the gate early with a clear STDERR message:
Why
When a merged PR adds a dependency, a stale
node_modulesmakes TS builds fail withopaque
Cannot find moduleerrors printed to STDOUT. The Stop hooks only captureSTDERR, so agents see an unhelpful "No stderr output" and cannot diagnose it. This
surfaces the real cause and the one-line fix.
Safety / scope
[ -f "$root/pnpm-lock.yaml" ], sonon-pnpm projects (npm/yarn/cargo/go) are completely unaffected.
cmpof two files.Originated as a local fix in a downstream project (reDeploy) using this template.
🤖 Generated with Claude Code