Refuse to proceed when *path* is a symlink or an existing non-directory. A symlinked ``.specify`` (or ``.specify/workflows``) could redirect workflow writes outside the project root, so any command that creates or writes files beneath it must bail first. Absence is tolerated — the calle
(path: Path, label: str)
| 67 | |
| 68 | |
| 69 | def _reject_unsafe_dir(path: Path, label: str) -> None: |
| 70 | """Refuse to proceed when *path* is a symlink or an existing non-directory. |
| 71 | |
| 72 | A symlinked ``.specify`` (or ``.specify/workflows``) could redirect |
| 73 | workflow writes outside the project root, so any command that creates or |
| 74 | writes files beneath it must bail first. Absence is tolerated — the caller |
| 75 | creates the directory — only an existing-but-wrong target is rejected. |
| 76 | """ |
| 77 | if path.is_symlink(): |
| 78 | err_console.print(f"[red]Error:[/red] Refusing to use symlinked {label} path") |
| 79 | raise typer.Exit(1) |
| 80 | if path.exists() and not path.is_dir(): |
| 81 | err_console.print(f"[red]Error:[/red] {label} path exists but is not a directory") |
| 82 | raise typer.Exit(1) |
| 83 | |
| 84 | |
| 85 | def _reject_unsafe_workflow_storage(project_root: Path) -> None: |
no test coverage detected