#!/usr/bin/env bash
# Stop hook: cleanup stale worktrees and temp files on session end
set -euo pipefail

# Clean temp bridge files (formerly wacli temp files)
rm -f /tmp/wacli-sync-probe-*.log /tmp/wacli-bootstrap-*.log 2>/dev/null || true

# Clean stale agent worktrees older than 2 hours
find "$HOME/Projects/claude-ops/.worktrees" -maxdepth 1 -type d -mmin +120 -exec rm -rf {} \; 2>/dev/null || true

exit 0
