import { execSync } from 'node:child_process';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
export class GitRemoteCliGateway {
    executor;
    existsSyncImpl;
    constructor(deps = {}) {
        this.executor = deps.executeCommand ?? execSync;
        this.existsSyncImpl = deps.existsSyncImpl ?? existsSync;
    }
    isRepo(path) {
        return this.existsSyncImpl(join(path, '.git'));
    }
    getOriginRemote(path) {
        try {
            const output = this.executor('git remote get-url origin', { cwd: path, stdio: 'pipe' });
            const value = output.toString().trim();
            return value.length > 0 ? value : null;
        }
        catch {
            return null;
        }
    }
    detectPlatform(remoteUrl) {
        const lowered = remoteUrl.toLowerCase();
        if (lowered.includes('github.com'))
            return 'github';
        if (lowered.includes('gitlab.com') || lowered.includes('gitlab.'))
            return 'gitlab';
        return 'unknown';
    }
}
//# sourceMappingURL=gitRemote.cli.gateway.js.map