Validate that a project path is accessible and writable. Args: path: The path to validate. Returns: Tuple of (is_valid, error_message).
(path: Path)
| 463 | # ============================================================================= |
| 464 | |
| 465 | def 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 | |
| 496 | def cleanup_stale_projects() -> list[str]: |
no outgoing calls
no test coverage detected