"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildCommandPathProbe = buildCommandPathProbe;
exports.runShell = runShell;
const node_child_process_1 = require("node:child_process");
function buildCommandPathProbe(command, platform = process.platform) {
    return platform === 'win32' ? `where ${command}` : `command -v ${command}`;
}
function runShell(command, platform = process.platform) {
    const result = platform === 'win32'
        ? (0, node_child_process_1.spawnSync)('cmd.exe', ['/d', '/s', '/c', command], { encoding: 'utf8', timeout: 10000 })
        : (0, node_child_process_1.spawnSync)('/bin/zsh', ['-lc', command], { encoding: 'utf8', timeout: 10000 });
    return {
        exitCode: result.status ?? 1,
        output: `${result.stdout ?? ''}${result.stderr ?? ''}`.trim(),
    };
}
