#!/bin/bash
# scan-for-secrets - Convenience wrapper for secret scanning
#
# This script locates and runs the Python secret scanner from anywhere.
# It automatically finds the script relative to this wrapper's location.
#
# Usage:
#   scan-for-secrets              # Scan staged files (default)
#   scan-for-secrets --all-files  # Scan all tracked files
#   scan-for-secrets --path file  # Scan specific file/directory
#   scan-for-secrets --json       # Output as JSON
#   scan-for-secrets --help       # Show help

set -e

# Find the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCANNER="$SCRIPT_DIR/scan_secrets.py"

# Check if the Python scanner exists
if [ ! -f "$SCANNER" ]; then
    echo "Error: scan_secrets.py not found at $SCANNER" >&2
    exit 2
fi

# Run the scanner with all arguments passed through
python3 "$SCANNER" "$@"
