#!/usr/bin/env python3
import os
import sys

error_types = {}

for file in os.listdir('/Eden/CORE/phi_fractal'):
    if file.startswith('eden_capability_') and file.endswith('.py'):
        filepath = f'/Eden/CORE/phi_fractal/{file}'
        try:
            with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
                compile(f.read(), file, 'exec')
        except SyntaxError as e:
            error_msg = str(e.msg)
            if error_msg not in error_types:
                error_types[error_msg] = []
            error_types[error_msg].append((file, e.lineno))

print("ERROR TYPES:")
print("="*70)
for error, files in sorted(error_types.items(), key=lambda x: -len(x[1])):
    print(f"\n{error}: {len(files)} files")
    for fname, lineno in files[:3]:
        print(f"  - {fname[:50]} (line {lineno})")
    if len(files) > 3:
        print(f"  ... and {len(files)-3} more")
