diff --git a/Dockerfile b/Dockerfile index 5f12622..bb88217 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,7 @@ RUN mkdir -p /build && date -u '+%Y-%m-%d %H:%M UTC' > /build/build-time ADD roux-server /usr/local/bin/roux-server ADD scripts/scrape-recipe /usr/local/bin/scrape-recipe ADD scripts/convert-to-cooklang /usr/local/bin/convert-to-cooklang +ADD prompts /usr/local/share/roux/prompts/ RUN chmod +x /usr/local/bin/roux-server /usr/local/bin/scrape-recipe /usr/local/bin/convert-to-cooklang ENV PATH="/opt/roux-venv/bin:${PATH}" diff --git a/scripts/convert-to-cooklang b/scripts/convert-to-cooklang index 48cc6dc..2d97953 100755 --- a/scripts/convert-to-cooklang +++ b/scripts/convert-to-cooklang @@ -42,11 +42,30 @@ def load_config(path: str) -> dict: def load_prompts() -> tuple[str, str, str]: """Load system prompt, converter instructions, and user template. - Resolved relative to the script's parent directory (project root). + Tries locations in order: + 1. ../prompts/ relative to the script (development from project root) + 2. /usr/local/share/roux/prompts/ (production Docker deployment) """ script_dir = os.path.dirname(os.path.abspath(__file__)) - project_root = os.path.dirname(script_dir) # scripts/ -> project root - prompts_dir = os.path.join(project_root, "prompts") + candidates = [ + os.path.join(script_dir, "..", "prompts"), + "/usr/local/share/roux/prompts", + ] + + prompts_dir = None + for candidate in candidates: + candidate = os.path.abspath(candidate) + if os.path.isdir(candidate): + prompts_dir = candidate + break + + if prompts_dir is None: + print( + "Error: prompts directory not found. " + "Searched: " + ", ".join(candidates), + file=sys.stderr, + ) + sys.exit(1) def read(name: str) -> str: with open(os.path.join(prompts_dir, name)) as f: