#!/bin/sh
# Tier 2 autonomous mode: detect (not prevent) any `git checkout` of tracked files.
# Layer 1 (OpenCode permission) is the primary defense; this is a logging backup.

LOG_DIR="${LOCALAPPDATA:-$HOME/.local/share}/manual_slop/tier2"
LOG_FILE="$LOG_DIR/tier2_checkout_log.txt"
mkdir -p "$LOG_DIR" 2>/dev/null || true

COMMIT=$(git rev-parse HEAD 2>/dev/null || echo "unknown")
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date -u)
echo "[$TIMESTAMP] checkout detected: $COMMIT, files: $*" >> "$LOG_FILE" 2>/dev/null || true

exit 0
