"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClaudeBin = getClaudeBin;
const node_child_process_1 = require("node:child_process");
let resolvedClaudeBin = null;
/**
 * Resolve the `claude` executable path once and cache it for the process.
 * Falls back to the bare "claude" name (relying on PATH) if resolution fails.
 */
function getClaudeBin() {
    if (resolvedClaudeBin)
        return resolvedClaudeBin;
    const cmd = process.platform === "win32" ? "where" : "which";
    try {
        resolvedClaudeBin = (0, node_child_process_1.execFileSync)(cmd, ["claude"], { encoding: "utf-8" }).trim().split("\n")[0];
    }
    catch {
        resolvedClaudeBin = "claude";
    }
    return resolvedClaudeBin;
}
