#!/bin/bash THRESHOLD=30000 # bytes — flag files over ~30 KB # Check all .py files in tools/ and tools/engine_lib/ OVERSIZED=$(python3 -c " import os threshold = $THRESHOLD dirs = ['./tools', './tools/engine_lib'] for d in dirs: if not os.path.isdir(d): continue for f in sorted(os.listdir(d)): if not f.endswith('.py'): continue path = os.path.join(d, f) size = os.path.getsize(path) if size > threshold: print(f'{path} ({size} bytes)') ") if [ -n "$OVERSIZED" ]; then echo "Oversized files (>${THRESHOLD} bytes) — consider refactoring:" echo "$OVERSIZED" exit 1 fi echo "Compiling tools/*.py and tools/engine_lib/*.py..." if python3 -m compileall tools/*.py tools/engine_lib/*.py; then echo "OK" else echo "Compilation failed" exit 1 fi