| 1 | #!/usr/bin/env node |
| 2 | const { spawnSync } = require("node:child_process"); |
| 3 | |
| 4 | const pkg = `@reasonix/cli-${process.platform}-${process.arch}`; |
| 5 | const exe = `reasonix${process.platform === "win32" ? ".exe" : ""}`; |
| 6 | |
| 7 | let binary; |
| 8 | try { |
| 9 | binary = require.resolve(`${pkg}/bin/${exe}`); |
| 10 | } catch { |
| 11 | console.error( |
| 12 | `reasonix: no prebuilt binary for ${process.platform}-${process.arch}.\n` + |
| 13 | `Install the matching optional package (${pkg}), or build from source:\n` + |
| 14 | ` https://github.com/esengine/DeepSeek-Reasonix`, |
| 15 | ); |
| 16 | process.exit(1); |
| 17 | } |
| 18 | |
| 19 | const res = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" }); |
| 20 | if (res.error) throw res.error; |
| 21 | process.exit(res.status === null ? 1 : res.status); |
| 22 |