#!/usr/bin/env python3
"""
Cleanup script for demo-skill

This script removes all files created by the demo-skill, allowing you to
clean up between demo runs.
"""

import sys
import shutil
from pathlib import Path

# Files and directories created by demo-skill
FILES_TO_DELETE = [
    # Add files created by your demo skill here
    # Example:
    # "web/scratch/src/data/my-demo/data.json",
    # "web/scratch/src/pages/MyDemo.tsx",
]

def cleanup():
    """Remove all files created by the demo skill."""
    
    print("Cleaning up demo-skill...")
    print()
    
    removed_count = 0
    already_removed_count = 0
    
    for file_path in FILES_TO_DELETE:
        path = Path(file_path)
        
        if path.exists():
            try:
                if path.is_dir():
                    shutil.rmtree(path)
                    print(f"✓ Removed directory: {file_path}")
                else:
                    path.unlink()
                    print(f"✓ Removed file: {file_path}")
                removed_count += 1
            except Exception as e:
                print(f"✗ Failed to remove {file_path}: {e}")
        else:
            print(f"  Already removed: {file_path}")
            already_removed_count += 1
    
    print()
    print(f"Removed: {removed_count} file(s)")
    print(f"Already removed: {already_removed_count} file(s)")
    print("Cleanup complete!")


def main():
    cleanup()


if __name__ == "__main__":
    main()