<?php
// Run from cron/Task Scheduler only: php automation_runner.php
if (PHP_SAPI !== 'cli') { http_response_code(404); exit; }
require __DIR__.'/config/config.php';
require __DIR__.'/app/Core/helpers.php';
require app_path('Core/Database.php');
require app_path('Core/Auth.php');
require app_path('Models/BaseModel.php');
require app_path('Models/AIAutomation.php');
require app_path('Services/GeminiService.php');
require app_path('Services/AIAutomationService.php');
try { $result=(new AIAutomationService())->runAll('cron',null); echo json_encode($result,JSON_PRETTY_PRINT).PHP_EOL; exit(0); }
catch(Throwable $e){ fwrite(STDERR,$e->getMessage().PHP_EOL); exit(1); }
