import { execSync } from 'node:child_process';
function probeBinary(executor, command) {
    try {
        const output = executor(command, { stdio: 'pipe' });
        const text = output.toString().trim();
        const match = text.match(/(\d+(?:\.\d+)*)/);
        return { present: true, version: match ? match[1] : null };
    }
    catch {
        return { present: false, version: null };
    }
}
export class DependencyProbeCliGateway {
    executor;
    getNodeVersion;
    constructor(deps = {}) {
        this.executor = deps.executeCommand ?? execSync;
        this.getNodeVersion = deps.getNodeVersion ?? (() => process.versions.node);
    }
    probeAll() {
        return {
            node: { present: true, version: this.getNodeVersion() },
            yarn: probeBinary(this.executor, 'yarn --version'),
            claude: probeBinary(this.executor, 'claude --version'),
            git: probeBinary(this.executor, 'git --version'),
            gh: probeBinary(this.executor, 'gh --version'),
            glab: probeBinary(this.executor, 'glab --version'),
        };
    }
}
//# sourceMappingURL=dependencyProbe.cli.gateway.js.map