51 """Render *path* as a project-relative POSIX string.
53 OI-533: standardises path output across linter, health, and git
54 commands so findings never leak absolute machine paths into CI
55 artifacts or pasted error reports.
60 The file or directory to render. May be absolute or relative.
62 The project root; typically ``ctx.project_root``. Should be
63 absolute and resolved so :meth:`~pathlib.Path.relative_to`
64 computes the expected relative.
68 Project-relative POSIX string when *path* lives inside
69 *project_root*; otherwise the absolute POSIX form of *path* (so
70 out-of-tree paths remain unambiguous).
72 func =
"to_project_relative"
73 _dbg(
"OCT-CORE", func, f
"relativising {path} against {project_root}", 4)
75 return path.relative_to(project_root).as_posix()
77 return path.as_posix()