#!/usr/bin/env node import { spawn } from 'node:child_process'; import { createRequire } from 'node:module'; const require = createRequire(import.meta.url); const pkgName = `@ziex/cli-${process.platform}-${process.arch}`; const ext = process.platform === 'win32' ? '.exe' : ''; try { const binaryPath = require.resolve(`${pkgName}/bin/zx${ext}`); const child = spawn(binaryPath, process.argv.slice(2), { stdio: 'inherit', shell: process.platform === 'win32' }); child.on('exit', (code) => process.exit(code ?? 0)); child.on('error', (err) => { console.error('Failed to start child process:', err); process.exit(1); }); } catch (e) { console.error(`Error: Could not find binary for ${process.platform}-${process.arch}`); console.error(`Ensure the optional dependency "${pkgName}" is installed.`); process.exit(1); }