Check if valid spec files exist for a project. Checks in order: 1. Project prompts directory: {project_dir}/prompts/app_spec.txt 2. Project root (legacy): {project_dir}/app_spec.txt
(project_dir: Path)
| 33 | |
| 34 | |
| 35 | def check_spec_exists(project_dir: Path) -> bool: |
| 36 | """ |
| 37 | Check if valid spec files exist for a project. |
| 38 | |
| 39 | Checks in order: |
| 40 | 1. Project prompts directory: {project_dir}/prompts/app_spec.txt |
| 41 | 2. Project root (legacy): {project_dir}/app_spec.txt |
| 42 | """ |
| 43 | # Check project prompts directory first |
| 44 | project_prompts = get_project_prompts_dir(project_dir) |
| 45 | spec_file = project_prompts / "app_spec.txt" |
| 46 | if spec_file.exists(): |
| 47 | try: |
| 48 | content = spec_file.read_text(encoding="utf-8") |
| 49 | return "<project_specification>" in content |
| 50 | except (OSError, PermissionError): |
| 51 | return False |
| 52 | |
| 53 | # Check legacy location in project root |
| 54 | legacy_spec = project_dir / "app_spec.txt" |
| 55 | if legacy_spec.exists(): |
| 56 | try: |
| 57 | content = legacy_spec.read_text(encoding="utf-8") |
| 58 | return "<project_specification>" in content |
| 59 | except (OSError, PermissionError): |
| 60 | return False |
| 61 | |
| 62 | return False |
| 63 | |
| 64 | |
| 65 | def get_existing_projects() -> list[tuple[str, Path]]: |
no test coverage detected