Skip to content

Commit 65d3317

Browse files
feat(source-control): GitCafe lives in @t3tools/source-control-gitcafe (pingdotgg#17681)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 57b3780 commit 65d3317

35 files changed

Lines changed: 4463 additions & 17 deletions

‎apps/server/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@t3tools/source-control-bitbucket": "workspace:*",
5050
"@t3tools/source-control-core": "workspace:*",
5151
"@t3tools/source-control-forgejo": "workspace:*",
52+
"@t3tools/source-control-gitcafe": "workspace:*",
5253
"@t3tools/source-control-github": "workspace:*",
5354
"@t3tools/source-control-gitlab": "workspace:*",
5455
"effect": "catalog:",

‎apps/server/src/sourceControl/SourceControlDiscovery.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import * as GitHubPullRequestApi from "@t3tools/source-control-github/server/Git
2525
import * as GitLabCli from "@t3tools/source-control-gitlab/server/GitLabCli";
2626
import * as GitLabPullRequestCli from "@t3tools/source-control-gitlab/server/GitLabPullRequestCli";
2727
import * as ForgejoCli from "@t3tools/source-control-forgejo/server/ForgejoCli";
28+
import * as GitCafeApi from "@t3tools/source-control-gitcafe/server/GitCafeApi";
2829
import * as ForgejoSourceControlProvider from "@t3tools/source-control-forgejo/server/ForgejoSourceControlProvider";
2930
import * as ForgejoPullRequestProvider from "@t3tools/source-control-forgejo/server/ForgejoPullRequestProvider";
3031
import * as SourceControlDiscovery from "./SourceControlDiscovery.ts";
@@ -53,6 +54,7 @@ const layerSourceControlProviderRegistryTest = (input: {
5354
Layer.mock(GitLabCli.GitLabCli)({}),
5455
Layer.mock(GitLabPullRequestCli.GitLabPullRequestCli)({}),
5556
Layer.mock(ForgejoCli.ForgejoCli)({ listLogins: () => Effect.succeed([]) }),
57+
Layer.mock(GitCafeApi.GitCafeApi)({}),
5658
Layer.mock(VcsDriverRegistry.VcsDriverRegistry)({}),
5759
Layer.mock(VcsProcess.VcsProcess)(input.process),
5860
ServerSourceControlHost.layer.pipe(
@@ -203,6 +205,12 @@ it.effect("reports implemented tools separately from locally available executabl
203205
auth: "unknown",
204206
account: Option.none(),
205207
},
208+
{
209+
kind: "gitcafe",
210+
status: "missing",
211+
auth: "unknown",
212+
account: Option.none(),
213+
},
206214
],
207215
);
208216
const bitbucket = result.sourceControlProviders.find((item) => item.kind === "bitbucket");
@@ -266,6 +274,13 @@ Logged in to gitlab.com as gitlab-user
266274
) {
267275
return Effect.succeed(processOutput("[email protected]\n"));
268276
}
277+
if (input.command === "cafe" && input.args.slice(-3).join(" ") === "auth status --json") {
278+
return Effect.succeed(
279+
processOutput(
280+
encodeJson({ schemaVersion: 1, data: { host: "git.cafe", username: "cafe-user" } }),
281+
),
282+
);
283+
}
269284
return Effect.fail(
270285
new VcsProcessSpawnError({
271286
operation: input.operation,
@@ -341,6 +356,12 @@ Logged in to gitlab.com as gitlab-user
341356
account: Option.some("forgejo-user"),
342357
detail: Option.none(),
343358
},
359+
{
360+
kind: "gitcafe",
361+
auth: "authenticated",
362+
account: Option.some("cafe-user"),
363+
detail: Option.none(),
364+
},
344365
],
345366
);
346367
}).pipe(Effect.provide(layerTest));

‎apps/server/src/sourceControl/SourceControlProviderRegistry.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import * as GitHubCredentials from "@t3tools/source-control-github/server/GitHub
2424
import * as GitLabCli from "@t3tools/source-control-gitlab/server/GitLabCli";
2525
import * as GitLabPullRequestCli from "@t3tools/source-control-gitlab/server/GitLabPullRequestCli";
2626
import * as ForgejoCli from "@t3tools/source-control-forgejo/server/ForgejoCli";
27+
import * as GitCafeApi from "@t3tools/source-control-gitcafe/server/GitCafeApi";
2728
import * as SourceControlProviderRegistry from "./SourceControlProviderRegistry.ts";
2829
import * as ServerSourceControlHost from "./ServerSourceControlHost.ts";
2930

@@ -126,6 +127,7 @@ function makeRegistry(input: {
126127
Layer.mock(GitLabCli.GitLabCli)(input.gitlab ?? {}),
127128
Layer.mock(GitLabPullRequestCli.GitLabPullRequestCli)({}),
128129
Layer.mock(ForgejoCli.ForgejoCli)({ listLogins: () => Effect.succeed([]) }),
130+
Layer.mock(GitCafeApi.GitCafeApi)({}),
129131
ServerConfig.layerTest(process.cwd(), {
130132
prefix: "t3-source-control-registry-test-",
131133
}).pipe(Layer.provide(NodeServices.layer)),

‎apps/server/src/sourceControl/builtInDrivers.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import * as BitbucketPullRequestApi from "@t3tools/source-control-bitbucket/serv
1515
import * as BitbucketDriver from "@t3tools/source-control-bitbucket/server/driver";
1616
import * as ForgejoCli from "@t3tools/source-control-forgejo/server/ForgejoCli";
1717
import * as ForgejoDriver from "@t3tools/source-control-forgejo/server/driver";
18+
import * as GitCafeApi from "@t3tools/source-control-gitcafe/server/GitCafeApi";
19+
import * as GitCafeCredentials from "@t3tools/source-control-gitcafe/server/GitCafeCredentials";
20+
import * as GitCafeDriver from "@t3tools/source-control-gitcafe/server/driver";
1821
import * as GitHubApi from "@t3tools/source-control-github/server/GitHubApi";
1922
import * as GitHubPullRequestApi from "@t3tools/source-control-github/server/GitHubPullRequestApi";
2023
import * as GitHubDriver from "@t3tools/source-control-github/server/driver";
@@ -32,6 +35,7 @@ const drivers = [
3235
AzureDevOpsDriver.driver,
3336
BitbucketDriver.driver,
3437
ForgejoDriver.driver,
38+
GitCafeDriver.driver,
3539
];
3640

3741
/** Every service a built-in driver's `make` needs; the server's layers must provide them all. */
@@ -51,5 +55,6 @@ export const layer = Layer.mergeAll(
5155
AzureDevOpsPullRequestCli.layer.pipe(Layer.provideMerge(AzureDevOpsCli.layer)),
5256
BitbucketPullRequestApi.layer.pipe(Layer.provideMerge(BitbucketApi.layer)),
5357
ForgejoCli.layer,
58+
GitCafeApi.layer.pipe(Layer.provideMerge(GitCafeCredentials.layer)),
5459
GitLabPullRequestCli.layer.pipe(Layer.provideMerge(GitLabCli.layer)),
5560
).pipe(Layer.provideMerge(ServerSourceControlHost.layer));

‎apps/web/src/components/CommandPalette.tsx‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,14 @@ import {
187187
CommandPaletteVirtualizedResults,
188188
scrollCommandPaletteRowIntoView,
189189
} from "./CommandPaletteResults";
190-
import { AzureDevOpsIcon, BitbucketIcon, GitHubIcon, GitLabIcon, ForgejoIcon } from "./Icons";
190+
import {
191+
AzureDevOpsIcon,
192+
BitbucketIcon,
193+
GitCafeIcon,
194+
GitHubIcon,
195+
GitLabIcon,
196+
ForgejoIcon,
197+
} from "./Icons";
191198
import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon";
192199
import { Checkbox } from "./ui/checkbox";
193200
import { ProjectFavicon } from "./ProjectFavicon";
@@ -252,7 +259,7 @@ interface AddProjectEnvironmentOption {
252259

253260
type AddProjectRemoteProviderKind = Extract<
254261
SourceControlProviderKind,
255-
"github" | "gitlab" | "forgejo" | "bitbucket" | "azure-devops"
262+
"github" | "gitlab" | "forgejo" | "bitbucket" | "azure-devops" | "gitcafe"
256263
>;
257264
type AddProjectRemoteSource = AddProjectRemoteProviderKind | "url";
258265

@@ -278,13 +285,15 @@ const REMOTE_PROJECT_SOURCES: ReadonlyArray<AddProjectRemoteSource> = [
278285
"forgejo",
279286
"bitbucket",
280287
"azure-devops",
288+
"gitcafe",
281289
];
282290
const REMOTE_PROJECT_PROVIDER_SOURCES: ReadonlyArray<AddProjectRemoteProviderKind> = [
283291
"github",
284292
"gitlab",
285293
"forgejo",
286294
"bitbucket",
287295
"azure-devops",
296+
"gitcafe",
288297
];
289298

290299
function remoteProjectSourceLabel(source: AddProjectRemoteSource): string {
@@ -299,6 +308,8 @@ function remoteProjectSourceLabel(source: AddProjectRemoteSource): string {
299308
return "Bitbucket";
300309
case "azure-devops":
301310
return "Azure DevOps";
311+
case "gitcafe":
312+
return "GitCafe";
302313
case "url":
303314
return "Git URL";
304315
}
@@ -308,6 +319,7 @@ function remoteProjectSourcePathHint(source: AddProjectRemoteSource): string {
308319
switch (source) {
309320
case "forgejo":
310321
case "github":
322+
case "gitcafe":
311323
return "owner/repo";
312324
case "gitlab":
313325
return "group/project";
@@ -338,6 +350,8 @@ function remoteProjectSourceIcon(source: AddProjectRemoteSource, className: stri
338350
return <BitbucketIcon className={className} />;
339351
case "azure-devops":
340352
return <AzureDevOpsIcon className={className} />;
353+
case "gitcafe":
354+
return <GitCafeIcon className={className} />;
341355
case "url":
342356
return <LinkIcon className={className} />;
343357
}
@@ -392,6 +406,7 @@ function buildAddProjectRemoteSourceReadiness(
392406
forgejo: unavailable,
393407
bitbucket: unavailable,
394408
"azure-devops": unavailable,
409+
gitcafe: unavailable,
395410
};
396411

397412
if (!discovery) {
@@ -2093,6 +2108,7 @@ function OpenCommandPaletteDialog(props: {
20932108
"bitbucket",
20942109
"azure",
20952110
"devops",
2111+
"gitcafe",
20962112
"url",
20972113
"environment",
20982114
],

‎apps/web/src/components/GitActionsControl.tsx‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import {
5050
GitHubIcon,
5151
GitLabIcon,
5252
ForgejoIcon,
53+
GitCafeIcon,
5354
} from "~/components/Icons";
5455
import { RadioGroup } from "~/components/ui/radio-group";
5556
import { Spinner } from "~/components/ui/spinner";
@@ -158,7 +159,7 @@ interface PendingDefaultBranchAction {
158159

159160
type PublishProviderKind = Extract<
160161
SourceControlProviderKind,
161-
"github" | "gitlab" | "forgejo" | "bitbucket" | "azure-devops"
162+
"github" | "gitlab" | "forgejo" | "bitbucket" | "azure-devops" | "gitcafe"
162163
>;
163164

164165
type GitActionToastId = ReturnType<typeof toastManager.add>;
@@ -239,6 +240,14 @@ const PUBLISH_PROVIDER_OPTIONS = [
239240
pathPlaceholder: "project/repository",
240241
Icon: AzureDevOpsIcon,
241242
},
243+
{
244+
value: "gitcafe",
245+
label: "GitCafe",
246+
description: "git.cafe",
247+
host: "git.cafe",
248+
pathPlaceholder: "owner/repo",
249+
Icon: GitCafeIcon,
250+
},
242251
] as const satisfies ReadonlyArray<{
243252
readonly value: PublishProviderKind;
244253
readonly label: string;
@@ -565,6 +574,7 @@ function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
565574
forgejo: null,
566575
bitbucket: null,
567576
"azure-devops": null,
577+
gitcafe: null,
568578
};
569579
for (const provider of sourceControlDiscovery.data?.sourceControlProviders ?? []) {
570580
if (isPublishProviderKind(provider.kind)) {

‎apps/web/src/components/Icons.tsx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,14 @@ export const ForgejoIcon: Icon = (props) => (
693693
</svg>
694694
);
695695

696+
// GitCafe's own mark, from https://git.cafe/favicon.svg, inset so the full-bleed square does not
697+
// read heavier than the round and cut-out marks beside it.
698+
export const GitCafeIcon: Icon = (props) => (
699+
<svg viewBox="0 0 64 64" aria-hidden="true" {...props}>
700+
<rect x="4.8" y="4.8" width="54.4" height="54.4" fill="#a78bfa" />
701+
</svg>
702+
);
703+
696704
// macOS System Settings > Privacy & Security pane marks, so the SnapShot setup
697705
// step points at the same icon the user is about to look for.
698706
export const MacScreenRecordingIcon: Icon = (props) => {

‎apps/web/src/components/ThreadStatusIndicators.test.tsx‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,26 @@ describe("linked pull request snapshots", () => {
7979
sourceControlProvider: { kind: "gitlab", name: "gitlab", baseUrl: "" },
8080
});
8181
});
82+
it.each([
83+
["https://git.cafe/owner/repo/pulls/42", "gitcafe"],
84+
["https://staging.git.cafe/owner/repo/pulls/42", "gitcafe"],
85+
["https://codeberg.org/owner/repo/pulls/42", "forgejo"],
86+
["https://gitlab.example.com/acme/web/-/merge_requests/42", "gitlab"],
87+
["https://github.com/owner/repo/pull/42", "github"],
88+
])("classifies %s as %s", (url, kind) => {
89+
const result = linkedPullRequestSnapshotStatus({
90+
...link,
91+
url,
92+
snapshot: {
93+
state: "open",
94+
title: "Change",
95+
headBranch: "feature",
96+
baseBranch: "main",
97+
isDraft: false,
98+
updatedAt: null,
99+
syncedAt: "2026-01-03T00:00:00Z",
100+
},
101+
});
102+
expect(result?.sourceControlProvider.kind).toBe(kind);
103+
});
82104
});

‎apps/web/src/components/ThreadStatusIndicators.tsx‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
import { useSupportsMultiplePullRequests } from "~/hooks/useSupportsMultiplePullRequests";
77

88
import { pullRequestDetailToVcsStatus } from "@t3tools/client-runtime/state/pull-requests";
9+
import { detectSourceControlProviderFromRemoteUrl } from "@t3tools/shared/sourceControl";
910
import {
1011
resolveEnvironmentMachineKind,
1112
type EnvironmentId,
@@ -129,15 +130,19 @@ export function linkedPullRequestSnapshotStatus(
129130
): LinkedThreadPullRequestStatus | null {
130131
const snapshot = link.snapshot;
131132
if (snapshot === null) return null;
132-
const kind = link.url.includes("/-/merge_requests/")
133-
? "gitlab"
134-
: link.url.includes("/pullrequest/")
135-
? "azure-devops"
136-
: link.url.includes("/pull-requests/")
137-
? "bitbucket"
138-
: link.url.includes("/pulls/")
139-
? "forgejo"
140-
: "github";
133+
// GitCafe's `/pulls/` routes look like Forgejo's, so its two hosts are told apart first.
134+
const kind =
135+
detectSourceControlProviderFromRemoteUrl(link.url)?.kind === "gitcafe"
136+
? "gitcafe"
137+
: link.url.includes("/-/merge_requests/")
138+
? "gitlab"
139+
: link.url.includes("/pullrequest/")
140+
? "azure-devops"
141+
: link.url.includes("/pull-requests/")
142+
? "bitbucket"
143+
: link.url.includes("/pulls/")
144+
? "forgejo"
145+
: "github";
141146
return {
142147
pr: {
143148
number: link.number,

‎apps/web/src/components/pullRequest/pullRequestDetail.logic.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ export function pullRequestCheckoutCommand(
128128
: null;
129129
case "azure-devops":
130130
return `az repos pr checkout --id ${number}`;
131+
case "gitcafe":
132+
return `cafe pr checkout ${number}`;
131133
case "bitbucket": {
132134
if (
133135
!headRepositoryNameWithOwner ||

0 commit comments

Comments
 (0)