Skip to content

chore(gate): pnpm-gated node_modules freshness preflight - #50

Merged
robercano-ghbot merged 1 commit into
mainfrom
chore/gate-pnpm-freshness-preflight
Jul 6, 2026
Merged

chore(gate): pnpm-gated node_modules freshness preflight#50
robercano-ghbot merged 1 commit into
mainfrom
chore/gate-pnpm-freshness-preflight

Conversation

@robercano-ghbot

Copy link
Copy Markdown
Collaborator

What

Adds a pnpm-gated dependency-freshness preflight to .claude/scripts/gate.sh.
Before running any gate, it compares the working pnpm-lock.yaml against the
resolved copy pnpm writes to node_modules/.pnpm/lock.yaml. If they differ (or the
installed copy is missing), it aborts the gate early with a clear STDERR message:

gate.sh: node_modules is out of sync with pnpm-lock.yaml — run 'pnpm install' (gate '<name>' aborted).

Why

When a merged PR adds a dependency, a stale node_modules makes TS builds fail with
opaque Cannot find module errors printed to STDOUT. The Stop hooks only capture
STDERR, so agents see an unhelpful "No stderr output" and cannot diagnose it. This
surfaces the real cause and the one-line fix.

Safety / scope

  • pnpm-gated: the whole block is wrapped in [ -f "$root/pnpm-lock.yaml" ], so
    non-pnpm projects (npm/yarn/cargo/go) are completely unaffected.
  • Offline, no new deps — a byte cmp of two files.
  • Placed right after repo-root resolution, before adapter/gates resolution.

Originated as a local fix in a downstream project (reDeploy) using this template.

🤖 Generated with Claude Code

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-ghbot
robercano-ghbot merged commit 1b748bc into main Jul 6, 2026
9 checks passed
@robercano-ghbot
robercano-ghbot deleted the chore/gate-pnpm-freshness-preflight branch July 6, 2026 10:33
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.

2 participants