#!/usr/bin/env python3
"""Weekly health report generator for Hermes cron (script-only)."""
from __future__ import annotations
import subprocess, sys
from pathlib import Path
PIPELINE = Path('/home/agent/.hermes/assets/Gesundheit/scripts/health_pipeline.py')
r = subprocess.run([sys.executable, str(PIPELINE), 'weekly-report'], text=True, capture_output=True, timeout=180)
if r.returncode != 0:
    print('Wochenbericht Fehler:', r.stderr or r.stdout)
else:
    path = (r.stdout or '').strip().splitlines()[-1]
    print('## Wochenbericht Gesundheit erstellt')
    print(f'- Bericht: `{path}`')
    print('- Dashboard und aktuelle Blutwerte bleiben über die Reports-Dateien verfügbar.')
