import { execSync } from 'child_process';
import path from 'path';
import os from 'os';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const isWin = os.platform() === 'win32';
const script = isWin ? 'init.ps1' : 'init.sh';
const scriptPath = path.join(__dirname, script);
console.log(`[start] ${os.platform()} detected — launching ${script}`);
try {
if (isWin) {
execSync(`powershell -File "${scriptPath}"`, { stdio: 'inherit', cwd: __dirname });
} else {
execSync(`bash "${scriptPath}"`, { stdio: 'inherit', cwd: __dirname });
}
} catch (err) {
process.exit(err.status || 1);
}