isInternalModelRepo method

Future<bool> isInternalModelRepo()

Check if the current repo is in the allowlist for internal model names.

Implementation

Future<bool> isInternalModelRepo() async {
  if (_repoClassCache != null) {
    return _repoClassCache == RepoClassification.internal;
  }

  final cwd = getAttributionRepoRoot();
  final remoteUrl = await getRemoteUrlForDir?.call(cwd);

  if (remoteUrl == null) {
    _repoClassCache = RepoClassification.none;
    return false;
  }

  final isInternal = _internalModelRepos.any(
    (repo) => remoteUrl.contains(repo),
  );
  _repoClassCache = isInternal
      ? RepoClassification.internal
      : RepoClassification.external;
  return isInternal;
}