#!/usr/bin/env node
import { spawn } from 'child_process';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';

const root = join(dirname(fileURLToPath(import.meta.url)), '..');
const entry = join(root, 'src', 'index.ts');
const child = spawn(
  process.execPath,
  [
    join(root, '..', 'node_modules', 'tsx', 'dist', 'cli.mjs'),
    entry,
    ...process.argv.slice(2),
  ],
  { stdio: 'inherit', cwd: join(root, '..') },
);
child.on('exit', (code) => process.exit(code ?? 1));
