List directory contents. Args: path: Directory path (default: workspace root) Returns: List of file/directory names Raises: FilesystemAccessError: If directory cannot be listed
(self, path: Union[str, Path] = ".")
| 378 | return False |
| 379 | |
| 380 | def list_dir(self, path: Union[str, Path] = ".") -> List[str]: |
| 381 | """ |
| 382 | List directory contents. |
| 383 | |
| 384 | Args: |
| 385 | path: Directory path (default: workspace root) |
| 386 | |
| 387 | Returns: |
| 388 | List of file/directory names |
| 389 | |
| 390 | Raises: |
| 391 | FilesystemAccessError: If directory cannot be listed |
| 392 | """ |
| 393 | try: |
| 394 | path = self._validate_path(path) |
| 395 | |
| 396 | if not path.is_dir(): |
| 397 | raise FilesystemAccessError(f"Not a directory: {path}") |
| 398 | |
| 399 | entries = [e.name for e in path.iterdir()] |
| 400 | entries.sort() |
| 401 | |
| 402 | try: |
| 403 | rel = path.relative_to(self.workspace) |
| 404 | except ValueError: |
| 405 | rel = path |
| 406 | info(f"Listed {rel} ({len(entries)} entries)") |
| 407 | return entries |
| 408 | |
| 409 | except FilesystemAccessError: |
| 410 | raise |
| 411 | except Exception as e: |
| 412 | raise FilesystemAccessError(f"Failed to list {path}: {e}") |
| 413 | |
| 414 | def _generate_diff(self, filename: str, old_lines: List[str], new_lines: List[str]) -> str: |
| 415 | """Generate unified diff between old and new content.""" |
no test coverage detected