#!/usr/bin/env node
var _major = parseInt(process.versions.node.split(".")[0], 10);
if (_major < 18) {
  console.error(
    "poe-claude requires Node.js 18 or later. Current: " + process.version
  );
  process.exit(1);
}
import { spawn } from "node:child_process";
import path from "node:path";
import { fileURLToPath } from "node:url";

const currentFile = fileURLToPath(import.meta.url);
const distDir = path.resolve(path.dirname(currentFile), "..");
const entry = path.join(distDir, "index.js");
const service = "claude-code";
const agentArgs = process.argv.slice(2);
const args = [entry, "wrap", service, "--", ...agentArgs];
const child = spawn(process.execPath, args, { stdio: "inherit" });
child.on("close", (code) => process.exit(code ?? 0));
child.on("error", (error) => {
  throw error;
});
