import { safeParseNpmRegistryResponse } from '../../../../modules/cli-configuration/entities/packageVersion/packageVersion.guard.js';
export class NpmPackageVersionGateway {
    registryUrl;
    constructor(packageName = 'reviewflow') {
        this.registryUrl = `https://registry.npmjs.org/${packageName}/latest`;
    }
    async fetchLatestVersion() {
        try {
            const response = await fetch(this.registryUrl);
            if (!response.ok) {
                return null;
            }
            const data = await response.json();
            const parsed = safeParseNpmRegistryResponse(data);
            if (!parsed.success) {
                return null;
            }
            return parsed.data.version;
        }
        catch {
            return null;
        }
    }
}
//# sourceMappingURL=packageVersion.npm.gateway.js.map