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

Function get_app_spec

prompts.py:266–300  ·  view source on GitHub ↗

Load the app spec from the project. Checks in order: 1. Project prompts directory: {project_dir}/prompts/app_spec.txt 2. Project root (legacy): {project_dir}/app_spec.txt Args: project_dir: The project directory Returns: The app spec content Raises:

(project_dir: Path)

Source from the content-addressed store, hash-verified

264
265
266def get_app_spec(project_dir: Path) -> str:
267 """
268 Load the app spec from the project.
269
270 Checks in order:
271 1. Project prompts directory: {project_dir}/prompts/app_spec.txt
272 2. Project root (legacy): {project_dir}/app_spec.txt
273
274 Args:
275 project_dir: The project directory
276
277 Returns:
278 The app spec content
279
280 Raises:
281 FileNotFoundError: If no app_spec.txt found
282 """
283 # Try project prompts directory first
284 project_prompts = get_project_prompts_dir(project_dir)
285 spec_path = project_prompts / "app_spec.txt"
286 if spec_path.exists():
287 try:
288 return spec_path.read_text(encoding="utf-8")
289 except (OSError, PermissionError) as e:
290 raise FileNotFoundError(f"Could not read {spec_path}: {e}") from e
291
292 # Fallback to legacy location in project root
293 legacy_spec = project_dir / "app_spec.txt"
294 if legacy_spec.exists():
295 try:
296 return legacy_spec.read_text(encoding="utf-8")
297 except (OSError, PermissionError) as e:
298 raise FileNotFoundError(f"Could not read {legacy_spec}: {e}") from e
299
300 raise FileNotFoundError(f"No app_spec.txt found for project: {project_dir}")
301
302
303def scaffold_project_prompts(project_dir: Path) -> Path:

Callers

nothing calls this directly

Calls 1

get_project_prompts_dirFunction · 0.85

Tested by

no test coverage detected