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

Function check_spec_exists

start.py:35–62  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

33
34
35def 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
65def get_existing_projects() -> list[tuple[str, Path]]:

Callers 2

run_spec_creationFunction · 0.85
run_manual_spec_flowFunction · 0.85

Calls 1

get_project_prompts_dirFunction · 0.90

Tested by

no test coverage detected