MCPcopy Create free account
hub / github.com/AutoForgeAI/autoforge / validate_project_path

Function validate_project_path

registry.py:465–493  ·  view source on GitHub ↗

Validate that a project path is accessible and writable. Args: path: The path to validate. Returns: Tuple of (is_valid, error_message).

(path: Path)

Source from the content-addressed store, hash-verified

463# =============================================================================
464
465def validate_project_path(path: Path) -> tuple[bool, str]:
466 """
467 Validate that a project path is accessible and writable.
468
469 Args:
470 path: The path to validate.
471
472 Returns:
473 Tuple of (is_valid, error_message).
474 """
475 path = Path(path).resolve()
476
477 # Check if path exists
478 if not path.exists():
479 return False, f"Path does not exist: {path}"
480
481 # Check if it's a directory
482 if not path.is_dir():
483 return False, f"Path is not a directory: {path}"
484
485 # Check read permissions
486 if not os.access(path, os.R_OK):
487 return False, f"No read permission: {path}"
488
489 # Check write permissions
490 if not os.access(path, os.W_OK):
491 return False, f"No write permission: {path}"
492
493 return True, ""
494
495
496def cleanup_stale_projects() -> list[str]:

Callers 2

list_projectsFunction · 0.90
list_valid_projectsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected