25 lines
703 B
Python
25 lines
703 B
Python
"""Paths for bundled resources and per-run artifacts."""
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
SOURCE_DIR = Path(__file__).resolve().parent
|
|
|
|
|
|
def prompt_path(name: str) -> Path:
|
|
"""Return a prompt bundled with the application source code."""
|
|
path = SOURCE_DIR / "prompts" / name
|
|
if not path.is_file():
|
|
raise FileNotFoundError(f"Prompt not found: {path}")
|
|
return path
|
|
|
|
|
|
def debug_path(component: str, index: int) -> Path | None:
|
|
"""Create a debug directory in the current working directory when enabled."""
|
|
root = Path.cwd() / "debug"
|
|
if not root.is_dir():
|
|
return None
|
|
path = root / component / str(index)
|
|
path.mkdir(parents=True, exist_ok=True)
|
|
return path
|