import { existsSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
function defaultStartPath() {
    return fileURLToPath(new URL('.', import.meta.url));
}
export class InstallTypeDetectorFsGateway {
    startPath;
    constructor(startPath = defaultStartPath()) {
        this.startPath = startPath;
    }
    detect() {
        let current = this.startPath;
        while (true) {
            if (existsSync(join(current, '.git'))) {
                return 'source-checkout';
            }
            const parent = dirname(current);
            if (parent === current) {
                return 'global-npm';
            }
            current = parent;
        }
    }
}
//# sourceMappingURL=installTypeDetector.fs.gateway.js.map