#!/usr/bin/env python3 """ Clean up script for GPTEdit project Removes unnecessary files safely """ import os import shutil from pathlib import Path def cleanup_project(root_dir): """Clean up unnecessary files""" root_path = Path(root_dir) print(f"๐Ÿงน Cleaning up project: {root_path}") # Files and directories to remove cleanup_targets = [ # Backup files "src/connector/openai_client_backup.py.disabled", "tests/image_utils_backup.py", # Debug and test files in root "debug_gptedit.py", "debug_path.py", "quick_test.py", "replay_edit.py", "test_api_key.py", "test_size_optimization.py", "test_verification.py", "clear_cache.py", "search_response_format.py", # Temporary files "temp/fairy_image.png", "temp/imagen4.png", "temp/optimized_imagen4.png", # Python cache directories "src/__pycache__", "src/connector/__pycache__", "src/server/__pycache__", "src/utils/__pycache__" ] removed_count = 0 for target in cleanup_targets: target_path = root_path / target if target_path.exists(): try: if target_path.is_dir(): shutil.rmtree(target_path) print(f"โœ… Removed directory: {target}") else: target_path.unlink() print(f"โœ… Removed file: {target}") removed_count += 1 except Exception as e: print(f"โŒ Failed to remove {target}: {e}") else: print(f"โš ๏ธ Not found: {target}") print(f"\n๐ŸŽ‰ Cleanup complete! Removed {removed_count} items") # Show remaining structure print(f"\n๐Ÿ“ Remaining project structure:") essential_files = [ "main.py", "requirements.txt", ".env", ".env.example", "README.md", "src/", "input_images/", "generated_images/", "tests/" ] for item in essential_files: item_path = root_path / item if item_path.exists(): print(f" โœ… {item}") else: print(f" โŒ {item} (missing)") if __name__ == "__main__": script_dir = Path(__file__).parent print("=" * 60) print("GPTEdit Project Cleanup") print("=" * 60) cleanup_project(script_dir) print("\n" + "=" * 60) print("โœ… PROJECT CLEANUP COMPLETED!") print("Ready to restart the MCP server") print("=" * 60)