refactor: locate project root by pyproject.toml marker

This commit is contained in:
2026-06-18 17:20:51 +02:00
parent 77f215be84
commit 8a46ff8487
+7 -1
View File
@@ -33,7 +33,13 @@ def is_wecker_ringing() -> bool:
def _project_root() -> Path:
return Path(__file__).parent.parent.absolute()
"""Locate the project root by searching upward for pyproject.toml."""
start = Path(__file__).resolve()
for parent in start.parents:
if (parent / "pyproject.toml").exists():
return parent
# Fallback for unusual layouts; keep a sensible default.
return start.parent.parent
def _default_command() -> str: