@devries-cameron20 / t3code-1 / commits / fd3549c8ff
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

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

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 10, 2026 at 12:06 UTC fd3549c8ffa5eac8230a8b5e1a87e59d28ba488e
74 files changed +816 -551
apps/mobile/src/features/projects/AddProjectScreen.tsx
+3 -2
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { MaterialListRow } from "../../components/MaterialListRow";
3 import { SettingsScreen } from "../settings/components/SettingsScreen";
4 import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
@@ -812,7 +813,7 @@ export function AddProjectRepositoryScreen(props: {
813 const result = await lookupRepositoryQuery({
814 environmentId: environment.environmentId,
815 input: {
815 - provider,
816 + provider: SourceControlProviderKind.make(provider),
817 repository: repositoryInput.trim(),
818 },
819 });
@@ -1079,7 +1080,7 @@ export function AddProjectNewScreen(props: { readonly environmentId?: string | s
1080 environmentId: environment.environmentId,
1081 input: {
1082 cwd: workspaceRoot,
1082 - provider: "github",
1083 + provider: SourceControlProviderKind.make("github"),
1084 repository: getNewProjectGitHubRepository(githubTarget, workspaceRoot),
1085 visibility: "private",
1086 },
apps/mobile/src/state/use-thread-pr.test.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { ProjectId, type ThreadPullRequestLink, type VcsStatusResult } from "@t3tools/contracts";
3 import { describe, expect, it } from "vite-plus/test";
4
@@ -28,7 +29,7 @@ describe("presentThreadPr", () => {
29 it("uses merge-request terminology for GitLab", () => {
30 expect(
31 presentThreadPr(pullRequest, {
31 - kind: "gitlab",
32 + kind: SourceControlProviderKind.make("gitlab"),
33 name: "GitLab",
34 baseUrl: "https://gitlab.com",
35 }),
apps/server/src/git/GitManager.test.ts
+15 -5
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 // @effect-diagnostics nodeBuiltinImport:off
3 import * as NodeFS from "node:fs";
4 import * as NodePath from "node:path";
@@ -410,7 +411,13 @@ function createGitHubProviderWithFakeGh(scenario: FakeGhScenario = {}): {
411 const ghCalls: string[] = [];
412
413 const fail = (cwd: string, detail: string, cause?: unknown, operation = "fakeGh") =>
413 - new SourceControlProviderFailure({ provider: "github", operation, cwd, detail, cause });
414 + new SourceControlProviderFailure({
415 + provider: SourceControlProviderKind.make("github"),
416 + operation,
417 + cwd,
418 + detail,
419 + cause,
420 + });
421
422 /** `operation` is the provider method the call answers, which a failure reports. */
423 const execute = (input: {
@@ -534,7 +541,7 @@ function createGitHubProviderWithFakeGh(scenario: FakeGhScenario = {}): {
541 /** What GitHubSourceControlProvider makes of a pull request it read. */
542 const toChangeRequest = (summary: FakePullRequestSummary): ChangeRequest => ({
543 ...summary,
537 - provider: "github",
544 + provider: SourceControlProviderKind.make("github"),
545 state: summary.state ?? "open",
546 closedAt: summary.closedAt ?? null,
547 mergedAt: summary.mergedAt ?? null,
@@ -546,7 +553,7 @@ function createGitHubProviderWithFakeGh(scenario: FakeGhScenario = {}): {
553
554 return {
555 service: {
549 - kind: "github",
556 + kind: SourceControlProviderKind.make("github"),
557 // The GitHub provider's own lookup rule and template convention, which GitManager reads
558 // instead of the kind.
559 headBranchProbe: ({ headSelectors }) => ({
@@ -602,7 +609,10 @@ function createGitHubProviderWithFakeGh(scenario: FakeGhScenario = {}): {
609 if (raw.length === 0) return [];
610 const decoded = decodeGitHubPullRequestListJson(raw);
611 return Result.isSuccess(decoded)
605 - ? decoded.success.map((record) => ({ provider: "github" as const, ...record }))
612 + ? decoded.success.map((record) => ({
613 + provider: SourceControlProviderKind.make("github"),
614 + ...record,
615 + }))
616 : [];
617 }),
618 ),
@@ -2841,7 +2851,7 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
2851 operation: "lookupStatusPr",
2852 branch: "feature/status-rate-limited",
2853 errorTag: "SourceControlProviderError",
2844 - provider: "github",
2854 + provider: SourceControlProviderKind.make("github"),
2855 providerOperation: "listChangeRequests",
2856 errorDetail: "GitHub API rate limit exceeded. Requests resume when the limit resets.",
2857 });
apps/server/src/git/GitManager.ts
+7 -2
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Arr from "effect/Array";
3 import * as Cache from "effect/Cache";
4 import * as Context from "effect/Context";
@@ -1787,7 +1788,9 @@ export const make = Effect.gen(function* () {
1788 ) {
1789 const terms = yield* sourceControlProvider(cwd).pipe(
1790 Effect.map((provider) => getChangeRequestTerminologyForKind(provider.kind)),
1790 - Effect.orElseSucceed(() => getChangeRequestTerminologyForKind("unknown")),
1791 + Effect.orElseSucceed(() =>
1792 + getChangeRequestTerminologyForKind(SourceControlProviderKind.make("unknown")),
1793 + ),
1794 );
1795 const summary = summarizeGitActionResult(result, terms);
1796 let latestOpenPr: PullRequestInfo | null = null;
@@ -2853,7 +2856,9 @@ export const make = Effect.gen(function* () {
2856 const changeRequestTerms = wantsPr
2857 ? yield* sourceControlProvider(input.cwd).pipe(
2858 Effect.map((provider) => getChangeRequestTerminologyForKind(provider.kind)),
2856 - Effect.orElseSucceed(() => getChangeRequestTerminologyForKind("unknown")),
2859 + Effect.orElseSucceed(() =>
2860 + getChangeRequestTerminologyForKind(SourceControlProviderKind.make("unknown")),
2861 + ),
2862 )
2863 : null;
2864
apps/server/src/orchestration-v2/PullRequestSyncReactor.test.ts
+4 -3
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Stream from "effect/Stream";
3 import {
4 EventId,
@@ -148,7 +149,7 @@ function makeSummary(
149 overrides: Partial<PullRequestSummary> = {},
150 ): PullRequestSummary {
151 return {
151 - provider: "github",
152 + provider: SourceControlProviderKind.make("github"),
153 projectId: input.projectId,
154 repository: input.repository,
155 number: input.number,
@@ -1009,7 +1010,7 @@ describe("PullRequestSyncReactor", () => {
1010 Effect.gen(function* () {
1011 if (input.host === "github.com" && (yield* Clock.currentTimeMillis) < retryAt) {
1012 const paused = new PullRequestProviderError({
1012 - provider: "github",
1013 + provider: SourceControlProviderKind.make("github"),
1014 operation: "getChangeRequestSummary",
1015 reason: "rate-limited",
1016 detail: "paused",
@@ -1079,7 +1080,7 @@ describe("PullRequestSyncReactor", () => {
1080 operation: "stack",
1081 detail: "paused",
1082 cause: new PullRequestProviderError({
1082 - provider: "github",
1083 + provider: SourceControlProviderKind.make("github"),
1084 operation: "getChangeRequestStack",
1085 reason: "rate-limited",
1086 detail: "paused",
apps/server/src/orchestration-v2/ThreadSettlementService.test.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { assert, describe, expect, it } from "@effect/vitest";
3 import * as DateTime from "effect/DateTime";
4 import {
@@ -472,7 +473,7 @@ function makePullRequestSummary(input: {
473 readonly updatedAt?: string;
474 }): PullRequestSummary {
475 return {
475 - provider: "github",
476 + provider: SourceControlProviderKind.make("github"),
477 projectId: input.projectId,
478 repository: input.repository,
479 number: input.number,
apps/server/src/orchestration-v2/runtimeLayer.test.ts
+4 -3
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { limitRecoveryCommand } from "./UsageLimitRecoveryWorker.ts";
3 import * as McpProviderSessions from "@t3tools/provider-core/server/McpProviderSessions";
4 import * as SourceControlProviderRegistry from "../sourceControl/SourceControlProviderRegistry.ts";
@@ -169,7 +170,7 @@ const watchedPullRequestDetail = (input: {
170 readonly number: number;
171 readonly at: string;
172 }): PullRequestDetail => ({
172 - provider: "github",
173 + provider: SourceControlProviderKind.make("github"),
174 capabilities: {
175 diff: true,
176 comment: true,
@@ -2572,7 +2573,7 @@ it.layer(layerTest)("OrchestrationV2LayerLive lifecycle", (it) => {
2573 operation: "getChangeRequest",
2574 detail: "github requests are paused until the rate limit resets",
2575 cause: new PullRequestProviderError({
2575 - provider: "github",
2576 + provider: SourceControlProviderKind.make("github"),
2577 operation: "getChangeRequest",
2578 reason: "rate-limited",
2579 detail: "paused",
@@ -2831,7 +2832,7 @@ it.layer(layerTest)("OrchestrationV2LayerLive lifecycle", (it) => {
2832 operation: "watchFingerprint",
2833 detail: "paused",
2834 cause: new PullRequestProviderError({
2834 - provider: "github",
2835 + provider: SourceControlProviderKind.make("github"),
2836 operation: "getChangeRequestWatchFingerprint",
2837 reason: "rate-limited",
2838 detail: "paused",
apps/server/src/project/ProjectCloneTracker.test.ts
+3 -2
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { describe, expect, it } from "@effect/vitest";
3 import {
4 OrchestrationDispatchCommandError,
@@ -116,7 +117,7 @@ describe("ProjectCloneTracker", () => {
117 ? Effect.fail(
118 new SourceControlRepositoryError({
119 operation: "cloneRepository",
119 - provider: "unknown",
120 + provider: SourceControlProviderKind.make("unknown"),
121 detail: "fatal: repository not found",
122 }),
123 )
@@ -255,7 +256,7 @@ describe("ProjectCloneTracker", () => {
256 Effect.fail(
257 new SourceControlRepositoryError({
258 operation: "cloneRepository",
258 - provider: "unknown",
259 + provider: SourceControlProviderKind.make("unknown"),
260 detail: "Destination path already exists and is not empty.",
261 }),
262 ),
apps/server/src/project/ProjectCloneTracker.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import type {
3 ProjectCloneSnapshot,
4 ProjectCloneStage,
@@ -301,7 +302,7 @@ export const make = Effect.gen(function* () {
302 if (!claimed) {
303 return yield* new SourceControlRepositoryError({
304 operation: "cloneRepository",
304 - provider: input.provider ?? "unknown",
305 + provider: input.provider ?? SourceControlProviderKind.make("unknown"),
306 detail: "A clone into this destination is already in progress.",
307 });
308 }
apps/server/src/project/RepositoryIdentityResolver.test.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 // @effect-diagnostics nodeBuiltinImport:off - realpathSync.native resolves Windows 8.3 short names, which the Effect realPath does not.
3 import * as NodeFS from "node:fs";
4 import * as NodeServices from "@effect/platform-node/NodeServices";
@@ -71,7 +72,7 @@ it.layer(NodeServices.layer)("RepositoryIdentityResolverLive", (it) => {
72 if (refinementFails)
73 return Effect.fail(
74 new SourceControlProviderError({
74 - provider: "forgejo",
75 + provider: SourceControlProviderKind.make("forgejo"),
76 operation: "detectProvider",
77 cwd: rootPath,
78 detail: "account unavailable",
apps/server/src/pullRequest/PullRequestProviderRateLimit.test.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { assert, it } from "@effect/vitest";
3
4 import * as AzureDevOpsCli from "@t3tools/source-control-azure-devops/server/AzureDevOpsCli";
@@ -59,7 +60,7 @@ it("keeps GitHub's exact retry time", () => {
60 assert.deepStrictEqual(
61 gitHubProviderFailure(
62 new SourceControlRateLimit.SourceControlRateLimitPausedError({
62 - provider: "github",
63 + provider: SourceControlProviderKind.make("github"),
64 host: "github.com",
65 retryAt: 1_786_802_400_000,
66 }),
apps/server/src/pullRequest/PullRequestService.test.ts
+295 -238
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as NodeServices from "@effect/platform-node/NodeServices";
3 import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
4 import * as KeyValueStore from "effect/persistence/KeyValueStore";
@@ -17,7 +18,6 @@ import type {
18 ProjectId,
19 PullRequestReviewCapabilities,
20 PullRequestReviewerCapabilities,
20 - SourceControlProviderKind,
21 } from "@t3tools/contracts";
22 import { DEFAULT_SERVER_SETTINGS } from "@t3tools/contracts/settings";
23 import type { ServerSettings } from "@t3tools/contracts";
@@ -129,7 +129,7 @@ it.effect("caches narrow previews and invalidates them after refresh or mutation
129 const service = yield* makeService({
130 projects: [project({ id: "p1", title: "web", workspaceRoot: "/w", repository: "acme/web" })],
131 providers: [
132 - fakeProvider("github", {
132 + fakeProvider(SourceControlProviderKind.make("github"), {
133 getViewer: () => Effect.die("preview must not read the viewer"),
134 getChangeRequestPreview: () =>
135 Effect.sync(() => {
@@ -175,13 +175,13 @@ it.effect("keeps cached previews available and pauses uncached previews until qu
175 const service = yield* makeService({
176 projects: [project({ id: "p1", title: "web", workspaceRoot: "/w", repository: "acme/web" })],
177 providers: [
178 - fakeProvider("github", {
178 + fakeProvider(SourceControlProviderKind.make("github"), {
179 getChangeRequestPreview: ({ number }) =>
180 Effect.gen(function* () {
181 reads++;
182 if (reads === 2)
183 return yield* new PullRequestProviderError({
184 - provider: "github",
184 + provider: SourceControlProviderKind.make("github"),
185 operation: "getChangeRequestPreview",
186 reason: "rate-limited",
187 detail: "GitHub requests are paused until the rate limit resets.",
@@ -218,7 +218,7 @@ it.effect("reuses only unexpired detail for previews", () =>
218 const service = yield* makeService({
219 projects: [project({ id: "p1", title: "web", workspaceRoot: "/w", repository: "acme/web" })],
220 providers: [
221 - fakeProvider("github", {
221 + fakeProvider(SourceControlProviderKind.make("github"), {
222 getChangeRequest: () => Effect.succeed(hostedChangeRequest("Description")),
223 getChangeRequestPreview: () =>
224 Effect.sync(() => {
@@ -250,7 +250,7 @@ it.effect("shares detail and activity for a minute, and for ten once merged", ()
250 const service = yield* makeService({
251 projects: [project({ id: "p1", title: "web", workspaceRoot: "/w", repository: "acme/web" })],
252 providers: [
253 - fakeProvider("github", {
253 + fakeProvider(SourceControlProviderKind.make("github"), {
254 getChangeRequest: ({ number }) =>
255 Effect.sync(() => {
256 reads.push(`detail #${number}`);
@@ -314,7 +314,7 @@ it.effect("does not wait for an in-flight detail read to display a preview", ()
314 const service = yield* makeService({
315 projects: [project({ id: "p1", title: "web", workspaceRoot: "/w", repository: "acme/web" })],
316 providers: [
317 - fakeProvider("github", {
317 + fakeProvider(SourceControlProviderKind.make("github"), {
318 getChangeRequest: () =>
319 Deferred.succeed(detailStarted, undefined).pipe(
320 Effect.andThen(Deferred.await(releaseDetail)),
@@ -342,7 +342,7 @@ it.effect("keeps previews warm when another project finishes a turn", () =>
342 project({ id: "p2", title: "docs", workspaceRoot: "/d", repository: "acme/docs" }),
343 ],
344 providers: [
345 - fakeProvider("github", {
345 + fakeProvider(SourceControlProviderKind.make("github"), {
346 getChangeRequestPreview: (input) =>
347 Effect.sync(() => {
348 reads.push(input.repository);
@@ -374,11 +374,11 @@ it.effect("uses full detail for hosts without a narrow preview", () =>
374 title: "web",
375 workspaceRoot: "/w",
376 repository: "acme/web",
377 - provider: "gitlab",
377 + provider: SourceControlProviderKind.make("gitlab"),
378 }),
379 ],
380 providers: [
381 - fakeProvider("gitlab", {
381 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
382 getChangeRequest: () =>
383 Effect.sync(() => {
384 reads += 1;
@@ -405,7 +405,7 @@ function unusable(provider: SourceControlProviderKind, reason: "missing-tool" |
405 }
406
407 const requestFailed = new PullRequestProviderError({
408 - provider: "github",
408 + provider: SourceControlProviderKind.make("github"),
409 operation: "listChangeRequests",
410 reason: "failed",
411 detail: "HTTP 404",
@@ -530,12 +530,12 @@ it.effect("lists GitHub Enterprise PRs for a stored unknown repository after hos
530 title: "enterprise",
531 workspaceRoot: "/repo",
532 repository: "team/project",
533 - provider: "unknown",
533 + provider: SourceControlProviderKind.make("unknown"),
534 host: "code.example.test",
535 }),
536 ],
537 providers: [
538 - fakeProvider("github", {
538 + fakeProvider(SourceControlProviderKind.make("github"), {
539 /** Supplies a PR only after verifying discovery retained the Enterprise repository target. */
540 listChangeRequests: ({ host, repository }) => {
541 assert.strictEqual(host, "code.example.test");
@@ -554,7 +554,11 @@ it.effect("lists GitHub Enterprise PRs for a stored unknown repository after hos
554 return Effect.succeed({
555 context: {
556 ...context,
557 - provider: { ...context.provider, kind: "github", name: "GitHub Self-Hosted" },
557 + provider: {
558 + ...context.provider,
559 + kind: SourceControlProviderKind.make("github"),
560 + name: "GitHub Self-Hosted",
561 + },
562 },
563 provider: undefined as never,
564 });
@@ -576,7 +580,7 @@ it.effect("refines unknown self-hosted GitLab projects before listing merge requ
580 title: "self-hosted",
581 workspaceRoot: "/gitlab",
582 repository: "group/project",
579 - provider: "unknown",
583 + provider: SourceControlProviderKind.make("unknown"),
584 host: "code.example.test",
585 });
586 const service = yield* makeService({
@@ -584,12 +588,15 @@ it.effect("refines unknown self-hosted GitLab projects before listing merge requ
588 selfHosted,
589 { ...selfHosted, id: "p2" as ProjectId, workspaceRoot: "/gitlab-worktree" },
590 ],
587 - providers: [fakeProvider("gitlab")],
591 + providers: [fakeProvider(SourceControlProviderKind.make("gitlab"))],
592 resolveHandle: ({ context }) => {
593 refinementCalls += 1;
594 assert.strictEqual(context?.remoteUrl, "https://code.example.test/group/project.git");
595 return Effect.succeed({
592 - context: { ...context!, provider: { ...context!.provider, kind: "gitlab" } },
596 + context: {
597 + ...context!,
598 + provider: { ...context!.provider, kind: SourceControlProviderKind.make("gitlab") },
599 + },
600 provider: undefined as never,
601 });
602 },
@@ -610,7 +617,7 @@ it.effect("derives a legacy repository host after refining its provider", () =>
617 title: "legacy self-hosted",
618 workspaceRoot: "/gitlab",
619 repository: "group/project",
613 - provider: "unknown",
620 + provider: SourceControlProviderKind.make("unknown"),
621 host: "code.example.test",
622 });
623 const identity = current.repositoryIdentity!;
@@ -625,10 +632,13 @@ it.effect("derives a legacy repository host after refining its provider", () =>
632 } as unknown as OrchestrationProjectShell;
633 const service = yield* makeService({
634 projects: [legacy],
628 - providers: [fakeProvider("gitlab")],
635 + providers: [fakeProvider(SourceControlProviderKind.make("gitlab"))],
636 resolveHandle: ({ context }) =>
637 Effect.succeed({
631 - context: { ...context!, provider: { ...context!.provider, kind: "gitlab" } },
638 + context: {
639 + ...context!,
640 + provider: { ...context!.provider, kind: SourceControlProviderKind.make("gitlab") },
641 + },
642 provider: undefined as never,
643 }),
644 });
@@ -648,18 +658,21 @@ it.effect("tries another checkout when provider refinement remains unknown", ()
658 title: "self-hosted",
659 workspaceRoot: "/gone",
660 repository: "group/project",
651 - provider: "unknown",
661 + provider: SourceControlProviderKind.make("unknown"),
662 host: "code.example.test",
663 });
664 const service = yield* makeService({
665 projects: [selfHosted, { ...selfHosted, id: "p2" as ProjectId, workspaceRoot: "/healthy" }],
656 - providers: [fakeProvider("gitlab")],
666 + providers: [fakeProvider(SourceControlProviderKind.make("gitlab"))],
667 resolveHandle: ({ cwd, context }) => {
668 asked.push(cwd);
669 return cwd === "/gone"
670 ? Effect.succeed({ context: context!, provider: undefined as never })
671 : Effect.succeed({
662 - context: { ...context!, provider: { ...context!.provider, kind: "gitlab" } },
672 + context: {
673 + ...context!,
674 + provider: { ...context!.provider, kind: SourceControlProviderKind.make("gitlab") },
675 + },
676 provider: undefined as never,
677 });
678 },
@@ -689,11 +702,11 @@ it.effect("reads nothing from a host with no implementation, but reports it", ()
702 title: "on gitlab",
703 workspaceRoot: "/c",
704 repository: "group/project",
692 - provider: "gitlab",
705 + provider: SourceControlProviderKind.make("gitlab"),
706 }),
707 ],
708 providers: [
696 - fakeProvider("github", {
709 + fakeProvider(SourceControlProviderKind.make("github"), {
710 listChangeRequests: (input) => {
711 listed.push(input.repository);
712 return Effect.succeed({
@@ -718,8 +731,8 @@ it.effect("reads nothing from a host with no implementation, but reports it", ()
731 projectCount: summary.projectCount,
732 })),
733 [
721 - { kind: "github", configured: true, projectCount: 1 },
722 - { kind: "gitlab", configured: false, projectCount: 1 },
734 + { kind: SourceControlProviderKind.make("github"), configured: true, projectCount: 1 },
735 + { kind: SourceControlProviderKind.make("gitlab"), configured: false, projectCount: 1 },
736 ],
737 );
738 }),
@@ -733,7 +746,7 @@ it.effect("asks for a whole page of a host, and for the reader's own size when g
746 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
747 ],
748 providers: [
736 - fakeProvider("github", {
749 + fakeProvider(SourceControlProviderKind.make("github"), {
750 listChangeRequests: (input) => {
751 limits.push(input.limit);
752 return Effect.succeed({ items: [], truncated: false, continues: true });
@@ -759,7 +772,7 @@ it.effect("says where each repository carries on, and from nothing it has run ou
772 project({ id: "p2", title: "web", workspaceRoot: "/b", repository: "acme/web" }),
773 ],
774 providers: [
762 - fakeProvider("github", {
775 + fakeProvider(SourceControlProviderKind.make("github"), {
776 listChangeRequests: ({ repository }) =>
777 Effect.succeed({
778 items: [changeRequest(1, "2026-07-02T00:00:00Z")],
@@ -787,7 +800,7 @@ it.effect("offers no continuation for a host that cannot be carried on from", ()
800 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
801 ],
802 providers: [
790 - fakeProvider("github", {
803 + fakeProvider(SourceControlProviderKind.make("github"), {
804 listChangeRequests: () =>
805 Effect.succeed({
806 items: [changeRequest(1, "2026-07-02T00:00:00Z")],
@@ -815,12 +828,12 @@ it.effect("uses a provider's raw cursor advance when it consumed malformed rows"
828 title: "web",
829 workspaceRoot: "/a",
830 repository: "acme/web",
818 - provider: "azure-devops",
831 + provider: SourceControlProviderKind.make("azure-devops"),
832 host: "dev.azure.com",
833 }),
834 ],
835 providers: [
823 - fakeProvider("azure-devops", {
836 + fakeProvider(SourceControlProviderKind.make("azure-devops"), {
837 listChangeRequests: () =>
838 Effect.succeed({
839 items: [changeRequest(7, "2026-07-02T00:00:00Z")],
@@ -851,7 +864,7 @@ it.effect("reads only the repositories it was asked to carry on with", () =>
864 project({ id: "p2", title: "web", workspaceRoot: "/b", repository: "acme/web" }),
865 ],
866 providers: [
854 - fakeProvider("github", {
867 + fakeProvider(SourceControlProviderKind.make("github"), {
868 listChangeRequests: (input) => {
869 listed.push(input.repository);
870 cursors.push(input.cursor);
@@ -882,7 +895,7 @@ it.effect("keeps a row already sent at the boundary instant from arriving twice"
895 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
896 ],
897 providers: [
885 - fakeProvider("github", {
898 + fakeProvider(SourceControlProviderKind.make("github"), {
899 // The boundary instant is asked for inclusively, so the host hands back the rows
900 // already sent at it alongside the ones beside them — which a strictly-older read
901 // would have lost instead.
@@ -922,7 +935,7 @@ it.effect("keeps the earlier exclusions when a slice ends on the instant it bega
935 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
936 ],
937 providers: [
925 - fakeProvider("github", {
938 + fakeProvider(SourceControlProviderKind.make("github"), {
939 listChangeRequests: () =>
940 Effect.succeed({
941 items: [
@@ -960,7 +973,9 @@ it.effect("refuses a continuation it did not issue, before asking any host anyth
973 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
974 ],
975 providers: [
963 - fakeProvider("github", { listChangeRequests: () => Effect.die("should not be read") }),
976 + fakeProvider(SourceControlProviderKind.make("github"), {
977 + listChangeRequests: () => Effect.die("should not be read"),
978 + }),
979 ],
980 });
981
@@ -983,11 +998,11 @@ it.effect("calls a transient viewer failure a failed operation, not a signed-out
998 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
999 ],
1000 providers: [
986 - fakeProvider("github", {
1001 + fakeProvider(SourceControlProviderKind.make("github"), {
1002 getViewer: () =>
1003 Effect.fail(
1004 new PullRequestProviderError({
990 - provider: "github",
1005 + provider: SourceControlProviderKind.make("github"),
1006 operation: "getViewer",
1007 reason: "failed",
1008 detail: "HTTP 500",
@@ -1014,23 +1029,24 @@ it.effect("reports an unusable host over a merely failing one", () =>
1029 title: "on gitlab",
1030 workspaceRoot: "/c",
1031 repository: "group/project",
1017 - provider: "gitlab",
1032 + provider: SourceControlProviderKind.make("gitlab"),
1033 }),
1034 ],
1035 providers: [
1021 - fakeProvider("github", {
1036 + fakeProvider(SourceControlProviderKind.make("github"), {
1037 getViewer: () =>
1038 Effect.fail(
1039 new PullRequestProviderError({
1025 - provider: "github",
1040 + provider: SourceControlProviderKind.make("github"),
1041 operation: "getViewer",
1042 reason: "failed",
1043 detail: "HTTP 500",
1044 }),
1045 ),
1046 }),
1032 - fakeProvider("gitlab", {
1033 - getViewer: () => Effect.fail(unusable("gitlab", "missing-tool")),
1047 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
1048 + getViewer: () =>
1049 + Effect.fail(unusable(SourceControlProviderKind.make("gitlab"), "missing-tool")),
1050 }),
1051 ],
1052 });
@@ -1052,11 +1068,11 @@ it.effect("lists every host that has an implementation", () =>
1068 title: "on gitlab",
1069 workspaceRoot: "/b",
1070 repository: "group/sub/project",
1055 - provider: "gitlab",
1071 + provider: SourceControlProviderKind.make("gitlab"),
1072 }),
1073 ],
1074 providers: [
1059 - fakeProvider("github", {
1075 + fakeProvider(SourceControlProviderKind.make("github"), {
1076 listChangeRequests: () =>
1077 Effect.succeed({
1078 items: [changeRequest(1, "2026-07-01T00:00:00Z")],
@@ -1064,7 +1080,7 @@ it.effect("lists every host that has an implementation", () =>
1080 continues: true,
1081 }),
1082 }),
1067 - fakeProvider("gitlab", {
1083 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
1084 listChangeRequests: (input) =>
1085 // Nested groups need the full path, not the last two segments.
1086 input.repository === "group/sub/project"
@@ -1100,12 +1116,14 @@ it.effect("narrows the listing to one host when asked", () =>
1116 title: "on gitlab",
1117 workspaceRoot: "/b",
1118 repository: "group/project",
1103 - provider: "gitlab",
1119 + provider: SourceControlProviderKind.make("gitlab"),
1120 }),
1121 ],
1122 providers: [
1107 - fakeProvider("github", { listChangeRequests: () => Effect.die("should not be read") }),
1108 - fakeProvider("gitlab", {
1123 + fakeProvider(SourceControlProviderKind.make("github"), {
1124 + listChangeRequests: () => Effect.die("should not be read"),
1125 + }),
1126 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
1127 listChangeRequests: () =>
1128 Effect.succeed({
1129 items: [changeRequest(2, "2026-07-05T00:00:00Z")],
@@ -1139,7 +1157,7 @@ it.effect("tells two hosts of one kind apart in the switcher and the filter", ()
1157 }),
1158 ],
1159 providers: [
1142 - fakeProvider("github", {
1160 + fakeProvider(SourceControlProviderKind.make("github"), {
1161 listChangeRequests: ({ host }) =>
1162 Effect.succeed({
1163 items: host === "ghe.example.com" ? [changeRequest(2, "2026-07-05T00:00:00Z")] : [],
@@ -1179,11 +1197,11 @@ it.effect("keeps one host listed when another is not set up", () =>
1197 title: "on gitlab",
1198 workspaceRoot: "/b",
1199 repository: "group/project",
1182 - provider: "gitlab",
1200 + provider: SourceControlProviderKind.make("gitlab"),
1201 }),
1202 ],
1203 providers: [
1186 - fakeProvider("github", {
1204 + fakeProvider(SourceControlProviderKind.make("github"), {
1205 listChangeRequests: () =>
1206 Effect.succeed({
1207 items: [changeRequest(1, "2026-07-01T00:00:00Z")],
@@ -1191,8 +1209,9 @@ it.effect("keeps one host listed when another is not set up", () =>
1209 continues: true,
1210 }),
1211 }),
1194 - fakeProvider("gitlab", {
1195 - getViewer: () => Effect.fail(unusable("gitlab", "missing-tool")),
1212 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
1213 + getViewer: () =>
1214 + Effect.fail(unusable(SourceControlProviderKind.make("gitlab"), "missing-tool")),
1215 }),
1216 ],
1217 });
@@ -1220,8 +1239,9 @@ it.effect("fails as unavailable only when no host can be read", () =>
1239 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
1240 ],
1241 providers: [
1223 - fakeProvider("github", {
1224 - getViewer: () => Effect.fail(unusable("github", "missing-tool")),
1242 + fakeProvider(SourceControlProviderKind.make("github"), {
1243 + getViewer: () =>
1244 + Effect.fail(unusable(SourceControlProviderKind.make("github"), "missing-tool")),
1245 }),
1246 ],
1247 });
@@ -1250,7 +1270,7 @@ it.effect("reads a repository once when several worktrees share it", () =>
1270 }),
1271 ],
1272 providers: [
1253 - fakeProvider("github", {
1273 + fakeProvider(SourceControlProviderKind.make("github"), {
1274 listChangeRequests: () => {
1275 calls += 1;
1276 return Effect.succeed({
@@ -1278,7 +1298,7 @@ it.effect("keeps healthy repositories when one of them cannot be read", () =>
1298 project({ id: "p2", title: "broken", workspaceRoot: "/b", repository: "pingdotgg/broken" }),
1299 ],
1300 providers: [
1281 - fakeProvider("github", {
1301 + fakeProvider(SourceControlProviderKind.make("github"), {
1302 listChangeRequests: (input) =>
1303 input.repository === "pingdotgg/broken"
1304 ? Effect.fail(requestFailed)
@@ -1309,11 +1329,11 @@ it.effect("tries another workspace on the same host for the viewer", () =>
1329 project({ id: "p2", title: "healthy", workspaceRoot: "/healthy", repository: "acme/two" }),
1330 ],
1331 providers: [
1312 - fakeProvider("github", {
1332 + fakeProvider(SourceControlProviderKind.make("github"), {
1333 getViewer: (input) =>
1334 input.cwd === "/healthy"
1335 ? Effect.succeed("bilal")
1316 - : Effect.fail(unusable("github", "missing-tool")),
1336 + : Effect.fail(unusable(SourceControlProviderKind.make("github"), "missing-tool")),
1337 listChangeRequests: () =>
1338 Effect.succeed({
1339 items: [changeRequest(1, "2026-07-02T00:00:00Z")],
@@ -1345,7 +1365,7 @@ it.effect("routing verifies the current account on the requested host without ca
1365 }),
1366 ],
1367 providers: [
1348 - fakeProvider("github", {
1368 + fakeProvider(SourceControlProviderKind.make("github"), {
1369 getRoutingIdentity: (input) => {
1370 assert.deepStrictEqual(input, { cwd: "/a", host: "github.example.test" });
1371 return Effect.succeed({
@@ -1359,7 +1379,7 @@ it.effect("routing verifies the current account on the requested host without ca
1379 const ref = { projectId: "p1" as ProjectId, repository: "acme/web", number: 1 };
1380 assert.deepStrictEqual(yield* service.routing(ref), {
1381 host: "github.example.test",
1362 - provider: "github",
1382 + provider: SourceControlProviderKind.make("github"),
1383 viewer: "first-account",
1384 accountId: "123",
1385 projectTitle: "web",
@@ -1382,7 +1402,7 @@ it.effect("refuses an action the host never claimed it could run", () =>
1402 const service = yield* makeService({
1403 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
1404 providers: [
1385 - fakeProvider("github", {
1405 + fakeProvider(SourceControlProviderKind.make("github"), {
1406 capabilities: {
1407 diff: true,
1408 comment: true,
@@ -1428,12 +1448,12 @@ it.effect("publishes a merge for immediate settlement only after host confirmati
1448 project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" }),
1449 ],
1450 providers: [
1431 - fakeProvider("github", {
1451 + fakeProvider(SourceControlProviderKind.make("github"), {
1452 getChangeRequestSummary: () =>
1453 confirmationFails
1454 ? Effect.fail(
1455 new PullRequestProviderError({
1436 - provider: "github",
1456 + provider: SourceControlProviderKind.make("github"),
1457 operation: "getChangeRequestSummary",
1458 reason: "failed",
1459 detail: "HTTP 504",
@@ -1486,7 +1506,7 @@ it.effect("refreshes every reader before a queued merge confirmation finishes",
1506 project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" }),
1507 ],
1508 providers: [
1489 - fakeProvider("github", {
1509 + fakeProvider(SourceControlProviderKind.make("github"), {
1510 getChangeRequestSummary: () =>
1511 Effect.gen(function* () {
1512 yield* Deferred.succeed(confirmationStarted, undefined);
@@ -1528,7 +1548,7 @@ it.effect("refuses an action this viewer may not take, and says what access it t
1548 const service = yield* makeService({
1549 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
1550 providers: [
1531 - fakeProvider("github", {
1551 + fakeProvider(SourceControlProviderKind.make("github"), {
1552 // The host merges; this account only reads it, and opened the change request — which
1553 // is every contributor to a repository they do not own.
1554 getViewerPermissions: () =>
@@ -1565,7 +1585,7 @@ it.effect("gates arming a merge for later exactly as it gates merging now", () =
1585 const service = yield* makeService({
1586 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
1587 providers: [
1568 - fakeProvider("github", {
1588 + fakeProvider(SourceControlProviderKind.make("github"), {
1589 capabilities: {
1590 diff: true,
1591 comment: true,
@@ -1620,7 +1640,7 @@ it.effect("hands the host the strategy an armed merge was asked for", () =>
1640 const service = yield* makeService({
1641 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
1642 providers: [
1623 - fakeProvider("github", {
1643 + fakeProvider(SourceControlProviderKind.make("github"), {
1644 capabilities: {
1645 diff: true,
1646 comment: true,
@@ -1666,7 +1686,7 @@ it.effect("refuses an auto-merge the host never claimed, without asking it", ()
1686 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
1687 providers: [
1688 // Bitbucket's shape: it merges, and has nothing that merges later on its own.
1669 - fakeProvider("github", {
1689 + fakeProvider(SourceControlProviderKind.make("github"), {
1690 runAction: () => {
1691 ran = true;
1692 return Effect.void;
@@ -1694,7 +1714,7 @@ it.effect("refuses to resolve a conversation this viewer may not, without asking
1714 const service = yield* makeService({
1715 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
1716 providers: [
1697 - fakeProvider("github", {
1717 + fakeProvider(SourceControlProviderKind.make("github"), {
1718 getViewerPermissions: () =>
1719 Effect.succeed({
1720 actions: ["merge", "ready", "draft", "close", "reopen"],
@@ -1729,7 +1749,7 @@ it.effect("asks nobody what the viewer may do when the host cannot do it at all"
1749 const service = yield* makeService({
1750 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
1751 providers: [
1732 - fakeProvider("github", {
1752 + fakeProvider(SourceControlProviderKind.make("github"), {
1753 capabilities: {
1754 diff: true,
1755 comment: true,
@@ -1768,7 +1788,7 @@ it.effect("refuses a comment on a host that cannot post one", () =>
1788 const service = yield* makeService({
1789 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
1790 providers: [
1771 - fakeProvider("github", {
1791 + fakeProvider(SourceControlProviderKind.make("github"), {
1792 capabilities: {
1793 diff: false,
1794 comment: false,
@@ -1817,7 +1837,7 @@ it.effect("keeps two hosts of one provider kind as two accounts", () =>
1837 }),
1838 ],
1839 providers: [
1820 - fakeProvider("github", {
1840 + fakeProvider(SourceControlProviderKind.make("github"), {
1841 getViewer: (input) => Effect.succeed(viewerFor[input.cwd] ?? "unknown"),
1842 listChangeRequests: () =>
1843 Effect.succeed({
@@ -1858,11 +1878,11 @@ it.effect("reports repositories on a host that could not be read", () =>
1878 }),
1879 ],
1880 providers: [
1861 - fakeProvider("github", {
1881 + fakeProvider(SourceControlProviderKind.make("github"), {
1882 getViewer: (input) =>
1883 input.cwd === "/cloud"
1884 ? Effect.succeed("bilal")
1865 - : Effect.fail(unusable("github", "unauthenticated")),
1885 + : Effect.fail(unusable(SourceControlProviderKind.make("github"), "unauthenticated")),
1886 listChangeRequests: () =>
1887 Effect.succeed({
1888 items: [changeRequest(1, "2026-07-02T00:00:00Z")],
@@ -1893,7 +1913,7 @@ it.effect("stops new reads after a rate limit while leaving manual actions avail
1913 project({ id: "p1", title: "cloud", workspaceRoot: "/cloud", repository: "acme/web" }),
1914 ],
1915 providers: [
1896 - fakeProvider("github", {
1916 + fakeProvider(SourceControlProviderKind.make("github"), {
1917 listChangeRequests: () =>
1918 Effect.sync(() => {
1919 listCalls += 1;
@@ -1901,7 +1921,7 @@ it.effect("stops new reads after a rate limit while leaving manual actions avail
1921 Effect.andThen(
1922 Effect.fail(
1923 new PullRequestProviderError({
1904 - provider: "github",
1924 + provider: SourceControlProviderKind.make("github"),
1925 operation: "listChangeRequests",
1926 reason: "rate-limited",
1927 detail: "GitHub API rate limit exceeded.",
@@ -1933,13 +1953,14 @@ it.effect("stops new reads after a rate limit while leaving manual actions avail
1953 }),
1954 );
1955
1936 -for (const [provider, host] of [
1956 +for (const [providerName, host] of [
1957 ["github", "github.com"],
1958 ["gitlab", "gitlab.com"],
1959 ["forgejo", "code.example.test"],
1960 ["bitbucket", "bitbucket.org"],
1961 ["azure-devops", "dev.azure.com"],
1962 ] as const) {
1963 + const provider = SourceControlProviderKind.make(providerName);
1964 it.effect.each(["detail", "checks"] as const)(
1965 `shares fresh ${provider} %s reads and respects rate-limit resets`,
1966 (read) =>
@@ -2006,7 +2027,7 @@ it.effect("does not fall back to full detail when checks are unsupported", () =>
2027 project({ id: "p1", title: "web", workspaceRoot: "/repo", repository: "acme/web" }),
2028 ],
2029 providers: [
2009 - fakeProvider("github", {
2030 + fakeProvider(SourceControlProviderKind.make("github"), {
2031 getChangeRequest: () => Effect.die("Unexpected full detail read"),
2032 }),
2033 ],
@@ -2025,7 +2046,7 @@ it.effect("uses a manual rate limit to pause later reads", () =>
2046 project({ id: "p1", title: "cloud", workspaceRoot: "/cloud", repository: "acme/web" }),
2047 ],
2048 providers: [
2028 - fakeProvider("github", {
2049 + fakeProvider(SourceControlProviderKind.make("github"), {
2050 listChangeRequests: () =>
2051 Effect.sync(() => {
2052 listCalls += 1;
@@ -2034,7 +2055,7 @@ it.effect("uses a manual rate limit to pause later reads", () =>
2055 runAction: () =>
2056 Effect.fail(
2057 new PullRequestProviderError({
2037 - provider: "github",
2058 + provider: SourceControlProviderKind.make("github"),
2059 operation: "runAction",
2060 reason: "rate-limited",
2061 detail: "GitHub API rate limit exceeded.",
@@ -2066,7 +2087,7 @@ it.effect("flags a review request for the viewer but not on their own change req
2087 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
2088 ],
2089 providers: [
2069 - fakeProvider("github", {
2090 + fakeProvider(SourceControlProviderKind.make("github"), {
2091 listChangeRequests: () =>
2092 Effect.succeed({
2093 items: [
@@ -2099,7 +2120,7 @@ it.effect("refuses a repository that does not belong to the requested project",
2120 projects: [
2121 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
2122 ],
2102 - providers: [fakeProvider("github")],
2123 + providers: [fakeProvider(SourceControlProviderKind.make("github"))],
2124 });
2125
2126 const error = yield* service
@@ -2116,7 +2137,7 @@ it.effect("caches stack membership separately from action details", () =>
2137 const service = yield* makeService({
2138 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
2139 providers: [
2119 - fakeProvider("github", {
2140 + fakeProvider(SourceControlProviderKind.make("github"), {
2141 getChangeRequestStack: (input) =>
2142 Effect.sync(() => {
2143 reads.push(input.includeDetails === true);
@@ -2157,7 +2178,7 @@ it.effect("reads a host-native stack through the provider and null where it has
2178 const service = yield* makeService({
2179 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
2180 providers: [
2160 - fakeProvider("github", {
2181 + fakeProvider(SourceControlProviderKind.make("github"), {
2182 getChangeRequestStack: () =>
2183 Effect.succeed({
2184 id: "9",
@@ -2185,7 +2206,7 @@ it.effect("reads a host-native stack through the provider and null where it has
2206
2207 const withoutStacks = yield* makeService({
2208 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
2188 - providers: [fakeProvider("github")],
2209 + providers: [fakeProvider(SourceControlProviderKind.make("github"))],
2210 });
2211 assert.isNull(
2212 yield* withoutStacks.stack({
@@ -2215,7 +2236,7 @@ it.effect("routes explicit Forgejo HTTP authorities through SSH checkouts after
2236 }),
2237 ],
2238 providers: [
2218 - fakeProvider("forgejo", {
2239 + fakeProvider(SourceControlProviderKind.make("forgejo"), {
2240 getViewer: (input) => {
2241 viewers.push(input.host);
2242 assert.strictEqual(input.host, "code.example:3000");
@@ -2244,7 +2265,11 @@ it.effect("routes explicit Forgejo HTTP authorities through SSH checkouts after
2265 return Effect.succeed({
2266 context: {
2267 ...context,
2247 - provider: { kind: "forgejo", name: "Forgejo", baseUrl: "http://code.example:3000" },
2268 + provider: {
2269 + kind: SourceControlProviderKind.make("forgejo"),
2270 + name: "Forgejo",
2271 + baseUrl: "http://code.example:3000",
2272 + },
2273 },
2274 provider: undefined as never,
2275 });
@@ -2294,12 +2319,12 @@ it.effect("rejects a different Forgejo HTTP port for an HTTP checkout", () =>
2319 title: "http",
2320 workspaceRoot: "/http",
2321 repository: "team/repo",
2297 - provider: "forgejo",
2322 + provider: SourceControlProviderKind.make("forgejo"),
2323 host: "code.example",
2324 remoteUrl: "http://code.example:4000/team/repo.git",
2325 }),
2326 ],
2302 - providers: [fakeProvider("forgejo")],
2327 + providers: [fakeProvider(SourceControlProviderKind.make("forgejo"))],
2328 });
2329 const failure = yield* service
2330 .summary(
@@ -2327,7 +2352,7 @@ it.effect("resolves a project's repository identity when its shell has none cach
2352 const service = yield* makeService({
2353 projects: [{ ...resolved, repositoryIdentity: null }],
2354 providers: [
2330 - fakeProvider("github", {
2355 + fakeProvider(SourceControlProviderKind.make("github"), {
2356 getChangeRequestSummary: () => Effect.succeed(changeRequest(7, "2026-07-02T00:00:00Z")),
2357 }),
2358 ],
@@ -2351,7 +2376,7 @@ it.effect("routes a hosted reference to another repository through a project on
2376 project({ id: "frontend", title: "web", workspaceRoot: "/web", repository: "acme/web" }),
2377 ],
2378 providers: [
2354 - fakeProvider("github", {
2379 + fakeProvider(SourceControlProviderKind.make("github"), {
2380 getChangeRequestSummary: (input) =>
2381 Effect.sync(() => {
2382 seen.push({ cwd: input.cwd, repository: input.repository, host: input.host });
@@ -2381,12 +2406,12 @@ it.effect("routes Azure reads and writes through the requested organization's ch
2406 title: organization,
2407 workspaceRoot: `/${organization}`,
2408 repository: `${organization}/project/_git/web`,
2384 - provider: "azure-devops",
2409 + provider: SourceControlProviderKind.make("azure-devops"),
2410 host: "dev.azure.com",
2411 }),
2412 ),
2413 providers: [
2389 - fakeProvider("azure-devops", {
2414 + fakeProvider(SourceControlProviderKind.make("azure-devops"), {
2415 getChangeRequestSummary: (input) =>
2416 Effect.sync(() => {
2417 seen.push(`read ${input.cwd} ${input.repository}`);
@@ -2434,7 +2459,7 @@ it.effect.each([
2459 id: "target",
2460 title: "target",
2461 workspaceRoot: "/target",
2437 - provider: "azure-devops",
2462 + provider: SourceControlProviderKind.make("azure-devops"),
2463 ...checkout,
2464 });
2465 const service = yield* makeService({
@@ -2444,7 +2469,7 @@ it.effect.each([
2469 id: repository,
2470 title: repository,
2471 workspaceRoot: `/${repository}`,
2447 - provider: "azure-devops",
2472 + provider: SourceControlProviderKind.make("azure-devops"),
2473 host: "dev.azure.com",
2474 repository,
2475 }),
@@ -2452,7 +2477,7 @@ it.effect.each([
2477 target,
2478 ],
2479 providers: [
2455 - fakeProvider("azure-devops", {
2480 + fakeProvider(SourceControlProviderKind.make("azure-devops"), {
2481 getChangeRequestSummary: (input) =>
2482 Effect.sync(() => {
2483 seen.push(`read ${input.cwd} ${input.repository}`);
@@ -2486,12 +2511,12 @@ it.effect("refuses Azure cross-organization reads and writes without its checkou
2511 title: "org-a",
2512 workspaceRoot: "/org-a",
2513 repository: "org-a/project/_git/web",
2489 - provider: "azure-devops",
2514 + provider: SourceControlProviderKind.make("azure-devops"),
2515 host: "dev.azure.com",
2516 }),
2517 ],
2518 providers: [
2494 - fakeProvider("azure-devops", {
2519 + fakeProvider(SourceControlProviderKind.make("azure-devops"), {
2520 getChangeRequestSummary: () => Effect.die("must not read the wrong organization"),
2521 runAction: () => Effect.die("must not modify the wrong organization"),
2522 }),
@@ -2518,7 +2543,7 @@ it.effect("refuses a hosted reference when nothing is checked out from that host
2543 projects: [
2544 project({ id: "frontend", title: "web", workspaceRoot: "/web", repository: "acme/web" }),
2545 ],
2521 - providers: [fakeProvider("github")],
2546 + providers: [fakeProvider(SourceControlProviderKind.make("github"))],
2547 });
2548
2549 const error = yield* service
@@ -2546,11 +2571,11 @@ it.effect("refuses a diff on a host that cannot produce one", () =>
2571 title: "on azure",
2572 workspaceRoot: "/a",
2573 repository: "org/project",
2549 - provider: "azure-devops",
2574 + provider: SourceControlProviderKind.make("azure-devops"),
2575 }),
2576 ],
2577 providers: [
2553 - fakeProvider("azure-devops", {
2578 + fakeProvider(SourceControlProviderKind.make("azure-devops"), {
2579 capabilities: {
2580 diff: false,
2581 comment: true,
@@ -2580,7 +2605,11 @@ it.effect("rejects an empty comment before reaching the host", () =>
2605 projects: [
2606 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
2607 ],
2583 - providers: [fakeProvider("github", { comment: () => Effect.die("must not be called") })],
2608 + providers: [
2609 + fakeProvider(SourceControlProviderKind.make("github"), {
2610 + comment: () => Effect.die("must not be called"),
2611 + }),
2612 + ],
2613 });
2614
2615 const error = yield* service
@@ -2606,11 +2635,11 @@ it.effect("refuses a verdict the host never claimed, without asking the provider
2635 title: "on gitlab",
2636 workspaceRoot: "/a",
2637 repository: "group/project",
2609 - provider: "gitlab",
2638 + provider: SourceControlProviderKind.make("gitlab"),
2639 }),
2640 ],
2641 providers: [
2613 - fakeProvider("gitlab", {
2642 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
2643 capabilities: {
2644 diff: true,
2645 comment: true,
@@ -2658,7 +2687,7 @@ it.effect("refuses line comments on a host that takes only a summary", () =>
2687 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
2688 ],
2689 providers: [
2661 - fakeProvider("github", {
2690 + fakeProvider(SourceControlProviderKind.make("github"), {
2691 capabilities: {
2692 diff: true,
2693 comment: true,
@@ -2704,7 +2733,7 @@ it.effect(
2733 }),
2734 ],
2735 providers: [
2707 - fakeProvider("github", {
2736 + fakeProvider(SourceControlProviderKind.make("github"), {
2737 submitReview: () => {
2738 approved = true;
2739 return Effect.void;
@@ -2736,7 +2765,7 @@ it.effect("refuses to resolve a conversation on a host that cannot", () =>
2765 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
2766 ],
2767 providers: [
2739 - fakeProvider("github", {
2768 + fakeProvider(SourceControlProviderKind.make("github"), {
2769 capabilities: {
2770 diff: true,
2771 comment: true,
@@ -2777,7 +2806,7 @@ it.effect("refuses to react on a host with no reactions", () =>
2806 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
2807 ],
2808 providers: [
2780 - fakeProvider("github", {
2809 + fakeProvider(SourceControlProviderKind.make("github"), {
2810 capabilities: {
2811 diff: true,
2812 comment: true,
@@ -2814,7 +2843,7 @@ it.effect("refuses to react on a host whose capabilities omit reactions entirely
2843 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
2844 ],
2845 providers: [
2817 - fakeProvider("github", {
2846 + fakeProvider(SourceControlProviderKind.make("github"), {
2847 capabilities: {
2848 diff: true,
2849 comment: true,
@@ -2855,7 +2884,7 @@ it.effect("passes a reaction through with its subject id on a host that has them
2884 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
2885 ],
2886 providers: [
2858 - fakeProvider("github", {
2887 + fakeProvider(SourceControlProviderKind.make("github"), {
2888 setReaction: (input) => {
2889 received = {
2890 subjectId: input.subjectId,
@@ -2888,7 +2917,7 @@ it.effect("invalidates the cached activity after reacting, like the other mutati
2917 const service = yield* makeService({
2918 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
2919 providers: [
2891 - fakeProvider("github", {
2920 + fakeProvider(SourceControlProviderKind.make("github"), {
2921 getChangeRequestActivity: () => {
2922 activityCalls += 1;
2923 return Effect.succeed({
@@ -2926,7 +2955,9 @@ it.effect("refuses an empty reply before it reaches the host", () =>
2955 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
2956 ],
2957 providers: [
2929 - fakeProvider("github", { replyToThread: () => Effect.die("must not be called") }),
2958 + fakeProvider(SourceControlProviderKind.make("github"), {
2959 + replyToThread: () => Effect.die("must not be called"),
2960 + }),
2961 ],
2962 });
2963
@@ -2952,7 +2983,7 @@ it.effect("refuses a merge strategy the host does not offer", () =>
2983 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
2984 ],
2985 providers: [
2955 - fakeProvider("github", {
2986 + fakeProvider(SourceControlProviderKind.make("github"), {
2987 capabilities: {
2988 diff: true,
2989 comment: true,
@@ -3005,7 +3036,7 @@ it.effect("hands the provider the host its repository lives on", () =>
3036 }),
3037 ],
3038 providers: [
3008 - fakeProvider("github", {
3039 + fakeProvider(SourceControlProviderKind.make("github"), {
3040 listChangeRequests: (input) => {
3041 hosts.push(input.host);
3042 return Effect.succeed({ items: [], truncated: false, continues: true });
@@ -3037,12 +3068,12 @@ it.effect("asks every host the reader's search, rather than filtering what came
3068 title: "on gitlab",
3069 workspaceRoot: "/b",
3070 repository: "group/project",
3040 - provider: "gitlab",
3071 + provider: SourceControlProviderKind.make("gitlab"),
3072 }),
3073 ],
3074 providers: [
3044 - fakeProvider("github", { listChangeRequests: listing }),
3045 - fakeProvider("gitlab", { listChangeRequests: listing }),
3075 + fakeProvider(SourceControlProviderKind.make("github"), { listChangeRequests: listing }),
3076 + fakeProvider(SourceControlProviderKind.make("gitlab"), { listChangeRequests: listing }),
3077 ],
3078 });
3079
@@ -3062,7 +3093,7 @@ it.effect("asks for no search when the reader has typed nothing", () =>
3093 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
3094 ],
3095 providers: [
3065 - fakeProvider("github", {
3096 + fakeProvider(SourceControlProviderKind.make("github"), {
3097 listChangeRequests: (input) => {
3098 asked.push(input.query);
3099 return Effect.succeed({ items: [], truncated: false, continues: true });
@@ -3098,13 +3129,13 @@ it.effect("asks another checkout who is signed in when the first one cannot answ
3129 }),
3130 ],
3131 providers: [
3101 - fakeProvider("github", {
3132 + fakeProvider(SourceControlProviderKind.make("github"), {
3133 getViewer: (input) => {
3134 asked.push(input.cwd);
3135 return input.cwd === "/gone"
3136 ? Effect.fail(
3137 new PullRequestProviderError({
3107 - provider: "github",
3138 + provider: SourceControlProviderKind.make("github"),
3139 operation: "getViewer",
3140 reason: "failed",
3141 detail: "not a git repository",
@@ -3138,7 +3169,7 @@ it.effect("refuses to ask for a review on a host that cannot, before any call is
3169 const service = yield* makeService({
3170 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3171 providers: [
3141 - fakeProvider("github", {
3172 + fakeProvider(SourceControlProviderKind.make("github"), {
3173 capabilities: {
3174 diff: true,
3175 comment: true,
@@ -3179,7 +3210,7 @@ it.effect("refuses the candidate list on a host that has no such list to give",
3210 const service = yield* makeService({
3211 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3212 providers: [
3182 - fakeProvider("github", {
3213 + fakeProvider(SourceControlProviderKind.make("github"), {
3214 capabilities: {
3215 diff: false,
3216 comment: false,
@@ -3215,7 +3246,7 @@ it.effect("refuses a review request this viewer may not make, and says what acce
3246 const service = yield* makeService({
3247 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3248 providers: [
3218 - fakeProvider("github", {
3249 + fakeProvider(SourceControlProviderKind.make("github"), {
3250 // The host asks for reviews; this account only reads the repository.
3251 getViewerPermissions: () =>
3252 Effect.succeed({
@@ -3254,7 +3285,7 @@ it.effect("keeps the menu from a viewer who may not ask, which is all it is for"
3285 const service = yield* makeService({
3286 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3287 providers: [
3257 - fakeProvider("github", {
3288 + fakeProvider(SourceControlProviderKind.make("github"), {
3289 getViewerPermissions: () =>
3290 Effect.succeed({
3291 actions: [],
@@ -3286,7 +3317,7 @@ it.effect("hands the host's own candidate list back, and asks for it with the ch
3317 const service = yield* makeService({
3318 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3319 providers: [
3289 - fakeProvider("github", {
3320 + fakeProvider(SourceControlProviderKind.make("github"), {
3321 listReviewerCandidates: (input) => {
3322 askedFor = input.number;
3323 return Effect.succeed({
@@ -3328,7 +3359,7 @@ it.effect("refuses a label change on a host that has not said it takes one", ()
3359 const service = yield* makeService({
3360 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3361 providers: [
3331 - fakeProvider("github", {
3362 + fakeProvider(SourceControlProviderKind.make("github"), {
3363 // The method is there; the capability that would let it be called is not.
3364 setLabels: () => {
3365 changed = true;
@@ -3360,8 +3391,11 @@ it.effect("refuses a label change this viewer may not make, and says what access
3391 const service = yield* makeService({
3392 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3393 providers: [
3363 - fakeProvider("github", {
3364 - capabilities: { ...fakeProvider("github").capabilities, labels: true },
3394 + fakeProvider(SourceControlProviderKind.make("github"), {
3395 + capabilities: {
3396 + ...fakeProvider(SourceControlProviderKind.make("github")).capabilities,
3397 + labels: true,
3398 + },
3399 getViewerPermissions: () =>
3400 Effect.succeed({
3401 actions: [],
@@ -3405,8 +3439,11 @@ it.effect("hands a label change to the host, and reads the labels back for the m
3439 const service = yield* makeService({
3440 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3441 providers: [
3408 - fakeProvider("github", {
3409 - capabilities: { ...fakeProvider("github").capabilities, labels: true },
3442 + fakeProvider(SourceControlProviderKind.make("github"), {
3443 + capabilities: {
3444 + ...fakeProvider(SourceControlProviderKind.make("github")).capabilities,
3445 + labels: true,
3446 + },
3447 listLabelCandidates: () =>
3448 Effect.succeed({
3449 candidates: [{ name: "bug", color: null, description: null, isApplied: false }],
@@ -3447,7 +3484,7 @@ it.effect("answers a repeated listing from cache, and concurrent readers share o
3484 const service = yield* makeService({
3485 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3486 providers: [
3450 - fakeProvider("github", {
3487 + fakeProvider(SourceControlProviderKind.make("github"), {
3488 listChangeRequests: () => {
3489 hostCalls += 1;
3490 return Effect.succeed({
@@ -3496,7 +3533,7 @@ it.effect.each(["list", "listStats"] as const)(
3533 project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" }),
3534 ],
3535 providers: [
3499 - fakeProvider("github", {
3536 + fakeProvider(SourceControlProviderKind.make("github"), {
3537 listChangeRequests: () =>
3538 lookup.pipe(
3539 Effect.as({
@@ -3545,7 +3582,7 @@ it.effect("shares one cold viewer lookup across distinct concurrent lists", () =
3582 const service = yield* makeService({
3583 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3584 providers: [
3548 - fakeProvider("github", {
3585 + fakeProvider(SourceControlProviderKind.make("github"), {
3586 getViewer: () =>
3587 Effect.sync(() => {
3588 viewerCalls += 1;
@@ -3583,7 +3620,7 @@ it.effect("uses five host reads for the normal indexed-repository page workflow"
3620 const service = yield* makeService({
3621 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3622 providers: [
3586 - fakeProvider("github", {
3623 + fakeProvider(SourceControlProviderKind.make("github"), {
3624 getViewer: () =>
3625 Effect.sync(() => {
3626 viewerCalls += 1;
@@ -3643,7 +3680,7 @@ it.effect("returns the refreshed listing on the first read after its cache expir
3680 const service = yield* makeService({
3681 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3682 providers: [
3646 - fakeProvider("github", {
3683 + fakeProvider(SourceControlProviderKind.make("github"), {
3684 listChangeRequests: () => {
3685 hostCalls += 1;
3686 return Effect.succeed({
@@ -3682,7 +3719,7 @@ it.effect("a listing narrowed to some projects is its own cache entry", () =>
3719 project({ id: "p2", title: "docs", workspaceRoot: "/b", repository: "acme/docs" }),
3720 ],
3721 providers: [
3685 - fakeProvider("github", {
3722 + fakeProvider(SourceControlProviderKind.make("github"), {
3723 listChangeRequestsAcross: (input) => {
3724 asked.push(input.repositories);
3725 return Effect.succeed({
@@ -3725,7 +3762,7 @@ it.effect(
3762 project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" }),
3763 ],
3764 providers: [
3728 - fakeProvider("github", {
3765 + fakeProvider(SourceControlProviderKind.make("github"), {
3766 listChangeRequests: ({ filters }) =>
3767 Effect.gen(function* () {
3768 reads += 1;
@@ -3782,7 +3819,7 @@ it.effect("keeps unrelated PRs warm after a mutation, explicit refresh, and proj
3819 project({ id: "p2", title: "docs", workspaceRoot: "/b", repository: "acme/docs" }),
3820 ],
3821 providers: [
3785 - fakeProvider("github", {
3822 + fakeProvider(SourceControlProviderKind.make("github"), {
3823 getChangeRequest: (input) =>
3824 Effect.sync(() => {
3825 calls.push(`${input.repository}/${input.number}`);
@@ -3827,7 +3864,7 @@ it.effect(
3864 }),
3865 ],
3866 providers: [
3830 - fakeProvider("github", {
3867 + fakeProvider(SourceControlProviderKind.make("github"), {
3868 getChangeRequest: (input) =>
3869 Effect.sync(() => {
3870 hosts.push(input.host);
@@ -3858,7 +3895,7 @@ it.effect("does not revive old summaries when project epochs are evicted", () =>
3895 const service = yield* makeService({
3896 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3897 providers: [
3861 - fakeProvider("github", {
3898 + fakeProvider(SourceControlProviderKind.make("github"), {
3899 getChangeRequest: () => Effect.succeed({ ...hostedChangeRequest("body"), title }),
3900 }),
3901 ],
@@ -3882,7 +3919,7 @@ it.effect("explicit and turn invalidations make the next listing ask the host ag
3919 const service = yield* makeService({
3920 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
3921 providers: [
3885 - fakeProvider("github", {
3922 + fakeProvider(SourceControlProviderKind.make("github"), {
3923 getViewer: () => {
3924 viewerCalls += 1;
3925 return Effect.succeed("bilal");
@@ -3924,7 +3961,7 @@ it.effect("close and reopen notify subscribed readers after invalidating their c
3961 project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" }),
3962 ],
3963 providers: [
3927 - fakeProvider("github", {
3964 + fakeProvider(SourceControlProviderKind.make("github"), {
3965 getChangeRequestSummary: () =>
3966 Effect.succeed({ ...changeRequest(1, "2026-09-16T00:00:00.000Z"), state }),
3967 runAction: (input) =>
@@ -3976,7 +4013,7 @@ it.effect("explicit invalidation refreshes origin readers after a routed host mu
4013 project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" }),
4014 ],
4015 providers: [
3979 - fakeProvider("github", {
4016 + fakeProvider(SourceControlProviderKind.make("github"), {
4017 getChangeRequestSummary: () =>
4018 Effect.succeed({ ...changeRequest(1, "2026-09-16T00:00:00.000Z"), state }),
4019 }),
@@ -4021,7 +4058,7 @@ it.effect("does not cache a failed listing", () =>
4058 const service = yield* makeService({
4059 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
4060 providers: [
4024 - fakeProvider("github", {
4061 + fakeProvider(SourceControlProviderKind.make("github"), {
4062 // The viewer lookup is what fails the whole listing rather than one repository.
4063 getViewer: () => {
4064 hostCalls += 1;
@@ -4052,11 +4089,11 @@ it.effect("reads a host's repositories in one search, and files the rows back un
4089 title: "on gitlab",
4090 workspaceRoot: "/c",
4091 repository: "group/project",
4055 - provider: "gitlab",
4092 + provider: SourceControlProviderKind.make("gitlab"),
4093 }),
4094 ],
4095 providers: [
4059 - fakeProvider("github", {
4096 + fakeProvider(SourceControlProviderKind.make("github"), {
4097 listChangeRequests: ({ repository }) => {
4098 separately.push(repository);
4099 return Effect.succeed({ items: [], truncated: false, continues: true });
@@ -4073,7 +4110,7 @@ it.effect("reads a host's repositories in one search, and files the rows back un
4110 },
4111 }),
4112 // A host with no search across repositories keeps being asked one at a time.
4076 - fakeProvider("gitlab", {
4113 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
4114 listChangeRequests: ({ repository }) => {
4115 separately.push(repository);
4116 return Effect.succeed({
@@ -4111,7 +4148,7 @@ it.effect("carries every repository of a slice on from the oldest row in it", ()
4148 project({ id: "p3", title: "docs", workspaceRoot: "/c", repository: "acme/docs" }),
4149 ],
4150 providers: [
4114 - fakeProvider("github", {
4151 + fakeProvider(SourceControlProviderKind.make("github"), {
4152 listChangeRequestsAcross: () =>
4153 Effect.succeed({
4154 items: [
@@ -4144,7 +4181,7 @@ it.effect("carries a slice on without sending the rows it already sent", () =>
4181 const service = yield* makeService({
4182 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
4183 providers: [
4147 - fakeProvider("github", {
4184 + fakeProvider(SourceControlProviderKind.make("github"), {
4185 listChangeRequestsAcross: (input) => {
4186 cursors.push(input.cursor);
4187 return Effect.succeed({
@@ -4189,7 +4226,7 @@ it.effect("reads a workspace larger than one search in chunks, and merges them",
4226 }),
4227 ),
4228 providers: [
4192 - fakeProvider("github", {
4229 + fakeProvider(SourceControlProviderKind.make("github"), {
4230 listChangeRequestsAcross: (input) => {
4231 asked.push(input.repositories.length);
4232 return Effect.succeed({
@@ -4218,7 +4255,7 @@ it.effect("asks on its own for a repository a search answered nothing for", () =
4255 project({ id: "p2", title: "docs", workspaceRoot: "/b", repository: "acme/docs" }),
4256 ],
4257 providers: [
4221 - fakeProvider("github", {
4258 + fakeProvider(SourceControlProviderKind.make("github"), {
4259 listChangeRequests: ({ repository }) => {
4260 separately.push(repository);
4261 return repository === "acme/docs"
@@ -4262,7 +4299,7 @@ it.effect("reads the repositories one at a time when the search itself fails", (
4299 project({ id: "p2", title: "docs", workspaceRoot: "/b", repository: "acme/docs" }),
4300 ],
4301 providers: [
4265 - fakeProvider("github", {
4302 + fakeProvider(SourceControlProviderKind.make("github"), {
4303 listChangeRequests: ({ repository }) => {
4304 separately.push(repository);
4305 return Effect.succeed({
@@ -4295,11 +4332,11 @@ it.effect("fills in the line counts for the rows it is given", () =>
4332 title: "on gitlab",
4333 workspaceRoot: "/b",
4334 repository: "group/project",
4298 - provider: "gitlab",
4335 + provider: SourceControlProviderKind.make("gitlab"),
4336 }),
4337 ],
4338 providers: [
4302 - fakeProvider("github", {
4339 + fakeProvider(SourceControlProviderKind.make("github"), {
4340 listChangeRequestStats: (input) => {
4341 asked.push(input.changeRequests);
4342 return Effect.succeed([
@@ -4308,7 +4345,7 @@ it.effect("fills in the line counts for the rows it is given", () =>
4345 },
4346 }),
4347 // Its listing carries the counts already, so it has nothing to be asked.
4311 - fakeProvider("gitlab"),
4348 + fakeProvider(SourceControlProviderKind.make("gitlab")),
4349 ],
4350 });
4351
@@ -4355,7 +4392,7 @@ it.effect(
4392 project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" }),
4393 ],
4394 providers: [
4358 - fakeProvider("github", {
4395 + fakeProvider(SourceControlProviderKind.make("github"), {
4396 listChangeRequestStats: (input) => {
4397 asked.push(input.changeRequests.map((ref) => ref.number));
4398 return Effect.succeed(
@@ -4404,7 +4441,7 @@ it.effect("reads the fresh diff when detail or summary discovers a changed revis
4441 const service = yield* makeService({
4442 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
4443 providers: [
4407 - fakeProvider("github", {
4444 + fakeProvider(SourceControlProviderKind.make("github"), {
4445 getChangeRequest: () =>
4446 Effect.sync(() => ({ ...hostedChangeRequest("body"), updatedAt: revision })),
4447 getChangeRequestSummary: () =>
@@ -4453,7 +4490,9 @@ it.effect("keeps the rows when the line counts cannot be read", () =>
4490 const service = yield* makeService({
4491 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
4492 providers: [
4456 - fakeProvider("github", { listChangeRequestStats: () => Effect.fail(requestFailed) }),
4493 + fakeProvider(SourceControlProviderKind.make("github"), {
4494 + listChangeRequestStats: () => Effect.fail(requestFailed),
4495 + }),
4496 ],
4497 });
4498
@@ -4478,7 +4517,7 @@ it.effect(
4517 project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" }),
4518 ],
4519 providers: [
4481 - fakeProvider("github", {
4520 + fakeProvider(SourceControlProviderKind.make("github"), {
4521 listChangeRequestStats: () => {
4522 statsCalls += 1;
4523 return Effect.succeed([]);
@@ -4556,7 +4595,7 @@ it.effect("shares linked summaries and reuses them for display without asking th
4595 const service = yield* makeService({
4596 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
4597 providers: [
4559 - fakeProvider("github", {
4598 + fakeProvider(SourceControlProviderKind.make("github"), {
4599 getChangeRequestSummary: () =>
4600 Effect.sync(() => {
4601 calls += 1;
@@ -4567,7 +4606,7 @@ it.effect("shares linked summaries and reuses them for display without asking th
4606 shouldFail
4607 ? Effect.fail(
4608 new PullRequestProviderError({
4570 - provider: "github",
4609 + provider: SourceControlProviderKind.make("github"),
4610 operation: "getChangeRequestSummary",
4611 reason: "failed",
4612 detail: "HTTP 504",
@@ -4622,8 +4661,11 @@ it.effect("keeps routed reads separate when the GitHub account changes", () =>
4661 project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" }),
4662 ],
4663 providers: [
4625 - fakeProvider("github", {
4626 - capabilities: { ...fakeProvider("github").capabilities, viewedFiles: "host" },
4664 + fakeProvider(SourceControlProviderKind.make("github"), {
4665 + capabilities: {
4666 + ...fakeProvider(SourceControlProviderKind.make("github")).capabilities,
4667 + viewedFiles: "host",
4668 + },
4669 getFilesViewed: () =>
4670 read().pipe(
4671 Effect.as({
@@ -4685,8 +4727,11 @@ it.effect("isolates routed caches for two credentials belonging to the same acco
4727 project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" }),
4728 ],
4729 providers: [
4688 - fakeProvider("github", {
4689 - capabilities: { ...fakeProvider("github").capabilities, viewedFiles: "host" },
4730 + fakeProvider(SourceControlProviderKind.make("github"), {
4731 + capabilities: {
4732 + ...fakeProvider(SourceControlProviderKind.make("github")).capabilities,
4733 + viewedFiles: "host",
4734 + },
4735 getFilesViewed: () =>
4736 read().pipe(
4737 Effect.as({
@@ -4744,7 +4789,7 @@ it.effect("rejects mismatched routing credentials before use and preserves actio
4789 const service = yield* makeService({
4790 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
4791 providers: [
4747 - fakeProvider("github", {
4792 + fakeProvider(SourceControlProviderKind.make("github"), {
4793 getRoutingIdentity: () => Effect.succeed({ accountId: "101", viewer: "octocat" }),
4794 withVerifiedCredential: (_, use) =>
4795 use({
@@ -4798,7 +4843,7 @@ it.effect("answers a known pull request immediately while the host refreshes", (
4843 const service = yield* makeService({
4844 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
4845 providers: [
4801 - fakeProvider("github", {
4846 + fakeProvider(SourceControlProviderKind.make("github"), {
4847 getChangeRequest: () =>
4848 Effect.gen(function* () {
4849 calls += 1;
@@ -4829,7 +4874,7 @@ it.effect("does not ask the host again for a linked summary it already holds", (
4874 const service = yield* makeService({
4875 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
4876 providers: [
4832 - fakeProvider("github", {
4877 + fakeProvider(SourceControlProviderKind.make("github"), {
4878 getChangeRequestSummary: () =>
4879 Effect.sync(() => {
4880 calls += 1;
@@ -4858,7 +4903,7 @@ it.effect(
4903 project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" }),
4904 ],
4905 providers: [
4861 - fakeProvider("github", {
4906 + fakeProvider(SourceControlProviderKind.make("github"), {
4907 getChangeRequestSummary: () =>
4908 Effect.succeed({
4909 ...changeRequest(1, "2026-07-02T00:00:00Z"),
@@ -4896,7 +4941,7 @@ it.effect("reuses an observed merged state for strict settlement reads", () =>
4941 const service = yield* makeService({
4942 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
4943 providers: [
4899 - fakeProvider("github", {
4944 + fakeProvider(SourceControlProviderKind.make("github"), {
4945 getChangeRequest: () =>
4946 Effect.succeed({
4947 ...hostedChangeRequest("merged body", 4),
@@ -4927,7 +4972,7 @@ it.effect("announces state a detail read sees first or newly", () =>
4972 const service = yield* makeService({
4973 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
4974 providers: [
4930 - fakeProvider("github", {
4975 + fakeProvider(SourceControlProviderKind.make("github"), {
4976 getChangeRequest: () => Effect.succeed({ ...hostedChangeRequest("body"), ...detail }),
4977 getChangeRequestSummary: () =>
4978 Effect.succeed({
@@ -4979,7 +5024,7 @@ it.effect("announces a reported state without trusting it", () =>
5024 const service = yield* makeService({
5025 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5026 providers: [
4982 - fakeProvider("github", {
5027 + fakeProvider(SourceControlProviderKind.make("github"), {
5028 getChangeRequest: () => Effect.succeed({ ...hostedChangeRequest("body"), ...detail }),
5029 }),
5030 ],
@@ -5024,7 +5069,7 @@ it.effect("does not let a stale detail reopen overwrite a fresher linked summary
5069 const service = yield* makeService({
5070 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5071 providers: [
5027 - fakeProvider("github", {
5072 + fakeProvider(SourceControlProviderKind.make("github"), {
5073 getChangeRequest: () =>
5074 Effect.gen(function* () {
5075 detailCalls += 1;
@@ -5078,7 +5123,7 @@ it.effect("does not let a still-cached detail overwrite a fresher linked summary
5123 const service = yield* makeService({
5124 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5125 providers: [
5081 - fakeProvider("github", {
5126 + fakeProvider(SourceControlProviderKind.make("github"), {
5127 getChangeRequest: () => Effect.succeed(hostedChangeRequest("old body", 4)),
5128 getChangeRequestSummary: () =>
5129 Effect.succeed({
@@ -5114,11 +5159,11 @@ it.effect("tells the client when the host has no pull request under that number"
5159 const service = yield* makeService({
5160 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5161 providers: [
5117 - fakeProvider("github", {
5162 + fakeProvider(SourceControlProviderKind.make("github"), {
5163 getChangeRequest: () =>
5164 Effect.fail(
5165 new PullRequestProviderError({
5121 - provider: "github",
5166 + provider: SourceControlProviderKind.make("github"),
5167 operation: "getChangeRequest",
5168 reason: "not-found",
5169 detail: "Pull request not found. Check the PR number or URL and try again.",
@@ -5142,12 +5187,12 @@ it.effect("keeps recent detail on a transient refresh failure but not after inva
5187 const service = yield* makeService({
5188 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5189 providers: [
5145 - fakeProvider("github", {
5190 + fakeProvider(SourceControlProviderKind.make("github"), {
5191 getChangeRequest: () =>
5192 failing
5193 ? Effect.fail(
5194 new PullRequestProviderError({
5150 - provider: "github",
5195 + provider: SourceControlProviderKind.make("github"),
5196 operation: "getChangeRequest",
5197 reason: "failed",
5198 detail: "spawn gh EAGAIN",
@@ -5197,7 +5242,7 @@ it.effect("carries an armed auto-merge through to the detail, and silence as sil
5242 project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" }),
5243 ],
5244 providers: [
5200 - fakeProvider("github", {
5245 + fakeProvider(SourceControlProviderKind.make("github"), {
5246 getChangeRequest: () =>
5247 Effect.succeed({
5248 ...changeRequest(1, "2026-07-02T00:00:00Z"),
@@ -5243,13 +5288,13 @@ it.effect("narrows the rows of a host that ignored the filters it was handed", (
5288 title: "web",
5289 workspaceRoot: "/a",
5290 repository: "acme/web",
5246 - provider: "gitlab",
5291 + provider: SourceControlProviderKind.make("gitlab"),
5292 }),
5293 ],
5294 providers: [
5295 // Only GitHub narrows a listing for itself; every other host answers unnarrowed, and
5296 // sending it a draft filter it quietly ignores used to put drafts on a filtered page.
5252 - fakeProvider("gitlab", {
5297 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
5298 listChangeRequests: () =>
5299 Effect.succeed({
5300 items: [
@@ -5285,11 +5330,11 @@ it.effect("keeps a row of a host that ignored the filters if any name of a label
5330 title: "web",
5331 workspaceRoot: "/a",
5332 repository: "acme/web",
5288 - provider: "gitlab",
5333 + provider: SourceControlProviderKind.make("gitlab"),
5334 }),
5335 ],
5336 providers: [
5292 - fakeProvider("gitlab", {
5337 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
5338 listChangeRequests: () =>
5339 Effect.succeed({
5340 items: [
@@ -5328,13 +5373,13 @@ it.effect('resolves an author filter of "me" to the viewer before narrowing a ho
5373 title: "web",
5374 workspaceRoot: "/a",
5375 repository: "acme/web",
5331 - provider: "gitlab",
5376 + provider: SourceControlProviderKind.make("gitlab"),
5377 }),
5378 ],
5379 providers: [
5380 // Only GitHub narrows a listing for itself, so this fixture's "me" has to be resolved
5381 // locally too — the same helper both call sites lean on.
5337 - fakeProvider("gitlab", {
5382 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
5383 listChangeRequests: () =>
5384 Effect.succeed({
5385 items: [
@@ -5395,7 +5440,7 @@ it.effect.each([false, true])(
5440 }),
5441 ],
5442 providers: [
5398 - fakeProvider("github", {
5443 + fakeProvider(SourceControlProviderKind.make("github"), {
5444 capabilities,
5445 getViewerPermissions: () =>
5446 Effect.succeed({
@@ -5463,7 +5508,7 @@ it.effect("refuses a way of updating a branch that the host or the viewer does n
5508 const service = yield* makeService({
5509 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5510 providers: [
5466 - fakeProvider("github", {
5511 + fakeProvider(SourceControlProviderKind.make("github"), {
5512 capabilities: {
5513 diff: true,
5514 comment: true,
@@ -5516,11 +5561,11 @@ it.effect("refuses to merge a target branch into a source branch on a host that
5561 title: "on gitlab",
5562 workspaceRoot: "/a",
5563 repository: "group/project",
5519 - provider: "gitlab",
5564 + provider: SourceControlProviderKind.make("gitlab"),
5565 }),
5566 ],
5567 providers: [
5523 - fakeProvider("gitlab", {
5568 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
5569 capabilities: {
5570 diff: true,
5571 comment: true,
@@ -5575,12 +5620,12 @@ it.effect("judges the review filter only on a host that summarises its reviews",
5620 title: "on gitlab",
5621 workspaceRoot: "/b",
5622 repository: "group/project",
5578 - provider: "gitlab",
5623 + provider: SourceControlProviderKind.make("gitlab"),
5624 }),
5625 ],
5626 providers: [
5627 // GitHub answers with the field on every row: null is "nobody has decided yet".
5583 - fakeProvider("github", {
5628 + fakeProvider(SourceControlProviderKind.make("github"), {
5629 listChangeRequests: () =>
5630 Effect.succeed({
5631 items: [
@@ -5595,7 +5640,7 @@ it.effect("judges the review filter only on a host that summarises its reviews",
5640 }),
5641 }),
5642 // GitLab never supplies the field, so its rows are not the filter's to judge.
5598 - fakeProvider("gitlab", {
5643 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
5644 listChangeRequests: () =>
5645 Effect.succeed({
5646 items: [changeRequest(3, "2026-07-02T00:00:00Z")],
@@ -5621,7 +5666,7 @@ it.effect("sends only the words a rewrite carries", () =>
5666 const service = yield* makeService({
5667 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5668 providers: [
5624 - fakeProvider("github", {
5669 + fakeProvider(SourceControlProviderKind.make("github"), {
5670 updateChangeRequest: (input) => {
5671 received.push({ title: input.title, body: input.body });
5672 return Effect.void;
@@ -5647,7 +5692,9 @@ it.effect("refuses a rewrite that changes nothing, before any call is made", ()
5692 const service = yield* makeService({
5693 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5694 providers: [
5650 - fakeProvider("github", { updateChangeRequest: () => Effect.die("must not be called") }),
5695 + fakeProvider(SourceControlProviderKind.make("github"), {
5696 + updateChangeRequest: () => Effect.die("must not be called"),
5697 + }),
5698 ],
5699 });
5700
@@ -5665,7 +5712,7 @@ it.effect("refuses to rewrite anything on a host that never claimed it", () =>
5712 const service = yield* makeService({
5713 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5714 providers: [
5668 - fakeProvider("github", {
5715 + fakeProvider(SourceControlProviderKind.make("github"), {
5716 capabilities: {
5717 diff: true,
5718 comment: true,
@@ -5704,7 +5751,7 @@ it.effect("passes a rewritten remark through with the id and kind it arrived und
5751 const service = yield* makeService({
5752 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5753 providers: [
5707 - fakeProvider("github", {
5754 + fakeProvider(SourceControlProviderKind.make("github"), {
5755 updateComment: (input) => {
5756 received = { id: input.commentId, kind: input.kind, body: input.body };
5757 return Effect.void;
@@ -5735,7 +5782,9 @@ it.effect("refuses a remark rewritten into nothing but whitespace", () =>
5782 const service = yield* makeService({
5783 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5784 providers: [
5738 - fakeProvider("github", { updateComment: () => Effect.die("must not be called") }),
5785 + fakeProvider(SourceControlProviderKind.make("github"), {
5786 + updateComment: () => Effect.die("must not be called"),
5787 + }),
5788 ],
5789 });
5790
@@ -5761,7 +5810,7 @@ it.effect("forgets the cached detail after a rewrite or terminal turn", () =>
5810 const service = yield* makeService({
5811 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5812 providers: [
5764 - fakeProvider("github", {
5813 + fakeProvider(SourceControlProviderKind.make("github"), {
5814 getChangeRequest: () => {
5815 coreCalls += 1;
5816 return Effect.succeed({
@@ -5813,7 +5862,7 @@ it.effect("names the signed-in account in the detail, and says nothing where the
5862 number: 1,
5863 });
5864 });
5816 - const readable = fakeProvider("github", {
5865 + const readable = fakeProvider(SourceControlProviderKind.make("github"), {
5866 getChangeRequest: () =>
5867 Effect.succeed({
5868 ...changeRequest(1, "2026-07-02T00:00:00Z"),
@@ -5837,7 +5886,8 @@ it.effect("names the signed-in account in the detail, and says nothing where the
5886 const named = yield* detailFrom(readable);
5887 const unnamed = yield* detailFrom({
5888 ...readable,
5840 - getViewer: () => Effect.fail(unusable("github", "unauthenticated")),
5889 + getViewer: () =>
5890 + Effect.fail(unusable(SourceControlProviderKind.make("github"), "unauthenticated")),
5891 });
5892
5893 assert.strictEqual(named.viewer, "bilal");
@@ -5855,7 +5905,7 @@ it.effect("keeps the diff cached across a file being ticked off", () =>
5905 project({ id: "p1", title: "t3code", workspaceRoot: "/a", repository: "pingdotgg/t3code" }),
5906 ],
5907 providers: [
5858 - fakeProvider("github", {
5908 + fakeProvider(SourceControlProviderKind.make("github"), {
5909 capabilities: {
5910 diff: true,
5911 comment: true,
@@ -5912,7 +5962,7 @@ it.effect("returns large diff slices intact without retaining them in either cac
5962 const service = yield* makeService({
5963 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
5964 providers: [
5915 - fakeProvider("github", {
5965 + fakeProvider(SourceControlProviderKind.make("github"), {
5966 getDiff: () =>
5967 Effect.sync(() => {
5968 reads += 1;
@@ -5950,7 +6000,7 @@ it.effect("caches a small replacement after releasing a large diff", () =>
6000 const service = yield* makeService({
6001 projects: [project({ id: "p1", title: "web", workspaceRoot: "/a", repository: "acme/web" })],
6002 providers: [
5953 - fakeProvider("github", {
6003 + fakeProvider(SourceControlProviderKind.make("github"), {
6004 getDiff: () =>
6005 Effect.sync(() => {
6006 reads += 1;
@@ -5976,7 +6026,7 @@ const environmentViewedProvider = (
6026 asked: Array<ReadonlyArray<string>>,
6027 unreadable: ReadonlySet<string> = new Set(),
6028 ) =>
5979 - fakeProvider("gitlab", {
6029 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
6030 capabilities: {
6031 diff: true,
6032 comment: true,
@@ -6018,7 +6068,7 @@ const environmentViewedService = (
6068 title: "on gitlab",
6069 workspaceRoot: "/a",
6070 repository: "group/project",
6021 - provider: "gitlab",
6071 + provider: SourceControlProviderKind.make("gitlab"),
6072 }),
6073 ],
6074 providers: [environmentViewedProvider(revisions, asked, unreadable)],
@@ -6083,7 +6133,7 @@ it.effect("tracks Forgejo viewed files through its diff and refuses truncated ba
6133 title: "on forgejo",
6134 workspaceRoot: "/forgejo",
6135 repository: "reviewer/project",
6086 - provider: "forgejo",
6136 + provider: SourceControlProviderKind.make("forgejo"),
6137 host: "forge.example:3000",
6138 remoteUrl: "http://forge.example:3000/reviewer/project.git",
6139 }),
@@ -6145,7 +6195,7 @@ it.effect("keeps hosted Forgejo marks with their repository instead of the servi
6195 title: "first repository",
6196 workspaceRoot: "/first",
6197 repository: "reviewer/first",
6148 - provider: "forgejo",
6198 + provider: SourceControlProviderKind.make("forgejo"),
6199 host: "forge.example",
6200 remoteUrl: "https://forge.example:3000/reviewer/first.git",
6201 }),
@@ -6153,13 +6203,20 @@ it.effect("keeps hosted Forgejo marks with their repository instead of the servi
6203 const service = yield* makeService({
6204 projects,
6205 providers: [
6156 - { ...environmentViewedProvider(new Map([["same.ts", "blob"]]), []), kind: "forgejo" },
6206 + {
6207 + ...environmentViewedProvider(new Map([["same.ts", "blob"]]), []),
6208 + kind: SourceControlProviderKind.make("forgejo"),
6209 + },
6210 ],
6211 resolveHandle: ({ context }) =>
6212 Effect.succeed({
6213 context: {
6214 ...context!,
6162 - provider: { kind: "forgejo", name: "Forgejo", baseUrl: "https://forge.example:3000" },
6215 + provider: {
6216 + kind: SourceControlProviderKind.make("forgejo"),
6217 + name: "Forgejo",
6218 + baseUrl: "https://forge.example:3000",
6219 + },
6220 },
6221 provider: undefined as never,
6222 }),
@@ -6186,7 +6243,7 @@ it.effect("keeps hosted Forgejo marks with their repository instead of the servi
6243 title: "second repository",
6244 workspaceRoot: "/second",
6245 repository: "reviewer/second",
6189 - provider: "forgejo",
6246 + provider: SourceControlProviderKind.make("forgejo"),
6247 host: "forge.example",
6248 remoteUrl: "https://forge.example:3000/reviewer/second.git",
6249 }),
@@ -6201,7 +6258,7 @@ it.effect("keeps hosted Forgejo marks with their repository instead of the servi
6258 title: "second repository over SSH",
6259 workspaceRoot: "/ssh",
6260 repository: "reviewer/second",
6204 - provider: "forgejo",
6261 + provider: SourceControlProviderKind.make("forgejo"),
6262 host: "ssh.forge.example",
6263 remoteUrl: "git@ssh.forge.example:reviewer/second.git",
6264 }),
@@ -6269,7 +6326,7 @@ it.effect("holds what a whole-change answer carried, so the next tick reads noth
6326 title: "on gitlab",
6327 workspaceRoot: "/a",
6328 repository: "group/project",
6272 - provider: "gitlab",
6329 + provider: SourceControlProviderKind.make("gitlab"),
6330 }),
6331 ],
6332 providers: [
@@ -6643,11 +6700,11 @@ it.effect("still reports its own marks when the host will not say what the head
6700 title: "on gitlab",
6701 workspaceRoot: "/a",
6702 repository: "group/project",
6646 - provider: "gitlab",
6703 + provider: SourceControlProviderKind.make("gitlab"),
6704 }),
6705 ],
6706 providers: [
6650 - fakeProvider("gitlab", {
6707 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
6708 capabilities: {
6709 diff: true,
6710 comment: true,
@@ -6699,11 +6756,11 @@ it.effect("finishes two presses on one file in the order they were made", () =>
6756 title: "on gitlab",
6757 workspaceRoot: "/a",
6758 repository: "group/project",
6702 - provider: "gitlab",
6759 + provider: SourceControlProviderKind.make("gitlab"),
6760 }),
6761 ],
6762 providers: [
6706 - fakeProvider("gitlab", {
6763 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
6764 capabilities: {
6765 diff: true,
6766 comment: true,
@@ -6755,7 +6812,7 @@ const azureViewedService = (projects: ReadonlyArray<OrchestrationProjectShell>)
6812 makeService({
6813 projects,
6814 providers: [
6758 - fakeProvider("azure-devops", {
6815 + fakeProvider(SourceControlProviderKind.make("azure-devops"), {
6816 capabilities: {
6817 diff: true,
6818 comment: true,
@@ -6781,7 +6838,7 @@ const AZURE_PAIR = [
6838 title: "platform web",
6839 workspaceRoot: "/a",
6840 repository: "acme/platform/_git/web",
6784 - provider: "azure-devops",
6841 + provider: SourceControlProviderKind.make("azure-devops"),
6842 host: "dev.azure.com",
6843 }),
6844 project({
@@ -6789,7 +6846,7 @@ const AZURE_PAIR = [
6846 title: "other web",
6847 workspaceRoot: "/b",
6848 repository: "acme/other/_git/web",
6792 - provider: "azure-devops",
6849 + provider: SourceControlProviderKind.make("azure-devops"),
6850 host: "dev.azure.com",
6851 }),
6852 ];
@@ -6880,7 +6937,7 @@ it.effect("keeps the marked paths when a whole-change answer is wider than the c
6937 title: "on gitlab",
6938 workspaceRoot: "/a",
6939 repository: "group/project",
6883 - provider: "gitlab",
6940 + provider: SourceControlProviderKind.make("gitlab"),
6941 }),
6942 ],
6943 providers: [
@@ -6949,7 +7006,7 @@ const environmentViewedServiceWithViewer = (
7006 title: "on gitlab",
7007 workspaceRoot: "/a",
7008 repository: "group/project",
6952 - provider: "gitlab",
7009 + provider: SourceControlProviderKind.make("gitlab"),
7010 }),
7011 ],
7012 providers: [{ ...environmentViewedProvider(revisions, []), getViewer }],
@@ -6983,7 +7040,7 @@ it.effect("puts a listing and a press for one host on a single viewer lookup", (
7040 title: "on gitlab",
7041 workspaceRoot: "/a",
7042 repository: "group/project",
6986 - provider: "gitlab",
7043 + provider: SourceControlProviderKind.make("gitlab"),
7044 }),
7045 ],
7046 providers: [
@@ -7048,7 +7105,7 @@ it.effect("records a press while the host is backing off", () =>
7105 title: "on gitlab",
7106 workspaceRoot: "/a",
7107 repository: "group/project",
7051 - provider: "gitlab",
7108 + provider: SourceControlProviderKind.make("gitlab"),
7109 }),
7110 ],
7111 providers: [
@@ -7064,7 +7121,7 @@ it.effect("records a press while the host is backing off", () =>
7121 getFileRevisions: () =>
7122 Effect.fail(
7123 new PullRequestProviderError({
7067 - provider: "gitlab",
7124 + provider: SourceControlProviderKind.make("gitlab"),
7125 operation: "getFileRevisions",
7126 reason: "rate-limited",
7127 detail: "API rate limit exceeded.",
@@ -7111,7 +7168,7 @@ it.effect("asks who is reading through a pause only for the press that is waitin
7168 title: "on gitlab",
7169 workspaceRoot: "/a",
7170 repository: "group/project",
7114 - provider: "gitlab",
7171 + provider: SourceControlProviderKind.make("gitlab"),
7172 }),
7173 ],
7174 providers: [
@@ -7129,7 +7186,7 @@ it.effect("asks who is reading through a pause only for the press that is waitin
7186 getFileRevisions: () =>
7187 Effect.fail(
7188 new PullRequestProviderError({
7132 - provider: "gitlab",
7189 + provider: SourceControlProviderKind.make("gitlab"),
7190 operation: "getFileRevisions",
7191 reason: "rate-limited",
7192 detail: "API rate limit exceeded.",
@@ -7174,7 +7231,7 @@ it.effect("does not ask a paused host who is reading again after the ask failed"
7231 title: "on gitlab",
7232 workspaceRoot: "/a",
7233 repository: "group/project",
7177 - provider: "gitlab",
7234 + provider: SourceControlProviderKind.make("gitlab"),
7235 }),
7236 ],
7237 providers: [
@@ -7185,7 +7242,7 @@ it.effect("does not ask a paused host who is reading again after the ask failed"
7242 viewerLookups += 1;
7243 return Effect.fail(
7244 new PullRequestProviderError({
7188 - provider: "gitlab",
7245 + provider: SourceControlProviderKind.make("gitlab"),
7246 operation: "getViewer",
7247 reason: "failed",
7248 detail: "glab exited with status 1",
@@ -7197,7 +7254,7 @@ it.effect("does not ask a paused host who is reading again after the ask failed"
7254 runAction: () =>
7255 Effect.fail(
7256 new PullRequestProviderError({
7200 - provider: "gitlab",
7257 + provider: SourceControlProviderKind.make("gitlab"),
7258 operation: "runAction",
7259 reason: "rate-limited",
7260 detail: "API rate limit exceeded.",
@@ -7231,7 +7288,7 @@ it.effect("refuses the marks when the host could not be asked who is reading", (
7288 ? Effect.succeed("bilal")
7289 : Effect.fail(
7290 new PullRequestProviderError({
7234 - provider: "gitlab",
7291 + provider: SourceControlProviderKind.make("gitlab"),
7292 operation: "getViewer",
7293 reason: "failed",
7294 detail: "glab exited with status 1",
@@ -7276,11 +7333,11 @@ it.effect("refuses to track viewed files on a host that does not", () =>
7333 title: "on gitlab",
7334 workspaceRoot: "/a",
7335 repository: "group/project",
7279 - provider: "gitlab",
7336 + provider: SourceControlProviderKind.make("gitlab"),
7337 }),
7338 ],
7339 providers: [
7283 - fakeProvider("gitlab", {
7340 + fakeProvider(SourceControlProviderKind.make("gitlab"), {
7341 getFilesViewed: () => Effect.die("must not be called"),
7342 setFilesViewed: () => Effect.die("must not be called"),
7343 }),
@@ -7308,12 +7365,12 @@ it.effect("keeps Azure continuation cursors separate for repositories with the s
7365 title: organization,
7366 workspaceRoot: `/${organization}`,
7367 repository: `${organization}/project/_git/web`,
7311 - provider: "azure-devops",
7368 + provider: SourceControlProviderKind.make("azure-devops"),
7369 host: "dev.azure.com",
7370 }),
7371 ),
7372 providers: [
7316 - fakeProvider("azure-devops", {
7373 + fakeProvider(SourceControlProviderKind.make("azure-devops"), {
7374 listChangeRequests: (input) =>
7375 Effect.sync(() => {
7376 seen.push(input.cwd);
@@ -7363,9 +7420,9 @@ it.effect.each([
7420 },
7421 },
7422 providers: [
7366 - fakeProvider("github", {
7423 + fakeProvider(SourceControlProviderKind.make("github"), {
7424 capabilities: {
7368 - ...fakeProvider("github").capabilities,
7425 + ...fakeProvider(SourceControlProviderKind.make("github")).capabilities,
7426 actions: ["merge", "enable-auto-merge"],
7427 },
7428 getChangeRequestSummary: () => Effect.succeed(changeRequest(1, "2026-07-02T00:00:00Z")),
apps/server/src/pullRequest/PullRequestService.ts
+7 -4
@@ -72,7 +72,7 @@ import {
72 type PullRequestThreadCommentsResult,
73 type PullRequestUpdateInput,
74 type SourceControlProviderInfo,
75 - type SourceControlProviderKind,
75 + SourceControlProviderKind,
76 type ThreadPullRequestKey,
77 } from "@t3tools/contracts";
78 import { resolveProjectSettings } from "@t3tools/shared/projectSettings";
@@ -736,14 +736,15 @@ export const make = Effect.gen(function* () {
736 sourceControlRepositorySelector(project.repositoryIdentity) === null
737 )
738 continue;
739 - const host = pullRequestHostOf(identity, "unknown");
739 + const host = pullRequestHostOf(identity, SourceControlProviderKind.make("unknown"));
740 // A legacy identity has no canonical host until its provider is refined, so it must reach
741 // the refinement before a host filter can decide whether it belongs in the result.
742 if (
743 filter.host !== undefined &&
744 host !== "unknown" &&
745 host !== filter.host.toLowerCase() &&
746 - pullRequestHostOf(identity, "forgejo") !== filter.host.toLowerCase() &&
746 + pullRequestHostOf(identity, SourceControlProviderKind.make("forgejo")) !==
747 + filter.host.toLowerCase() &&
748 !isSshRemoteUrl(identity.locator.remoteUrl)
749 ) {
750 continue;
@@ -768,7 +769,9 @@ export const make = Effect.gen(function* () {
769 cwd: project.workspaceRoot,
770 context: {
771 provider:
771 - provider.kind === "forgejo" ? { ...provider, kind: "unknown" } : provider,
772 + provider.kind === "forgejo"
773 + ? { ...provider, kind: SourceControlProviderKind.make("unknown") }
774 + : provider,
775 remoteName,
776 remoteUrl,
777 ...(filter.host !== undefined && isSshRemoteUrl(remoteUrl)
apps/server/src/pullRequest/pullRequestSyncKey.ts
+3 -2
@@ -2,7 +2,7 @@ import {
2 pullRequestHostOf,
3 type PullRequestRef,
4 type RepositoryIdentity,
5 - type SourceControlProviderKind,
5 + SourceControlProviderKind,
6 type ThreadPullRequestKey,
7 } from "@t3tools/contracts";
8 import { sourceControlRepositorySelector } from "@t3tools/shared/sourceControl";
@@ -18,7 +18,8 @@ export function pullRequestSyncKey(
18 reference.repository.toLowerCase() !==
19 sourceControlRepositorySelector(identity)?.toLowerCase() ||
20 (reference.host !== undefined &&
21 - reference.host.toLowerCase() !== pullRequestHostOf(identity, "azure-devops"))
21 + reference.host.toLowerCase() !==
22 + pullRequestHostOf(identity, SourceControlProviderKind.make("azure-devops")))
23 )
24 return null;
25 const [host, ...repository] = identity.canonicalKey.split("/");
apps/server/src/sourceControl/BitbucketApi.test.ts
+8 -3
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { assert, it, vi } from "@effect/vitest";
3 import * as NodeServices from "@effect/platform-node/NodeServices";
4 import * as ConfigProvider from "effect/ConfigProvider";
@@ -362,7 +363,7 @@ it.effect.each([false, true])(
363 ? {
364 context: {
365 provider: {
365 - kind: "bitbucket" as const,
366 + kind: SourceControlProviderKind.make("bitbucket"),
367 name: "Bitbucket",
368 baseUrl: "https://bitbucket.org",
369 },
@@ -396,7 +397,11 @@ it.effect("prefers an explicit repository and uses context when the repository i
397 return Effect.gen(function* () {
398 const bitbucket = yield* BitbucketApi.BitbucketApi;
399 const context = {
399 - provider: { kind: "bitbucket" as const, name: "Bitbucket", baseUrl: "https://bitbucket.org" },
400 + provider: {
401 + kind: SourceControlProviderKind.make("bitbucket"),
402 + name: "Bitbucket",
403 + baseUrl: "https://bitbucket.org",
404 + },
405 remoteName: "origin",
406 remoteUrl: "git@bitbucket.org:another/context.git",
407 };
@@ -838,7 +843,7 @@ it.effect("checks out same-repository pull requests with the existing Bitbucket
843 cwd: "/repo",
844 context: {
845 provider: {
841 - kind: "bitbucket",
846 + kind: SourceControlProviderKind.make("bitbucket"),
847 name: "Bitbucket",
848 baseUrl: "https://bitbucket.org",
849 },
apps/server/src/sourceControl/SourceControlDiscovery.test.ts
+18 -13
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { assert, it } from "@effect/vitest";
3 import * as NodeServices from "@effect/platform-node/NodeServices";
4 import * as Effect from "effect/Effect";
@@ -176,37 +177,37 @@ it.effect("reports implemented tools separately from locally available executabl
177 })),
178 [
179 {
179 - kind: "github",
180 + kind: SourceControlProviderKind.make("github"),
181 status: "available",
182 auth: "authenticated",
183 account: Option.some("juliusmarminge"),
184 },
185 {
185 - kind: "gitlab",
186 + kind: SourceControlProviderKind.make("gitlab"),
187 status: "missing",
188 auth: "unknown",
189 account: Option.none(),
190 },
191 {
191 - kind: "azure-devops",
192 + kind: SourceControlProviderKind.make("azure-devops"),
193 status: "missing",
194 auth: "unknown",
195 account: Option.none(),
196 },
197 {
197 - kind: "bitbucket",
198 + kind: SourceControlProviderKind.make("bitbucket"),
199 status: "available",
200 auth: "unauthenticated",
201 account: Option.none(),
202 },
203 {
203 - kind: "forgejo",
204 + kind: SourceControlProviderKind.make("forgejo"),
205 status: "missing",
206 auth: "unknown",
207 account: Option.none(),
208 },
209 {
209 - kind: "gitcafe",
210 + kind: SourceControlProviderKind.make("gitcafe"),
211 status: "missing",
212 auth: "unknown",
213 account: Option.none(),
@@ -327,37 +328,37 @@ Logged in to gitlab.com as gitlab-user
328 })),
329 [
330 {
330 - kind: "github",
331 + kind: SourceControlProviderKind.make("github"),
332 auth: "authenticated",
333 account: Option.some("octocat"),
334 detail: Option.none(),
335 },
336 {
336 - kind: "gitlab",
337 + kind: SourceControlProviderKind.make("gitlab"),
338 auth: "authenticated",
339 account: Option.some("gitlab-user"),
340 detail: Option.none(),
341 },
342 {
342 - kind: "azure-devops",
343 + kind: SourceControlProviderKind.make("azure-devops"),
344 auth: "authenticated",
345 account: Option.some("azure-user@example.com"),
346 detail: Option.none(),
347 },
348 {
348 - kind: "bitbucket",
349 + kind: SourceControlProviderKind.make("bitbucket"),
350 auth: "authenticated",
351 account: Option.some("bitbucket-user"),
352 detail: Option.none(),
353 },
354 {
354 - kind: "forgejo",
355 + kind: SourceControlProviderKind.make("forgejo"),
356 auth: "authenticated",
357 account: Option.some("forgejo-user"),
358 detail: Option.none(),
359 },
360 {
360 - kind: "gitcafe",
361 + kind: SourceControlProviderKind.make("gitcafe"),
362 auth: "authenticated",
363 account: Option.some("cafe-user"),
364 detail: Option.none(),
@@ -528,7 +529,11 @@ it.effect(
529 reference: "42",
530 force: true,
531 context: {
531 - provider: { kind: "forgejo", name: "Forgejo", baseUrl: "https://forgejo.test" },
532 + provider: {
533 + kind: SourceControlProviderKind.make("forgejo"),
534 + name: "Forgejo",
535 + baseUrl: "https://forgejo.test",
536 + },
537 remoteName: "origin",
538 remoteUrl: "git@forgejo.test:maria/project.git",
539 },
apps/server/src/sourceControl/SourceControlProviderRegistry.test.ts
+6 -5
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { assert, it } from "@effect/vitest";
3 import * as NodeServices from "@effect/platform-node/NodeServices";
4 import * as DateTime from "effect/DateTime";
@@ -154,7 +155,7 @@ it.effect("routes directly by provider kind for remote-first workflows", () =>
155 remotes: [],
156 });
157
157 - const provider = yield* registry.get("github");
158 + const provider = yield* registry.get(SourceControlProviderKind.make("github"));
159
160 assert.strictEqual(provider.kind, "github");
161 }),
@@ -163,7 +164,7 @@ it.effect("routes directly by provider kind for remote-first workflows", () =>
164 it.effect("includes the request cwd when an unregistered provider is used", () =>
165 Effect.gen(function* () {
166 const registry = yield* makeRegistry({ remotes: [] });
166 - const provider = yield* registry.get("unknown");
167 + const provider = yield* registry.get(SourceControlProviderKind.make("unknown"));
168
169 const error = yield* provider
170 .getChangeRequest({ cwd: "/repo", reference: "#42" })
@@ -257,7 +258,7 @@ it.effect("refines the caller-selected remote instead of choosing another config
258 cwd: "/repo",
259 context: {
260 provider: {
260 - kind: "unknown",
261 + kind: SourceControlProviderKind.make("unknown"),
262 name: "self-hosted.example.test",
263 baseUrl: "https://self-hosted.example.test",
264 },
@@ -412,7 +413,7 @@ it.effect.each([
413 },
414 });
415 const handle = yield* registry.resolveHandle({ cwd: "/repo" });
415 - assert.strictEqual(handle.provider.kind, scenario.expected);
416 + assert.strictEqual(handle.provider.kind, SourceControlProviderKind.make(scenario.expected));
417 assert.strictEqual(handle.context?.provider.baseUrl, "https://code.example.test");
418 assert.deepStrictEqual(hosts, ["code.example.test"]);
419 // Recognition goes through the credential layer; gh is only one of its sources.
@@ -437,7 +438,7 @@ it.effect("skips GitHub discovery for the identity resolver's empty base URL", (
438 },
439 });
440 const context = {
440 - provider: { kind: "unknown" as const, name: "Unknown", baseUrl: "" },
441 + provider: { kind: SourceControlProviderKind.make("unknown"), name: "Unknown", baseUrl: "" },
442 remoteName: "origin",
443 remoteUrl,
444 };
apps/server/src/sourceControl/SourceControlProviderRegistry.ts
+5 -4
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Cache from "effect/Cache";
3 import * as Context from "effect/Context";
4 import * as Duration from "effect/Duration";
@@ -8,7 +9,7 @@ import {
9 SourceControlProviderError,
10 type SourceControlProviderDiscoveryItem,
11 } from "@t3tools/contracts";
11 -import type { SourceControlProviderKind } from "@t3tools/contracts";
12 +import type {} from "@t3tools/contracts";
13 import { detectSourceControlProviderFromRemoteUrl } from "@t3tools/shared/sourceControl";
14
15 import * as BuiltInDrivers from "./builtInDrivers.ts";
@@ -214,7 +215,7 @@ export const makeWithProviders = Effect.fn("makeSourceControlProviderRegistryWit
215 Effect.mapError(
216 (error) =>
217 new SourceControlProviderError({
217 - provider: "unknown",
218 + provider: SourceControlProviderKind.make("unknown"),
219 operation: "detectProvider",
220 cwd,
221 detail: "Failed to detect source control provider.",
@@ -226,7 +227,7 @@ export const makeWithProviders = Effect.fn("makeSourceControlProviderRegistryWit
227 Effect.mapError(
228 (error) =>
229 new SourceControlProviderError({
229 - provider: "unknown",
230 + provider: SourceControlProviderKind.make("unknown"),
231 operation: "detectProvider",
232 cwd,
233 detail: "Failed to detect source control provider.",
@@ -265,7 +266,7 @@ export const makeWithProviders = Effect.fn("makeSourceControlProviderRegistryWit
266 })
267 ).pipe(
268 Effect.map((context) => {
268 - const kind = context?.provider.kind ?? "unknown";
269 + const kind = context?.provider.kind ?? SourceControlProviderKind.make("unknown");
270 const provider = providers.get(kind) ?? unsupportedProvider(kind);
271 return {
272 provider: bindProviderContext(provider, context),
apps/server/src/sourceControl/SourceControlRepositoryService.test.ts
+24 -17
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as NodePath from "@effect/platform-node/NodePath";
3 import * as NodeServices from "@effect/platform-node/NodeServices";
4 import { assert, it } from "@effect/vitest";
@@ -37,7 +38,7 @@ function makeProvider(
38 >;
39
40 return {
40 - kind: "github",
41 + kind: SourceControlProviderKind.make("github"),
42 listChangeRequests: () => unsupported("listChangeRequests"),
43 getChangeRequest: () => unsupported("getChangeRequest"),
44 createChangeRequest: () => unsupported("createChangeRequest"),
@@ -114,19 +115,22 @@ it.effect("looks up repositories through the requested provider without search",
115 return Effect.gen(function* () {
116 const service = yield* SourceControlRepositoryService.SourceControlRepositoryService;
117 const result = yield* service.lookupRepository({
117 - provider: "github",
118 + provider: SourceControlProviderKind.make("github"),
119 repository: "octocat/t3code",
120 cwd: "/workspace",
121 });
122
122 - assert.deepStrictEqual(result, { provider: "github", ...CLONE_URLS });
123 + assert.deepStrictEqual(result, {
124 + provider: SourceControlProviderKind.make("github"),
125 + ...CLONE_URLS,
126 + });
127 assert.deepStrictEqual(calls, [{ cwd: "/workspace", repository: "octocat/t3code" }]);
128 }).pipe(Effect.provide(layer({ provider })));
129 });
130
131 it.effect("preserves provider failures without deriving the repository message from them", () => {
132 const providerCause = new SourceControlProviderError({
129 - provider: "github",
133 + provider: SourceControlProviderKind.make("github"),
134 operation: "getRepositoryCloneUrls",
135 cwd: "/workspace",
136 repository: "octocat/t3code",
@@ -140,7 +144,7 @@ it.effect("preserves provider failures without deriving the repository message f
144 const service = yield* SourceControlRepositoryService.SourceControlRepositoryService;
145 const error = yield* Effect.flip(
146 service.lookupRepository({
143 - provider: "github",
147 + provider: SourceControlProviderKind.make("github"),
148 repository: "octocat/t3code",
149 cwd: "/workspace",
150 }),
@@ -176,7 +180,7 @@ it.effect(
180 yield* Effect.gen(function* () {
181 const service = yield* SourceControlRepositoryService.SourceControlRepositoryService;
182 const input = {
179 - provider: "bitbucket" as const,
183 + provider: SourceControlProviderKind.make("bitbucket"),
184 repository: locatorCause.repository,
185 cwd: "/workspace",
186 };
@@ -204,11 +208,11 @@ it.effect(
208
209 it.effect("keeps a plain Bitbucket locator lookalike out of the repository message", () => {
210 const provider = makeProvider({
207 - kind: "bitbucket",
211 + kind: SourceControlProviderKind.make("bitbucket"),
212 getRepositoryCloneUrls: () =>
213 Effect.fail(
214 new SourceControlProviderError({
211 - provider: "bitbucket",
215 + provider: SourceControlProviderKind.make("bitbucket"),
216 operation: "getRepositoryCloneUrls",
217 cwd: "/workspace",
218 detail: "credential token abc123 was rejected",
@@ -224,7 +228,10 @@ it.effect("keeps a plain Bitbucket locator lookalike out of the repository messa
228 return Effect.gen(function* () {
229 const service = yield* SourceControlRepositoryService.SourceControlRepositoryService;
230 const error = yield* Effect.flip(
227 - service.lookupRepository({ provider: "bitbucket", repository: "t3code" }),
231 + service.lookupRepository({
232 + provider: SourceControlProviderKind.make("bitbucket"),
233 + repository: "t3code",
234 + }),
235 );
236
237 assert.strictEqual(error.detail, "The source control operation could not be completed.");
@@ -250,7 +257,7 @@ it.effect("keeps arbitrary Bitbucket request failures out of the repository mess
257 const service = yield* SourceControlRepositoryService.SourceControlRepositoryService;
258 const error = yield* Effect.flip(
259 service.lookupRepository({
253 - provider: "bitbucket",
260 + provider: SourceControlProviderKind.make("bitbucket"),
261 repository: "pingdotgg/t3code",
262 cwd: "/workspace",
263 }),
@@ -276,7 +283,7 @@ it.effect("clones a looked-up repository into the requested destination", () =>
283 yield* Effect.gen(function* () {
284 const service = yield* SourceControlRepositoryService.SourceControlRepositoryService;
285 const result = yield* service.cloneRepository({
279 - provider: "github",
286 + provider: SourceControlProviderKind.make("github"),
287 repository: "octocat/t3code",
288 destinationPath,
289 protocol: "https",
@@ -285,7 +292,7 @@ it.effect("clones a looked-up repository into the requested destination", () =>
292 assert.deepStrictEqual(result, {
293 cwd: destinationPath,
294 remoteUrl: CLONE_URLS.url,
288 - repository: { provider: "github", ...CLONE_URLS },
295 + repository: { provider: SourceControlProviderKind.make("github"), ...CLONE_URLS },
296 });
297 assert.deepStrictEqual(cloneCalls, [
298 {
@@ -546,7 +553,7 @@ it.effect("publishes by creating the repository, adding a remote, and pushing up
553 const service = yield* SourceControlRepositoryService.SourceControlRepositoryService;
554 const result = yield* service.publishRepository({
555 cwd: "/workspace",
549 - provider: "github",
556 + provider: SourceControlProviderKind.make("github"),
557 repository: "octocat/t3code",
558 visibility: "private",
559 remoteName: "origin",
@@ -554,7 +561,7 @@ it.effect("publishes by creating the repository, adding a remote, and pushing up
561 });
562
563 assert.deepStrictEqual(result, {
557 - repository: { provider: "github", ...CLONE_URLS },
564 + repository: { provider: SourceControlProviderKind.make("github"), ...CLONE_URLS },
565 remoteName: "origin",
566 remoteUrl: CLONE_URLS.sshUrl,
567 branch: "feature/remote-v1",
@@ -601,7 +608,7 @@ it.effect("publishes to the remote name returned by ensureRemote", () => {
608 const service = yield* SourceControlRepositoryService.SourceControlRepositoryService;
609 const result = yield* service.publishRepository({
610 cwd: "/workspace",
604 - provider: "github",
611 + provider: SourceControlProviderKind.make("github"),
612 repository: "octocat/t3code",
613 visibility: "private",
614 remoteName: "origin",
@@ -637,7 +644,7 @@ it.effect("publish succeeds with status remote_added when the local repo has no
644 const service = yield* SourceControlRepositoryService.SourceControlRepositoryService;
645 const result = yield* service.publishRepository({
646 cwd: "/workspace",
640 - provider: "github",
647 + provider: SourceControlProviderKind.make("github"),
648 repository: "octocat/t3code",
649 visibility: "private",
650 remoteName: "origin",
@@ -645,7 +652,7 @@ it.effect("publish succeeds with status remote_added when the local repo has no
652 });
653
654 assert.deepStrictEqual(result, {
648 - repository: { provider: "github", ...CLONE_URLS },
655 + repository: { provider: SourceControlProviderKind.make("github"), ...CLONE_URLS },
656 remoteName: "origin",
657 remoteUrl: CLONE_URLS.sshUrl,
658 branch: "main",
apps/server/src/sourceControl/SourceControlRepositoryService.ts
+23 -12
@@ -12,7 +12,7 @@ import {
12 type SourceControlCloneRepositoryInput,
13 type SourceControlCloneRepositoryResult,
14 type SourceControlCloneProtocol,
15 - type SourceControlProviderKind,
15 + SourceControlProviderKind,
16 type SourceControlPublishRepositoryInput,
17 type SourceControlPublishRepositoryResult,
18 type SourceControlRepositoryCloneUrls,
@@ -209,7 +209,7 @@ export const make = Effect.gen(function* () {
209 if (trimmed.length === 0) {
210 return yield* new SourceControlRepositoryError({
211 operation: "cloneRepository",
212 - provider: "unknown",
212 + provider: SourceControlProviderKind.make("unknown"),
213 detail: "Choose a destination path before cloning.",
214 });
215 }
@@ -229,7 +229,7 @@ export const make = Effect.gen(function* () {
229 (cause) =>
230 new SourceControlRepositoryError({
231 operation: "cloneRepository",
232 - provider: "unknown",
232 + provider: SourceControlProviderKind.make("unknown"),
233 detail: "Destination path already exists and is not a directory.",
234 cause,
235 }),
@@ -238,7 +238,7 @@ export const make = Effect.gen(function* () {
238 if (entries.length > 0) {
239 return yield* new SourceControlRepositoryError({
240 operation: "cloneRepository",
241 - provider: "unknown",
241 + provider: SourceControlProviderKind.make("unknown"),
242 detail: "Destination path already exists and is not empty.",
243 });
244 }
@@ -260,7 +260,8 @@ export const make = Effect.gen(function* () {
260 const preparedDestination = yield* prepareDestination(input.destinationPath);
261 let repository: SourceControlRepositoryInfo | null = null;
262 let remoteUrl = input.remoteUrl?.trim() ?? null;
263 - let provider: SourceControlProviderKind = input.provider ?? "unknown";
263 + let provider: SourceControlProviderKind =
264 + input.provider ?? SourceControlProviderKind.make("unknown");
265
266 if (input.provider && input.repository) {
267 repository = yield* lookupRepository({
@@ -335,7 +336,7 @@ export const make = Effect.gen(function* () {
336 (cause) =>
337 new SourceControlRepositoryError({
338 operation: "cloneRepository",
338 - provider: input.provider ?? "unknown",
339 + provider: input.provider ?? SourceControlProviderKind.make("unknown"),
340 detail:
341 stderrTail.length > 0
342 ? stderrTail.join(" ")
@@ -370,7 +371,7 @@ export const make = Effect.gen(function* () {
371 (cause) =>
372 new SourceControlRepositoryError({
373 operation: "discardClone",
373 - provider: "unknown",
374 + provider: SourceControlProviderKind.make("unknown"),
375 detail: "The clone destination could not be inspected.",
376 cause,
377 }),
@@ -379,7 +380,7 @@ export const make = Effect.gen(function* () {
380 if (entries.length > 0 && !entries.includes(".git")) {
381 return yield* new SourceControlRepositoryError({
382 operation: "discardClone",
382 - provider: "unknown",
383 + provider: SourceControlProviderKind.make("unknown"),
384 detail: "Destination path contains files that are not from the clone.",
385 });
386 }
@@ -393,7 +394,7 @@ export const make = Effect.gen(function* () {
394 (cause) =>
395 new SourceControlRepositoryError({
396 operation: "discardClone",
396 - provider: "unknown",
397 + provider: SourceControlProviderKind.make("unknown"),
398 detail: "The partial clone could not be removed.",
399 cause,
400 }),
@@ -462,13 +463,23 @@ export const make = Effect.gen(function* () {
463 lookupRepository: (input) =>
464 lookupRepository(input).pipe(mapRepositoryError("lookupRepository", input.provider)),
465 prepareClone: (input) =>
465 - prepareClone(input).pipe(mapRepositoryError("cloneRepository", input.provider ?? "unknown")),
466 + prepareClone(input).pipe(
467 + mapRepositoryError(
468 + "cloneRepository",
469 + input.provider ?? SourceControlProviderKind.make("unknown"),
470 + ),
471 + ),
472 cloneRepository: (input, options) =>
473 cloneRepository(input, options).pipe(
468 - mapRepositoryError("cloneRepository", input.provider ?? "unknown"),
474 + mapRepositoryError(
475 + "cloneRepository",
476 + input.provider ?? SourceControlProviderKind.make("unknown"),
477 + ),
478 ),
479 discardClone: (destinationPath) =>
471 - discardClone(destinationPath).pipe(mapRepositoryError("discardClone", "unknown")),
480 + discardClone(destinationPath).pipe(
481 + mapRepositoryError("discardClone", SourceControlProviderKind.make("unknown")),
482 + ),
483 publishRepository: (input) =>
484 publishRepository(input).pipe(mapRepositoryError("publishRepository", input.provider)),
485 });
apps/server/src/textGeneration/ThreadTitleLinks.test.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { expect, it } from "@effect/vitest";
3 import * as Effect from "effect/Effect";
4 import * as Schema from "effect/Schema";
@@ -87,7 +88,7 @@ it.effect("keeps lookup failure out of generation and skips unlinked messages",
88 resolveLink: () =>
89 Effect.fail(
90 new SourceControlProviderError({
90 - provider: "unknown",
91 + provider: SourceControlProviderKind.make("unknown"),
92 operation: "resolveLink",
93 cwd: "/tmp",
94 detail: "Unavailable",
apps/server/src/vcs/VcsStatusBroadcaster.test.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { assert, it, describe } from "@effect/vitest";
3 import * as NodeServices from "@effect/platform-node/NodeServices";
4 import * as Cause from "effect/Cause";
@@ -34,7 +35,7 @@ const TEST_EPOCH = DateTime.makeUnsafe("1970-01-01T00:00:00.000Z");
35 const baseLocalStatus: VcsStatusLocalResult = {
36 isRepo: true,
37 sourceControlProvider: {
37 - kind: "github",
38 + kind: SourceControlProviderKind.make("github"),
39 name: "GitHub",
40 baseUrl: "https://github.com",
41 },
apps/web/src/components/CommandPalette.tsx
+10 -7
@@ -39,7 +39,7 @@ import {
39 type FilesystemBrowseResult,
40 type ProjectId,
41 type SourceControlDiscoveryResult,
42 - type SourceControlProviderKind,
42 + SourceControlProviderKind,
43 type SourceControlRepositoryInfo,
44 PRIMARY_LOCAL_ENVIRONMENT_ID,
45 resolveEnvironmentMachineKind,
@@ -257,10 +257,13 @@ interface AddProjectEnvironmentOption {
257 readonly status: string;
258 }
259
260 -type AddProjectRemoteProviderKind = Extract<
261 - SourceControlProviderKind,
262 - "github" | "gitlab" | "forgejo" | "bitbucket" | "azure-devops" | "gitcafe"
263 ->;
260 +type AddProjectRemoteProviderKind =
261 + | "github"
262 + | "gitlab"
263 + | "forgejo"
264 + | "bitbucket"
265 + | "azure-devops"
266 + | "gitcafe";
267 type AddProjectRemoteSource = AddProjectRemoteProviderKind | "url";
268
269 type AddProjectCloneFlow =
@@ -421,7 +424,7 @@ function buildAddProjectRemoteSourceReadiness(
424 for (const source of REMOTE_PROJECT_SOURCES) {
425 const kind = sourceProviderKind(source);
426 if (!kind) continue;
424 - const provider = providerByKind.get(kind);
427 + const provider = providerByKind.get(SourceControlProviderKind.make(kind));
428 if (!provider) {
429 readiness[source] = unavailable;
430 continue;
@@ -2628,7 +2631,7 @@ function OpenCommandPaletteDialog(props: {
2631 const lookupResult = await lookupRepository({
2632 environmentId: addProjectCloneFlow.environmentId,
2633 input: {
2631 - provider,
2634 + provider: SourceControlProviderKind.make(provider),
2635 repository: rawRepository,
2636 },
2637 });
apps/web/src/components/GitActionsControl.logic.test.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import type { VcsStatusResult } from "@t3tools/contracts";
3 import { assert, describe, it } from "vite-plus/test";
4 import {
@@ -343,7 +344,7 @@ describe("when: source control provider uses merge requests", () => {
344 const gitlabStatus = status({
345 aheadCount: 2,
346 sourceControlProvider: {
346 - kind: "gitlab",
347 + kind: SourceControlProviderKind.make("gitlab"),
348 name: "GitLab",
349 baseUrl: "https://gitlab.com",
350 },
apps/web/src/components/GitActionsControl.tsx
+13 -11
@@ -3,6 +3,7 @@ import { useAtomValue } from "@effect/atom-react";
3 import {
4 AuthOrchestrationOperateScope,
5 AuthSourceControlWriteScope,
6 + SourceControlProviderKind,
7 type ScopedThreadRef,
8 } from "@t3tools/contracts";
9 import {
@@ -14,7 +15,6 @@ import type {
15 GitStackedAction,
16 SourceControlCloneProtocol,
17 SourceControlProviderDiscoveryItem,
17 - SourceControlProviderKind,
18 SourceControlPublishRepositoryResult,
19 SourceControlRepositoryVisibility,
20 VcsStatusResult,
@@ -158,10 +158,13 @@ interface PendingDefaultBranchAction {
158 filePaths?: string[];
159 }
160
161 -type PublishProviderKind = Extract<
162 - SourceControlProviderKind,
163 - "github" | "gitlab" | "forgejo" | "bitbucket" | "azure-devops" | "gitcafe"
164 ->;
161 +type PublishProviderKind =
162 + | "github"
163 + | "gitlab"
164 + | "forgejo"
165 + | "bitbucket"
166 + | "azure-devops"
167 + | "gitcafe";
168
169 type GitActionToastId = ReturnType<typeof toastManager.add>;
170
@@ -265,9 +268,7 @@ function publishProviderOption(provider: PublishProviderKind) {
268 );
269 }
270
268 -function isPublishProviderKind(
269 - provider: SourceControlProviderKind,
270 -): provider is PublishProviderKind {
271 +function isPublishProviderKind(provider: string): provider is PublishProviderKind {
272 return PUBLISH_PROVIDER_OPTIONS.some((option) => option.value === provider);
273 }
274
@@ -582,8 +583,9 @@ function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
583 gitcafe: null,
584 };
585 for (const provider of sourceControlDiscovery.data?.sourceControlProviders ?? []) {
585 - if (isPublishProviderKind(provider.kind)) {
586 - accounts[provider.kind] = Option.getOrNull(provider.auth.account);
586 + const kind: string = provider.kind;
587 + if (isPublishProviderKind(kind)) {
588 + accounts[kind] = Option.getOrNull(provider.auth.account);
589 }
590 }
591 return accounts;
@@ -670,7 +672,7 @@ function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
672
673 void (async () => {
674 const result = await publishRepositoryAction.run({
673 - provider: publishProvider,
675 + provider: SourceControlProviderKind.make(publishProvider),
676 repository: publishRepository.trim(),
677 visibility: publishVisibility,
678 remoteName: publishRemoteName.trim() || "origin",
apps/web/src/components/ThreadStatusIndicators.test.ts
+3 -2
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { ProjectId, type PullRequestSummary, type VcsStatusResult } from "@t3tools/contracts";
3 import { describe, expect, it } from "@effect/vitest";
4 import * as Effect from "effect/Effect";
@@ -93,7 +94,7 @@ function pullRequestSummary(
94 updatedAt: string,
95 ): PullRequestSummary {
96 return {
96 - provider: "github",
97 + provider: SourceControlProviderKind.make("github"),
98 projectId: ProjectId.make("project-1"),
99 repository: "pingdotgg/t3code",
100 number: 42,
@@ -179,7 +180,7 @@ describe("resolveDisplayedThreadPr + nextThreadChangeRequestSnapshot", () => {
180 url: "https://github.com/pingdotgg/t3code/pull/42",
181 };
182 const provider = {
182 - kind: "github" as const,
183 + kind: SourceControlProviderKind.make("github"),
184 name: "GitHub",
185 baseUrl: "https://github.com",
186 };
apps/web/src/components/ThreadStatusIndicators.tsx
+2 -1
@@ -13,6 +13,7 @@ import {
13 type ThreadLinkedPullRequest,
14 type ThreadPullRequestLink,
15 type VcsStatusResult,
16 + SourceControlProviderKind,
17 } from "@t3tools/contracts";
18 import { Atom } from "effect/reactivity";
19 import { FolderGit2Icon, TerminalIcon } from "lucide-react";
@@ -154,7 +155,7 @@ export function linkedPullRequestSnapshotStatus(
155 baseRef: snapshot.baseBranch,
156 ...(snapshot.updatedAt === null ? {} : { updatedAt: snapshot.updatedAt }),
157 },
157 - sourceControlProvider: { kind, name: kind, baseUrl: "" },
158 + sourceControlProvider: { kind: SourceControlProviderKind.make(kind), name: kind, baseUrl: "" },
159 };
160 }
161
apps/web/src/components/pullRequest/PullRequestDetailPanel.test.tsx
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import {
3 EnvironmentId,
4 ProjectId,
@@ -151,7 +152,7 @@ import { PullRequestDetailPanel } from "./PullRequestDetailPanel";
152 import { pullRequestPanelContext } from "./pullRequestDetail.logic";
153
154 const detail: PullRequestDetailView = {
154 - provider: "github",
155 + provider: SourceControlProviderKind.make("github"),
156 projectId: ProjectId.make("project"),
157 projectTitle: "Project",
158 workspaceRoot: "/workspace",
apps/web/src/components/pullRequest/PullRequestSummaryTab.test.tsx
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { EnvironmentId, ProjectId, type PullRequestDetailView } from "@t3tools/contracts";
3 import { act, type ReactNode } from "react";
4 import { create, type ReactTestRenderer } from "react-test-renderer";
@@ -26,7 +27,7 @@ vi.mock("../ui/tooltip", () => ({
27 import { PullRequestSummaryTab } from "./PullRequestSummaryTab";
28
29 const detail: PullRequestDetailView = {
29 - provider: "github",
30 + provider: SourceControlProviderKind.make("github"),
31 projectId: ProjectId.make("project"),
32 projectTitle: "Project",
33 workspaceRoot: "/workspace",
apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts
+12 -8
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { resolvePlanFollowUpSubmission } from "../../proposedPlan";
3 import { serializeLegacyContextMessage } from "@t3tools/shared/composerContextLegacySend";
4 import {
@@ -95,12 +96,14 @@ describe("pull request checkout commands", () => {
96 ],
97 ["unknown", "feature", null, null],
98 ] as const)("builds the %s command", (provider, branch, repository, expected) => {
98 - expect(pullRequestCheckoutCommand(provider, 42, branch, repository)).toBe(expected);
99 + expect(
100 + pullRequestCheckoutCommand(SourceControlProviderKind.make(provider), 42, branch, repository),
101 + ).toBe(expected);
102 });
103 it("fetches Forgejo pull refs from the actual repository, including a mounted host and port", () => {
104 expect(
105 pullRequestCheckoutCommand(
103 - "forgejo",
106 + SourceControlProviderKind.make("forgejo"),
107 42,
108 "feature",
109 null,
@@ -113,7 +116,7 @@ describe("pull request checkout commands", () => {
116 it("quotes shell metacharacters in Forgejo repository URLs", () => {
117 expect(
118 pullRequestCheckoutCommand(
116 - "forgejo",
119 + SourceControlProviderKind.make("forgejo"),
120 42,
121 "feature",
122 null,
@@ -1714,7 +1717,7 @@ describe("cached pull request detail", () => {
1717 const reference = { projectId: ProjectId.make("project-1"), repository: "acme/web", number: 7 };
1718 const detail = (overrides: Partial<PullRequestDetail> = {}): PullRequestDetail =>
1719 ({
1717 - provider: "github",
1720 + provider: SourceControlProviderKind.make("github"),
1721 capabilities: {
1722 diff: true,
1723 comment: true,
@@ -1797,7 +1800,7 @@ describe("cached pull request detail", () => {
1800 remoteName: "origin",
1801 remoteUrl: "https://github.com/acme/web.git",
1802 },
1800 - provider: "github",
1803 + provider: SourceControlProviderKind.make("github"),
1804 });
1805 expect(readPullRequestDetailSnapshot(storage, "env-1", resolved)?.title).toBe(
1806 "Cache the title",
@@ -1824,7 +1827,7 @@ describe("cached pull request detail", () => {
1827 remoteName: "origin",
1828 remoteUrl: "git@ssh.dev.azure.com:v3/org/project/web",
1829 },
1827 - provider: "azure-devops",
1830 + provider: SourceControlProviderKind.make("azure-devops"),
1831 }),
1832 ).toBe(reference);
1833 expect(resolvePullRequestReferenceHost(reference, undefined)).toBe(reference);
@@ -1847,7 +1850,7 @@ describe("cached pull request detail", () => {
1850 it("keeps Forgejo ports isolated when recovering legacy snapshots", () => {
1851 const storage = makeStorage();
1852 const cached = detail({
1850 - provider: "forgejo",
1853 + provider: SourceControlProviderKind.make("forgejo"),
1854 url: "https://forge.example:8443/acme/web/pulls/7",
1855 });
1856 writePullRequestDetailSnapshot(storage, "env-1", reference, cached);
@@ -1869,7 +1872,8 @@ describe("cached pull request detail", () => {
1872
1873 it.each(["github", "gitlab"] as const)(
1874 "retains portless %s snapshot identities for custom web ports",
1872 - (provider) => {
1875 + (providerName) => {
1876 + const provider = SourceControlProviderKind.make(providerName);
1877 const storage = makeStorage();
1878 const host = `${provider}.example.com`;
1879 const hosted = { ...reference, host };
apps/web/src/components/pullRequest/pullRequestDetail.logic.ts
+9 -5
@@ -21,7 +21,7 @@ import {
21 type PullRequestReviewThread,
22 type PullRequestState,
23 type PullRequestUpdateMethod,
24 - type SourceControlProviderKind,
24 + SourceControlProviderKind,
25 type ThreadLinkedPullRequest,
26 type ThreadPullRequestLink,
27 type VcsRef,
@@ -140,7 +140,7 @@ export function pullRequestCheckoutCommand(
140 }
141 return `git clone --single-branch --branch ${headBranch} https://bitbucket.org/${headRepositoryNameWithOwner}.git t3code-pr-${number}`;
142 }
143 - case "unknown":
143 + default:
144 return null;
145 }
146 }
@@ -155,10 +155,11 @@ export function loadingPullRequestCheckoutCommand(
155 identity?.provider ??
156 (host === "github.com" ? "github" : host === "gitlab.com" ? "gitlab" : null);
157 if (provider !== "github" && provider !== "gitlab" && provider !== "azure-devops") return null;
158 - if (identity?.provider !== undefined && host && pullRequestHostOf(identity, provider) !== host) {
158 + const kind = SourceControlProviderKind.make(provider);
159 + if (identity?.provider !== undefined && host && pullRequestHostOf(identity, kind) !== host) {
160 return null;
161 }
161 - return pullRequestCheckoutCommand(provider, reference.number, "");
162 + return pullRequestCheckoutCommand(kind, reference.number, "");
163 }
164
165 /** Activity changes only when the same host resource reports a newer revision. */
@@ -1304,7 +1305,10 @@ export function resolvePullRequestReferenceHost(
1305 ): PullRequestRef {
1306 // Other providers may resolve an SSH remote to a different web authority on the server.
1307 if (reference.host !== undefined || identity?.provider !== "github") return reference;
1307 - return { ...reference, host: pullRequestHostOf(identity, "github") };
1308 + return {
1309 + ...reference,
1310 + host: pullRequestHostOf(identity, SourceControlProviderKind.make("github")),
1311 + };
1312 }
1313
1314 export interface PullRequestDetailSnapshotRef {
apps/web/src/components/pullRequest/pullRequestList.logic.test.ts
+3 -2
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import type { EnvironmentId, ProjectId, PullRequestListEntry } from "@t3tools/contracts";
3 import { describe, expect, it } from "vite-plus/test";
4
@@ -330,7 +331,7 @@ describe("pull request involvement filtering", () => {
331 entry({ number: 1, author: { login: "Bilal", name: null, avatarUrl: null } }),
332 entry({
333 number: 2,
333 - provider: "gitlab",
334 + provider: SourceControlProviderKind.make("gitlab"),
335 host: "gitlab.com",
336 author: { login: "Bilal", name: null, avatarUrl: null },
337 }),
@@ -1322,7 +1323,7 @@ describe("merging the environments' own listings", () => {
1323 providers: [
1324 {
1325 host: "github.com",
1325 - kind: "github",
1326 + kind: SourceControlProviderKind.make("github"),
1327 searchesOnHost: false,
1328 projectCount: 2,
1329 configured: false,
apps/web/src/components/settings/SourceControlSettings.tsx
+1 -1
@@ -78,7 +78,7 @@ const EMPTY_DISCOVERY_RESULT: SourceControlDiscoveryResult = {
78 sourceControlProviders: [],
79 };
80
81 -const SOURCE_CONTROL_PROVIDER_ICONS: Partial<Record<SourceControlProviderKind, Icon>> = {
81 +const SOURCE_CONTROL_PROVIDER_ICONS: Partial<Record<string, Icon>> = {
82 github: GitHubIcon,
83 gitlab: GitLabIcon,
84 forgejo: ForgejoIcon,
apps/web/src/hooks/useNewProject.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { scopeProjectRef } from "@t3tools/client-runtime/environment";
3 import { getNewProjectGitHubRepository } from "@t3tools/client-runtime/operations/projects";
4 import {
@@ -45,7 +46,7 @@ export function useNewProject() {
46 environmentId: input.environmentId,
47 input: {
48 cwd: input.workspaceRoot,
48 - provider: "github",
49 + provider: SourceControlProviderKind.make("github"),
50 repository: getNewProjectGitHubRepository(input, input.workspaceRoot),
51 visibility: "private",
52 },
apps/web/src/state/pullRequests.test.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { ProjectId, type PullRequestSummary } from "@t3tools/contracts";
3 import { describe, expect, it } from "vite-plus/test";
4
@@ -5,7 +6,7 @@ import { newestPullRequestObservation, newestPullRequestSummary } from "./pullRe
6
7 function summary(overrides: Partial<PullRequestSummary> = {}): PullRequestSummary {
8 return {
8 - provider: "github",
9 + provider: SourceControlProviderKind.make("github"),
10 projectId: ProjectId.make("pull-request-cache-test"),
11 repository: "acme/widget",
12 number: 7,
apps/web/src/state/sourceControlActions.test.ts
+2 -1
@@ -3,6 +3,7 @@ import {
3 AuthSourceControlWriteScope,
4 EnvironmentId,
5 ThreadId,
6 + SourceControlProviderKind,
7 } from "@t3tools/contracts";
8 import * as Cause from "effect/Cause";
9 import { AsyncResult } from "effect/reactivity";
@@ -98,7 +99,7 @@ const cases = [
99 isAllowed: action.isAllowed,
100 run: () =>
101 action.run({
101 - provider: "github",
102 + provider: SourceControlProviderKind.make("github"),
103 repository: "owner/repo",
104 visibility: "private",
105 remoteName: "origin",
apps/web/src/state/sourceControlActions.ts
+2 -1
@@ -16,6 +16,7 @@ import {
16 type EnvironmentId,
17 type GitResolvePullRequestResult,
18 type SourceControlCloneProtocol,
19 + type SourceControlProviderKind,
20 type SourceControlRepositoryVisibility,
21 type ThreadId,
22 } from "@t3tools/contracts";
@@ -275,7 +276,7 @@ export function useSourceControlPublishRepositoryAction(scope: SourceControlActi
276 );
277 const action = useCallback(
278 async (input: {
278 - provider: "github" | "gitlab" | "forgejo" | "bitbucket" | "azure-devops" | "gitcafe";
279 + provider: SourceControlProviderKind;
280 repository: string;
281 visibility: SourceControlRepositoryVisibility;
282 remoteName: string;
packages/client-runtime/src/operations/projects.test.ts
+6 -5
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { describe, expect, it } from "vite-plus/test";
3 import {
4 EnvironmentId,
@@ -71,14 +72,14 @@ describe("add project shared logic", () => {
72 it("uses HTTPS for repositories selected through a provider", () => {
73 expect(
74 getDefaultCloneUrl({
74 - provider: "github",
75 + provider: SourceControlProviderKind.make("github"),
76 url: "https://github.com/imputnet/helium",
77 sshUrl: "git@github.com:imputnet/helium.git",
78 }),
79 ).toBe("https://github.com/imputnet/helium");
80 expect(
81 getDefaultCloneUrl({
81 - provider: "forgejo",
82 + provider: SourceControlProviderKind.make("forgejo"),
83 url: "https://forgejo.example.test:8443/owner/repo.git",
84 sshUrl: "ssh://git@forgejo.example.test:2222/owner/repo.git",
85 }),
@@ -88,7 +89,7 @@ describe("add project shared logic", () => {
89 it("preserves existing clone transport behavior for other providers", () => {
90 expect(
91 getDefaultCloneUrl({
91 - provider: "gitlab",
92 + provider: SourceControlProviderKind.make("gitlab"),
93 url: "https://gitlab.com/group/project.git",
94 sshUrl: "git@gitlab.com:group/project.git",
95 }),
@@ -187,7 +188,7 @@ describe("add project shared logic", () => {
188 versionControlSystems: [],
189 sourceControlProviders: [
190 {
190 - kind: "github",
191 + kind: SourceControlProviderKind.make("github"),
192 label: "GitHub",
193 status: "available",
194 installHint: "Install gh",
@@ -201,7 +202,7 @@ describe("add project shared logic", () => {
202 },
203 },
204 {
204 - kind: "gitlab",
205 + kind: SourceControlProviderKind.make("gitlab"),
206 label: "GitLab",
207 status: "available",
208 installHint: "Install glab",
packages/client-runtime/src/operations/projects.ts
+8 -6
@@ -6,9 +6,9 @@ import type {
6 ProjectId,
7 ServerConfig,
8 SourceControlDiscoveryResult,
9 - SourceControlProviderKind,
9 SourceControlRepositoryInfo,
10 } from "@t3tools/contracts";
11 +import { SourceControlProviderKind } from "@t3tools/contracts";
12 import { newProjectFolderName } from "@t3tools/shared/path";
13 import * as Arr from "effect/Array";
14 import * as Option from "effect/Option";
@@ -25,10 +25,12 @@ import {
25 } from "../state/projects.ts";
26 import type { EnvironmentProject } from "../state/models.ts";
27
28 -export type AddProjectRemoteProviderKind = Extract<
29 - SourceControlProviderKind,
30 - "github" | "gitlab" | "forgejo" | "bitbucket" | "azure-devops"
31 ->;
28 +export type AddProjectRemoteProviderKind =
29 + | "github"
30 + | "gitlab"
31 + | "forgejo"
32 + | "bitbucket"
33 + | "azure-devops";
34 export type AddProjectRemoteSource = AddProjectRemoteProviderKind | "url";
35
36 export function canCreateProjectInEnvironment(
@@ -190,7 +192,7 @@ export function buildAddProjectRemoteSourceReadiness(
192 for (const source of ADD_PROJECT_REMOTE_SOURCES) {
193 const kind = addProjectRemoteSourceProvider(source);
194 if (!kind) continue;
193 - const provider = providerByKind.get(kind);
195 + const provider = providerByKind.get(SourceControlProviderKind.make(kind));
196 if (!provider) {
197 readiness[source] = unavailable;
198 continue;
packages/client-runtime/src/state/sourceControl.test.ts
+4 -3
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { vi } from "vite-plus/test";
3 import {
4 EnvironmentId,
@@ -36,7 +37,7 @@ const TARGET = new PrimaryConnectionTarget({
37
38 const PUBLISH_RESULT: SourceControlPublishRepositoryResult = {
39 repository: {
39 - provider: "github",
40 + provider: SourceControlProviderKind.make("github"),
41 nameWithOwner: "t3tools/t3code",
42 url: "https://github.com/t3tools/t3code",
43 sshUrl: "git@github.com:t3tools/t3code.git",
@@ -140,7 +141,7 @@ describe("source control environment atoms", () => {
141 environmentId: TARGET.environmentId,
142 input: {
143 cwd: "/repo",
143 - provider: "github",
144 + provider: SourceControlProviderKind.make("github"),
145 repository: "t3tools/t3code",
146 visibility: "private",
147 },
@@ -156,7 +157,7 @@ describe("source control environment atoms", () => {
157 environmentId: TARGET.environmentId,
158 input: {
159 cwd: "/repo",
159 - provider: "github",
160 + provider: SourceControlProviderKind.make("github"),
161 repository: "t3tools/t3code",
162 visibility: "private",
163 },
packages/contracts/src/pullRequest.test.ts
+11 -6
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "./sourceControl.ts";
2 import * as Schema from "effect/Schema";
3 import { describe, expect, it } from "vite-plus/test";
4
@@ -25,7 +26,7 @@ const LIST_RESULT: PullRequestListResult = {
26 providers: [
27 {
28 host: "github.com",
28 - kind: "github",
29 + kind: SourceControlProviderKind.make("github"),
30 searchesOnHost: true,
31 projectCount: 1,
32 configured: true,
@@ -33,7 +34,7 @@ const LIST_RESULT: PullRequestListResult = {
34 },
35 {
36 host: "gitlab.com",
36 - kind: "gitlab",
37 + kind: SourceControlProviderKind.make("gitlab"),
38 searchesOnHost: true,
39 projectCount: 1,
40 configured: false,
@@ -42,7 +43,7 @@ const LIST_RESULT: PullRequestListResult = {
43 ],
44 entries: [
45 {
45 - provider: "github",
46 + provider: SourceControlProviderKind.make("github"),
47 host: "github.com",
48 projectId: "project-1" as PullRequestListResult["entries"][number]["projectId"],
49 projectTitle: "t3code",
@@ -75,12 +76,16 @@ describe("PullRequestListResult", () => {
76 canonicalKey: "forge.example/team/repo",
77 locator: { remoteUrl: "http://forge.example:3000/team/repo.git" },
78 };
78 - expect(pullRequestHostOf(identity, "forgejo")).toBe("forge.example:3000");
79 - expect(pullRequestHostOf(identity, "gitlab")).toBe("forge.example");
79 + expect(pullRequestHostOf(identity, SourceControlProviderKind.make("forgejo"))).toBe(
80 + "forge.example:3000",
81 + );
82 + expect(pullRequestHostOf(identity, SourceControlProviderKind.make("gitlab"))).toBe(
83 + "forge.example",
84 + );
85 expect(
86 pullRequestHostOf(
87 { ...identity, locator: { remoteUrl: "ssh://git@forge.example:2222/team/repo.git" } },
83 - "forgejo",
88 + SourceControlProviderKind.make("forgejo"),
89 ),
90 ).toBe("forge.example");
91 });
packages/contracts/src/pullRequest.ts
+50 -34
@@ -1301,38 +1301,54 @@ export type PullRequestUnavailableReason = typeof PullRequestUnavailableReason.T
1301 * symptom. The reason names keep their `cli-` prefix for wire compatibility; for GitHub and
1302 * Bitbucket they mean "no credential" and "a refused credential", not a missing tool.
1303 */
1304 -const PROVIDER_REQUIREMENT: Partial<
1305 - Record<SourceControlProviderKind, { readonly missing: string; readonly unauthenticated: string }>
1306 -> = {
1307 - github: {
1308 - missing:
1309 - "No GitHub credential on the server. Set GH_TOKEN, or install the GitHub CLI (https://cli.github.com/) and run `gh auth login`.",
1310 - unauthenticated:
1311 - "GitHub has no working credential for this host. Run `gh auth login`, or check the account and hosts in Settings → Source Control.",
1312 - },
1313 - forgejo: {
1314 - missing:
1315 - "Install Forgejo CLI (`fj` 0.6 or later) from https://codeberg.org/forgejo-contrib/forgejo-cli or Gitea CLI (`tea` 0.16 or later) from https://gitea.com/gitea/tea to browse Forgejo pull requests.",
1316 - unauthenticated:
1317 - "Authenticate your Forgejo or Gitea server with `fj --host <server-url> auth add-token` on the T3 Code server. If fj is missing or unconfigured for that server, use `tea login add`. A configured fj account must be repaired with fj.",
1318 - },
1319 - gitlab: {
1320 - missing:
1321 - "GitLab CLI (`glab`) is required to browse change requests on this host. Install it from https://gitlab.com/gitlab-org/cli and reload.",
1322 - unauthenticated: "GitLab CLI is not authenticated. Run `glab auth login` and retry.",
1323 - },
1324 - "azure-devops": {
1325 - missing:
1326 - "Azure CLI (`az`) with the Azure DevOps extension is required. Install `az`, then run `az extension add --name azure-devops`.",
1327 - unauthenticated: "Azure CLI is not signed in. Run `az login` and retry.",
1328 - },
1329 - bitbucket: {
1330 - missing:
1331 - "Bitbucket needs API credentials on the server. Add them in Settings → Source Control.",
1332 - unauthenticated:
1333 - "Bitbucket rejected the configured credentials. Check them in Settings → Source Control.",
1334 - },
1335 -};
1304 +const PROVIDER_REQUIREMENT = new Map<
1305 + string,
1306 + { readonly missing: string; readonly unauthenticated: string }
1307 +>([
1308 + [
1309 + "github",
1310 + {
1311 + missing:
1312 + "No GitHub credential on the server. Set GH_TOKEN, or install the GitHub CLI (https://cli.github.com/) and run `gh auth login`.",
1313 + unauthenticated:
1314 + "GitHub has no working credential for this host. Run `gh auth login`, or check the account and hosts in Settings → Source Control.",
1315 + },
1316 + ],
1317 + [
1318 + "forgejo",
1319 + {
1320 + missing:
1321 + "Install Forgejo CLI (`fj` 0.6 or later) from https://codeberg.org/forgejo-contrib/forgejo-cli or Gitea CLI (`tea` 0.16 or later) from https://gitea.com/gitea/tea to browse Forgejo pull requests.",
1322 + unauthenticated:
1323 + "Authenticate your Forgejo or Gitea server with `fj --host <server-url> auth add-token` on the T3 Code server. If fj is missing or unconfigured for that server, use `tea login add`. A configured fj account must be repaired with fj.",
1324 + },
1325 + ],
1326 + [
1327 + "gitlab",
1328 + {
1329 + missing:
1330 + "GitLab CLI (`glab`) is required to browse change requests on this host. Install it from https://gitlab.com/gitlab-org/cli and reload.",
1331 + unauthenticated: "GitLab CLI is not authenticated. Run `glab auth login` and retry.",
1332 + },
1333 + ],
1334 + [
1335 + "azure-devops",
1336 + {
1337 + missing:
1338 + "Azure CLI (`az`) with the Azure DevOps extension is required. Install `az`, then run `az extension add --name azure-devops`.",
1339 + unauthenticated: "Azure CLI is not signed in. Run `az login` and retry.",
1340 + },
1341 + ],
1342 + [
1343 + "bitbucket",
1344 + {
1345 + missing:
1346 + "Bitbucket needs API credentials on the server. Add them in Settings → Source Control.",
1347 + unauthenticated:
1348 + "Bitbucket rejected the configured credentials. Check them in Settings → Source Control.",
1349 + },
1350 + ],
1351 +]);
1352
1353 /**
1354 * The host a project's repository is addressed below. `canonicalKey` is the normalized remote,
@@ -1394,7 +1410,7 @@ export function pullRequestProviderRequirement(
1410 provider: SourceControlProviderKind,
1411 reason: PullRequestUnavailableReason,
1412 ): string | null {
1397 - const requirement = PROVIDER_REQUIREMENT[provider];
1413 + const requirement = PROVIDER_REQUIREMENT.get(provider);
1414 if (requirement === undefined) return null;
1415 switch (reason) {
1416 case "cli-missing":
@@ -1427,7 +1443,7 @@ export class PullRequestUnavailableError extends Schema.TaggedError<PullRequestU
1443
1444 override get message(): string {
1445 const requirement =
1430 - this.provider === undefined ? undefined : PROVIDER_REQUIREMENT[this.provider];
1446 + this.provider === undefined ? undefined : PROVIDER_REQUIREMENT.get(this.provider);
1447 switch (this.reason) {
1448 case "cli-missing":
1449 return (
packages/contracts/src/sourceControl.ts
+11 -9
@@ -2,15 +2,17 @@ import * as Schema from "effect/Schema";
2 import { PositiveInt, TrimmedNonEmptyString } from "./baseSchemas.ts";
3 import { VcsDriverKind } from "./vcs.ts";
4
5 -export const SourceControlProviderKind = Schema.Literals([
6 - "github",
7 - "gitlab",
8 - "forgejo",
9 - "azure-devops",
10 - "bitbucket",
11 - "gitcafe",
12 - "unknown",
13 -]);
5 +/**
6 + * `SourceControlProviderKind` — open branded slug naming a source control host, such as `github`.
7 + *
8 + * Open on purpose, like `ProviderDriverKind`: a server can report a host this client does not
9 + * ship a definition for, and clients fall back to a generic presentation instead of failing to
10 + * decode. `unknown` is what the server reports for a remote it cannot attribute to any host.
11 + */
12 +export const SourceControlProviderKind = TrimmedNonEmptyString.check(
13 + Schema.isMaxLength(64),
14 + Schema.isPattern(/^[a-z][a-z0-9-]*$/),
15 +).pipe(Schema.brand("SourceControlProviderKind"));
16 export type SourceControlProviderKind = typeof SourceControlProviderKind.Type;
17
18 export const SourceControlProviderInfo = Schema.Struct({
packages/shared/src/git.test.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import type { VcsStatusRemoteResult, VcsStatusResult } from "@t3tools/contracts";
3 import { describe, expect, it } from "vite-plus/test";
4
@@ -257,7 +258,7 @@ describe("applyGitStatusStreamEvent", () => {
258 const current: VcsStatusResult = {
259 isRepo: true,
260 sourceControlProvider: {
260 - kind: "github",
261 + kind: SourceControlProviderKind.make("github"),
262 name: "GitHub",
263 baseUrl: "https://github.com",
264 },
packages/shared/src/sourceControl.test.ts
+18 -9
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { describe, expect, it } from "vite-plus/test";
3
4 import {
@@ -10,30 +11,38 @@ import {
11
12 describe("source control presentation", () => {
13 it("uses merge request terminology for GitLab", () => {
13 - expect(getChangeRequestTerminologyForKind("gitlab")).toEqual({
14 + expect(getChangeRequestTerminologyForKind(SourceControlProviderKind.make("gitlab"))).toEqual({
15 shortLabel: "MR",
16 singular: "merge request",
17 });
18 });
19
20 it("uses pull request terminology for GitHub-compatible providers", () => {
20 - expect(getChangeRequestTerminologyForKind("github")).toEqual({
21 + expect(getChangeRequestTerminologyForKind(SourceControlProviderKind.make("github"))).toEqual({
22 shortLabel: "PR",
23 singular: "pull request",
24 });
24 - expect(getChangeRequestTerminologyForKind("azure-devops")).toEqual({
25 - shortLabel: "PR",
26 - singular: "pull request",
27 - });
28 - expect(getChangeRequestTerminologyForKind("bitbucket")).toEqual({
25 + expect(
26 + getChangeRequestTerminologyForKind(SourceControlProviderKind.make("azure-devops")),
27 + ).toEqual({
28 shortLabel: "PR",
29 singular: "pull request",
30 });
31 + expect(getChangeRequestTerminologyForKind(SourceControlProviderKind.make("bitbucket"))).toEqual(
32 + {
33 + shortLabel: "PR",
34 + singular: "pull request",
35 + },
36 + );
37 });
38
39 it("falls back to generic change request copy for unknown providers", () => {
40 expect(
36 - resolveChangeRequestPresentation({ kind: "unknown", name: "forge", baseUrl: "" }),
41 + resolveChangeRequestPresentation({
42 + kind: SourceControlProviderKind.make("unknown"),
43 + name: "forge",
44 + baseUrl: "",
45 + }),
46 ).toEqual(
47 expect.objectContaining({
48 shortName: "change request",
@@ -69,7 +78,7 @@ describe("detectSourceControlProviderFromRemoteUrl", () => {
78 },
79 );
80 }
72 - expect(getChangeRequestTerminologyForKind("forgejo")).toEqual({
81 + expect(getChangeRequestTerminologyForKind(SourceControlProviderKind.make("forgejo"))).toEqual({
82 shortLabel: "PR",
83 singular: "pull request",
84 });
packages/shared/src/sourceControl.ts
+14 -13
@@ -1,8 +1,5 @@
1 -import type {
2 - RepositoryIdentity,
3 - SourceControlProviderInfo,
4 - SourceControlProviderKind,
5 -} from "@t3tools/contracts";
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 +import type { RepositoryIdentity, SourceControlProviderInfo } from "@t3tools/contracts";
3
4 export interface ChangeRequestPresentation {
5 readonly icon:
@@ -124,7 +121,7 @@ export function resolveChangeRequestPresentation(
121 return BITBUCKET_CHANGE_REQUEST_PRESENTATION;
122 case "gitcafe":
123 return GITCAFE_CHANGE_REQUEST_PRESENTATION;
127 - case "unknown":
124 + default:
125 return GENERIC_CHANGE_REQUEST_PRESENTATION;
126 }
127 }
@@ -244,7 +241,11 @@ export function detectSourceControlProviderFromRemoteUrl(
241 const hostname = parseHostName(host);
242
243 if (isGitCafeHost(hostname)) {
247 - return { kind: "gitcafe", name: "GitCafe", baseUrl: toBaseUrl(hostname) };
244 + return {
245 + kind: SourceControlProviderKind.make("gitcafe"),
246 + name: "GitCafe",
247 + baseUrl: toBaseUrl(hostname),
248 + };
249 }
250
251 if (
@@ -253,7 +254,7 @@ export function detectSourceControlProviderFromRemoteUrl(
254 hasDnsLabel(hostname, "gitea")
255 ) {
256 return {
256 - kind: "forgejo",
257 + kind: SourceControlProviderKind.make("forgejo"),
258 name: "Forgejo",
259 baseUrl: /^https?:/iu.test(remoteUrl.trim())
260 ? new URL(remoteUrl.trim()).origin
@@ -263,7 +264,7 @@ export function detectSourceControlProviderFromRemoteUrl(
264
265 if (isGitHubHost(hostname)) {
266 return {
266 - kind: "github",
267 + kind: SourceControlProviderKind.make("github"),
268 name: hostname === "github.com" ? "GitHub" : "GitHub Self-Hosted",
269 baseUrl: toBaseUrl(host),
270 };
@@ -271,7 +272,7 @@ export function detectSourceControlProviderFromRemoteUrl(
272
273 if (isGitLabHost(hostname)) {
274 return {
274 - kind: "gitlab",
275 + kind: SourceControlProviderKind.make("gitlab"),
276 name: hostname === "gitlab.com" ? "GitLab" : "GitLab Self-Hosted",
277 baseUrl: toBaseUrl(host),
278 };
@@ -279,7 +280,7 @@ export function detectSourceControlProviderFromRemoteUrl(
280
281 if (isAzureDevOpsHost(hostname)) {
282 return {
282 - kind: "azure-devops",
283 + kind: SourceControlProviderKind.make("azure-devops"),
284 name: "Azure DevOps",
285 baseUrl: toBaseUrl(host),
286 };
@@ -287,14 +288,14 @@ export function detectSourceControlProviderFromRemoteUrl(
288
289 if (isBitbucketHost(hostname)) {
290 return {
290 - kind: "bitbucket",
291 + kind: SourceControlProviderKind.make("bitbucket"),
292 name: hostname === "bitbucket.org" ? "Bitbucket" : "Bitbucket Self-Hosted",
293 baseUrl: toBaseUrl(host),
294 };
295 }
296
297 return {
297 - kind: "unknown",
298 + kind: SourceControlProviderKind.make("unknown"),
299 name: host,
300 baseUrl: toBaseUrl(host),
301 };
packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestProvider.ts
+5 -4
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Effect from "effect/Effect";
3 import * as Semaphore from "effect/Semaphore";
4 import type { PullRequestCapabilities, PullRequestViewerPermissions } from "@t3tools/contracts";
@@ -157,7 +158,7 @@ export const make = Effect.gen(function* () {
158 const fail =
159 (operation: string) => (error: AzureDevOpsPullRequestCli.AzureDevOpsPullRequestCliError) =>
160 new PullRequestProviderError({
160 - provider: "azure-devops",
161 + provider: SourceControlProviderKind.make("azure-devops"),
162 operation,
163 ...azureDevOpsProviderFailure(error),
164 detail: error.detail,
@@ -168,7 +169,7 @@ export const make = Effect.gen(function* () {
169 const unsupported = (operation: string) =>
170 Effect.fail(
171 new PullRequestProviderError({
171 - provider: "azure-devops",
172 + provider: SourceControlProviderKind.make("azure-devops"),
173 operation,
174 reason: "failed",
175 detail: "Azure DevOps reviews cannot be written from here yet.",
@@ -296,7 +297,7 @@ export const make = Effect.gen(function* () {
297 };
298
299 const provider: PullRequestProviderApi = {
299 - kind: "azure-devops",
300 + kind: SourceControlProviderKind.make("azure-devops"),
301 capabilities: CAPABILITIES,
302 // The bare repository name repeats across an organization; the project path does not.
303 repositoryKey: ({ canonicalKey }) => canonicalKey,
@@ -612,7 +613,7 @@ export const make = Effect.gen(function* () {
613 listReviewerCandidates: () =>
614 Effect.fail(
615 new PullRequestProviderError({
615 - provider: "azure-devops",
616 + provider: SourceControlProviderKind.make("azure-devops"),
617 operation: "listReviewerCandidates",
618 reason: "failed",
619 detail: "Azure DevOps cannot say who may review a pull request.",
packages/source-control-azure-devops/src/server/AzureDevOpsSourceControlProvider.test.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { assert, it } from "@effect/vitest";
3 import * as Effect from "effect/Effect";
4 import * as Layer from "effect/Layer";
@@ -35,7 +36,7 @@ it.effect("maps Azure DevOps PR summaries into provider-neutral change requests"
36 });
37
38 assert.deepStrictEqual(changeRequest, {
38 - provider: "azure-devops",
39 + provider: SourceControlProviderKind.make("azure-devops"),
40 number: 42,
41 title: "Add Azure provider",
42 url: "https://dev.azure.com/acme/project/_git/repo/pullrequest/42",
packages/source-control-azure-devops/src/server/AzureDevOpsSourceControlProvider.ts
+11 -10
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Effect from "effect/Effect";
3 import { SourceControlProviderError, type ChangeRequest } from "@t3tools/contracts";
4
@@ -39,7 +40,7 @@ function parseAzureAuth(input: SourceControlAuthProbeInput) {
40
41 export const discovery = {
42 type: "cli",
42 - kind: "azure-devops",
43 + kind: SourceControlProviderKind.make("azure-devops"),
44 label: "Azure DevOps",
45 executable: "az",
46 versionArgs: ["--version"],
@@ -67,7 +68,7 @@ function toChangeRequest(summary: {
68 readonly updatedAt: ChangeRequest["updatedAt"];
69 }): ChangeRequest {
70 return {
70 - provider: "azure-devops",
71 + provider: SourceControlProviderKind.make("azure-devops"),
72 number: summary.number,
73 title: summary.title,
74 url: summary.url,
@@ -86,7 +87,7 @@ export const make = Effect.gen(function* () {
87 const azure = yield* AzureDevOpsCli.AzureDevOpsCli;
88
89 return SourceControlProvider.SourceControlProvider.of({
89 - kind: "azure-devops",
90 + kind: SourceControlProviderKind.make("azure-devops"),
91 listChangeRequests: (input) => {
92 const source = SourceControlProvider.sourceControlRefFromInput(input);
93 return azure
@@ -102,7 +103,7 @@ export const make = Effect.gen(function* () {
103 Effect.mapError(
104 (error) =>
105 new SourceControlProviderError({
105 - provider: "azure-devops",
106 + provider: SourceControlProviderKind.make("azure-devops"),
107 operation: "listChangeRequests",
108 command: error.command,
109 cwd: input.cwd,
@@ -121,7 +122,7 @@ export const make = Effect.gen(function* () {
122 Effect.mapError(
123 (error) =>
124 new SourceControlProviderError({
124 - provider: "azure-devops",
125 + provider: SourceControlProviderKind.make("azure-devops"),
126 operation: "getChangeRequest",
127 command: error.command,
128 cwd: input.cwd,
@@ -149,7 +150,7 @@ export const make = Effect.gen(function* () {
150 Effect.mapError(
151 (error) =>
152 new SourceControlProviderError({
152 - provider: "azure-devops",
153 + provider: SourceControlProviderKind.make("azure-devops"),
154 operation: "createChangeRequest",
155 command: error.command,
156 cwd: input.cwd,
@@ -167,7 +168,7 @@ export const make = Effect.gen(function* () {
168 Effect.mapError(
169 (error) =>
170 new SourceControlProviderError({
170 - provider: "azure-devops",
171 + provider: SourceControlProviderKind.make("azure-devops"),
172 operation: "getRepositoryCloneUrls",
173 command: error.command,
174 cwd: input.cwd,
@@ -184,7 +185,7 @@ export const make = Effect.gen(function* () {
185 Effect.mapError(
186 (error) =>
187 new SourceControlProviderError({
187 - provider: "azure-devops",
188 + provider: SourceControlProviderKind.make("azure-devops"),
189 operation: "createRepository",
190 command: error.command,
191 cwd: input.cwd,
@@ -201,7 +202,7 @@ export const make = Effect.gen(function* () {
202 Effect.mapError(
203 (error) =>
204 new SourceControlProviderError({
204 - provider: "azure-devops",
205 + provider: SourceControlProviderKind.make("azure-devops"),
206 operation: "getDefaultBranch",
207 command: error.command,
208 cwd: input.cwd,
@@ -221,7 +222,7 @@ export const make = Effect.gen(function* () {
222 Effect.mapError(
223 (error) =>
224 new SourceControlProviderError({
224 - provider: "azure-devops",
225 + provider: SourceControlProviderKind.make("azure-devops"),
226 operation: "checkoutChangeRequest",
227 command: error.command,
228 cwd: input.cwd,
packages/source-control-azure-devops/src/server/driver.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 /**
3 * The Azure DevOps driver: repository operations, discovery, and pull requests through `az`.
4 *
@@ -10,7 +11,7 @@ import * as AzureDevOpsPullRequestProvider from "./AzureDevOpsPullRequestProvide
11 import * as AzureDevOpsSourceControlProvider from "./AzureDevOpsSourceControlProvider.ts";
12
13 export const driver = defineSourceControlDriver({
13 - kind: "azure-devops",
14 + kind: SourceControlProviderKind.make("azure-devops"),
15 make: Effect.all({
16 sourceControl: AzureDevOpsSourceControlProvider.make,
17 discovery: Effect.succeed(AzureDevOpsSourceControlProvider.discovery),
packages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.ts
+4 -3
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Effect from "effect/Effect";
3 import type { PullRequestCapabilities, PullRequestViewerPermissions } from "@t3tools/contracts";
4
@@ -122,7 +123,7 @@ export const make = Effect.gen(function* () {
123 const fail =
124 (operation: string) => (error: BitbucketPullRequestApi.BitbucketPullRequestApiError) =>
125 new PullRequestProviderError({
125 - provider: "bitbucket",
126 + provider: SourceControlProviderKind.make("bitbucket"),
127 operation,
128 ...bitbucketProviderFailure(error),
129 // Every Bitbucket failure states its own fact; this names the operation around it, so
@@ -157,7 +158,7 @@ export const make = Effect.gen(function* () {
158 };
159
160 const provider: PullRequestProviderApi = {
160 - kind: "bitbucket",
161 + kind: SourceControlProviderKind.make("bitbucket"),
162 capabilities: CAPABILITIES,
163
164 // Bitbucket credentials come from the server's environment rather than a checkout, so the
@@ -363,7 +364,7 @@ export const make = Effect.gen(function* () {
364 setReaction: () =>
365 Effect.fail(
366 new PullRequestProviderError({
366 - provider: "bitbucket",
367 + provider: SourceControlProviderKind.make("bitbucket"),
368 operation: "setReaction",
369 reason: "failed",
370 detail: "Bitbucket does not support reactions.",
packages/source-control-bitbucket/src/server/BitbucketSourceControlProvider.test.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { assert, it } from "@effect/vitest";
3 import * as Effect from "effect/Effect";
4 import * as Layer from "effect/Layer";
@@ -36,7 +37,7 @@ it.effect("maps Bitbucket PR summaries into provider-neutral change requests", (
37 });
38
39 assert.deepStrictEqual(changeRequest, {
39 - provider: "bitbucket",
40 + provider: SourceControlProviderKind.make("bitbucket"),
41 number: 42,
42 title: "Add Bitbucket provider",
43 url: "https://bitbucket.org/pingdotgg/t3code/pull-requests/42",
packages/source-control-bitbucket/src/server/BitbucketSourceControlProvider.ts
+11 -10
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Effect from "effect/Effect";
3 import * as Option from "effect/Option";
4 import { SourceControlProviderError, type ChangeRequest } from "@t3tools/contracts";
@@ -9,7 +10,7 @@ import type { SourceControlApiDiscoverySpec } from "@t3tools/source-control-core
10
11 function toChangeRequest(summary: NormalizedBitbucketPullRequestRecord): ChangeRequest {
12 return {
12 - provider: "bitbucket",
13 + provider: SourceControlProviderKind.make("bitbucket"),
14 number: summary.number,
15 title: summary.title,
16 url: summary.url,
@@ -34,7 +35,7 @@ export const make = Effect.gen(function* () {
35 const bitbucket = yield* BitbucketApi.BitbucketApi;
36
37 return SourceControlProvider.SourceControlProvider.of({
37 - kind: "bitbucket",
38 + kind: SourceControlProviderKind.make("bitbucket"),
39 listChangeRequests: (input) => {
40 const source = SourceControlProvider.sourceControlRefFromInput(input);
41 return bitbucket
@@ -51,7 +52,7 @@ export const make = Effect.gen(function* () {
52 Effect.mapError(
53 (error) =>
54 new SourceControlProviderError({
54 - provider: "bitbucket",
55 + provider: SourceControlProviderKind.make("bitbucket"),
56 operation: "listChangeRequests",
57 cwd: input.cwd,
58 reference: SourceControlProvider.transportSafeSourceControlErrorValue(
@@ -69,7 +70,7 @@ export const make = Effect.gen(function* () {
70 Effect.mapError(
71 (error) =>
72 new SourceControlProviderError({
72 - provider: "bitbucket",
73 + provider: SourceControlProviderKind.make("bitbucket"),
74 operation: "getChangeRequest",
75 cwd: input.cwd,
76 reference: SourceControlProvider.transportSafeSourceControlErrorValue(
@@ -97,7 +98,7 @@ export const make = Effect.gen(function* () {
98 Effect.mapError(
99 (error) =>
100 new SourceControlProviderError({
100 - provider: "bitbucket",
101 + provider: SourceControlProviderKind.make("bitbucket"),
102 operation: "createChangeRequest",
103 cwd: input.cwd,
104 reference: SourceControlProvider.transportSafeSourceControlErrorValue(
@@ -114,7 +115,7 @@ export const make = Effect.gen(function* () {
115 Effect.mapError(
116 (error) =>
117 new SourceControlProviderError({
117 - provider: "bitbucket",
118 + provider: SourceControlProviderKind.make("bitbucket"),
119 operation: "getRepositoryCloneUrls",
120 cwd: input.cwd,
121 repository: SourceControlProvider.transportSafeSourceControlErrorValue(
@@ -130,7 +131,7 @@ export const make = Effect.gen(function* () {
131 Effect.mapError(
132 (error) =>
133 new SourceControlProviderError({
133 - provider: "bitbucket",
134 + provider: SourceControlProviderKind.make("bitbucket"),
135 operation: "createRepository",
136 cwd: input.cwd,
137 repository: SourceControlProvider.transportSafeSourceControlErrorValue(
@@ -151,7 +152,7 @@ export const make = Effect.gen(function* () {
152 Effect.mapError(
153 (error) =>
154 new SourceControlProviderError({
154 - provider: "bitbucket",
155 + provider: SourceControlProviderKind.make("bitbucket"),
156 operation: "getDefaultBranch",
157 cwd: input.cwd,
158 detail: "Failed to get default branch.",
@@ -171,7 +172,7 @@ export const make = Effect.gen(function* () {
172 Effect.mapError(
173 (error) =>
174 new SourceControlProviderError({
174 - provider: "bitbucket",
175 + provider: SourceControlProviderKind.make("bitbucket"),
176 operation: "checkoutChangeRequest",
177 cwd: input.cwd,
178 reference: SourceControlProvider.transportSafeSourceControlErrorValue(
@@ -190,7 +191,7 @@ export const makeDiscovery = Effect.gen(function* () {
191
192 return {
193 type: "api",
193 - kind: "bitbucket",
194 + kind: SourceControlProviderKind.make("bitbucket"),
195 label: "Bitbucket",
196 installHint: "Add a Bitbucket token in Settings → Source Control.",
197 probeAuth: bitbucket.probeAuth,
packages/source-control-bitbucket/src/server/driver.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 /**
3 * The Bitbucket Cloud driver: repository operations, discovery, and pull requests through the
4 * Bitbucket REST API.
@@ -11,7 +12,7 @@ import * as BitbucketPullRequestProvider from "./BitbucketPullRequestProvider.ts
12 import * as BitbucketSourceControlProvider from "./BitbucketSourceControlProvider.ts";
13
14 export const driver = defineSourceControlDriver({
14 - kind: "bitbucket",
15 + kind: SourceControlProviderKind.make("bitbucket"),
16 make: Effect.all({
17 sourceControl: BitbucketSourceControlProvider.make,
18 discovery: BitbucketSourceControlProvider.makeDiscovery,
packages/source-control-core/src/server/SourceControlRateLimit.test.ts
+17 -4
@@ -1,10 +1,11 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { assert, it } from "@effect/vitest";
3 import * as Effect from "effect/Effect";
4 import * as TestClock from "effect/testing/TestClock";
5
6 import * as SourceControlRateLimit from "./SourceControlRateLimit.ts";
7
7 -const github = { provider: "github" as const, host: "github.com" };
8 +const github = { provider: SourceControlProviderKind.make("github"), host: "github.com" };
9
10 it.effect("isolates cooldowns for verified credentials on the same host", () =>
11 Effect.gen(function* () {
@@ -41,7 +42,7 @@ it.effect("backs off repeated rate limits until a successful request", () =>
42 const firstPause = yield* Effect.flip(limits.check(github));
43 assert.deepInclude(firstPause, {
44 _tag: "SourceControlRateLimitPausedError",
44 - provider: "github",
45 + provider: SourceControlProviderKind.make("github"),
46 host: "github.com",
47 retryAt: 30_000,
48 });
@@ -105,8 +106,20 @@ it.effect("keeps providers and hosts isolated", () =>
106 const lease = yield* limits.check(github);
107 yield* limits.recordRateLimit({ ...github, lease });
108
108 - assert.equal(yield* limits.check({ provider: "gitlab", host: "github.com" }), 0);
109 - assert.equal(yield* limits.check({ provider: "github", host: "github.example.com" }), 0);
109 + assert.equal(
110 + yield* limits.check({
111 + provider: SourceControlProviderKind.make("gitlab"),
112 + host: "github.com",
113 + }),
114 + 0,
115 + );
116 + assert.equal(
117 + yield* limits.check({
118 + provider: SourceControlProviderKind.make("github"),
119 + host: "github.example.com",
120 + }),
121 + 0,
122 + );
123 }).pipe(Effect.provide(SourceControlRateLimit.layer)),
124 );
125
packages/source-control-forgejo/src/server/ForgejoPullRequestProvider.ts
+4 -3
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Effect from "effect/Effect";
3 import * as Schema from "effect/Schema";
4 import * as Result from "effect/Result";
@@ -67,7 +68,7 @@ export const make = Effect.gen(function* () {
68 const cli = yield* ForgejoCli.ForgejoCli;
69 const failure = (operation: string, detail: string, cause?: unknown) =>
70 new PullRequestProviderError({
70 - provider: "forgejo",
71 + provider: SourceControlProviderKind.make("forgejo"),
72 operation,
73 reason: "failed",
74 detail,
@@ -78,7 +79,7 @@ export const make = Effect.gen(function* () {
79 Effect.mapError(
80 (error) =>
81 new PullRequestProviderError({
81 - provider: "forgejo",
82 + provider: SourceControlProviderKind.make("forgejo"),
83 operation: input.path,
84 detail: error.detail,
85 cause: error,
@@ -203,7 +204,7 @@ export const make = Effect.gen(function* () {
204 const unsupported = (operation: string) =>
205 Effect.fail(failure(operation, `Forgejo does not expose ${operation} through its API.`));
206 const provider: PullRequestProviderApi = {
206 - kind: "forgejo",
207 + kind: SourceControlProviderKind.make("forgejo"),
208 capabilities: CAPABILITIES,
209 getViewer,
210 listChangeRequests: Effect.fn("ForgejoPullRequestProvider.listChangeRequests")(
packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts
+25 -8
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { assert, it } from "@effect/vitest";
3 import * as Effect from "effect/Effect";
4 import * as FileSystem from "effect/FileSystem";
@@ -258,7 +259,11 @@ it.effect("gives Forgejo identities the browser URL of the login that serves the
259 });
260 const served = (baseUrl: string) => () =>
261 Effect.succeed({
261 - provider: { kind: "forgejo" as const, name: "Forgejo / Gitea", baseUrl },
262 + provider: {
263 + kind: SourceControlProviderKind.make("forgejo"),
264 + name: "Forgejo / Gitea",
265 + baseUrl,
266 + },
267 remoteName: "origin",
268 remoteUrl: "",
269 });
@@ -271,7 +276,7 @@ it.effect("gives Forgejo identities the browser URL of the login that serves the
276 }),
277 {
278 ...identity("http://forge.test:3000/git/team/repo.git"),
274 - provider: "forgejo",
279 + provider: SourceControlProviderKind.make("forgejo"),
280 webUrl: "http://forge.test:3000/git/team/repo",
281 },
282 );
@@ -557,7 +562,7 @@ it.effect("discovers Forgejo accounts and retains the server port", () =>
562 cwd: "/repo",
563 context: {
564 provider: {
560 - kind: "unknown",
565 + kind: SourceControlProviderKind.make("unknown"),
566 name: "git.forgejo.local",
567 baseUrl: "https://git.forgejo.local",
568 },
@@ -577,7 +582,7 @@ it.effect("discovers Forgejo accounts and retains the server port", () =>
582 ),
583 });
584 assert.deepStrictEqual(refined, {
580 - kind: "forgejo",
585 + kind: SourceControlProviderKind.make("forgejo"),
586 name: "Forgejo / Gitea",
587 baseUrl: "http://forgejo.local:3000",
588 });
@@ -622,7 +627,11 @@ it.effect("does not choose a default Forgejo login across ambiguous SSH server p
627 const refined = ForgejoSourceControlProvider.discovery.refineUnknownRemote({
628 cwd: "/repo",
629 context: {
625 - provider: { kind: "unknown", name: "Forgejo", baseUrl: "https://forgejo.local" },
630 + provider: {
631 + kind: SourceControlProviderKind.make("unknown"),
632 + name: "Forgejo",
633 + baseUrl: "https://forgejo.local",
634 + },
635 remoteName: "origin",
636 remoteUrl: "git@forgejo.local:maria/project.git",
637 requestedHost: "forgejo.local:4000",
@@ -732,7 +741,11 @@ it.effect("routes mounted Forgejo repositories without repeating the mount in AP
741 cwd: "/repo",
742 repository: "forgejo/maria/project",
743 context: {
735 - provider: { kind: "forgejo", name: "Forgejo", baseUrl: "https://code.test/forgejo" },
744 + provider: {
745 + kind: SourceControlProviderKind.make("forgejo"),
746 + name: "Forgejo",
747 + baseUrl: "https://code.test/forgejo",
748 + },
749 remoteName: "origin",
750 remoteUrl: "https://code.test/forgejo/maria/project.git",
751 },
@@ -744,7 +757,11 @@ it.effect("routes mounted Forgejo repositories without repeating the mount in AP
757 cwd: "/repo",
758 repository: "forgejo/project",
759 context: {
747 - provider: { kind: "forgejo", name: "Forgejo", baseUrl: "https://code.test/forgejo" },
760 + provider: {
761 + kind: SourceControlProviderKind.make("forgejo"),
762 + name: "Forgejo",
763 + baseUrl: "https://code.test/forgejo",
764 + },
765 remoteName: "origin",
766 remoteUrl: "ssh://git@code.test/forgejo/project.git",
767 },
@@ -827,7 +844,7 @@ it.effect("prefers fj for HTTP and ported SSH aliases on root servers", () => {
844 repository: "maria/project",
845 context: {
846 provider: {
830 - kind: "forgejo",
847 + kind: SourceControlProviderKind.make("forgejo"),
848 name: "Forgejo",
849 baseUrl: "http://forgejo.local:3000",
850 },
packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.ts
+24 -8
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Effect from "effect/Effect";
3 import * as FileSystem from "effect/FileSystem";
4 import * as Schema from "effect/Schema";
@@ -18,7 +19,7 @@ const isForgejoCliError = Schema.is(ForgejoCli.ForgejoCliError);
19
20 export const discovery = {
21 type: "cli",
21 - kind: "forgejo",
22 + kind: SourceControlProviderKind.make("forgejo"),
23 label: "Forgejo / Gitea",
24 executable: "tea",
25 versionArgs: ["--version"],
@@ -47,7 +48,13 @@ export const discovery = {
48 remote,
49 input.context.requestedHost,
50 );
50 - return login ? { kind: "forgejo", name: "Forgejo / Gitea", baseUrl: login.url } : null;
51 + return login
52 + ? {
53 + kind: SourceControlProviderKind.make("forgejo"),
54 + name: "Forgejo / Gitea",
55 + baseUrl: login.url,
56 + }
57 + : null;
58 },
59 installHint:
60 "Install `fj` 0.6 or later from https://codeberg.org/forgejo-contrib/forgejo-cli and run `fj --host <server-url> auth add-token`, or install `tea` 0.16 or later from https://gitea.com/gitea/tea and run `tea login add` for each Forgejo or Gitea server.",
@@ -60,7 +67,7 @@ export const makeDiscovery = Effect.gen(function* () {
67 if (!listLogins) return discovery;
68 return {
69 type: "managed-cli",
63 - kind: "forgejo",
70 + kind: SourceControlProviderKind.make("forgejo"),
71 label: discovery.label,
72 installHint: discovery.installHint,
73 probe: Effect.fn("ForgejoSourceControlProvider.discovery")(function* (cwd: string) {
@@ -150,7 +157,12 @@ export const makeDiscovery = Effect.gen(function* () {
157 remoteUrl: input.context.remoteUrl,
158 }).pipe(Effect.orElseSucceed(() => []));
159 const login = ForgejoCli.matchForgejoLogin(logins, remote, input.context.requestedHost);
153 - if (login) return { kind: "forgejo" as const, name: discovery.label, baseUrl: login.url };
160 + if (login)
161 + return {
162 + kind: SourceControlProviderKind.make("forgejo"),
163 + name: discovery.label,
164 + baseUrl: login.url,
165 + };
166 }
167 return null;
168 },
@@ -188,7 +200,7 @@ const refineRepositoryIdentity: NonNullable<
200 const context = yield* resolveContext({
201 cwd: identity.rootPath,
202 context: {
191 - provider: { kind: "unknown", name: "Unknown", baseUrl: "" },
203 + provider: { kind: SourceControlProviderKind.make("unknown"), name: "Unknown", baseUrl: "" },
204 remoteName: identity.locator.remoteName,
205 remoteUrl: identity.locator.remoteUrl,
206 },
@@ -200,7 +212,11 @@ const refineRepositoryIdentity: NonNullable<
212 !remote.ssh && basePath && remote.path.startsWith(`${basePath}/`)
213 ? remote.path.slice(basePath.length + 1)
214 : remote.path;
203 - return { ...identity, provider: "forgejo", webUrl: `${baseUrl}/${path}` };
215 + return {
216 + ...identity,
217 + provider: SourceControlProviderKind.make("forgejo"),
218 + webUrl: `${baseUrl}/${path}`,
219 + };
220 });
221
222 const RepositorySchema = Schema.Struct({
@@ -245,7 +261,7 @@ export const make = Effect.gen(function* () {
261 Effect.mapError(
262 (cause: unknown) =>
263 new SourceControlProviderError({
248 - provider: "forgejo",
264 + provider: SourceControlProviderKind.make("forgejo"),
265 operation,
266 cwd,
267 ...(isForgejoCliError(cause) ? { command: cause.command } : {}),
@@ -272,7 +288,7 @@ export const make = Effect.gen(function* () {
288 );
289 });
290 return SourceControlProvider.SourceControlProvider.of({
275 - kind: "forgejo",
291 + kind: SourceControlProviderKind.make("forgejo"),
292 repositoryNameFromRemoteUrl,
293 refineRepositoryIdentity,
294 listChangeRequests: (input) =>
packages/source-control-forgejo/src/server/driver.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 /**
3 * The Forgejo / Gitea driver: repository operations, discovery, and pull requests through
4 * `fj` or `tea`.
@@ -11,7 +12,7 @@ import * as ForgejoPullRequestProvider from "./ForgejoPullRequestProvider.ts";
12 import * as ForgejoSourceControlProvider from "./ForgejoSourceControlProvider.ts";
13
14 export const driver = defineSourceControlDriver({
14 - kind: "forgejo",
15 + kind: SourceControlProviderKind.make("forgejo"),
16 make: Effect.all({
17 sourceControl: ForgejoSourceControlProvider.make,
18 discovery: ForgejoSourceControlProvider.makeDiscovery,
packages/source-control-forgejo/src/server/forgejoPullRequests.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Schema from "effect/Schema";
3 import * as Option from "effect/Option";
4 import type { ChangeRequest } from "@t3tools/contracts";
@@ -26,7 +27,7 @@ export const ForgejoPullRequestSchema = Schema.Struct({
27 });
28 export function toForgejoChangeRequest(raw: typeof ForgejoPullRequestSchema.Type): ChangeRequest {
29 return {
29 - provider: "forgejo",
30 + provider: SourceControlProviderKind.make("forgejo"),
31 number: raw.number,
32 title: raw.title,
33 url: raw.html_url,
packages/source-control-gitcafe/src/server/GitCafePullRequestProvider.ts
+4 -3
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Effect from "effect/Effect";
3 import * as Option from "effect/Option";
4 import * as Schema from "effect/Schema";
@@ -176,7 +177,7 @@ export const make = Effect.gen(function* () {
177
178 const failure = (operation: string, detail: string, cause?: unknown) =>
179 new PullRequestProviderError({
179 - provider: "gitcafe",
180 + provider: SourceControlProviderKind.make("gitcafe"),
181 operation,
182 reason: "failed",
183 detail,
@@ -207,7 +208,7 @@ export const make = Effect.gen(function* () {
208 Effect.mapError(
209 (error) =>
210 new PullRequestProviderError({
210 - provider: "gitcafe",
211 + provider: SourceControlProviderKind.make("gitcafe"),
212 operation,
213 reason: error.reason,
214 detail: error.detail,
@@ -475,7 +476,7 @@ export const make = Effect.gen(function* () {
476 });
477
478 const provider: PullRequestProviderApi = {
478 - kind: "gitcafe",
479 + kind: SourceControlProviderKind.make("gitcafe"),
480 capabilities: CAPABILITIES,
481 getViewer: (input) =>
482 read(
packages/source-control-gitcafe/src/server/GitCafeSourceControlProvider.test.ts
+11 -2
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 /**
3 * Pins `./GitCafeSourceControlProvider.ts`, which pass 2 creates:
4 *
@@ -87,7 +88,11 @@ describe("GitCafeSourceControlProvider", () => {
88 );
89 });
90 const context = {
90 - provider: { kind: "gitcafe" as const, name: "GitCafe", baseUrl: `https://${host}` },
91 + provider: {
92 + kind: SourceControlProviderKind.make("gitcafe"),
93 + name: "GitCafe",
94 + baseUrl: `https://${host}`,
95 + },
96 remoteName: "origin",
97 remoteUrl,
98 };
@@ -220,7 +225,11 @@ describe("GitCafeSourceControlProvider", () => {
225 remoteUrl === undefined
226 ? undefined
227 : {
223 - provider: { kind: "gitcafe" as const, name: "GitCafe", baseUrl: "https://git.cafe" },
228 + provider: {
229 + kind: SourceControlProviderKind.make("gitcafe"),
230 + name: "GitCafe",
231 + baseUrl: "https://git.cafe",
232 + },
233 remoteName: "origin",
234 remoteUrl,
235 };
packages/source-control-gitcafe/src/server/GitCafeSourceControlProvider.ts
+5 -4
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Effect from "effect/Effect";
3 import * as Option from "effect/Option";
4 import * as Result from "effect/Result";
@@ -59,7 +60,7 @@ const cliFailure = (output: string) =>
60
61 export const discovery = {
62 type: "cli",
62 - kind: "gitcafe",
63 + kind: SourceControlProviderKind.make("gitcafe"),
64 label: "GitCafe",
65 executable: "cafe",
66 versionArgs: ["--version"],
@@ -150,7 +151,7 @@ export const make = Effect.gen(function* () {
151
152 const error = (operation: string, cwd: string, detail: string, cause?: unknown) =>
153 new SourceControlProviderError({
153 - provider: "gitcafe",
154 + provider: SourceControlProviderKind.make("gitcafe"),
155 operation,
156 cwd,
157 detail,
@@ -269,7 +270,7 @@ export const make = Effect.gen(function* () {
270 );
271 const owner = target.repository.split("/")[0] ?? null;
272 return {
272 - provider: "gitcafe",
273 + provider: SourceControlProviderKind.make("gitcafe"),
274 number: pull.number,
275 title: pull.title,
276 url: `https://${target.host}/${target.repository}/pulls/${pull.number}`,
@@ -290,7 +291,7 @@ export const make = Effect.gen(function* () {
291 });
292
293 return SourceControlProvider.SourceControlProvider.of({
293 - kind: "gitcafe",
294 + kind: SourceControlProviderKind.make("gitcafe"),
295 repositoryNameFromRemoteUrl: (url) => GitCafeHosts.parseGitCafeRemote(url)?.repository ?? null,
296 getChangeRequest: getPull,
297 listChangeRequests: Effect.fn("GitCafeSourceControlProvider.listChangeRequests")(
packages/source-control-gitcafe/src/server/driver.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 /**
3 * The GitCafe driver: repository operations and discovery through `cafe` and git, and pull
4 * requests through GitCafe's REST API on git.cafe and staging.git.cafe.
@@ -11,7 +12,7 @@ import * as GitCafePullRequestProvider from "./GitCafePullRequestProvider.ts";
12 import * as GitCafeSourceControlProvider from "./GitCafeSourceControlProvider.ts";
13
14 export const driver = defineSourceControlDriver({
14 - kind: "gitcafe",
15 + kind: SourceControlProviderKind.make("gitcafe"),
16 make: Effect.all({
17 sourceControl: GitCafeSourceControlProvider.make,
18 discovery: Effect.succeed(GitCafeSourceControlProvider.discovery),
packages/source-control-github/src/server/GitHubApi.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Clock from "effect/Clock";
3 import * as Context from "effect/Context";
4 import * as Data from "effect/Data";
@@ -389,7 +390,7 @@ export const make = Effect.gen(function* () {
390 // this reads today is `core`; a `search/` read would need its own resource here. A refusal
391 // still pauses the whole host, the key PullRequestService records its own backoff under.
392 const resource = input.graphql === true ? "graphql" : "core";
392 - const key = { provider: "github" as const, host };
393 + const key = { provider: SourceControlProviderKind.make("github"), host };
394 const run = Effect.gen(function* () {
395 const lease = yield* quota
396 .admit(host, resource, { allowReserve: input.allowReserve })
packages/source-control-github/src/server/GitHubPullRequestProvider.ts
+3 -2
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { removeAgentCredits } from "@t3tools/source-control-core/server/mergeMessage";
3 import * as Effect from "effect/Effect";
4 import type {
@@ -202,7 +203,7 @@ export const make = Effect.gen(function* () {
203
204 const fail = (operation: string) => (error: GitHubPullRequestApi.GitHubPullRequestApiError) =>
205 new PullRequestProviderError({
205 - provider: "github",
206 + provider: SourceControlProviderKind.make("github"),
207 operation,
208 ...gitHubProviderFailure(error),
209 detail: error.message,
@@ -261,7 +262,7 @@ export const make = Effect.gen(function* () {
262 );
263
264 const provider: PullRequestProviderApi = {
264 - kind: "github",
265 + kind: SourceControlProviderKind.make("github"),
266 capabilities: CAPABILITIES,
267 mergeMessageRewrite: removeAgentCredits,
268 getRoutingIdentity: (input) =>
packages/source-control-github/src/server/GitHubQuota.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Clock from "effect/Clock";
3 import * as Context from "effect/Context";
4 import * as Effect from "effect/Effect";
@@ -86,7 +87,7 @@ const make = Effect.gen(function* () {
87 const floor = options?.allowReserve === true ? 1 : snapshot.limit * RESERVE_RATIO;
88 if (snapshot.remaining >= floor) return;
89 return yield* new SourceControlRateLimit.SourceControlRateLimitPausedError({
89 - provider: "github",
90 + provider: SourceControlProviderKind.make("github"),
91 host: host.trim().toLowerCase(),
92 retryAt: snapshot.resetAtMs,
93 });
packages/source-control-github/src/server/GitHubSourceControlProvider.test.ts
+12 -3
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as HostProcess from "@t3tools/shared/HostProcess";
3 import { assert, describe, it } from "@effect/vitest";
4 import * as NodeServices from "@effect/platform-node/NodeServices";
@@ -137,7 +138,11 @@ const makeProvider = (api: Partial<GitHubApi.GitHubApi["Service"]>) =>
138 GitHubSourceControlProvider.make.pipe(Effect.provide(harness({ remotes: "", api }).layer));
139
140 const githubContext = (host: string) => ({
140 - provider: { kind: "github" as const, name: "GitHub", baseUrl: `https://${host}` },
141 + provider: {
142 + kind: SourceControlProviderKind.make("github"),
143 + name: "GitHub",
144 + baseUrl: `https://${host}`,
145 + },
146 remoteName: "origin",
147 remoteUrl: `git@${host}:acme/web.git`,
148 });
@@ -1067,7 +1072,7 @@ it.live.each([
1072 cwd: "/repo",
1073 context: {
1074 provider: {
1070 - kind: "github" as const,
1075 + kind: SourceControlProviderKind.make("github"),
1076 name: "GitHub Self-Hosted",
1077 baseUrl: "https://code.example.test",
1078 },
@@ -1184,7 +1189,11 @@ it.effect.each([
1189 const input = {
1190 cwd: "/repo",
1191 context: {
1187 - provider: { kind: "github" as const, name: "GitHub", baseUrl: `https://${host}` },
1192 + provider: {
1193 + kind: SourceControlProviderKind.make("github"),
1194 + name: "GitHub",
1195 + baseUrl: `https://${host}`,
1196 + },
1197 remoteName: "origin",
1198 remoteUrl: `git@${host}:me/web.git`,
1199 },
packages/source-control-github/src/server/GitHubSourceControlProvider.ts
+8 -7
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Context from "effect/Context";
3 import * as Data from "effect/Data";
4 import * as Effect from "effect/Effect";
@@ -62,7 +63,7 @@ const decodeLinkSubject = Schema.decodeUnknownEffect(
63 );
64
65 function toChangeRequest(record: NormalizedGitHubPullRequestRecord): ChangeRequest {
65 - return { provider: "github", ...record };
66 + return { provider: SourceControlProviderKind.make("github"), ...record };
67 }
68
69 function authAccounts(accounts: ReadonlyArray<GitHubAuthStatusAccount>) {
@@ -164,7 +165,7 @@ export function parseGitHubAuth(
165
166 export const discovery = {
167 type: "cli",
167 - kind: "github",
168 + kind: SourceControlProviderKind.make("github"),
169 label: "GitHub",
170 executable: "gh",
171 versionArgs: ["--version"],
@@ -271,7 +272,7 @@ export const makeDiscovery = Effect.gen(function* () {
272 Effect.map((known) =>
273 known
274 ? ({
274 - kind: "github",
275 + kind: SourceControlProviderKind.make("github"),
276 name: "GitHub Self-Hosted",
277 baseUrl: context.provider.baseUrl,
278 } as const)
@@ -878,7 +879,7 @@ export const make = Effect.gen(function* () {
879 ) =>
880 (error: GitHubFailure) =>
881 new SourceControlProviderError({
881 - provider: "github",
882 + provider: SourceControlProviderKind.make("github"),
883 operation,
884 cwd,
885 ...(context?.reference === undefined
@@ -915,7 +916,7 @@ export const make = Effect.gen(function* () {
916 Effect.mapError(
917 (cause) =>
918 new SourceControlProviderError({
918 - provider: "github",
919 + provider: SourceControlProviderKind.make("github"),
920 operation: "resolveLink",
921 cwd: input.cwd,
922 detail: "The linked subject could not be read.",
@@ -927,7 +928,7 @@ export const make = Effect.gen(function* () {
928 Effect.mapError(
929 (cause) =>
930 new SourceControlProviderError({
930 - provider: "github",
931 + provider: SourceControlProviderKind.make("github"),
932 operation: "resolveLink.decode",
933 cwd: input.cwd,
934 detail: "The linked subject could not be read.",
@@ -939,7 +940,7 @@ export const make = Effect.gen(function* () {
940 });
941
942 return SourceControlProvider.SourceControlProvider.of({
942 - kind: "github",
943 + kind: SourceControlProviderKind.make("github"),
944 // `gh pr list --head` filters on the head ref name alone and accepts anything, so an
945 // `owner:branch` or `remote:branch` selector silently lists zero pull requests while
946 // spending a GraphQL call; the bare branch is always among the selectors. Without the owner,
packages/source-control-github/src/server/driver.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 /**
3 * The GitHub driver: repository operations and discovery through `gh` and git, and pull requests
4 * through the GitHub REST and GraphQL APIs.
@@ -11,7 +12,7 @@ import * as GitHubPullRequestProvider from "./GitHubPullRequestProvider.ts";
12 import * as GitHubSourceControlProvider from "./GitHubSourceControlProvider.ts";
13
14 export const driver = defineSourceControlDriver({
14 - kind: "github",
15 + kind: SourceControlProviderKind.make("github"),
16 make: Effect.all({
17 sourceControl: GitHubSourceControlProvider.make,
18 discovery: GitHubSourceControlProvider.makeDiscovery,
packages/source-control-gitlab/src/server/GitLabPullRequestProvider.ts
+3 -2
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Effect from "effect/Effect";
3 import type {
4 PullRequestCapabilities,
@@ -111,7 +112,7 @@ export const make = Effect.gen(function* () {
112
113 const fail = (operation: string) => (error: GitLabPullRequestCli.GitLabPullRequestCliError) =>
114 new PullRequestProviderError({
114 - provider: "gitlab",
115 + provider: SourceControlProviderKind.make("gitlab"),
116 operation,
117 ...gitLabProviderFailure(error),
118 detail: error.detail,
@@ -119,7 +120,7 @@ export const make = Effect.gen(function* () {
120 });
121
122 const provider: PullRequestProviderApi = {
122 - kind: "gitlab",
123 + kind: SourceControlProviderKind.make("gitlab"),
124 capabilities: CAPABILITIES,
125
126 getViewer: (input) =>
packages/source-control-gitlab/src/server/GitLabSourceControlProvider.test.ts
+3 -2
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import { assert, it } from "@effect/vitest";
3 import * as Effect from "effect/Effect";
4 import * as Layer from "effect/Layer";
@@ -38,7 +39,7 @@ it.effect("maps GitLab MR summaries into provider-neutral change requests", () =
39 });
40
41 assert.deepStrictEqual(changeRequest, {
41 - provider: "gitlab",
42 + provider: SourceControlProviderKind.make("gitlab"),
43 number: 42,
44 title: "Add GitLab provider",
45 url: "https://gitlab.com/pingdotgg/t3code/-/merge_requests/42",
@@ -189,7 +190,7 @@ it("refines unknown GitLab remotes with mixed-case provider hosts", () => {
190 cwd: "/repo",
191 context: {
192 provider: {
192 - kind: "unknown",
193 + kind: SourceControlProviderKind.make("unknown"),
194 name: "Self-Hosted.Example.Test",
195 baseUrl: "https://Self-Hosted.Example.Test",
196 },
packages/source-control-gitlab/src/server/GitLabSourceControlProvider.ts
+14 -13
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 import * as Schema from "effect/Schema";
3 import * as Effect from "effect/Effect";
4 import * as Option from "effect/Option";
@@ -25,7 +26,7 @@ const decodeLinkSubject = Schema.decodeUnknownEffect(
26
27 function toChangeRequest(summary: GitLabCli.GitLabMergeRequestSummary): ChangeRequest {
28 return {
28 - provider: "gitlab",
29 + provider: SourceControlProviderKind.make("gitlab"),
30 number: summary.number,
31 title: summary.title,
32 url: summary.url,
@@ -90,7 +91,7 @@ function refineUnknownGitLabRemote(input: SourceControlUnknownRemoteRefinementIn
91 }
92
93 return {
93 - kind: "gitlab",
94 + kind: SourceControlProviderKind.make("gitlab"),
95 name: "GitLab Self-Hosted",
96 baseUrl: input.context.provider.baseUrl,
97 } as const;
@@ -98,7 +99,7 @@ function refineUnknownGitLabRemote(input: SourceControlUnknownRemoteRefinementIn
99
100 export const discovery = {
101 type: "cli",
101 - kind: "gitlab",
102 + kind: SourceControlProviderKind.make("gitlab"),
103 label: "GitLab",
104 executable: "glab",
105 versionArgs: ["--version"],
@@ -127,7 +128,7 @@ export const make = Effect.gen(function* () {
128 Effect.mapError(
129 (cause) =>
130 new SourceControlProviderError({
130 - provider: "gitlab",
131 + provider: SourceControlProviderKind.make("gitlab"),
132 operation: "resolveLink",
133 cwd: input.cwd,
134 detail: "The linked subject could not be read.",
@@ -139,7 +140,7 @@ export const make = Effect.gen(function* () {
140 Effect.mapError(
141 (cause) =>
142 new SourceControlProviderError({
142 - provider: "gitlab",
143 + provider: SourceControlProviderKind.make("gitlab"),
144 operation: "resolveLink.decode",
145 cwd: input.cwd,
146 detail: "The linked subject could not be read.",
@@ -151,7 +152,7 @@ export const make = Effect.gen(function* () {
152 });
153
154 return SourceControlProvider.SourceControlProvider.of({
154 - kind: "gitlab",
155 + kind: SourceControlProviderKind.make("gitlab"),
156 resolveLink: (input) => {
157 // Automatic enrichment must not send ambient CLI credentials to a host from message text.
158 if (input.url.host !== "gitlab.com") return undefined;
@@ -179,7 +180,7 @@ export const make = Effect.gen(function* () {
180 Effect.mapError(
181 (error) =>
182 new SourceControlProviderError({
182 - provider: "gitlab",
183 + provider: SourceControlProviderKind.make("gitlab"),
184 operation: "listChangeRequests",
185 command: error.command,
186 cwd: input.cwd,
@@ -198,7 +199,7 @@ export const make = Effect.gen(function* () {
199 Effect.mapError(
200 (error) =>
201 new SourceControlProviderError({
201 - provider: "gitlab",
202 + provider: SourceControlProviderKind.make("gitlab"),
203 operation: "getChangeRequest",
204 command: error.command,
205 cwd: input.cwd,
@@ -226,7 +227,7 @@ export const make = Effect.gen(function* () {
227 Effect.mapError(
228 (error) =>
229 new SourceControlProviderError({
229 - provider: "gitlab",
230 + provider: SourceControlProviderKind.make("gitlab"),
231 operation: "createChangeRequest",
232 command: error.command,
233 cwd: input.cwd,
@@ -244,7 +245,7 @@ export const make = Effect.gen(function* () {
245 Effect.mapError(
246 (error) =>
247 new SourceControlProviderError({
247 - provider: "gitlab",
248 + provider: SourceControlProviderKind.make("gitlab"),
249 operation: "getRepositoryCloneUrls",
250 command: error.command,
251 cwd: input.cwd,
@@ -261,7 +262,7 @@ export const make = Effect.gen(function* () {
262 Effect.mapError(
263 (error) =>
264 new SourceControlProviderError({
264 - provider: "gitlab",
265 + provider: SourceControlProviderKind.make("gitlab"),
266 operation: "createRepository",
267 command: error.command,
268 cwd: input.cwd,
@@ -278,7 +279,7 @@ export const make = Effect.gen(function* () {
279 Effect.mapError(
280 (error) =>
281 new SourceControlProviderError({
281 - provider: "gitlab",
282 + provider: SourceControlProviderKind.make("gitlab"),
283 operation: "getDefaultBranch",
284 command: error.command,
285 cwd: input.cwd,
@@ -292,7 +293,7 @@ export const make = Effect.gen(function* () {
293 Effect.mapError(
294 (error) =>
295 new SourceControlProviderError({
295 - provider: "gitlab",
296 + provider: SourceControlProviderKind.make("gitlab"),
297 operation: "checkoutChangeRequest",
298 command: error.command,
299 cwd: input.cwd,
packages/source-control-gitlab/src/server/driver.ts
+2 -1
@@ -1,3 +1,4 @@
1 +import { SourceControlProviderKind } from "@t3tools/contracts";
2 /**
3 * The GitLab driver: repository operations, discovery, and merge requests through `glab`.
4 *
@@ -10,7 +11,7 @@ import * as GitLabPullRequestProvider from "./GitLabPullRequestProvider.ts";
11 import * as GitLabSourceControlProvider from "./GitLabSourceControlProvider.ts";
12
13 export const driver = defineSourceControlDriver({
13 - kind: "gitlab",
14 + kind: SourceControlProviderKind.make("gitlab"),
15 make: Effect.all({
16 sourceControl: GitLabSourceControlProvider.make,
17 discovery: Effect.succeed(GitLabSourceControlProvider.discovery),