#!/usr/bin/env bun

const { spawn } = require("child_process");
const { join } = require("path");

const cliPath = join(__dirname, "..", "src", "cli", "index.ts");
const args = process.argv.slice(2);

const child = spawn("bun", ["run", cliPath, ...args], {
  stdio: "inherit",
  cwd: process.cwd(),
});

child.on("exit", (code) => process.exit(code || 0));
child.on("error", (err) => {
  console.error("Failed to start SparkBun CLI:", err.message);
  process.exit(1);
});
