| """Path helpers for code_indexing_mcp (CodeCaster) tool arguments.""" | |
| from __future__ import annotations | |
| import os | |
| from pathlib import Path | |
| def shared_data_root() -> Path: | |
| return Path(os.getenv("SHARED_DATA_ROOT", "/app/shared_data")) | |
| def repo_path_for_ingest_tool(local_path: str | Path) -> str: | |
| """`ingest_repo` accepts a path relative to SHARED_DATA_ROOT or an absolute path.""" | |
| path = Path(local_path).resolve() | |
| root = shared_data_root().resolve() | |
| try: | |
| return path.relative_to(root).as_posix() | |
| except ValueError: | |
| return str(path) | |