#!/usr/bin/env node
/**
 * Cross-platform entry: runs install-requirements.ps1 (Windows) or install-requirements.sh (macOS/Linux).
 * Extra args are forwarded (e.g. -IncludeDocker, --with-docker, --yes).
 */
const { spawnSync } = require('child_process');
const path = require('path');

const root = path.resolve(__dirname, '..');
const extra = process.argv.slice(2);

if (process.platform === 'win32') {
  const ps1 = path.join(__dirname, 'install-requirements.ps1');
  const r = spawnSync(
    'powershell.exe',
    ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', ps1, ...extra],
    { cwd: root, stdio: 'inherit', env: process.env }
  );
  process.exit(r.status === null ? 1 : r.status);
}

const sh = path.join(__dirname, 'install-requirements.sh');
const r = spawnSync('sh', [sh, ...extra], { cwd: root, stdio: 'inherit', env: process.env });
process.exit(r.status === null ? 1 : r.status);
