openclaw - ✅(Solved) Fix pre-commit hook assumes bare pnpm instead of Corepack-managed pnpm [3 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#66695Fetched 2026-04-15 06:24:51
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
cross-referenced ×3commented ×1mentioned ×1referenced ×1

The repo pre-commit flow assumes pnpm is directly available on PATH, which breaks in environments that rely on Corepack-managed pnpm instead of a globally installed pnpm shim.

Root Cause

This is a narrow dev-experience bug, but it is annoying because it blocks normal contribution flow even when the repo itself is otherwise usable.

Fix Action

Fixed

PR fix notes

PR #66696: Support Corepack-managed pnpm in pre-commit tooling

Description (problem / solution / changelog)

Summary

Make pre-commit tooling work in environments that rely on Corepack-managed pnpm instead of a globally installed bare pnpm binary.

Problem

I hit a contribution flow failure where corepack pnpm ... worked, but the repo hook still failed with:

git-hooks/pre-commit: line 76: pnpm: command not found

The repo declares packageManager: "[email protected]", so Corepack-managed pnpm is a reasonable setup.

Changes

  • git-hooks/pre-commit
    • if pnpm is missing but corepack exists, run corepack enable before the repo-wide pnpm check
  • scripts/pre-commit/run-node-tool.sh
    • prefer corepack pnpm for pnpm repos when pnpm is not already on PATH
    • improve the missing package manager message accordingly

Why this is safe

  • no behavior change for normal environments where pnpm is already installed on PATH
  • only broadens compatibility for Corepack-based setups
  • keeps the existing hook behavior and validation steps intact

Issue

  • Closes #66695

Changed files

  • git-hooks/pre-commit (modified, +3/-0)
  • scripts/pre-commit/run-node-tool.sh (modified, +11/-3)

PR #66753: fix(hooks): run pnpm check via Corepack when no global pnpm is on PATH

Description (problem / solution / changelog)

Summary

  • Fixes #66695
  • The pre-commit hook called bare pnpm check, which fails on contributor machines that only have Corepack-managed pnpm (pnpm: command not found).
  • Wraps the invocation in a small run_pnpm_check helper: prefer a direct pnpm binary, fall back to corepack pnpm check (which proxies to the version pinned in packageManager). If neither is available, print an install hint instead of bash's generic "command not found".

Why

The repo already pins pnpm via packageManager, so a clean Corepack-only clone is a supported contributor setup — but the hook broke that flow.

Test plan

  • bash -n git-hooks/pre-commit — syntax clean
  • Verified the fallback path works when pnpm is removed from PATH but corepack is available
  • Docs-only / FAST_COMMIT branches preserved

AI-assisted disclosure

  • AI-assisted (Claude)
  • Testing: lightly tested (syntax + manual path walkthrough). The hook is a dev-experience gate; no shipped code paths changed.
  • Prompt context: issue #66695 repro + suggested fix, plus read of git-hooks/pre-commit and scripts/pre-commit/run-node-tool.sh.
  • I understand what the code does.

Changed files

  • git-hooks/pre-commit (modified, +19/-1)

PR #66776: fix(pre-commit): fall back to corepack-managed pnpm

Description (problem / solution / changelog)

Summary

  • update to run

[email protected] check /Users/pica/.openclaw/workspace-builder/repos/openclaw pnpm check:no-conflict-markers && pnpm tool-display:check && pnpm check:host-env-policy:swift && pnpm check:import-cycles && pnpm check:madge-import-cycles && pnpm tsgo && node scripts/prepare-extension-package-boundary-artifacts.mjs && pnpm lint && pnpm lint:webhook:no-low-level-body-read && pnpm lint:auth:no-pairing-store-group && pnpm lint:auth:pairing-account-scope

[email protected] check:no-conflict-markers /Users/pica/.openclaw/workspace-builder/repos/openclaw node scripts/check-no-conflict-markers.mjs

[email protected] tool-display:check /Users/pica/.openclaw/workspace-builder/repos/openclaw node --import tsx scripts/tool-display.ts --check

tool-display snapshot is up to date

[email protected] check:host-env-policy:swift /Users/pica/.openclaw/workspace-builder/repos/openclaw node scripts/generate-host-env-security-policy-swift.mjs --check

OK apps/macos/Sources/OpenClaw/HostEnvSecurityPolicy.generated.swift

[email protected] check:import-cycles /Users/pica/.openclaw/workspace-builder/repos/openclaw node --import tsx scripts/check-import-cycles.ts

Import cycle check: 0 runtime value cycle(s).

[email protected] check:madge-import-cycles /Users/pica/.openclaw/workspace-builder/repos/openclaw node --import tsx scripts/check-madge-import-cycles.ts

 ELIFECYCLE  Command failed with exit code 1.  ELIFECYCLE  Command failed with exit code 1. when Version 10.32.1 Usage: pnpm [command] [flags] pnpm [ -h | --help | -v | --version ]

These are common pnpm commands used in various situations, use 'pnpm help -a' to list all commands

Manage your dependencies: add Installs a package and any packages that it depends on. By default, any new package is installed as a prod dependency i, install Install all dependencies for a project ln, link Connect the local project to another one rm, remove Removes packages from node_modules and from the project's package.json unlink Unlinks a package. Like yarn unlink but pnpm re-installs the dependency after removing the external link up, update Updates packages to their latest version based on the specified range

Review your dependencies: audit Checks for known security issues with the installed packages ls, list Print all the versions of packages that are installed, as well as their dependencies, in a tree-structure outdated Check for outdated packages why Shows all packages that depend on the specified package

Run your scripts: create Create a project from a "create-" or "@foo/create-" starter kit dlx Fetches a package from the registry without installing it as a dependency, hot loads it, and runs whatever default command binary it exposes exec Executes a shell command in scope of a project run Runs a defined package script

Other: c, config Manage the pnpm configuration files init Create a package.json file publish Publishes a package to the registry self-update Updates pnpm to the latest version

Options: -r, --recursive Run the command for each project in the workspace. exists, otherwise fall back to

[email protected] check /Users/pica/.openclaw/workspace-builder/repos/openclaw pnpm check:no-conflict-markers && pnpm tool-display:check && pnpm check:host-env-policy:swift && pnpm check:import-cycles && pnpm check:madge-import-cycles && pnpm tsgo && node scripts/prepare-extension-package-boundary-artifacts.mjs && pnpm lint && pnpm lint:webhook:no-low-level-body-read && pnpm lint:auth:no-pairing-store-group && pnpm lint:auth:pairing-account-scope

[email protected] check:no-conflict-markers /Users/pica/.openclaw/workspace-builder/repos/openclaw node scripts/check-no-conflict-markers.mjs

[email protected] tool-display:check /Users/pica/.openclaw/workspace-builder/repos/openclaw node --import tsx scripts/tool-display.ts --check

tool-display snapshot is up to date

[email protected] check:host-env-policy:swift /Users/pica/.openclaw/workspace-builder/repos/openclaw node scripts/generate-host-env-security-policy-swift.mjs --check

OK apps/macos/Sources/OpenClaw/HostEnvSecurityPolicy.generated.swift

[email protected] check:import-cycles /Users/pica/.openclaw/workspace-builder/repos/openclaw node --import tsx scripts/check-import-cycles.ts

Import cycle check: 0 runtime value cycle(s).

[email protected] check:madge-import-cycles /Users/pica/.openclaw/workspace-builder/repos/openclaw node --import tsx scripts/check-madge-import-cycles.ts

 ELIFECYCLE  Command failed with exit code 1.  ELIFECYCLE  Command failed with exit code 1.

  • fail with a clear error message only when neither Version 10.32.1 Usage: pnpm [command] [flags] pnpm [ -h | --help | -v | --version ]

These are common pnpm commands used in various situations, use 'pnpm help -a' to list all commands

Manage your dependencies: add Installs a package and any packages that it depends on. By default, any new package is installed as a prod dependency i, install Install all dependencies for a project ln, link Connect the local project to another one rm, remove Removes packages from node_modules and from the project's package.json unlink Unlinks a package. Like yarn unlink but pnpm re-installs the dependency after removing the external link up, update Updates packages to their latest version based on the specified range

Review your dependencies: audit Checks for known security issues with the installed packages ls, list Print all the versions of packages that are installed, as well as their dependencies, in a tree-structure outdated Check for outdated packages why Shows all packages that depend on the specified package

Run your scripts: create Create a project from a "create-" or "@foo/create-" starter kit dlx Fetches a package from the registry without installing it as a dependency, hot loads it, and runs whatever default command binary it exposes exec Executes a shell command in scope of a project run Runs a defined package script

Other: c, config Manage the pnpm configuration files init Create a package.json file publish Publishes a package to the registry self-update Updates pnpm to the latest version

Options: -r, --recursive Run the command for each project in the workspace. nor Corepack - 0.34.0

$ corepack <command>

General commands

corepack cache clean Cleans Corepack cache

corepack disable [--install-directory #0] ... Remove the Corepack shims from the install directory

corepack enable [--install-directory #0] ... Add the Corepack shims to the install directory

corepack install Install the package manager configured in the local project

corepack install <-g,--global> [--cache-only] ... Install package managers on the system

corepack pack [--json] [-o,--output #0] ... Store package managers in a tarball

corepack up Update the package manager used in the current project

corepack use <pattern> Define the package manager to use for the current project

You can also print more details about any of these commands by calling them with the -h,--help flag right after the command name. is available

  • keep existing and docs-only skip behavior unchanged

Tests

 RUN  v4.1.0 /Users/pica/.openclaw/workspace-builder/repos/openclaw

✓  tooling  ../git-hooks-pre-commit.test.ts (3 tests) 978ms ✓ falls back to corepack pnpm when pnpm is not directly on PATH  558ms

 Test Files  1 passed (1)  Tests  3 passed (3)  Start at  04:08:39  Duration  1.06s (transform 30ms, setup 23ms, import 2ms, tests 978ms, environment 0ms)

  • added integration coverage:

Fixes #66695

Changed files

  • git-hooks/pre-commit (modified, +8/-1)
  • test/git-hooks-pre-commit.test.ts (modified, +31/-0)

Code Example

git-hooks/pre-commit: line 76: pnpm: command not found

---

"packageManager": "[email protected]"

---

pnpm check
RAW_BUFFERClick to expand / collapse

Summary

The repo pre-commit flow assumes pnpm is directly available on PATH, which breaks in environments that rely on Corepack-managed pnpm instead of a globally installed pnpm shim.

Repro

In a clone with corepack available but no bare pnpm on PATH, a commit can fail from the hook with:

git-hooks/pre-commit: line 76: pnpm: command not found

I hit this while preparing a PR from a clean clone where corepack pnpm ... worked fine, but the hook still called bare pnpm check.

Why this is a bug

The repo already declares:

"packageManager": "[email protected]"

and parts of the tooling are already structured around package-manager abstraction. But the hook still hardcodes:

pnpm check

which makes Corepack-only setups fail even though the repo otherwise works.

Proposed fix

Make the pre-commit hook tolerate Corepack-managed pnpm, for example by enabling Corepack when needed before invoking pnpm check, and/or by routing helper scripts through a Corepack-aware pnpm resolver.

Notes

This is a narrow dev-experience bug, but it is annoying because it blocks normal contribution flow even when the repo itself is otherwise usable.

extent analysis

TL;DR

Modify the pre-commit hook to use Corepack-managed pnpm or ensure pnpm is available on the PATH.

Guidance

  • Identify how pnpm is managed in the environment: check if Corepack is available and if pnpm is installed globally or managed by Corepack.
  • Update the pre-commit hook to use Corepack-managed pnpm by enabling Corepack before invoking pnpm check, for example, by running corepack enable pnpm before the pnpm check command.
  • Consider routing helper scripts through a Corepack-aware pnpm resolver to ensure compatibility with different pnpm management setups.
  • Verify the fix by running the pre-commit hook in an environment with Corepack-managed pnpm and checking if the hook completes successfully.

Example

# Enable Corepack-managed pnpm before invoking pnpm check
corepack enable pnpm
pnpm check

Notes

This solution assumes that Corepack is available in the environment. If Corepack is not available, a different approach may be needed to ensure pnpm is accessible.

Recommendation

Apply workaround: Modify the pre-commit hook to use Corepack-managed pnpm to ensure compatibility with different pnpm management setups.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING