#!/bin/bash
# Functional asset shim for enhanced pre-commit.
# Delegates to repository hook if present; otherwise returns 2.

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
REPO_HOOK="$PROJECT_ROOT/git-hooks/enhanced-pre-commit"

if [ -x "$REPO_HOOK" ]; then
  exec "$REPO_HOOK"
else
  echo "[cflow-platform] enhanced-pre-commit not found in repo; run scripts/install-enhanced-git-hooks.sh" >&2
  exit 2
fi
