diff --git a/.claude/hooks/check-as-any-pre.py b/.claude/hooks/check-as-any-pre.py index 8359bff4f94..028c4269462 100755 --- a/.claude/hooks/check-as-any-pre.py +++ b/.claude/hooks/check-as-any-pre.py @@ -33,6 +33,10 @@ def main(): # Convert to Path object for easier handling path = Path(file_path) + # Only check files in src/ directory + if not path.parts or path.parts[0] != "src": + sys.exit(0) + # Check if it's a TypeScript file if path.suffix not in [".ts", ".tsx"]: sys.exit(0) diff --git a/.claude/hooks/graphql-check.py b/.claude/hooks/graphql-check.py index 931d1601a0e..40dbb7969e0 100755 --- a/.claude/hooks/graphql-check.py +++ b/.claude/hooks/graphql-check.py @@ -6,6 +6,7 @@ import json import sys import os +from pathlib import Path try: data = json.load(sys.stdin) @@ -29,10 +30,15 @@ if file_path: files_to_check.append(file_path) + # Only proceed if files are in src/ directory + src_files = [f for f in files_to_check if Path(f).parts and Path(f).parts[0] == "src"] + if not src_files: + sys.exit(0) + # Check if any of the files are GraphQL query/mutation files graphql_files_modified = any( file_path.endswith("mutations.ts") or file_path.endswith("queries.ts") - for file_path in files_to_check + for file_path in src_files ) if graphql_files_modified: diff --git a/.claude/hooks/validation-check.sh b/.claude/hooks/validation-check.sh index a7fecacc210..4f30c76c453 100755 --- a/.claude/hooks/validation-check.sh +++ b/.claude/hooks/validation-check.sh @@ -1,5 +1,11 @@ #!/bin/bash +# Check if there are any changes in src/ directory +if ! git diff --name-only HEAD | grep -q '^src/'; then + echo 'â„šī¸ No changes in src/ directory, skipping validation' >&2 + exit 0 +fi + echo '🔍 Running final validation...' >&2 # Run type checking @@ -10,7 +16,7 @@ fi # Run linting if ! npm run lint; then - echo '❌ ESLint validation failed - please fix linting errors before completing the task' >&2 + echo '❌ ESLint validation failed - please fix linting errors before completing the task' >&2 exit 2 fi