#!/usr/bin/env python3
"""
Wrapper to run daily_mentorship.py with correct sys.path.

Prevents AIVA/logging.py from shadowing stdlib logging module
(Python adds the script's directory to sys.path when running directly,
which causes AIVA/logging.py to shadow the stdlib logging module).

Usage:
    python3 /mnt/e/genesis-system/AIVA/scripts/mentor_cron_runner.py [--lookback N]
"""
import sys
import os

# Fix sys.path BEFORE importing anything
# Remove AIVA/ and AIVA/scripts/ from path to prevent shadowing stdlib
for p in list(sys.path):
    if '/AIVA' in p:
        sys.path.remove(p)

# Add Genesis paths
sys.path.insert(0, '/mnt/e/genesis-system/data/genesis-memory')
sys.path.insert(0, '/mnt/e/genesis-system')

# Forward CLI args, defaulting to --lookback 1 for daily cron
if len(sys.argv) == 1:
    sys.argv = ['daily_mentorship.py', '--lookback', '1']
else:
    sys.argv[0] = 'daily_mentorship.py'

# Run the real script via runpy (does NOT add script dir to sys.path)
import runpy
runpy.run_path(
    '/mnt/e/genesis-system/AIVA/daily_mentorship.py',
    run_name='__main__'
)
