from PIL import Image, ImageDraw, ImageFont
from pathlib import Path
root=Path(__file__).parent/'run-20261128T213531'
font=ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf',18)
for side in ['before','after']:
    raw=(root/(side+'.txt')).read_text().splitlines()
    lines=[]
    for line in raw:
        if line.startswith(('    at ','[','  migrations:','  ]','}',"    '", '    ...')):
            if 'Project path cannot be empty.' in line: lines.append('ProjectPathEmptyError: Project path cannot be empty.')
            continue
        lines.append(line)
    lines.insert(4,'Migration logs / stack frames omitted; full transcript linked separately.')
    img=Image.new('RGB',(1200,680),'#10151c'); d=ImageDraw.Draw(img)
    for i,line in enumerate(lines): d.text((24,22+i*28),line,font=font,fill='#e4edf6')
    img.save(root/(side+'.png'))
