diff --git a/.githooks/pre-commit b/.githooks/pre-commit index ee5b75b9..d22600a2 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -1,4 +1,6 @@ -#!/usr/bin/env sh -set -eu +#!/usr/bin/env bash +set -euo pipefail -scripts/check-local-path-leaks.sh --cached +# Resolve via git toplevel so the hook works from any cwd (e.g., when +# git invokes hooks from within a non-root subdirectory). +"$(git rev-parse --show-toplevel)/scripts/check-local-path-leaks.sh" --cached diff --git a/AGENTS.md b/AGENTS.md index b604f99f..a72adb36 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -58,6 +58,7 @@ Run before opening a merge request: - `cd web && pnpm run lint` - `cd web && pnpm run format:check` +- `make verify-local-paths` For local services, start PostgreSQL and Redis with `docker compose up -d postgres redis`. diff --git a/Makefile b/Makefile index 9edb443f..32cff7f3 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,10 @@ verify-local-paths: # Install repo-local git hooks for this checkout/worktree. install-hooks: + @existing="$$(git config --local core.hooksPath 2>/dev/null || true)"; \ + if [ -n "$$existing" ] && [ "$$existing" != ".githooks" ]; then \ + echo "warning: overwriting existing local core.hooksPath ($$existing) with .githooks"; \ + fi git config core.hooksPath .githooks # Fetch and build the pinned Jellyfin Web bundle diff --git a/scripts/check-local-path-leaks.sh b/scripts/check-local-path-leaks.sh index 0847660f..f4b57808 100755 --- a/scripts/check-local-path-leaks.sh +++ b/scripts/check-local-path-leaks.sh @@ -51,7 +51,7 @@ check_pattern() { check_pattern \ "T3 worktree path or generated worktree id" \ "(${t3_worktree_dir}|/Users/[^[:space:]]*/${t3_worktree_dir}/|${t3_worktree_id_prefix}[0-9a-f]{8})" \ - . + docs/superpowers/specs docs/superpowers/plans check_pattern \ "absolute local filesystem path in generated superpowers docs" \