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

Function discover_config_paths

plugins/codex-security/scripts/config_preflight.py:261–282  ·  view source on GitHub ↗
(
    *, cwd: Path, profile_layer_path: Path | None
)

Source from the content-addressed store, hash-verified

259
260
261def discover_config_paths(
262 *, cwd: Path, profile_layer_path: Path | None
263) -> tuple[list[Path], dict[str, Any]]:
264 resolved_cwd = cwd.expanduser().resolve()
265 if not resolved_cwd.is_dir():
266 raise ValueError(f"cwd must be a directory, got {str(resolved_cwd)!r}")
267
268 base_paths = [SYSTEM_CONFIG, DEFAULT_CONFIG]
269 if profile_layer_path is not None:
270 base_paths.append(profile_layer_path)
271 base_layers = [(path, read_toml(path, required=False)) for path in base_paths]
272 project_root = resolve_project_root(resolved_cwd, base_layers)
273 trust_level = project_trust_level(base_layers, project_root)
274 paths = [*base_paths]
275 if trust_level == "trusted":
276 paths.extend(project_config_paths(project_root, resolved_cwd))
277 return paths, {
278 "cwd": str(resolved_cwd),
279 "project_root": str(project_root),
280 "project_trust_level": trust_level,
281 "project_layers_loaded": trust_level == "trusted",
282 }
283
284
285def compare(actual: Any, op: str, expected: Any) -> bool:

Callers 1

evaluateFunction · 0.85

Calls 5

read_tomlFunction · 0.85
resolve_project_rootFunction · 0.85
project_trust_levelFunction · 0.85
project_config_pathsFunction · 0.85
extendMethod · 0.80

Tested by

no test coverage detected