refactor(contracts): source control provider kind is an open branded slug (#17739)

Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Julius MarmingeandClaude Opus 5.5 authored and GitHub committed 2026-10-10 12:06:59 -07:00
1 parent dacd2cb649
commit fd3549c8ff
74 files changed
+816 -551

No files matched your search

+14 -13
View File
@@ -1,8 +1,5 @@
import type {
RepositoryIdentity,
SourceControlProviderInfo,
SourceControlProviderKind,
} from "@t3tools/contracts";
import { SourceControlProviderKind } from "@t3tools/contracts";
import type { RepositoryIdentity, SourceControlProviderInfo } from "@t3tools/contracts";
export interface ChangeRequestPresentation {
readonly icon:
@@ -124,7 +121,7 @@ export function resolveChangeRequestPresentation(
return BITBUCKET_CHANGE_REQUEST_PRESENTATION;
case "gitcafe":
return GITCAFE_CHANGE_REQUEST_PRESENTATION;
case "unknown":
default:
return GENERIC_CHANGE_REQUEST_PRESENTATION;
}
}
@@ -244,7 +241,11 @@ export function detectSourceControlProviderFromRemoteUrl(
const hostname = parseHostName(host);
if (isGitCafeHost(hostname)) {
return { kind: "gitcafe", name: "GitCafe", baseUrl: toBaseUrl(hostname) };
return {
kind: SourceControlProviderKind.make("gitcafe"),
name: "GitCafe",
baseUrl: toBaseUrl(hostname),
};
}
if (
@@ -253,7 +254,7 @@ export function detectSourceControlProviderFromRemoteUrl(
hasDnsLabel(hostname, "gitea")
) {
return {
kind: "forgejo",
kind: SourceControlProviderKind.make("forgejo"),
name: "Forgejo",
baseUrl: /^https?:/iu.test(remoteUrl.trim())
? new URL(remoteUrl.trim()).origin
@@ -263,7 +264,7 @@ export function detectSourceControlProviderFromRemoteUrl(
if (isGitHubHost(hostname)) {
return {
kind: "github",
kind: SourceControlProviderKind.make("github"),
name: hostname === "github.com" ? "GitHub" : "GitHub Self-Hosted",
baseUrl: toBaseUrl(host),
};
@@ -271,7 +272,7 @@ export function detectSourceControlProviderFromRemoteUrl(
if (isGitLabHost(hostname)) {
return {
kind: "gitlab",
kind: SourceControlProviderKind.make("gitlab"),
name: hostname === "gitlab.com" ? "GitLab" : "GitLab Self-Hosted",
baseUrl: toBaseUrl(host),
};
@@ -279,7 +280,7 @@ export function detectSourceControlProviderFromRemoteUrl(
if (isAzureDevOpsHost(hostname)) {
return {
kind: "azure-devops",
kind: SourceControlProviderKind.make("azure-devops"),
name: "Azure DevOps",
baseUrl: toBaseUrl(host),
};
@@ -287,14 +288,14 @@ export function detectSourceControlProviderFromRemoteUrl(
if (isBitbucketHost(hostname)) {
return {
kind: "bitbucket",
kind: SourceControlProviderKind.make("bitbucket"),
name: hostname === "bitbucket.org" ? "Bitbucket" : "Bitbucket Self-Hosted",
baseUrl: toBaseUrl(host),
};
}
return {
kind: "unknown",
kind: SourceControlProviderKind.make("unknown"),
name: host,
baseUrl: toBaseUrl(host),
};