Files
gpt-edit/cleanup_project.py
2025-08-25 00:39:39 +09:00

101 lines
2.6 KiB
Python

#!/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)