#!/usr/bin/env python """HTML Snapshot Manager for scoutlet auto-heal. Saves engine HTML responses on success (baseline) and failure. Baseline HTML is used by the AI repair agent to compare with failed HTML. Usage: python scripts/snapshot.py save --status failed python scripts/snapshot.py save --status success python scripts/snapshot.py list [--snapshots-dir snapshots] python scripts/snapshot.py show [--snapshots-dir snapshots] """ import argparse import re import sys from datetime import datetime, timezone from pathlib import Path from lxml import html as lxml_html SNAPSHOTS_DIR = Path("snapshots") def minimize_html(raw_html: str) -> str: """Strip scripts, styles, and large inline data to keep snapshots small.""" try: doc = lxml_html.fromstring(raw_html) except Exception: return raw_html # remove