#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)" cd "$ROOT_DIR" MATCHES=$(rg -n "CacheKeys\\." --glob '*.ts' || true) # Remove allowed files from results FILTERED=$(printf '%s' "$MATCHES" | grep -v -E '^libs/common/src/cache/(cache-keys|ts-cache-key.provider)\\.ts:' || true) if [[ -n "$FILTERED" ]]; then echo "ERROR: Direct CacheKeys usage detected outside the allowed files:" >&2 printf '%s\n' "$FILTERED" >&2 exit 1 fi echo "CacheKeys usage is restricted to cache-keys.ts and ts-cache-key.provider.ts"