From a2174f1ff153976e3fafa4259b9f6213ef4cf43b Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Thu, 19 Mar 2026 18:56:43 -0700 Subject: [PATCH] fix(hooks): skip repo check outside workspace --- git-hooks/pre-commit | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index 34831d6cf3d..11079bc9f22 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -48,5 +48,10 @@ fi git add -- "${files[@]}" -cd "$ROOT_DIR" -pnpm check +# This hook is also exercised from lightweight temp repos in tests, where the +# staged-file safety behavior matters but the full OpenClaw workspace does not +# exist. Only run the repo-wide gate inside a real checkout. +if [[ -f "$ROOT_DIR/package.json" ]] && [[ -f "$ROOT_DIR/pnpm-lock.yaml" ]]; then + cd "$ROOT_DIR" + pnpm check +fi