45 """Render *path* as a project-relative POSIX string.
47 OI-533: standardises path output across linter, health, and git
48 commands so findings never leak absolute machine paths into CI
49 artifacts or pasted error reports.
54 The file or directory to render. May be absolute or relative.
56 The project root; typically ``ctx.project_root``. Should be
57 absolute and resolved so :meth:`~pathlib.Path.relative_to`
58 computes the expected relative.
62 Project-relative POSIX string when *path* lives inside
63 *project_root*; otherwise the absolute POSIX form of *path* (so
64 out-of-tree paths remain unambiguous).
67 return path.relative_to(project_root).as_posix()
69 return path.as_posix()