fix(paths): route ALL path getters through config.toml [paths] overrides (FR2 v2)

This commit is contained in:
ed
2026-06-19 08:56:38 -04:00
parent 3239536532
commit 3a86ca3704
2 changed files with 45 additions and 36 deletions
+18 -12
View File
@@ -83,8 +83,9 @@ def get_global_presets_path() -> Path:
"""
[C: src/presets.py:PresetManager.__init__, src/presets.py:PresetManager.delete_preset, src/presets.py:PresetManager.get_preset_scope]
"""
root_dir = Path(__file__).resolve().parent.parent
return Path(os.environ.get("SLOP_GLOBAL_PRESETS", root_dir / "presets.toml"))
if "presets" not in _RESOLVED:
_RESOLVED["presets"] = _resolve_path("SLOP_GLOBAL_PRESETS", "presets", "presets.toml")
return _RESOLVED["presets"]
def get_project_presets_path(project_root: Path) -> Path:
"""
@@ -96,8 +97,9 @@ def get_global_tool_presets_path() -> Path:
"""
[C: src/tool_presets.py:ToolPresetManager._get_path, src/tool_presets.py:ToolPresetManager.load_all_bias_profiles, src/tool_presets.py:ToolPresetManager.load_all_presets]
"""
root_dir = Path(__file__).resolve().parent.parent
return Path(os.environ.get("SLOP_GLOBAL_TOOL_PRESETS", root_dir / "tool_presets.toml"))
if "tool_presets" not in _RESOLVED:
_RESOLVED["tool_presets"] = _resolve_path("SLOP_GLOBAL_TOOL_PRESETS", "tool_presets", "tool_presets.toml")
return _RESOLVED["tool_presets"]
def get_project_tool_presets_path(project_root: Path) -> Path:
"""
@@ -109,8 +111,9 @@ def get_global_personas_path() -> Path:
"""
[C: src/personas.py:PersonaManager._get_path, src/personas.py:PersonaManager.get_persona_scope, src/personas.py:PersonaManager.load_all]
"""
root_dir = Path(__file__).resolve().parent.parent
return Path(os.environ.get("SLOP_GLOBAL_PERSONAS", root_dir / "personas.toml"))
if "personas" not in _RESOLVED:
_RESOLVED["personas"] = _resolve_path("SLOP_GLOBAL_PERSONAS", "personas", "personas.toml")
return _RESOLVED["personas"]
def get_project_personas_path(project_root: Path) -> Path:
"""
@@ -122,8 +125,9 @@ def get_global_themes_path() -> Path:
"""
[C: src/theme_2.py:load_themes_from_disk]
"""
root_dir = Path(__file__).resolve().parent.parent
return Path(os.environ.get("SLOP_GLOBAL_THEMES", root_dir / "themes"))
if "themes" not in _RESOLVED:
_RESOLVED["themes"] = _resolve_path("SLOP_GLOBAL_THEMES", "themes", "themes")
return _RESOLVED["themes"]
def get_project_themes_path(project_root: Path) -> Path:
"""
@@ -135,8 +139,9 @@ def get_global_workspace_profiles_path() -> Path:
"""
[C: src/workspace_manager.py:WorkspaceManager._get_path, src/workspace_manager.py:WorkspaceManager.load_all_profiles]
"""
root_dir = Path(__file__).resolve().parent.parent
return Path(os.environ.get("SLOP_GLOBAL_WORKSPACE_PROFILES", root_dir / "workspace_profiles.toml"))
if "workspace_profiles" not in _RESOLVED:
_RESOLVED["workspace_profiles"] = _resolve_path("SLOP_GLOBAL_WORKSPACE_PROFILES", "workspace_profiles", "workspace_profiles.toml")
return _RESOLVED["workspace_profiles"]
def get_project_workspace_profiles_path(project_root: Path) -> Path:
"""
@@ -148,8 +153,9 @@ def get_credentials_path() -> Path:
"""
[C: src/mcp_client.py:_is_allowed]
"""
root_dir = Path(__file__).resolve().parent.parent
return Path(os.environ.get("SLOP_CREDENTIALS", str(root_dir / "credentials.toml")))
if "credentials" not in _RESOLVED:
_RESOLVED["credentials"] = _resolve_path("SLOP_CREDENTIALS", "credentials", "credentials.toml")
return _RESOLVED["credentials"]
def _resolve_path(env_var: str, config_key: str, default: str) -> Path:
root_dir = Path(__file__).resolve().parent.parent