more adjustments

This commit is contained in:
2026-03-12 19:08:51 -04:00
parent 19e7c94c2e
commit 1f8bb58219
14 changed files with 272 additions and 213 deletions

View File

@@ -6,13 +6,11 @@ This module provides centralized path resolution for all configurable paths in t
Environment Variables:
SLOP_CONFIG: Path to config.toml
SLOP_CONDUCTOR_DIR: Path to conductor directory
SLOP_LOGS_DIR: Path to logs directory
SLOP_SCRIPTS_DIR: Path to generated scripts directory
Configuration (config.toml):
[paths]
conductor_dir = "conductor"
logs_dir = "logs/sessions"
scripts_dir = "scripts/generated"
@@ -27,8 +25,8 @@ Path Functions:
Resolution Order:
1. Check project-specific manual_slop.toml (for conductor paths)
2. Check environment variable
3. Check config.toml [paths] section
2. Check environment variable (for logs/scripts)
3. Check config.toml [paths] section (for logs/scripts)
4. Fall back to default
Usage:
@@ -110,37 +108,15 @@ def _get_project_conductor_dir_from_toml(project_root: Path) -> Optional[Path]:
return None
def get_conductor_dir(project_path: Optional[str] = None) -> Path:
if project_path:
project_root = Path(project_path).resolve()
p = _get_project_conductor_dir_from_toml(project_root)
if p: return p
if not project_path:
# Fallback for legacy/tests, but we should avoid this
return Path('conductor').resolve()
if "conductor_dir" not in _RESOLVED:
# Check env and config
root_dir = Path(__file__).resolve().parent.parent
env_val = os.environ.get("SLOP_CONDUCTOR_DIR")
if env_val:
p = Path(env_val)
if not p.is_absolute(): p = root_dir / p
_RESOLVED["conductor_dir"] = p.resolve()
else:
try:
with open(get_config_path(), "rb") as f:
cfg = tomllib.load(f)
if "paths" in cfg and "conductor_dir" in cfg["paths"]:
p = Path(cfg["paths"]["conductor_dir"])
if not p.is_absolute(): p = root_dir / p
_RESOLVED["conductor_dir"] = p.resolve()
except: pass
if "conductor_dir" in _RESOLVED:
return _RESOLVED["conductor_dir"]
project_root = Path(project_path).resolve()
p = _get_project_conductor_dir_from_toml(project_root)
if p: return p
if project_path:
return (Path(project_path).resolve() / "conductor").resolve()
root_dir = Path(__file__).resolve().parent.parent
return (root_dir / "conductor").resolve()
return (project_root / "conductor").resolve()
def get_logs_dir() -> Path:
if "logs_dir" not in _RESOLVED:
@@ -179,7 +155,6 @@ def _resolve_path_info(env_var: str, config_key: str, default: str) -> dict[str,
def get_full_path_info() -> dict[str, dict[str, Any]]:
return {
'conductor_dir': _resolve_path_info('SLOP_CONDUCTOR_DIR', 'conductor_dir', 'conductor'),
'logs_dir': _resolve_path_info('SLOP_LOGS_DIR', 'logs_dir', 'logs/sessions'),
'scripts_dir': _resolve_path_info('SLOP_SCRIPTS_DIR', 'scripts_dir', 'scripts/generated')
}