#!/bin/sh
# Pre-commit hook to prevent committing private content

# Check for private directories
for file in $(git diff --cached --name-only); do
    if echo "$file" | grep -q -E "^private/|^convos/|^logs/|__private__"; then
        echo "ERROR: Attempting to commit private content: $file"
        echo "Private content should not be committed to the repository."
        exit 1
    fi
done

# Check specific private directories from config
PRIVATE_PATTERNS=(
$private_dirs_patterns
)

for file in $(git diff --cached --name-only); do
    for pattern in "${PRIVATE_PATTERNS[@]}"; do
        if echo "$file" | grep -q -E "$pattern"; then
            echo "ERROR: Attempting to commit private content: $file"
            echo "This file matches a protected pattern: $pattern"
            exit 1
        fi
    done
done

exit 0
