@devries-cameron20 / t3code-1 / commits / 3b6ce931cc
Fork 0

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

refactor(server): classify source control exports (#10279)

Julius Marminge committed Sep 8, 2026 at 01:11 UTC 3b6ce931cc225b4b743daaa063e0bc9875555582
22 files changed +21 -28
apps/server/src/pullRequest/AzureDevOpsPullRequestCli.ts
+1
@@ -261,6 +261,7 @@ function isReviewerName(value: string): boolean {
261 return name.length > 0 && !name.startsWith("-");
262 }
263
264 +/** @public Service construction is part of the canonical Effect module API. */
265 export const make = Effect.gen(function* () {
266 const azure = yield* AzureDevOpsCli.AzureDevOpsCli;
267
apps/server/src/pullRequest/BitbucketPullRequestApi.ts
+1
@@ -378,6 +378,7 @@ function bitbucketReviewPosition(
378 }
379 }
380
381 +/** @public Service construction is part of the canonical Effect module API. */
382 export const make = Effect.gen(function* () {
383 const bitbucket = yield* BitbucketApi.BitbucketApi;
384
apps/server/src/pullRequest/GitHubPullRequestCli.ts
+2 -1
@@ -714,7 +714,7 @@ export class GitHubPullRequestCli extends Context.Service<
714 * The host is not read off the identity: it travels alongside it, because the identity a
715 * project records is the path below its host and never names the host itself.
716 */
717 -export function parseRepositorySelector(value: string): {
717 +function parseRepositorySelector(value: string): {
718 readonly owner: string;
719 readonly name: string;
720 } {
@@ -980,6 +980,7 @@ function actionArgs(
980 }
981 }
982
983 +/** @public Service construction is part of the canonical Effect module API. */
984 export const make = Effect.gen(function* () {
985 const github = yield* GitHubCli.GitHubCli;
986 const graphQlBudget = yield* GitHubGraphQlBudget.GitHubGraphQlBudget;
apps/server/src/pullRequest/GitLabPullRequestCli.ts
+1
@@ -511,6 +511,7 @@ function actionArgs(
511 }
512 }
513
514 +/** @public Service construction is part of the canonical Effect module API. */
515 export const make = Effect.gen(function* () {
516 const gitlab = yield* GitLabCli.GitLabCli;
517
apps/server/src/pullRequest/PullRequestProviderRegistry.ts
+2
@@ -41,6 +41,8 @@ export function fromProviders(
41 /**
42 * The hosts this build can read change requests from. A host with no entry here still shows up
43 * in the provider list as unimplemented, so its projects are explained rather than missing.
44 + *
45 + * @public Service construction is part of the canonical Effect module API.
46 */
47 export const make = Effect.map(
48 Effect.all([
apps/server/src/sourceControl/AzureDevOpsCli.ts
+1 -2
@@ -203,8 +203,6 @@ export const AzureDevOpsCliError = Schema.Union([
203 ]);
204 export type AzureDevOpsCliError = typeof AzureDevOpsCliError.Type;
205
206 -export const isAzureDevOpsCliError = Schema.is(AzureDevOpsCliError);
207 -
206 export interface AzureDevOpsRepositoryCloneUrls {
207 readonly nameWithOwner: string;
208 readonly url: string;
@@ -352,6 +350,7 @@ function decodeAzureDevOpsJson<S extends Schema.Top>(
350 );
351 }
352
353 +/** @public Service construction is part of the canonical Effect module API. */
354 export const make = Effect.gen(function* () {
355 const process = yield* VcsProcess.VcsProcess;
356
apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts
-3
@@ -1,5 +1,4 @@
1 import * as Effect from "effect/Effect";
2 -import * as Layer from "effect/Layer";
2 import { SourceControlProviderError, type ChangeRequest } from "@t3tools/contracts";
3
4 import * as AzureDevOpsCli from "./AzureDevOpsCli.ts";
@@ -235,5 +234,3 @@ export const make = Effect.gen(function* () {
234 ),
235 });
236 });
238 -
239 -export const layer = Layer.effect(SourceControlProvider.SourceControlProvider, make);
apps/server/src/sourceControl/BitbucketApi.ts
+2 -1
@@ -262,7 +262,7 @@ export const BitbucketApiError = Schema.Union([
262 BitbucketCheckoutError,
263 ]);
264 export type BitbucketApiError = typeof BitbucketApiError.Type;
265 -export const isBitbucketApiError = Schema.is(BitbucketApiError);
265 +const isBitbucketApiError = Schema.is(BitbucketApiError);
266
267 const RawBitbucketRepositorySchema = Schema.Struct({
268 full_name: TrimmedNonEmptyString,
@@ -606,6 +606,7 @@ function responseError(
606 });
607 }
608
609 +/** @public Service construction is part of the canonical Effect module API. */
610 export const make = Effect.gen(function* () {
611 const config = yield* BitbucketApiEnvConfig;
612 const httpClient = yield* HttpClient.HttpClient;
apps/server/src/sourceControl/BitbucketSourceControlProvider.ts
-3
@@ -1,5 +1,4 @@
1 import * as Effect from "effect/Effect";
2 -import * as Layer from "effect/Layer";
2 import * as Option from "effect/Option";
3 import { SourceControlProviderError, type ChangeRequest } from "@t3tools/contracts";
4
@@ -186,8 +185,6 @@ export const make = Effect.gen(function* () {
185 });
186 });
187
189 -export const layer = Layer.effect(SourceControlProvider.SourceControlProvider, make);
190 -
188 export const makeDiscovery = Effect.gen(function* () {
189 const bitbucket = yield* BitbucketApi.BitbucketApi;
190
apps/server/src/sourceControl/GitHubCli.ts
+1
@@ -338,6 +338,7 @@ function deriveRepositoryCloneUrlsFromCreateOutput(
338 };
339 }
340
341 +/** @public Service construction is part of the canonical Effect module API. */
342 export const make = Effect.gen(function* () {
343 const process = yield* VcsProcess.VcsProcess;
344
apps/server/src/sourceControl/GitHubSourceControlProvider.ts
-3
@@ -1,6 +1,5 @@
1 import * as DateTime from "effect/DateTime";
2 import * as Effect from "effect/Effect";
3 -import * as Layer from "effect/Layer";
3 import * as Option from "effect/Option";
4 import * as Result from "effect/Result";
5 import {
@@ -322,5 +321,3 @@ export const make = Effect.gen(function* () {
321 ),
322 });
323 });
325 -
326 -export const layer = Layer.effect(SourceControlProvider.SourceControlProvider, make);
apps/server/src/sourceControl/GitLabCli.ts
+1 -1
@@ -237,7 +237,6 @@ export const GitLabCliError = Schema.Union([
237 GitLabNamespaceDecodeError,
238 ]);
239 export type GitLabCliError = typeof GitLabCliError.Type;
240 -export const isGitLabCliError = Schema.is(GitLabCliError);
240
241 export interface GitLabMergeRequestSummary {
242 readonly number: number;
@@ -409,6 +408,7 @@ function parseRepositoryPath(repository: string): {
408 return { namespacePath, projectPath };
409 }
410
411 +/** @public Service construction is part of the canonical Effect module API. */
412 export const make = Effect.gen(function* () {
413 const process = yield* VcsProcess.VcsProcess;
414
apps/server/src/sourceControl/GitLabSourceControlProvider.ts
-3
@@ -1,5 +1,4 @@
1 import * as Effect from "effect/Effect";
2 -import * as Layer from "effect/Layer";
2 import * as Option from "effect/Option";
3 import { SourceControlProviderError, type ChangeRequest } from "@t3tools/contracts";
4
@@ -250,5 +249,3 @@ export const make = Effect.gen(function* () {
249 ),
250 });
251 });
253 -
254 -export const layer = Layer.effect(SourceControlProvider.SourceControlProvider, make);
apps/server/src/sourceControl/SourceControlDiscovery.ts
+1
@@ -64,6 +64,7 @@ export class SourceControlDiscovery extends Context.Service<
64 }
65 >()("t3/sourceControl/SourceControlDiscovery") {}
66
67 +/** @public Service construction is part of the canonical Effect module API. */
68 export const make = Effect.gen(function* () {
69 const config = yield* ServerConfig;
70 const process = yield* VcsProcess.VcsProcess;
apps/server/src/sourceControl/SourceControlProvider.ts
+1 -1
@@ -61,7 +61,7 @@ export function parseSourceControlOwnerRef(
61 return owner && refName ? { owner, refName } : undefined;
62 }
63
64 -export function normalizeSourceBranch(headSelector: string): string {
64 +function normalizeSourceBranch(headSelector: string): string {
65 return parseSourceControlOwnerRef(headSelector)?.refName ?? headSelector.trim();
66 }
67
apps/server/src/sourceControl/SourceControlProviderDiscovery.ts
+1 -1
@@ -115,7 +115,7 @@ export function providerAuth(input: {
115 };
116 }
117
118 -export function unknownAuth(detail?: string): SourceControlProviderAuth {
118 +function unknownAuth(detail?: string): SourceControlProviderAuth {
119 return providerAuth({ status: "unknown", detail });
120 }
121
apps/server/src/sourceControl/SourceControlRateLimit.ts
+1
@@ -82,6 +82,7 @@ export function retryAtFromHeader(value: string | undefined, now: number): numbe
82 return Number.isFinite(retryAt) && retryAt > now ? retryAt : undefined;
83 }
84
85 +/** @public Service construction is part of the canonical Effect module API. */
86 export const make = Effect.gen(function* () {
87 const entries = yield* Ref.make<ReadonlyMap<string, RateLimitEntry>>(new Map());
88
apps/server/src/sourceControl/SourceControlRepositoryService.ts
+1
@@ -77,6 +77,7 @@ function selectRemoteUrl(
77 }
78 }
79
80 +/** @public Service construction is part of the canonical Effect module API. */
81 export const make = Effect.gen(function* () {
82 const config = yield* ServerConfig;
83 const fileSystem = yield* FileSystem.FileSystem;
apps/server/src/sourceControl/azureDevOpsPullRequests.ts
+1 -3
@@ -5,7 +5,7 @@ import * as Option from "effect/Option";
5 import * as Result from "effect/Result";
6 import * as Schema from "effect/Schema";
7 import { PositiveInt, TrimmedNonEmptyString } from "@t3tools/contracts";
8 -import { decodeJsonResult, formatSchemaError } from "@t3tools/shared/schemaJson";
8 +import { decodeJsonResult } from "@t3tools/shared/schemaJson";
9
10 export interface NormalizedAzureDevOpsPullRequestRecord {
11 readonly number: number;
@@ -190,8 +190,6 @@ const decodeAzureDevOpsPullRequestList = decodeJsonResult(Schema.Array(Schema.Un
190 const decodeAzureDevOpsPullRequest = decodeJsonResult(AzureDevOpsPullRequestSchema);
191 const decodeAzureDevOpsPullRequestEntry = Schema.decodeUnknownExit(AzureDevOpsPullRequestSchema);
192
193 -export const formatAzureDevOpsJsonDecodeError = formatSchemaError;
194 -
193 export function decodeAzureDevOpsPullRequestListJson(
194 raw: string,
195 ): Result.Result<
apps/server/src/sourceControl/gitHubPullRequests.ts
+1 -3
@@ -5,7 +5,7 @@ import * as Option from "effect/Option";
5 import * as Result from "effect/Result";
6 import * as Schema from "effect/Schema";
7 import { PositiveInt, TrimmedNonEmptyString } from "@t3tools/contracts";
8 -import { decodeJsonResult, formatSchemaError } from "@t3tools/shared/schemaJson";
8 +import { decodeJsonResult } from "@t3tools/shared/schemaJson";
9
10 export interface NormalizedGitHubPullRequestRecord {
11 readonly number: number;
@@ -114,8 +114,6 @@ const decodeGitHubPullRequestList = decodeJsonResult(Schema.Array(Schema.Unknown
114 const decodeGitHubPullRequest = decodeJsonResult(GitHubPullRequestSchema);
115 const decodeGitHubPullRequestEntry = Schema.decodeUnknownExit(GitHubPullRequestSchema);
116
117 -export const formatGitHubJsonDecodeError = formatSchemaError;
118 -
117 export function decodeGitHubPullRequestListJson(
118 raw: string,
119 ): Result.Result<
apps/server/src/sourceControl/gitLabMergeRequests.ts
+1 -3
@@ -5,7 +5,7 @@ import * as Option from "effect/Option";
5 import * as Result from "effect/Result";
6 import * as Schema from "effect/Schema";
7 import { PositiveInt, TrimmedNonEmptyString } from "@t3tools/contracts";
8 -import { decodeJsonResult, formatSchemaError } from "@t3tools/shared/schemaJson";
8 +import { decodeJsonResult } from "@t3tools/shared/schemaJson";
9
10 export interface NormalizedGitLabMergeRequestRecord {
11 readonly number: number;
@@ -129,8 +129,6 @@ const decodeGitLabMergeRequestList = decodeJsonResult(Schema.Array(Schema.Unknow
129 const decodeGitLabMergeRequest = decodeJsonResult(GitLabMergeRequestSchema);
130 const decodeGitLabMergeRequestEntry = Schema.decodeUnknownExit(GitLabMergeRequestSchema);
131
132 -export const formatGitLabJsonDecodeError = formatSchemaError;
133 -
132 export function decodeGitLabMergeRequestListJson(
133 raw: string,
134 ): Result.Result<
apps/server/src/sourceControl/githubGraphQlBudget.ts
+1
@@ -77,6 +77,7 @@ function withRateLimit(document: string): string {
77 return `${document.slice(0, end)}\n ${RATE_LIMIT_SELECTION}\n${document.slice(end)}`;
78 }
79
80 +/** @public Service construction is part of the canonical Effect module API. */
81 export const make = Effect.gen(function* () {
82 const snapshots = yield* Ref.make<ReadonlyMap<string, GraphQlBudgetSnapshot>>(new Map());
83