"""Canonical filesystem locations for the SSR service, resolved from the repo root. Stage-3-transitional: this package lives at `frontend_ssr/`, a sibling of the static asset tree `frontend/` (not nested inside it -- nesting would let StaticFiles serve this package's own source/templates as downloadable files once app.py mounts frontend/). Still walks up to find `content/` as a sibling too, same as backend/paths.py does today, since both still live in one repo. Once frontend is its own repo (Stage 7), content/ is vendored at build time instead and this goes back to a no-walk resolution, same as backend's. """ import os _HERE = os.path.dirname(os.path.abspath(__file__)) def _repo_root() -> str: d = _HERE while True: if os.path.isdir(os.path.join(d, "frontend")) and os.path.isdir(os.path.join(d, "content")): return d parent = os.path.dirname(d) if parent == d: raise RuntimeError( "cannot locate the repo root (no ancestor has sibling frontend/ and content/)" ) d = parent REPO_DIR = _repo_root() STATIC_DIR = os.path.join(REPO_DIR, "frontend") TEMPLATES_DIR = os.path.join(_HERE, "templates") CONTENT_DIR = os.path.join(REPO_DIR, "content")