MCPcopy Create free account
hub / github.com/openai/plugins / resolve_project_root

Function resolve_project_root

plugins/codex-security/scripts/config_preflight.py:222–232  ·  view source on GitHub ↗
(cwd: Path, config_layers: list[tuple[Path, dict[str, Any]]])

Source from the content-addressed store, hash-verified

220
221
222def resolve_project_root(cwd: Path, config_layers: list[tuple[Path, dict[str, Any]]]) -> Path:
223 found, configured_markers = lookup_layered_value("project_root_markers", config_layers)
224 markers = configured_markers if found else [".git"]
225 if not isinstance(markers, list) or not all(isinstance(marker, str) for marker in markers):
226 raise ValueError("project_root_markers must be an array of strings")
227 if not markers:
228 return cwd
229 for candidate in (cwd, *cwd.parents):
230 if any((candidate / marker).exists() for marker in markers):
231 return candidate
232 return cwd
233
234
235def project_trust_level(

Callers 1

discover_config_pathsFunction · 0.85

Calls 1

lookup_layered_valueFunction · 0.85

Tested by

no test coverage detected