const { spawn } = require('child_process');
const path = require('path');
const binaryName = process.platform === 'win32' ? 'cc-switch.exe' : 'cc-switch';
const binaryPath = path.join(__dirname, 'bin', binaryName);
const args = process.argv.slice(2);
const child = spawn(binaryPath, args, {
stdio: 'inherit',
shell: process.platform === 'win32'
});
child.on('error', (err) => {
console.error('Failed to start cc-switch:', err.message);
console.error('\nTry running the installation again: npm install cc-switch');
process.exit(1);
});
child.on('exit', (code) => {
process.exit(code);
});