#!/usr/bin/env python3 """ Lightweight smoke test for Gemini artifact generation. - If GEMINI_API_KEY is missing: prints friendly error and exits 0 (app won't crash). - If key is present: calls Gemini with a tiny prompt; prints OK or error; exits 0 on OK, 1 on error. Do not store GEMINI_API_KEY in CI; use only for local or optional CI jobs that need it. """ import os import sys # Ensure repo root is on path (run from repo root: python scripts/test_gemini_smoke.py) _repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) if _repo_root not in sys.path: sys.path.insert(0, _repo_root) from backend.gemini_client import smoke_check if __name__ == "__main__": result = smoke_check() print(result) if result == "OK": sys.exit(0) if result.startswith("SKIP:"): sys.exit(0) # key missing is expected in CI; don't fail sys.exit(1)