#!/usr/bin/env node
const { spawnSync } = require('child_process');
const path = require('path');

const repoRoot = __dirname;
const script = path.join(repoRoot, 'arxiv-digest', 'scripts', 'run_daily.py');
const args = [script, ...process.argv.slice(2)];

const result = spawnSync('python3', args, {
  cwd: repoRoot,
  stdio: 'inherit',
  env: process.env,
});

if (result.error) {
  console.error(result.error);
  process.exit(1);
}

process.exit(result.status ?? 0);
