import os

def _read_hash():
    here = os.path.dirname(os.path.abspath(__file__))
    # Packaged builds: manifest.uuid copied next to this file
    # Source tree: manifest.uuid is at project root (two levels up from bcad/)
    candidates = [
        os.path.join(here, 'manifest.uuid'),
        os.path.join(os.path.dirname(here), 'manifest.uuid'),
    ]
    for p in candidates:
        try:
            with open(p, 'r') as f:
                return f.read().strip()[:8]
        except Exception:
            pass
    return 'dev'

HASH = _read_hash()
