Skip to content
TypeScript

refactor(source-control): forge definitions live in shared/, not client/ (#24181)

Julius Marminge814bd67250fd
diff --git a/.repos/alchemy-effect/packages/frontend-frameworks/src/core/NodeServe.ts b/.repos/alchemy-effect/packages/frontend-frameworks/src/core/NodeServe.ts
index cb295412092..3484d669695 100644
--- a/.repos/alchemy-effect/packages/frontend-frameworks/src/core/NodeServe.ts
+++ b/.repos/alchemy-effect/packages/frontend-frameworks/src/core/NodeServe.ts
@@ -48,7 +48,7 @@ export interface NodeServeHandler {
export interface NodeServeEntryOptions {
/**
* JS expression resolving the on-disk client-assets directory
- * (typically `fileURLToPath(new URL("../client/", import.meta.url))`).
+ * (typically `fileURLToPath(new URL("../shared/", import.meta.url))`).
* Omit to skip static-file serving (Next.js handles its own assets).
*/
readonly clientDirExpression?: string | undefined;
diff --git a/.repos/alchemy-effect/packages/frontend-frameworks/src/core/test/NodeServe.test.ts b/.repos/alchemy-effect/packages/frontend-frameworks/src/core/test/NodeServe.test.ts
index 66667e6fb44..01147c61d53 100644
--- a/.repos/alchemy-effect/packages/frontend-frameworks/src/core/test/NodeServe.test.ts
+++ b/.repos/alchemy-effect/packages/frontend-frameworks/src/core/test/NodeServe.test.ts
@@ -28,14 +28,14 @@ describe("relativeClientDirExpression", () => {
"/project/dist/server/serve-node.mjs",
"/project/dist/client",
),
- ).toBe(`fileURLToPath(new URL("../client/", import.meta.url))`);
+ ).toBe(`fileURLToPath(new URL("../shared/", import.meta.url))`);
});
});
describe("makeNodeServeEntrySource", () => {
it("listens on PORT, answers /health, serves static files, then the fetch handler", () => {
const source = makeNodeServeEntrySource({
- clientDirExpression: `fileURLToPath(new URL("../client/", import.meta.url))`,
+ clientDirExpression: `fileURLToPath(new URL("../shared/", import.meta.url))`,
handler: {
kind: "fetch",
imports: `import { handler } from "./index.mjs";`,
@@ -131,7 +131,7 @@ describe("makeNodeServeEntrySource", () => {
it("does not map GET / onto public/index.html (SSR home stays on the handler)", () => {
const source = makeNodeServeEntrySource({
- clientDirExpression: `fileURLToPath(new URL("../client/", import.meta.url))`,
+ clientDirExpression: `fileURLToPath(new URL("../shared/", import.meta.url))`,
handler: {
kind: "node",
imports: `import { handler } from "./index.mjs";`,
diff --git a/apps/server/src/assets/AssetAccess.test.ts b/apps/server/src/assets/AssetAccess.test.ts
index 692f2b46a83..d4db872fd2f 100644
--- a/apps/server/src/assets/AssetAccess.test.ts
+++ b/apps/server/src/assets/AssetAccess.test.ts
@@ -36,7 +36,7 @@ import * as NativeAppIconResolver from "./NativeAppIconResolver.ts";
import { symlinksSupported } from "@t3tools/shared/testing/symlinks";
import { fakeSourceControlDriverInstance } from "@t3tools/source-control-testing/fakeSourceControlDriver";
import * as BuiltInDrivers from "../sourceControl/builtInDrivers.ts";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
import { sourceControlMediaResponse } from "./sourceControlMediaResponse.ts";
import * as HostProcess from "@t3tools/shared/HostProcess";
@@ -953,7 +953,7 @@ describe("AssetAccess", () => {
it.effect("serves a host's credentialed media through that host's driver", () => {
const fetched: Array<{ url: string; headers: Readonly<Record<string, string>> }> = [];
const url = "https://github.com/owner/repo/blob/main/docs/shot.png";
- const media = sourceControlClients.mediaUrl(url)!;
+ const media = sourceControlDefinitions.mediaUrl(url)!;
const layerDrivers = Layer.succeed(BuiltInDrivers.SourceControlDrivers, [
{
driver: { kind: media.definition.kind, definition: media.definition },
diff --git a/apps/server/src/assets/AssetAccess.ts b/apps/server/src/assets/AssetAccess.ts
index 2d53da80392..530bf79e140 100644
--- a/apps/server/src/assets/AssetAccess.ts
+++ b/apps/server/src/assets/AssetAccess.ts
@@ -64,7 +64,7 @@ import * as ProjectFaviconResolver from "../project/ProjectFaviconResolver.ts";
import { isWithinRoot } from "../workspace/KnownWorkspaces.ts";
import * as WorkspacePaths from "../workspace/WorkspacePaths.ts";
import * as NativeAppIconResolver from "./NativeAppIconResolver.ts";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
import { extractIcnsPng } from "./icns.ts";
import { openMediaFile, readMediaFileHeader, type OpenMediaFile } from "./MediaFile.ts";
import * as HostProcess from "@t3tools/shared/HostProcess";
@@ -805,7 +805,7 @@ export const issueAssetUrl = Effect.fn("AssetAccess.issueAssetUrl")(function* (i
break;
}
case SOURCE_CONTROL_MEDIA_ASSET: {
- const media = sourceControlClients.mediaUrl(input.resource.url);
+ const media = sourceControlDefinitions.mediaUrl(input.resource.url);
if (media === null) {
return yield* new AssetSourceControlMediaUrlValidationError({});
}
diff --git a/apps/server/src/assets/sourceControlMediaResponse.ts b/apps/server/src/assets/sourceControlMediaResponse.ts
index 9c49420670f..96e96f32a17 100644
--- a/apps/server/src/assets/sourceControlMediaResponse.ts
+++ b/apps/server/src/assets/sourceControlMediaResponse.ts
@@ -5,7 +5,7 @@ import * as Option from "effect/Option";
import { HttpServerResponse } from "effect/http";
import * as BuiltInDrivers from "../sourceControl/builtInDrivers.ts";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
const FORWARDED_REQUEST_HEADERS = ["range", "if-range"] as const;
const FORWARDED_RESPONSE_HEADERS = [
@@ -34,7 +34,7 @@ export const sourceControlMediaResponse = Effect.fn(
remainingSeconds > 0 ? `private, max-age=${remainingSeconds}` : "private, no-store",
"x-content-type-options": "nosniff",
};
- const media = sourceControlClients.mediaUrl(asset.url);
+ const media = sourceControlDefinitions.mediaUrl(asset.url);
const drivers = yield* BuiltInDrivers.SourceControlDrivers;
const fetchMedia = drivers.find(({ driver }) => driver.kind === media?.definition.kind)?.instance
.fetchMedia;
diff --git a/apps/server/src/git/GitManager.ts b/apps/server/src/git/GitManager.ts
index 6902e84777b..de5fb137845 100644
--- a/apps/server/src/git/GitManager.ts
+++ b/apps/server/src/git/GitManager.ts
@@ -57,12 +57,12 @@ import { isSshRemoteUrl } from "@t3tools/shared/sourceControl";
import {
type ChangeRequestTerminology,
UNKNOWN_SOURCE_CONTROL_CLIENT,
-} from "@t3tools/source-control-core/client/definition";
+} from "@t3tools/source-control-core/shared/definition";
import {
normalizeThreadPullRequestKey,
threadPullRequestKeyOf,
} from "../sourceControl/threadPullRequests.ts";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
import { GitManagerError, GitPullRequestMaterializationError } from "@t3tools/contracts";
import {
@@ -249,10 +249,10 @@ interface BranchHeadContext {
}
export function pullRequestRepositoryKey(value: string): string | null {
- const repositoryUrl = sourceControlClients.parseChangeRequestUrl(value)?.link.repositoryUrl;
+ const repositoryUrl = sourceControlDefinitions.parseChangeRequestUrl(value)?.link.repositoryUrl;
return repositoryUrl === undefined
? null
- : sourceControlClients.repositoryKeyFromRemote(repositoryUrl);
+ : sourceControlDefinitions.repositoryKeyFromRemote(repositoryUrl);
}
/** Null when the host did not name the repository the head lives in. */
@@ -668,7 +668,7 @@ export const make = Effect.gen(function* () {
cwd: string,
) {
return yield* sourceControlProvider(cwd).pipe(
- Effect.map((provider) => sourceControlClients.get(provider.kind).changeRequest),
+ Effect.map((provider) => sourceControlDefinitions.get(provider.kind).changeRequest),
Effect.orElseSucceed(() => UNKNOWN_SOURCE_CONTROL_CLIENT.changeRequest),
);
});
@@ -973,7 +973,7 @@ export const make = Effect.gen(function* () {
number: number,
) {
const provider = yield* sourceControlProvider(cwd);
- const ref = sourceControlClients.get(provider.kind).changeRequestHeadRef?.(number);
+ const ref = sourceControlDefinitions.get(provider.kind).changeRequestHeadRef?.(number);
if (ref === undefined) {
return yield* new GitManagerError({
operation: "changeRequestHeadRef",
@@ -1016,9 +1016,9 @@ export const make = Effect.gen(function* () {
if (
remoteUrl === null ||
pullRequestKey === null ||
- sourceControlClients.canonicalRepositoryKey(pullRequestKey) !==
- sourceControlClients.canonicalRepositoryKey(
- sourceControlClients.repositoryKeyFromRemote(remoteUrl),
+ sourceControlDefinitions.canonicalRepositoryKey(pullRequestKey) !==
+ sourceControlDefinitions.canonicalRepositoryKey(
+ sourceControlDefinitions.repositoryKeyFromRemote(remoteUrl),
)
) {
return yield* cause;
@@ -1187,7 +1187,7 @@ export const make = Effect.gen(function* () {
>();
const noteLookupState = (pr: PullRequestInfo) =>
Effect.suspend(() => {
- const parsed = sourceControlClients.parseChangeRequestUrl(pr.url)?.link;
+ const parsed = sourceControlDefinitions.parseChangeRequestUrl(pr.url)?.link;
if (parsed === undefined || parsed.number !== pr.number) return Effect.void;
const key = normalizeThreadPullRequestKey(parsed);
const id = threadPullRequestKeyOf(key);
@@ -1431,7 +1431,7 @@ export const make = Effect.gen(function* () {
remote: { readonly remoteUrl: string | null; readonly repositoryNameWithOwner: string | null },
) {
const provider =
- remote.remoteUrl === null ? null : sourceControlClients.recognizeRemote(remote.remoteUrl);
+ remote.remoteUrl === null ? null : sourceControlDefinitions.recognizeRemote(remote.remoteUrl);
if (remote.remoteUrl === null || provider === null) return true;
const context = { provider, remoteName, remoteUrl: remote.remoteUrl };
const handle = yield* sourceControlProviders
@@ -1458,7 +1458,7 @@ export const make = Effect.gen(function* () {
(yield* readConfigValueNullable(cwd, `remote.${preferredRemoteName}.url`)) ??
(yield* readConfigValueNullable(cwd, "remote.origin.url"));
- const provider = remoteUrl ? sourceControlClients.recognizeRemote(remoteUrl) : null;
+ const provider = remoteUrl ? sourceControlDefinitions.recognizeRemote(remoteUrl) : null;
if (!remoteUrl || provider?.kind !== "unknown") return provider;
const handle = yield* sourceControlProviders
.resolveHandle({
@@ -1489,7 +1489,7 @@ export const make = Effect.gen(function* () {
/^https?:\/\//iu.test(remoteUrl) &&
(repositoryNameWithOwner?.split("/").length ?? 0) > 2
) {
- const kind = sourceControlClients.recognizeRemote(remoteUrl)?.kind;
+ const kind = sourceControlDefinitions.recognizeRemote(remoteUrl)?.kind;
const provider =
kind === undefined
? undefined
@@ -1500,7 +1500,7 @@ export const make = Effect.gen(function* () {
}
return {
remoteUrl,
- remoteUrlKey: remoteUrl ? sourceControlClients.repositoryKeyFromRemote(remoteUrl) : null,
+ remoteUrlKey: remoteUrl ? sourceControlDefinitions.repositoryKeyFromRemote(remoteUrl) : null,
repositoryNameWithOwner,
ownerLogin: parseRepositoryOwnerLogin(repositoryNameWithOwner),
};
@@ -2247,7 +2247,7 @@ export const make = Effect.gen(function* () {
emit: GitActionProgressEmitter,
) {
const provider = yield* sourceControlProvider(cwd);
- const terms = sourceControlClients.get(provider.kind).changeRequest;
+ const terms = sourceControlDefinitions.get(provider.kind).changeRequest;
const details = yield* gitCore.statusDetails(cwd);
const branch = details.branch ?? fallbackBranch;
if (!branch) {
@@ -2455,7 +2455,7 @@ export const make = Effect.gen(function* () {
? Effect.succeed(null)
: readConfig(`remote.${remoteName}.url`).pipe(
Effect.map((remoteUrl) =>
- remoteUrl ? sourceControlClients.repositoryKeyFromRemote(remoteUrl) : null,
+ remoteUrl ? sourceControlDefinitions.repositoryKeyFromRemote(remoteUrl) : null,
),
);
const remoteName = remoteNameOverride ?? (yield* readConfig(`branch.${branch}.remote`));
diff --git a/apps/server/src/git/linkCreatedPullRequest.ts b/apps/server/src/git/linkCreatedPullRequest.ts
index 0d44a31bf9b..50708d4ff7b 100644
--- a/apps/server/src/git/linkCreatedPullRequest.ts
+++ b/apps/server/src/git/linkCreatedPullRequest.ts
@@ -10,7 +10,7 @@ import * as Option from "effect/Option";
import * as Orchestrator from "../orchestration-v2/Orchestrator.ts";
import * as ProjectService from "../project/ProjectService.ts";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
export interface CreatedPullRequestKey {
readonly host: string;
@@ -27,16 +27,16 @@ export function createdPullRequestKey(
if ((status !== "created" && status !== "opened_existing") || number === undefined || !url) {
return null;
}
- const parsed = sourceControlClients.parseChangeRequestUrl(url)?.link;
+ const parsed = sourceControlDefinitions.parseChangeRequestUrl(url)?.link;
if (parsed !== undefined) {
return { host: parsed.host, repository: parsed.repository, number: parsed.number, url };
}
const identity = project?.repositoryIdentity;
const kind = identity?.provider;
- const repository = sourceControlClients.repositorySelector(identity);
+ const repository = sourceControlDefinitions.repositorySelector(identity);
if (!identity || kind === undefined || repository === null) return null;
return {
- host: sourceControlClients.changeRequestHost(identity, kind),
+ host: sourceControlDefinitions.changeRequestHost(identity, kind),
repository: repository.toLowerCase(),
number,
url,
diff --git a/apps/server/src/mcp/toolkits/pullRequests/handlers.ts b/apps/server/src/mcp/toolkits/pullRequests/handlers.ts
index 191258ca669..584abaf4276 100644
--- a/apps/server/src/mcp/toolkits/pullRequests/handlers.ts
+++ b/apps/server/src/mcp/toolkits/pullRequests/handlers.ts
@@ -15,7 +15,7 @@ import * as Orchestrator from "../../../orchestration-v2/Orchestrator.ts";
import * as ProjectService from "../../../project/ProjectService.ts";
import * as PullRequestReviewGuideService from "../../../pullRequest/PullRequestReviewGuideService.ts";
import { pullRequestSyncKey } from "../../../pullRequest/pullRequestSyncKey.ts";
-import { sourceControlClients } from "../../../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../../../sourceControl/sourceControlDefinitions.ts";
import {
normalizeThreadPullRequestKey,
resolveThreadPullRequestChains,
@@ -62,7 +62,7 @@ function projectHostAndProvider(project: OrchestrationProjectShell | undefined):
const kind = identity?.provider ?? null;
if (!identity || kind === null) return { host: null, kind: null };
return {
- host: sourceControlClients.changeRequestHost(identity, kind),
+ host: sourceControlDefinitions.changeRequestHost(identity, kind),
kind,
};
}
@@ -72,7 +72,7 @@ const resolveTarget = Effect.fn("PullRequestsToolkit.resolveTarget")(function* (
project: OrchestrationProjectShell | undefined,
) {
if (input.url !== undefined) {
- const parsed = sourceControlClients.parseChangeRequestUrl(input.url)?.link;
+ const parsed = sourceControlDefinitions.parseChangeRequestUrl(input.url)?.link;
if (parsed === undefined) {
return yield* new PullRequestUrlInvalidError({});
}
@@ -89,11 +89,11 @@ const resolveTarget = Effect.fn("PullRequestsToolkit.resolveTarget")(function* (
const repository = input.repository.toLowerCase();
// Without a URL, a public forge host says what shape its change request URLs take;
// any other host is taken to run the project's own forge.
- const kind = sourceControlClients.findByPublicHost(host)?.kind ?? projectHost.kind;
+ const kind = sourceControlDefinitions.findByPublicHost(host)?.kind ?? projectHost.kind;
const url =
kind === null
? null
- : sourceControlClients.get(kind).changeRequestUrl({
+ : sourceControlDefinitions.get(kind).changeRequestUrl({
host,
repository,
number: input.number,
@@ -171,7 +171,8 @@ function projectForPullRequest(
: pullRequestSyncKey(
{
projectId: project.id,
- repository: sourceControlClients.repositorySelector(project.repositoryIdentity) ?? "",
+ repository:
+ sourceControlDefinitions.repositorySelector(project.repositoryIdentity) ?? "",
number: 1,
},
project.repositoryIdentity,
diff --git a/apps/server/src/orchestration-v2/PullRequestSyncReactor.ts b/apps/server/src/orchestration-v2/PullRequestSyncReactor.ts
index 5d0b47eb4c4..0046bd879a8 100644
--- a/apps/server/src/orchestration-v2/PullRequestSyncReactor.ts
+++ b/apps/server/src/orchestration-v2/PullRequestSyncReactor.ts
@@ -14,7 +14,7 @@ import {
threadPullRequestKeysEqual,
visibleThreadPullRequests,
} from "../sourceControl/threadPullRequests.ts";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
import * as Cause from "effect/Cause";
import * as Clock from "effect/Clock";
import * as Context from "effect/Context";
@@ -44,7 +44,7 @@ const QUIET_AFTER_MS = 30 * 60 * 1_000;
const QUIET_SYNC_INTERVAL_MS = 5 * 60 * 1_000;
const isChangeRequestCloseCommand = (command: string) =>
- sourceControlClients.definitions.some(
+ sourceControlDefinitions.definitions.some(
(definition) => definition.changeRequestCloseCommand?.test(command) === true,
);
@@ -60,7 +60,7 @@ interface LinkEntry {
/** Another layer of the stack `url` belongs to, in its host's canonical shape. */
function siblingChangeRequestUrl(url: string, number: number): string | null {
if (!Number.isSafeInteger(number) || number < 1) return null;
- const parsed = sourceControlClients.parseChangeRequestUrl(url);
+ const parsed = sourceControlDefinitions.parseChangeRequestUrl(url);
if (parsed === null) return null;
const { definition, link } = parsed;
return definition.changeRequestUrl({
diff --git a/apps/server/src/orchestration-v2/ThreadPullRequestService.ts b/apps/server/src/orchestration-v2/ThreadPullRequestService.ts
index f235ef63e8f..39eb4e9f958 100644
--- a/apps/server/src/orchestration-v2/ThreadPullRequestService.ts
+++ b/apps/server/src/orchestration-v2/ThreadPullRequestService.ts
@@ -25,7 +25,7 @@ import * as ProjectStore from "./ProjectStore.ts";
import * as PullRequestService from "../pullRequest/PullRequestService.ts";
import * as RepositoryIdentityResolver from "../project/RepositoryIdentityResolver.ts";
import { forkParked } from "../serverActivation.ts";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
import * as Orchestrator from "./Orchestrator.ts";
class ThreadPullRequestServiceV2 extends Context.Service<
@@ -56,8 +56,8 @@ function pullRequestMatchesProject(
return (
pullRequest.repositoryKey !== null &&
project.repositoryIdentity != null &&
- sourceControlClients.canonicalRepositoryKey(pullRequest.repositoryKey) ===
- sourceControlClients.canonicalRepositoryKey(project.repositoryIdentity.canonicalKey)
+ sourceControlDefinitions.canonicalRepositoryKey(pullRequest.repositoryKey) ===
+ sourceControlDefinitions.canonicalRepositoryKey(project.repositoryIdentity.canonicalKey)
);
}
@@ -75,7 +75,7 @@ const resolveProjectForPullRequestDiscovery = Effect.fn(
});
return {
project: { ...project, repositoryIdentity },
- repository: sourceControlClients.repositorySelector(repositoryIdentity),
+ repository: sourceControlDefinitions.repositorySelector(repositoryIdentity),
};
});
diff --git a/apps/server/src/orchestration-v2/ThreadSettlementService.ts b/apps/server/src/orchestration-v2/ThreadSettlementService.ts
index bf9b46c41a5..2efe9e3e896 100644
--- a/apps/server/src/orchestration-v2/ThreadSettlementService.ts
+++ b/apps/server/src/orchestration-v2/ThreadSettlementService.ts
@@ -26,7 +26,7 @@ import * as ServerSettings from "../serverSettings.ts";
import { forkParked } from "../serverActivation.ts";
import * as TerminalManager from "../terminal/Manager.ts";
import * as ProjectStore from "./ProjectStore.ts";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
import * as Orchestrator from "./Orchestrator.ts";
import * as ProjectionStore from "./ProjectionStore.ts";
@@ -61,8 +61,8 @@ function pullRequestMatchesProject(
return (
pullRequest.repositoryKey !== null &&
project.repositoryIdentity != null &&
- sourceControlClients.canonicalRepositoryKey(pullRequest.repositoryKey) ===
- sourceControlClients.canonicalRepositoryKey(project.repositoryIdentity.canonicalKey)
+ sourceControlDefinitions.canonicalRepositoryKey(pullRequest.repositoryKey) ===
+ sourceControlDefinitions.canonicalRepositoryKey(project.repositoryIdentity.canonicalKey)
);
}
diff --git a/apps/server/src/project/AgentSessionScanner.ts b/apps/server/src/project/AgentSessionScanner.ts
index ffdee62c01b..24a81a1b143 100644
--- a/apps/server/src/project/AgentSessionScanner.ts
+++ b/apps/server/src/project/AgentSessionScanner.ts
@@ -34,7 +34,7 @@ import * as ProjectStore from "../orchestration-v2/ProjectStore.ts";
import { resolveCodexHomeLayout } from "../provider/Drivers/CodexHomeLayout.ts";
import { expandHomePath } from "@t3tools/provider-core/server/pathExpansion";
import * as ServerSettings from "../serverSettings.ts";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
import {
createTranscriptJsonReader,
createTranscriptJsonSelector,
@@ -723,7 +723,7 @@ export const make = Effect.gen(function* () {
_tag: "Repository",
git: {
remoteKey:
- originUrl === null ? null : sourceControlClients.repositoryKeyFromRemote(originUrl),
+ originUrl === null ? null : sourceControlDefinitions.repositoryKeyFromRemote(originUrl),
repository: repositoryPathFromRemoteUrl(originUrl),
},
} as const;
diff --git a/apps/server/src/project/RepositoryIdentityResolver.ts b/apps/server/src/project/RepositoryIdentityResolver.ts
index 86a840fec0f..f75e1624f2a 100644
--- a/apps/server/src/project/RepositoryIdentityResolver.ts
+++ b/apps/server/src/project/RepositoryIdentityResolver.ts
@@ -9,7 +9,7 @@ import * as Exit from "effect/Exit";
import * as Layer from "effect/Layer";
import * as ProcessRunner from "../processRunner.ts";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
import { explicitBareRepositoryEnv } from "../vcs/VcsProcess.ts";
import * as HostProcess from "@t3tools/shared/HostProcess";
@@ -99,7 +99,7 @@ function buildRepositoryOrigin(
canonicalKey: string,
): RepositoryIdentity["origin"] {
if (!originUrl) return undefined;
- const originKey = sourceControlClients.repositoryKeyFromRemote(originUrl);
+ const originKey = sourceControlDefinitions.repositoryKeyFromRemote(originUrl);
if (originKey === canonicalKey) return undefined;
const displayName = repositoryPathOf(originKey, originUrl);
return { canonicalKey: originKey, remoteUrl: originUrl, ...(displayName ? { displayName } : {}) };
@@ -111,8 +111,8 @@ function buildRepositoryIdentity(input: {
readonly originUrl: string | undefined;
readonly rootPath: string;
}): RepositoryIdentity {
- const canonicalKey = sourceControlClients.repositoryKeyFromRemote(input.remoteUrl);
- const sourceControlProvider = sourceControlClients.recognizeRemote(input.remoteUrl);
+ const canonicalKey = sourceControlDefinitions.repositoryKeyFromRemote(input.remoteUrl);
+ const sourceControlProvider = sourceControlDefinitions.recognizeRemote(input.remoteUrl);
const repositoryPath = repositoryPathOf(canonicalKey, input.remoteUrl);
const repositoryPathSegments = repositoryPath.split("/").filter((segment) => segment.length > 0);
const [owner] = repositoryPathSegments;
diff --git a/apps/server/src/pullRequest/PullRequestReviewGuideService.ts b/apps/server/src/pullRequest/PullRequestReviewGuideService.ts
index 5ae93c8827b..91b4b94e97d 100644
--- a/apps/server/src/pullRequest/PullRequestReviewGuideService.ts
+++ b/apps/server/src/pullRequest/PullRequestReviewGuideService.ts
@@ -24,7 +24,7 @@ import {
} from "@t3tools/contracts";
import type { ReviewGuideStackLayer } from "@t3tools/provider-core/server/textGeneration";
import { resolveProjectSettings } from "@t3tools/shared/projectSettings";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
import * as ServerConfig from "../config.ts";
import * as PullRequestReviewGuides from "../persistence/PullRequestReviewGuides.ts";
@@ -104,7 +104,7 @@ const make = Effect.gen(function* () {
{
projectId: ProjectId.make("own"),
number: key.number,
- repository: sourceControlClients.repositorySelector(identity) ?? "",
+ repository: sourceControlDefinitions.repositorySelector(identity) ?? "",
},
identity,
);
@@ -251,7 +251,7 @@ const make = Effect.gen(function* () {
),
);
const fetchAndResolve = (ref: string) => fetch([ref]).pipe(Effect.andThen(resolveHead));
- const headRef = sourceControlClients.get(detail.provider).changeRequestHeadRef?.(number);
+ const headRef = sourceControlDefinitions.get(detail.provider).changeRequestHeadRef?.(number);
const branchRef = `refs/heads/${branch}`;
const checkBranch = git.execute({
operation: "PullRequestReviewGuideService.checkHeadBranch",
diff --git a/apps/server/src/pullRequest/PullRequestService.ts b/apps/server/src/pullRequest/PullRequestService.ts
index b124c61d4a8..2a81959e9e7 100644
--- a/apps/server/src/pullRequest/PullRequestService.ts
+++ b/apps/server/src/pullRequest/PullRequestService.ts
@@ -75,7 +75,7 @@ import {
type ThreadPullRequestKey,
} from "@t3tools/contracts";
import { resolveProjectSettings } from "@t3tools/shared/projectSettings";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
import * as ProjectService from "../project/ProjectService.ts";
import * as ServerSettings from "../serverSettings.ts";
@@ -667,7 +667,7 @@ function sshRemoteHidesWebHost(
) {
return (
identity.provider !== undefined &&
- sourceControlClients.find(identity.provider)?.sshRemoteHidesWebHost === true &&
+ sourceControlDefinitions.find(identity.provider)?.sshRemoteHidesWebHost === true &&
isSshRemoteUrl(identity.locator.remoteUrl)
);
}
@@ -722,10 +722,10 @@ export const make = Effect.gen(function* () {
const identity = project.repositoryIdentity;
if (
(identity?.provider !== "unknown" && !(identity && sshRemoteHidesWebHost(identity))) ||
- sourceControlClients.repositorySelector(project.repositoryIdentity) === null
+ sourceControlDefinitions.repositorySelector(project.repositoryIdentity) === null
)
continue;
- const host = sourceControlClients.changeRequestHost(identity, "unknown");
+ const host = sourceControlDefinitions.changeRequestHost(identity, "unknown");
if (
filter.host !== undefined &&
host !== "unknown" &&
@@ -736,7 +736,7 @@ export const make = Effect.gen(function* () {
continue;
}
const { remoteName, remoteUrl } = identity.locator;
- const provider = sourceControlClients.recognizeRemote(remoteUrl);
+ const provider = sourceControlDefinitions.recognizeRemote(remoteUrl);
if (provider !== null) {
const candidates = refinements.get(provider.baseUrl);
const candidate = { project, provider, remoteName, remoteUrl };
@@ -754,7 +754,7 @@ export const make = Effect.gen(function* () {
sourceControlProviders.resolveHandle({
cwd: project.workspaceRoot,
context: {
- provider: sourceControlClients.find(provider.kind)?.sshRemoteHidesWebHost
+ provider: sourceControlDefinitions.find(provider.kind)?.sshRemoteHidesWebHost
? { ...provider, kind: SourceControlProviderKind.make("unknown") }
: provider,
remoteName,
@@ -828,19 +828,21 @@ export const make = Effect.gen(function* () {
if (filter.projectIds !== undefined && !filter.projectIds.includes(project.id)) continue;
const identity = project.repositoryIdentity;
let kind = identity?.provider;
- const repository = sourceControlClients.repositorySelector(project.repositoryIdentity);
+ const repository = sourceControlDefinitions.repositorySelector(
+ project.repositoryIdentity,
+ );
if (!identity || kind === undefined || repository === null) continue;
let refinedProvider: SourceControlProviderInfo | null | undefined;
if (kind === "unknown" || sshRemoteHidesWebHost(identity)) {
- const provider = sourceControlClients.recognizeRemote(identity.locator.remoteUrl);
+ const provider = sourceControlDefinitions.recognizeRemote(identity.locator.remoteUrl);
refinedProvider = provider === null ? null : refinedProviders.get(provider.baseUrl);
kind = refinedProvider?.kind ?? kind;
}
const host =
refinedProvider &&
- sourceControlClients.find(refinedProvider.kind)?.sshRemoteHidesWebHost
+ sourceControlDefinitions.find(refinedProvider.kind)?.sshRemoteHidesWebHost
? new URL(refinedProvider.baseUrl).host.toLowerCase()
- : sourceControlClients.changeRequestHost(identity, kind);
+ : sourceControlDefinitions.changeRequestHost(identity, kind);
if (filter.host !== undefined && host !== filter.host.toLowerCase()) {
continue;
}
@@ -869,11 +871,11 @@ export const make = Effect.gen(function* () {
host,
remote:
repositoryKey ??
- sourceControlClients.repositoryKeyFromRemote(`https://${host}/${repository}`),
+ sourceControlDefinitions.repositoryKeyFromRemote(`https://${host}/${repository}`),
repositoryKey:
repositoryKey === null
? null
- : sourceControlClients.canonicalRepositoryKey(repositoryKey.toLowerCase()),
+ : sourceControlDefinitions.canonicalRepositoryKey(repositoryKey.toLowerCase()),
});
}
return { supported, unimplemented, viewerRoots };
@@ -905,12 +907,12 @@ export const make = Effect.gen(function* () {
);
}
const referenceKey = `${host}/${repository}`.toLowerCase();
- const repositoryKey = sourceControlClients.canonicalRepositoryKey(referenceKey);
+ const repositoryKey = sourceControlDefinitions.canonicalRepositoryKey(referenceKey);
// A host that spells one repository several ways (Azure's SSH and legacy clone hosts)
// can differ from the browser URL's host. Compare the complete repository identity
// before narrowing those checkouts by host.
return listWorkspaceProjects(
- sourceControlClients.findByRepositoryKey(referenceKey) ? {} : { host },
+ sourceControlDefinitions.findByRepositoryKey(referenceKey) ? {} : { host },
).pipe(
Effect.flatMap(({ supported }) => {
const onHost = supported.filter((candidate) => candidate.host === host);
@@ -927,7 +929,7 @@ export const make = Effect.gen(function* () {
onHost.find((candidate) => candidate.repositoryKey === null);
if (route === undefined) {
return Effect.gen(function* () {
- const publicHost = sourceControlClients.findByPublicHost(host);
+ const publicHost = sourceControlDefinitions.findByPublicHost(host);
const api = publicHost === undefined ? null : registry.get(publicHost.kind);
if (api?.readsPublicHostWithoutCheckout) {
const selected = yield* projects.getShell(ref.projectId).pipe(
@@ -947,7 +949,7 @@ export const make = Effect.gen(function* () {
api: withRateLimitBackoff(api, host, rateLimits),
repository,
host,
- remote: sourceControlClients.repositoryKeyFromRemote(
+ remote: sourceControlDefinitions.repositoryKeyFromRemote(
`https://${host}/${repository}`,
),
repositoryKey: null,
@@ -964,7 +966,7 @@ export const make = Effect.gen(function* () {
: {
...route,
repository,
- remote: sourceControlClients.repositoryKeyFromRemote(
+ remote: sourceControlDefinitions.repositoryKeyFromRemote(
`https://${host}/${repository}`,
),
},
diff --git a/apps/server/src/pullRequest/pullRequestSyncKey.ts b/apps/server/src/pullRequest/pullRequestSyncKey.ts
index 681dfb07b9d..1e74563fd61 100644
--- a/apps/server/src/pullRequest/pullRequestSyncKey.ts
+++ b/apps/server/src/pullRequest/pullRequestSyncKey.ts
@@ -1,5 +1,5 @@
import type { PullRequestRef, RepositoryIdentity, ThreadPullRequestKey } from "@t3tools/contracts";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
import { normalizeThreadPullRequestKey } from "../sourceControl/threadPullRequests.ts";
export function pullRequestSyncKey(
@@ -7,11 +7,13 @@ export function pullRequestSyncKey(
identity?: RepositoryIdentity | null,
): ThreadPullRequestKey | null {
const host = identity
- ? sourceControlClients.changeRequestHost(identity, identity.provider)
+ ? sourceControlDefinitions.changeRequestHost(identity, identity.provider)
: undefined;
// A host whose tools select a repository by something other than its path (Azure DevOps takes
// the bare name) can only key such a reference through the project's own repository.
- const definition = identity?.provider ? sourceControlClients.find(identity.provider) : undefined;
+ const definition = identity?.provider
+ ? sourceControlDefinitions.find(identity.provider)
+ : undefined;
if (identity && definition?.repositorySelector && !reference.repository.includes("/")) {
if (
reference.repository.toLowerCase() !==
diff --git a/apps/server/src/server.ts b/apps/server/src/server.ts
index 24ad96319c8..a93d661dd8a 100644
--- a/apps/server/src/server.ts
+++ b/apps/server/src/server.ts
@@ -60,7 +60,7 @@ import * as AcpRegistrySupport from "@t3tools/provider-acp-registry/server/AcpRe
import * as CheckpointDiffQuery from "./checkpointing/CheckpointDiffQuery.ts";
import * as CheckpointStore from "./checkpointing/CheckpointStore.ts";
import * as SourceControlBuiltInDrivers from "./sourceControl/builtInDrivers.ts";
-import { BUILT_IN_SOURCE_CONTROL_DRIVER_LIST } from "./sourceControl/sourceControlClients.ts";
+import { BUILT_IN_SOURCE_CONTROL_DRIVER_LIST } from "./sourceControl/sourceControlDefinitions.ts";
import * as TextGeneration from "./textGeneration/TextGeneration.ts";
import * as ProviderInstanceRegistryHydration from "./provider/ProviderInstanceRegistryHydration.ts";
import * as ProjectSettingsOverrideSweep from "./provider/ProjectSettingsOverrideSweep.ts";
diff --git a/apps/server/src/sourceControl/SourceControlProviderRegistry.ts b/apps/server/src/sourceControl/SourceControlProviderRegistry.ts
index f1104a54835..eee2598d8c0 100644
--- a/apps/server/src/sourceControl/SourceControlProviderRegistry.ts
+++ b/apps/server/src/sourceControl/SourceControlProviderRegistry.ts
@@ -15,7 +15,7 @@ import {
import type {} from "@t3tools/contracts";
import * as BuiltInDrivers from "./builtInDrivers.ts";
-import { sourceControlClients } from "./sourceControlClients.ts";
+import { sourceControlDefinitions } from "./sourceControlDefinitions.ts";
import * as SourceControlProvider from "@t3tools/source-control-core/server/SourceControlProvider";
import {
probeSourceControlProvider,
@@ -144,7 +144,7 @@ function selectProviderContext(
): SourceControlProvider.SourceControlProviderContext | null {
const candidates: Array<SourceControlProvider.SourceControlProviderContext> = [];
for (const remote of remotes) {
- const provider = sourceControlClients.recognizeRemote(remote.url);
+ const provider = sourceControlDefinitions.recognizeRemote(remote.url);
if (provider) {
candidates.push({
provider,
@@ -337,7 +337,7 @@ export const makeWithProviders = Effect.fn("makeSourceControlProviderRegistryWit
if (input.url.protocol !== "https:" || input.url.username || input.url.password) {
return undefined;
}
- const kind = sourceControlClients.recognizeRemote(input.url.href)?.kind;
+ const kind = sourceControlDefinitions.recognizeRemote(input.url.href)?.kind;
return kind ? providers.get(kind)?.resolveLink?.(input) : undefined;
},
get,
diff --git a/apps/server/src/sourceControl/builtInDrivers.ts b/apps/server/src/sourceControl/builtInDrivers.ts
index 26bc4d4da21..0e994dcac4a 100644
--- a/apps/server/src/sourceControl/builtInDrivers.ts
+++ b/apps/server/src/sourceControl/builtInDrivers.ts
@@ -8,7 +8,7 @@ import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as ServerSourceControlHost from "./ServerSourceControlHost.ts";
-import { BUILT_IN_SOURCE_CONTROL_DRIVER_LIST } from "./sourceControlClients.ts";
+import { BUILT_IN_SOURCE_CONTROL_DRIVER_LIST } from "./sourceControlDefinitions.ts";
export interface SourceControlDriverEntry {
readonly driver: Pick<SourceControlDriver, "kind" | "definition">;
diff --git a/apps/server/src/sourceControl/sourceControlClients.ts b/apps/server/src/sourceControl/sourceControlDefinitions.ts
similarity index 89%
rename from apps/server/src/sourceControl/sourceControlClients.ts
rename to apps/server/src/sourceControl/sourceControlDefinitions.ts
index 856fe7da39a..590fdd2cfb9 100644
--- a/apps/server/src/sourceControl/sourceControlClients.ts
+++ b/apps/server/src/sourceControl/sourceControlDefinitions.ts
@@ -1,6 +1,6 @@
import * as AzureDevOpsDriver from "@t3tools/source-control-azure-devops/server/driver";
import * as BitbucketDriver from "@t3tools/source-control-bitbucket/server/driver";
-import { makeSourceControlClientRegistry } from "@t3tools/source-control-core/client/definition";
+import { makeSourceControlDefinitionRegistry } from "@t3tools/source-control-core/shared/definition";
import * as ForgejoDriver from "@t3tools/source-control-forgejo/server/driver";
import * as GitCafeDriver from "@t3tools/source-control-gitcafe/server/driver";
import * as GitHubDriver from "@t3tools/source-control-github/server/driver";
@@ -22,7 +22,7 @@ export const BUILT_IN_SOURCE_CONTROL_DRIVER_LIST = [
AzureDevOpsDriver.driver,
] as const;
-export const sourceControlClients = makeSourceControlClientRegistry(
+export const sourceControlDefinitions = makeSourceControlDefinitionRegistry(
BUILT_IN_SOURCE_CONTROL_DRIVER_LIST.map((driver) => driver.definition),
{
claimChangeRequestUrlsFirst: [GitCafeDriver.driver.kind],
diff --git a/apps/server/src/sourceControl/sourceControlHostSecrets.ts b/apps/server/src/sourceControl/sourceControlHostSecrets.ts
index ab366398be3..46c96ca5b7f 100644
--- a/apps/server/src/sourceControl/sourceControlHostSecrets.ts
+++ b/apps/server/src/sourceControl/sourceControlHostSecrets.ts
@@ -1,12 +1,12 @@
import { secretSettingsFields } from "@t3tools/contracts";
-import { sourceControlClients } from "./sourceControlClients.ts";
+import { sourceControlDefinitions } from "./sourceControlDefinitions.ts";
export const SOURCE_CONTROL_HOST_SECRET_FIELDS: ReadonlyMap<
string,
ReadonlyArray<string>
> = new Map(
- sourceControlClients.definitions.flatMap((definition) => {
+ sourceControlDefinitions.definitions.flatMap((definition) => {
const fields = definition.settings ? secretSettingsFields(definition.settings) : [];
return fields.length > 0 ? [[definition.kind, fields] as const] : [];
}),
diff --git a/apps/server/src/sourceControl/threadPullRequests.ts b/apps/server/src/sourceControl/threadPullRequests.ts
index 148fc92ac9e..8d9c72b1c6c 100644
--- a/apps/server/src/sourceControl/threadPullRequests.ts
+++ b/apps/server/src/sourceControl/threadPullRequests.ts
@@ -1,6 +1,6 @@
-import { makeThreadPullRequests } from "@t3tools/source-control-core/client/threadPullRequests";
+import { makeThreadPullRequests } from "@t3tools/source-control-core/shared/threadPullRequests";
-import { sourceControlClients } from "./sourceControlClients.ts";
+import { sourceControlDefinitions } from "./sourceControlDefinitions.ts";
export { visibleThreadPullRequests } from "@t3tools/shared/threadPullRequests";
@@ -12,4 +12,4 @@ export const {
resolveThreadPullRequestChains,
threadPullRequestsOf,
applyThreadPullRequestLinkUpdate,
-} = makeThreadPullRequests(sourceControlClients);
+} = makeThreadPullRequests(sourceControlDefinitions);
diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.ts
index 78c88d3c790..5a9aa74af60 100644
--- a/apps/server/src/vcs/GitVcsDriverCore.ts
+++ b/apps/server/src/vcs/GitVcsDriverCore.ts
@@ -50,7 +50,7 @@ import {
parseRemoteRefWithRemoteNames,
} from "../git/remoteRefs.ts";
import * as ServerConfig from "../config.ts";
-import { sourceControlClients } from "../sourceControl/sourceControlClients.ts";
+import { sourceControlDefinitions } from "../sourceControl/sourceControlDefinitions.ts";
const DEFAULT_TIMEOUT_MS = 30_000;
/** T3's record of the branch, named as on the host, that a branch was cut from. */
@@ -1735,7 +1735,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
"ensureRemote",
)(function* (input) {
const preferredName = sanitizeRemoteName(input.preferredName);
- const normalizedTargetUrl = sourceControlClients.repositoryKeyFromRemote(input.url);
+ const normalizedTargetUrl = sourceControlDefinitions.repositoryKeyFromRemote(input.url);
const remoteFetchUrls = yield* runGitStdout(
"GitVcsDriver.ensureRemote.listRemoteUrls",
input.cwd,
@@ -1743,7 +1743,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
).pipe(Effect.map((stdout) => parseRemoteFetchUrls(stdout)));
for (const [remoteName, remoteUrl] of remoteFetchUrls.entries()) {
- if (sourceControlClients.repositoryKeyFromRemote(remoteUrl) === normalizedTargetUrl) {
+ if (sourceControlDefinitions.repositoryKeyFromRemote(remoteUrl) === normalizedTargetUrl) {
return remoteName;
}
}
diff --git a/apps/web/src/components/pullRequest/pullRequestLinkContextMenu.ts b/apps/web/src/components/pullRequest/pullRequestLinkContextMenu.ts
index 6f6ad2a29e8..c6107a155bf 100644
--- a/apps/web/src/components/pullRequest/pullRequestLinkContextMenu.ts
+++ b/apps/web/src/components/pullRequest/pullRequestLinkContextMenu.ts
@@ -1,6 +1,6 @@
import type { ContextMenuItem } from "@t3tools/contracts";
import {
- type SourceControlClientDefinition,
+ type SourceControlDefinition,
UNKNOWN_SOURCE_CONTROL_CLIENT,
} from "@t3tools/client-runtime/source-control-clients";
@@ -11,7 +11,7 @@ import { toastManager } from "../ui/toast";
export type PullRequestLinkContextMenuAction = "copy-link" | "open-external";
-export const openOnHostLabel = (host: SourceControlClientDefinition): string =>
+export const openOnHostLabel = (host: SourceControlDefinition): string =>
host === UNKNOWN_SOURCE_CONTROL_CLIENT ? "Open on host" : `Open on ${host.label}`;
function pullRequestLinkContextMenuItems(
diff --git a/apps/web/src/components/settings/SourceControlAccountSettings.tsx b/apps/web/src/components/settings/SourceControlAccountSettings.tsx
index 258436f1df2..f97324365a9 100644
--- a/apps/web/src/components/settings/SourceControlAccountSettings.tsx
+++ b/apps/web/src/components/settings/SourceControlAccountSettings.tsx
@@ -11,7 +11,7 @@ import { Switch } from "../ui/switch";
import { groupHostAccounts, nextHostAccountChoices } from "./SourceControlAccountSettings.logic";
import {
readHostCredentialSettings,
- type SourceControlClientDefinition,
+ type SourceControlDefinition,
type SourceControlHostCredentials,
} from "@t3tools/client-runtime/source-control-clients";
import { redactedPlaceholder } from "./RedactedSensitiveText";
@@ -44,7 +44,7 @@ export function SourceControlAccountSettings({
onSaved,
}: {
readonly environmentId: EnvironmentId;
- readonly definition: SourceControlClientDefinition;
+ readonly definition: SourceControlDefinition;
readonly credentials: SourceControlHostCredentials;
readonly auth: SourceControlProviderAuth;
readonly onSaved: () => void;
diff --git a/apps/web/src/components/settings/SourceControlHostSettings.tsx b/apps/web/src/components/settings/SourceControlHostSettings.tsx
index 02892d3f194..97e4f8d9953 100644
--- a/apps/web/src/components/settings/SourceControlHostSettings.tsx
+++ b/apps/web/src/components/settings/SourceControlHostSettings.tsx
@@ -1,5 +1,5 @@
import type { EnvironmentId } from "@t3tools/contracts";
-import type { SourceControlClientDefinition } from "@t3tools/client-runtime/source-control-clients";
+import type { SourceControlDefinition } from "@t3tools/client-runtime/source-control-clients";
import { useState } from "react";
import { useEnvironmentSettings } from "../../hooks/useSettings";
@@ -14,8 +14,8 @@ export function SourceControlHostSettings({
onSaved,
}: {
readonly environmentId: EnvironmentId;
- readonly definition: SourceControlClientDefinition & {
- readonly settings: NonNullable<SourceControlClientDefinition["settings"]>;
+ readonly definition: SourceControlDefinition & {
+ readonly settings: NonNullable<SourceControlDefinition["settings"]>;
};
readonly onSaved: () => void;
}) {
diff --git a/apps/web/src/components/settings/SourceControlTokenSettings.tsx b/apps/web/src/components/settings/SourceControlTokenSettings.tsx
index d0d44c8b006..090f097be5e 100644
--- a/apps/web/src/components/settings/SourceControlTokenSettings.tsx
+++ b/apps/web/src/components/settings/SourceControlTokenSettings.tsx
@@ -5,7 +5,7 @@ import { useState } from "react";
import { useEnvironmentSettings } from "../../hooks/useSettings";
import {
readHostCredentialSettings,
- type SourceControlClientDefinition,
+ type SourceControlDefinition,
type SourceControlHostCredentials,
} from "@t3tools/client-runtime/source-control-clients";
import { serverEnvironment } from "../../state/server";
@@ -22,7 +22,7 @@ export function SourceControlTokenSettings({
onSaved,
}: {
readonly environmentId: EnvironmentId;
- readonly definition: SourceControlClientDefinition;
+ readonly definition: SourceControlDefinition;
readonly credentials: SourceControlHostCredentials;
readonly onSaved: () => void;
}) {
diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.ts
index 8d177d78859..b621143836f 100644
--- a/apps/web/src/components/settings/settingsSearch.ts
+++ b/apps/web/src/components/settings/settingsSearch.ts
@@ -6,7 +6,7 @@ import type { EnvironmentId } from "@t3tools/contracts";
import type { EnvironmentConnectionPhase } from "@t3tools/client-runtime/connection";
import {
sourceControlClients,
- type SourceControlClientDefinition,
+ type SourceControlDefinition,
} from "@t3tools/client-runtime/source-control-clients";
import { DEFAULT_KEYBINDINGS } from "@t3tools/shared/keybindings";
import { commandLabel } from "./KeybindingsSettings.logic";
@@ -116,7 +116,7 @@ export function sourceControlHostSettingsSearchId(kind: string) {
/** Each host's own settings: its accounts and token, or the fields of its settings form. */
export function sourceControlHostSearchItems(
- definitions: ReadonlyArray<SourceControlClientDefinition>,
+ definitions: ReadonlyArray<SourceControlDefinition>,
): ReadonlyArray<
SettingsSearchItem & { readonly id: ReturnType<typeof sourceControlHostSettingsSearchId> }
> {
diff --git a/apps/web/src/sourceControlPresentation.tsx b/apps/web/src/sourceControlPresentation.tsx
index 8fbc1470870..c122ed0fd38 100644
--- a/apps/web/src/sourceControlPresentation.tsx
+++ b/apps/web/src/sourceControlPresentation.tsx
@@ -3,7 +3,7 @@ import type { SourceControlProviderInfo } from "@t3tools/contracts";
import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
import type {
ChangeRequestTerminology,
- SourceControlClientDefinition,
+ SourceControlDefinition,
} from "@t3tools/client-runtime/source-control-clients";
import { PullRequestGlyph } from "~/components/pullRequest/pullRequestIcons";
import { SourceControlIconArtwork } from "./components/SourceControlIconArtwork";
@@ -12,10 +12,10 @@ export type { ChangeRequestTerminology } from "@t3tools/client-runtime/source-co
type SourceControlIcon = ElementType<{ className?: string }>;
-const SOURCE_CONTROL_ICONS = new WeakMap<SourceControlClientDefinition, SourceControlIcon>();
+const SOURCE_CONTROL_ICONS = new WeakMap<SourceControlDefinition, SourceControlIcon>();
/** One component per definition, so a host's icon keeps its identity across renders. */
-export function sourceControlIcon(definition: SourceControlClientDefinition): SourceControlIcon {
+export function sourceControlIcon(definition: SourceControlDefinition): SourceControlIcon {
const artwork = definition.icon;
if (artwork === null) return PullRequestGlyph.pullRequest;
let Icon = SOURCE_CONTROL_ICONS.get(definition);
@@ -29,14 +29,14 @@ export function sourceControlIcon(definition: SourceControlClientDefinition): So
}
export interface SourceControlPresentation {
- readonly definition: SourceControlClientDefinition;
+ readonly definition: SourceControlDefinition;
readonly providerName: string;
readonly terminology: ChangeRequestTerminology;
readonly Icon: SourceControlIcon;
}
function presentDefinition(
- definition: SourceControlClientDefinition,
+ definition: SourceControlDefinition,
providerName: string,
): SourceControlPresentation {
return {
diff --git a/docs/internals/overview.md b/docs/internals/overview.md
index 88b2affa061..1e98374dbaa 100644
--- a/docs/internals/overview.md
+++ b/docs/internals/overview.md
@@ -90,7 +90,7 @@ and inactivity settings without a connected client. Merge notifications invalida
and trigger a check. A merge outside T3, such as an agent running `gh pr merge`, sends no
notification, so the [PR sync reactor](../../apps/server/src/orchestration-v2/PullRequestSyncReactor.ts)
re-reads a thread's open links when a run that ran a merge or close command ends. Each forge's
-client definition names its CLI's commands in `changeRequestCloseCommand`. The guarded
+definition names its CLI's commands in `changeRequestCloseCommand`. The guarded
`thread.auto-settle` command rejects newer activity, explicit settlement overrides, and live or
blocked work. It records the activity timestamp for stable
sorting and detaches idle provider sessions. Clients render the persisted result; they do not
diff --git a/packages/client-runtime/src/changeRequestLinks.ts b/packages/client-runtime/src/changeRequestLinks.ts
index 3786a9eff06..2629a934c58 100644
--- a/packages/client-runtime/src/changeRequestLinks.ts
+++ b/packages/client-runtime/src/changeRequestLinks.ts
@@ -4,7 +4,7 @@ import type {
PullRequestRef,
RepositoryIdentity,
} from "@t3tools/contracts";
-import type { ChangeRequestLink } from "@t3tools/source-control-core/client/definition";
+import type { ChangeRequestLink } from "@t3tools/source-control-core/shared/definition";
import { sourceControlClients } from "./sourceControlClients.ts";
diff --git a/packages/client-runtime/src/operations/projects.ts b/packages/client-runtime/src/operations/projects.ts
index 182c95d6d71..98c7e00a716 100644
--- a/packages/client-runtime/src/operations/projects.ts
+++ b/packages/client-runtime/src/operations/projects.ts
@@ -25,7 +25,7 @@ import {
} from "../state/projects.ts";
import type { EnvironmentProject } from "../state/models.ts";
import { sourceControlClients } from "../sourceControlClients.ts";
-import type { SourceControlClientDefinition } from "../sourceControlClients.ts";
+import type { SourceControlDefinition } from "../sourceControlClients.ts";
export type AddProjectRemoteSource = SourceControlProviderKind | "url";
@@ -204,7 +204,7 @@ export function getNewProjectPathPreview(newProjectsRoot: string, name: string):
}
export interface NewProjectPublishTarget {
- readonly definition: SourceControlClientDefinition;
+ readonly definition: SourceControlDefinition;
readonly owner: string | null;
}
diff --git a/packages/client-runtime/src/sourceControlClients.ts b/packages/client-runtime/src/sourceControlClients.ts
index 51ea0131f17..e7ca2816091 100644
--- a/packages/client-runtime/src/sourceControlClients.ts
+++ b/packages/client-runtime/src/sourceControlClients.ts
@@ -1,10 +1,10 @@
-import * as AzureDevOps from "@t3tools/source-control-azure-devops/client/definition";
-import * as Bitbucket from "@t3tools/source-control-bitbucket/client/definition";
+import * as AzureDevOps from "@t3tools/source-control-azure-devops/shared/definition";
+import * as Bitbucket from "@t3tools/source-control-bitbucket/shared/definition";
import {
HostCredentialSettings,
- makeSourceControlClientRegistry,
+ makeSourceControlDefinitionRegistry,
readSourceControlHostSettings,
-} from "@t3tools/source-control-core/client/definition";
+} from "@t3tools/source-control-core/shared/definition";
import type { ServerSettings } from "@t3tools/contracts";
export {
@@ -16,14 +16,14 @@ export {
type HostCredentialSettings,
type ParsedChangeRequestUrl,
type ReferenceAutolink,
- type SourceControlClientDefinition,
+ type SourceControlDefinition,
type SourceControlHostCredentials,
type SourceControlIcon,
-} from "@t3tools/source-control-core/client/definition";
-import * as Forgejo from "@t3tools/source-control-forgejo/client/definition";
-import * as GitCafe from "@t3tools/source-control-gitcafe/client/definition";
-import * as GitHub from "@t3tools/source-control-github/client/definition";
-import * as GitLab from "@t3tools/source-control-gitlab/client/definition";
+} from "@t3tools/source-control-core/shared/definition";
+import * as Forgejo from "@t3tools/source-control-forgejo/shared/definition";
+import * as GitCafe from "@t3tools/source-control-gitcafe/shared/definition";
+import * as GitHub from "@t3tools/source-control-github/shared/definition";
+import * as GitLab from "@t3tools/source-control-gitlab/shared/definition";
/**
* GitHub comes first because a repository that has not reported its host yet reads as GitHub,
@@ -42,7 +42,7 @@ const BUILT_IN_SOURCE_CONTROL_CLIENTS = [
AzureDevOps.definition,
];
-export const sourceControlClients = makeSourceControlClientRegistry(
+export const sourceControlClients = makeSourceControlDefinitionRegistry(
BUILT_IN_SOURCE_CONTROL_CLIENTS,
{
claimChangeRequestUrlsFirst: [GitCafe.definition.kind],
diff --git a/packages/client-runtime/src/threadPullRequests.ts b/packages/client-runtime/src/threadPullRequests.ts
index c4443728930..a87f5342fcb 100644
--- a/packages/client-runtime/src/threadPullRequests.ts
+++ b/packages/client-runtime/src/threadPullRequests.ts
@@ -1,4 +1,4 @@
-import { makeThreadPullRequests } from "@t3tools/source-control-core/client/threadPullRequests";
+import { makeThreadPullRequests } from "@t3tools/source-control-core/shared/threadPullRequests";
import { sourceControlClients } from "./sourceControlClients.ts";
@@ -12,7 +12,7 @@ export {
type ThreadCurrentPullRequest,
type ThreadPullRequestBadge,
type ThreadPullRequestChain,
-} from "@t3tools/source-control-core/client/threadPullRequests";
+} from "@t3tools/source-control-core/shared/threadPullRequests";
export const {
normalizeThreadPullRequestKey,
diff --git a/packages/source-control-azure-devops/package.json b/packages/source-control-azure-devops/package.json
index 2d5a007b42b..ed7873c2b9f 100644
--- a/packages/source-control-azure-devops/package.json
+++ b/packages/source-control-azure-devops/package.json
@@ -3,9 +3,9 @@
"private": true,
"type": "module",
"exports": {
- "./client/definition": {
- "types": "./src/client/definition.ts",
- "import": "./src/client/definition.ts"
+ "./shared/definition": {
+ "types": "./src/shared/definition.ts",
+ "import": "./src/shared/definition.ts"
},
"./server/driver": {
"types": "./src/server/driver.ts",
diff --git a/packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestProvider.ts b/packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestProvider.ts
index 5032479d3b4..1e901f8f1f9 100644
--- a/packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestProvider.ts
+++ b/packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestProvider.ts
@@ -33,7 +33,7 @@ import type {
AzureDevOpsPullRequest,
AzureDevOpsRepositoryLocation,
} from "./azureDevOpsPullRequestJson.ts";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
/**
* Every file is two `az` invocations, each paying a Python interpreter's start-up, so reading them
diff --git a/packages/source-control-azure-devops/src/server/driver.ts b/packages/source-control-azure-devops/src/server/driver.ts
index 14adf1311d9..ac1f1a53855 100644
--- a/packages/source-control-azure-devops/src/server/driver.ts
+++ b/packages/source-control-azure-devops/src/server/driver.ts
@@ -5,7 +5,7 @@ import {
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
import * as AzureDevOpsCli from "./AzureDevOpsCli.ts";
import * as AzureDevOpsPullRequestCli from "./AzureDevOpsPullRequestCli.ts";
diff --git a/packages/source-control-azure-devops/src/client/definition.test.ts b/packages/source-control-azure-devops/src/shared/definition.test.ts
similarity index 96%
rename from packages/source-control-azure-devops/src/client/definition.test.ts
rename to packages/source-control-azure-devops/src/shared/definition.test.ts
index b739e8de831..4c3f3a0ec8f 100644
--- a/packages/source-control-azure-devops/src/client/definition.test.ts
+++ b/packages/source-control-azure-devops/src/shared/definition.test.ts
@@ -1,9 +1,9 @@
import { SourceControlProviderKind } from "@t3tools/contracts";
-import type { ChangeRequestProjectIdentity } from "@t3tools/source-control-core/client/definition";
+import type { ChangeRequestProjectIdentity } from "@t3tools/source-control-core/shared/definition";
import {
- makeSourceControlClientRegistry,
+ makeSourceControlDefinitionRegistry,
recognizeRemoteWith,
-} from "@t3tools/source-control-core/client/definition";
+} from "@t3tools/source-control-core/shared/definition";
import { describe, expect, it } from "vite-plus/test";
import { definition } from "./definition.ts";
@@ -123,7 +123,7 @@ describe("Azure DevOps remotes", () => {
});
describe("Azure DevOps repository keys", () => {
- const registry = makeSourceControlClientRegistry([definition]);
+ const registry = makeSourceControlDefinitionRegistry([definition]);
it("gives a repository the same key over SSH as over HTTPS", () => {
for (const remote of [
@@ -167,7 +167,7 @@ describe("Azure DevOps repository keys", () => {
});
describe("Azure DevOps repository selector", () => {
- const registry = makeSourceControlClientRegistry([definition]);
+ const registry = makeSourceControlDefinitionRegistry([definition]);
it("names a repository by its own name, not its project path", () => {
// `az repos pr list --repository` takes a name and detects the organisation and project from
diff --git a/packages/source-control-azure-devops/src/client/definition.ts b/packages/source-control-azure-devops/src/shared/definition.ts
similarity index 97%
rename from packages/source-control-azure-devops/src/client/definition.ts
rename to packages/source-control-azure-devops/src/shared/definition.ts
index dced8fa887f..d977bf3c2ae 100644
--- a/packages/source-control-azure-devops/src/client/definition.ts
+++ b/packages/source-control-azure-devops/src/shared/definition.ts
@@ -1,11 +1,11 @@
import { SourceControlProviderKind } from "@t3tools/contracts";
import {
changeRequestUrlBelow,
- defineSourceControlClient,
+ defineSourceControl,
isChangeRequestAuthorityOfProject,
parseChangeRequestPath,
remoteWebOrigin,
-} from "@t3tools/source-control-core/client/definition";
+} from "@t3tools/source-control-core/shared/definition";
import { icon } from "./icon.ts";
// Azure DevOps Server runs on any hostname; its `_git` route identifies it.
@@ -63,7 +63,7 @@ function checkoutCommandId(args: string): string | null {
const KIND = SourceControlProviderKind.make("azure-devops");
-export const definition = defineSourceControlClient({
+export const definition = defineSourceControl({
kind: KIND,
label: "Azure DevOps",
pickerLabel: "Azure DevOps",
diff --git a/packages/source-control-azure-devops/src/client/icon.ts b/packages/source-control-azure-devops/src/shared/icon.ts
similarity index 99%
rename from packages/source-control-azure-devops/src/client/icon.ts
rename to packages/source-control-azure-devops/src/shared/icon.ts
index 58cfef61e4d..23e71921251 100644
--- a/packages/source-control-azure-devops/src/client/icon.ts
+++ b/packages/source-control-azure-devops/src/shared/icon.ts
@@ -1,4 +1,4 @@
-import type { SourceControlIcon } from "@t3tools/source-control-core/client/definition";
+import type { SourceControlIcon } from "@t3tools/source-control-core/shared/definition";
// Microsoft Azure DevOps mark via selfhst/icons (CC BY 4.0): https://github.com/selfhst/icons/blob/main/svg/azure-devops.svg
export const icon: SourceControlIcon = {
diff --git a/packages/source-control-bitbucket/package.json b/packages/source-control-bitbucket/package.json
index 75e1e58ad2f..3589a1f3191 100644
--- a/packages/source-control-bitbucket/package.json
+++ b/packages/source-control-bitbucket/package.json
@@ -3,9 +3,9 @@
"private": true,
"type": "module",
"exports": {
- "./client/definition": {
- "types": "./src/client/definition.ts",
- "import": "./src/client/definition.ts"
+ "./shared/definition": {
+ "types": "./src/shared/definition.ts",
+ "import": "./src/shared/definition.ts"
},
"./server/driver": {
"types": "./src/server/driver.ts",
diff --git a/packages/source-control-bitbucket/src/server/BitbucketApi.ts b/packages/source-control-bitbucket/src/server/BitbucketApi.ts
index 21aa02f34bb..d3519af0979 100644
--- a/packages/source-control-bitbucket/src/server/BitbucketApi.ts
+++ b/packages/source-control-bitbucket/src/server/BitbucketApi.ts
@@ -18,8 +18,8 @@ import {
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
import { sanitizeBranchFragment } from "@t3tools/shared/git";
import { isSshRemoteUrl } from "@t3tools/shared/sourceControl";
-import { recognizeRemoteWith } from "@t3tools/source-control-core/client/definition";
-import { definition } from "../client/definition.ts";
+import { recognizeRemoteWith } from "@t3tools/source-control-core/shared/definition";
+import { definition } from "../shared/definition.ts";
import {
BitbucketPullRequestListSchema,
@@ -30,9 +30,9 @@ import {
import { collectUint8StreamText } from "@t3tools/provider-core/server/collectStreamText";
import * as SourceControlProvider from "@t3tools/source-control-core/server/SourceControlProvider";
import * as SourceControlHost from "@t3tools/source-control-core/server/SourceControlHost";
-import { readSourceControlHostSettings } from "@t3tools/source-control-core/client/definition";
+import { readSourceControlHostSettings } from "@t3tools/source-control-core/shared/definition";
-import * as BitbucketClient from "../client/definition.ts";
+import * as BitbucketClient from "../shared/definition.ts";
import * as SourceControlRateLimit from "@t3tools/source-control-core/server/SourceControlRateLimit";
const DEFAULT_API_BASE_URL = "https://api.bitbucket.org/2.0";
diff --git a/packages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.ts b/packages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.ts
index c6ca1d15592..6d625084062 100644
--- a/packages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.ts
+++ b/packages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.ts
@@ -12,7 +12,7 @@ import {
type PullRequestProviderApi,
} from "@t3tools/source-control-core/server/PullRequestProvider";
import type { BitbucketPullRequest } from "./bitbucketPullRequestJson.ts";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
const CAPABILITIES: PullRequestCapabilities = {
diff: true,
diff --git a/packages/source-control-bitbucket/src/server/driver.ts b/packages/source-control-bitbucket/src/server/driver.ts
index fe5eb2b4e35..ca33f7f9d11 100644
--- a/packages/source-control-bitbucket/src/server/driver.ts
+++ b/packages/source-control-bitbucket/src/server/driver.ts
@@ -5,7 +5,7 @@ import {
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
import * as BitbucketApi from "./BitbucketApi.ts";
import * as BitbucketPullRequestApi from "./BitbucketPullRequestApi.ts";
diff --git a/packages/source-control-bitbucket/src/client/definition.test.ts b/packages/source-control-bitbucket/src/shared/definition.test.ts
similarity index 98%
rename from packages/source-control-bitbucket/src/client/definition.test.ts
rename to packages/source-control-bitbucket/src/shared/definition.test.ts
index c28e0dfbac3..c8640b42936 100644
--- a/packages/source-control-bitbucket/src/client/definition.test.ts
+++ b/packages/source-control-bitbucket/src/shared/definition.test.ts
@@ -1,4 +1,4 @@
-import { recognizeRemoteWith } from "@t3tools/source-control-core/client/definition";
+import { recognizeRemoteWith } from "@t3tools/source-control-core/shared/definition";
import { describe, expect, it } from "vite-plus/test";
import { definition } from "./definition.ts";
diff --git a/packages/source-control-bitbucket/src/client/definition.ts b/packages/source-control-bitbucket/src/shared/definition.ts
similarity index 96%
rename from packages/source-control-bitbucket/src/client/definition.ts
rename to packages/source-control-bitbucket/src/shared/definition.ts
index a46038e6d7c..7559ff879b4 100644
--- a/packages/source-control-bitbucket/src/client/definition.ts
+++ b/packages/source-control-bitbucket/src/shared/definition.ts
@@ -7,12 +7,12 @@ import * as Effect from "effect/Effect";
import * as Schema from "effect/Schema";
import {
changeRequestUrlBelow,
- defineSourceControlClient,
+ defineSourceControl,
isChangeRequestInProjectRepository,
isChangeRequestOnProjectHost,
parseChangeRequestPath,
projectChangeRequestHost,
-} from "@t3tools/source-control-core/client/definition";
+} from "@t3tools/source-control-core/shared/definition";
import { icon } from "./icon.ts";
const safeShellArgument = /^[A-Za-z0-9._/@+=,-]+$/;
@@ -63,7 +63,7 @@ export const settings = makeProviderSettingsSchema(
);
export type BitbucketSettings = typeof settings.Type;
-export const definition = defineSourceControlClient({
+export const definition = defineSourceControl({
kind: KIND,
label: "Bitbucket",
pickerLabel: "Bitbucket",
diff --git a/packages/source-control-bitbucket/src/client/icon.ts b/packages/source-control-bitbucket/src/shared/icon.ts
similarity index 97%
rename from packages/source-control-bitbucket/src/client/icon.ts
rename to packages/source-control-bitbucket/src/shared/icon.ts
index 56902ec6148..62014b65a3b 100644
--- a/packages/source-control-bitbucket/src/client/icon.ts
+++ b/packages/source-control-bitbucket/src/shared/icon.ts
@@ -1,4 +1,4 @@
-import type { SourceControlIcon } from "@t3tools/source-control-core/client/definition";
+import type { SourceControlIcon } from "@t3tools/source-control-core/shared/definition";
export const icon: SourceControlIcon = {
viewBox: "8.4 14.39 2481.29 2231.21",
diff --git a/packages/source-control-core/package.json b/packages/source-control-core/package.json
index 4ecd07cc867..7b4e623c775 100644
--- a/packages/source-control-core/package.json
+++ b/packages/source-control-core/package.json
@@ -3,13 +3,13 @@
"private": true,
"type": "module",
"exports": {
- "./client/definition": {
- "types": "./src/client/definition.ts",
- "import": "./src/client/definition.ts"
+ "./shared/definition": {
+ "types": "./src/shared/definition.ts",
+ "import": "./src/shared/definition.ts"
},
- "./client/threadPullRequests": {
- "types": "./src/client/threadPullRequests.ts",
- "import": "./src/client/threadPullRequests.ts"
+ "./shared/threadPullRequests": {
+ "types": "./src/shared/threadPullRequests.ts",
+ "import": "./src/shared/threadPullRequests.ts"
},
"./server/diffFileRevisions": {
"types": "./src/server/diffFileRevisions.ts",
diff --git a/packages/source-control-core/src/server/driver.ts b/packages/source-control-core/src/server/driver.ts
index 9007dad84f0..81d3c035388 100644
--- a/packages/source-control-core/src/server/driver.ts
+++ b/packages/source-control-core/src/server/driver.ts
@@ -6,7 +6,7 @@ import type { HttpClient, HttpClientError, HttpClientResponse } from "effect/htt
import * as Layer from "effect/Layer";
import type * as Scope from "effect/Scope";
-import type { SourceControlClientDefinition } from "../client/definition.ts";
+import type { SourceControlDefinition } from "../shared/definition.ts";
import type { SourceControlProviderDiscoverySpec } from "./discovery.ts";
import type { PullRequestProviderApi } from "./PullRequestProvider.ts";
@@ -49,7 +49,7 @@ export type SourceControlDriverServices =
export interface SourceControlDriver {
readonly kind: SourceControlProviderKind;
- readonly definition: SourceControlClientDefinition;
+ readonly definition: SourceControlDefinition;
/**
* Run once per server, in a scope that lasts as long as the server. State a host shares across
* everything that talks to it, such as GitHub's quota reserve and rate-limit pause, lives in
diff --git a/packages/source-control-core/src/client/definition.ts b/packages/source-control-core/src/shared/definition.ts
similarity index 95%
rename from packages/source-control-core/src/client/definition.ts
rename to packages/source-control-core/src/shared/definition.ts
index c711dd47b6e..e3390d844b0 100644
--- a/packages/source-control-core/src/client/definition.ts
+++ b/packages/source-control-core/src/shared/definition.ts
@@ -194,7 +194,11 @@ export const hostCredentialSettingsFields = {
export const HostCredentialSettings = Schema.Struct(hostCredentialSettingsFields);
export type HostCredentialSettings = typeof HostCredentialSettings.Type;
-export interface SourceControlClientDefinition {
+/**
+ * What the server and every client know about a forge. It is plain data and pure functions so
+ * one copy serves both sides; a lint rule keeps UI runtimes out of `shared/`.
+ */
+export interface SourceControlDefinition {
readonly kind: SourceControlProviderKind;
readonly label: string;
readonly pickerLabel: string;
@@ -348,7 +352,7 @@ export function remoteWebOrigin(host: string, remoteUrl: string | undefined): st
return `https://${host}`;
}
-export function defineSourceControlClient<const Definition extends SourceControlClientDefinition>(
+export function defineSourceControl<const Definition extends SourceControlDefinition>(
definition: Definition,
): Definition {
return definition;
@@ -448,7 +452,7 @@ export function unknownRemoteProvider(remote: GitRemoteHost): SourceControlProvi
/** What `definition` alone makes of a remote, for a host's own code that asks only about itself. */
export function recognizeRemoteWith(
- definition: Pick<SourceControlClientDefinition, "recognizeRemote">,
+ definition: Pick<SourceControlDefinition, "recognizeRemote">,
remoteUrl: string,
): SourceControlProviderInfo | null {
const remote = parseGitRemoteHost(remoteUrl);
@@ -463,7 +467,7 @@ function defaultRepositorySelector(
return identity.owner && identity.name ? `${identity.owner}/${identity.name}` : null;
}
-export const UNKNOWN_SOURCE_CONTROL_CLIENT: SourceControlClientDefinition = {
+export const UNKNOWN_SOURCE_CONTROL_CLIENT: SourceControlDefinition = {
kind: SourceControlProviderKind.make("unknown"),
label: "source control",
pickerLabel: "source control",
@@ -502,27 +506,27 @@ export const UNKNOWN_SOURCE_CONTROL_CLIENT: SourceControlClientDefinition = {
};
export interface ParsedChangeRequest {
- readonly definition: SourceControlClientDefinition;
+ readonly definition: SourceControlDefinition;
readonly link: ParsedChangeRequestUrl;
}
export interface SourceControlMedia extends SourceControlMediaUrl {
- readonly definition: SourceControlClientDefinition;
+ readonly definition: SourceControlDefinition;
}
-export interface SourceControlClientRegistry {
- readonly definitions: ReadonlyArray<SourceControlClientDefinition>;
- readonly get: (kind: string | null | undefined) => SourceControlClientDefinition;
- readonly find: (kind: string) => SourceControlClientDefinition | undefined;
- readonly findByPublicHost: (hostname: string) => SourceControlClientDefinition | undefined;
+export interface SourceControlDefinitionRegistry {
+ readonly definitions: ReadonlyArray<SourceControlDefinition>;
+ readonly get: (kind: string | null | undefined) => SourceControlDefinition;
+ readonly find: (kind: string) => SourceControlDefinition | undefined;
+ readonly findByPublicHost: (hostname: string) => SourceControlDefinition | undefined;
/**
* The host whose `publicHost` is `hostname` or a parent domain of it, such as GitHub for
* `gist.github.com`: which host a link is on, not one T3 can read from.
*/
- readonly findByPublicDomain: (hostname: string) => SourceControlClientDefinition | undefined;
+ readonly findByPublicDomain: (hostname: string) => SourceControlDefinition | undefined;
/** The first host, in registry order, that reads `url` as one of its change requests. */
readonly parseChangeRequestUrl: (url: string) => ParsedChangeRequest | null;
- readonly findByChangeRequestUrl: (url: string) => SourceControlClientDefinition | undefined;
+ readonly findByChangeRequestUrl: (url: string) => SourceControlDefinition | undefined;
readonly hostLabelForChangeRequestUrl: (url: string) => string;
readonly isSameChangeRequest: (left: string, right: string) => boolean;
readonly changeRequestUrlFromReferenceAutolink: (url: string) => string | null;
@@ -535,7 +539,7 @@ export interface SourceControlClientRegistry {
readonly repositoryKeyFromRemote: (remoteUrl: string) => string;
readonly canonicalRepositoryKey: (key: string) => string;
/** The host that has more than one spelling of `key`, if any does. */
- readonly findByRepositoryKey: (key: string) => SourceControlClientDefinition | undefined;
+ readonly findByRepositoryKey: (key: string) => SourceControlDefinition | undefined;
readonly repositorySelector: (
identity: RepositorySelectorIdentity | null | undefined,
) => string | null;
@@ -557,9 +561,9 @@ function httpUrl(value: string): URL | null {
}
function inOrder(
- definitions: ReadonlyArray<SourceControlClientDefinition>,
+ definitions: ReadonlyArray<SourceControlDefinition>,
firstKinds: ReadonlyArray<SourceControlProviderKind> | undefined,
-): ReadonlyArray<SourceControlClientDefinition> {
+): ReadonlyArray<SourceControlDefinition> {
const first = (firstKinds ?? []).flatMap(
(kind) => definitions.find((definition) => definition.kind === kind) ?? [],
);
@@ -574,14 +578,14 @@ function inOrder(
* goes to the first that recognises it, in `recognizeRemotesIn` order and then the rest, because
* one hostname can carry several hosts' labels.
*/
-export function makeSourceControlClientRegistry(
- definitions: ReadonlyArray<SourceControlClientDefinition>,
+export function makeSourceControlDefinitionRegistry(
+ definitions: ReadonlyArray<SourceControlDefinition>,
options?: {
readonly claimChangeRequestUrlsFirst?: ReadonlyArray<SourceControlProviderKind>;
readonly recognizeRemotesIn?: ReadonlyArray<SourceControlProviderKind>;
},
-): SourceControlClientRegistry {
- const byKind = new Map<string, SourceControlClientDefinition>();
+): SourceControlDefinitionRegistry {
+ const byKind = new Map<string, SourceControlDefinition>();
for (const definition of definitions) {
if (byKind.has(definition.kind)) {
throw new Error(`Source control host '${definition.kind}' is defined more than once.`);
diff --git a/packages/source-control-core/src/client/threadPullRequests.ts b/packages/source-control-core/src/shared/threadPullRequests.ts
similarity index 99%
rename from packages/source-control-core/src/client/threadPullRequests.ts
rename to packages/source-control-core/src/shared/threadPullRequests.ts
index 3655f74e608..c92b768669d 100644
--- a/packages/source-control-core/src/client/threadPullRequests.ts
+++ b/packages/source-control-core/src/shared/threadPullRequests.ts
@@ -6,7 +6,7 @@ import type {
} from "@t3tools/contracts";
import { visibleThreadPullRequests } from "@t3tools/shared/threadPullRequests";
-import type { SourceControlClientRegistry } from "./definition.ts";
+import type { SourceControlDefinitionRegistry } from "./definition.ts";
type ThreadPullRequestKeySource = ThreadPullRequestKey & {
readonly authority?: string;
@@ -63,7 +63,7 @@ export type ThreadPullRequestBadge = {
*/
export function makeThreadPullRequests(
registry: Pick<
- SourceControlClientRegistry,
+ SourceControlDefinitionRegistry,
"parseChangeRequestUrl" | "canonicalRepositoryKey" | "findByRepositoryKey"
>,
) {
diff --git a/packages/source-control-forgejo/package.json b/packages/source-control-forgejo/package.json
index ebf1e383c11..f0fe04a5070 100644
--- a/packages/source-control-forgejo/package.json
+++ b/packages/source-control-forgejo/package.json
@@ -3,9 +3,9 @@
"private": true,
"type": "module",
"exports": {
- "./client/definition": {
- "types": "./src/client/definition.ts",
- "import": "./src/client/definition.ts"
+ "./shared/definition": {
+ "types": "./src/shared/definition.ts",
+ "import": "./src/shared/definition.ts"
},
"./server/driver": {
"types": "./src/server/driver.ts",
diff --git a/packages/source-control-forgejo/src/server/ForgejoPullRequestProvider.ts b/packages/source-control-forgejo/src/server/ForgejoPullRequestProvider.ts
index 30ea7faedb2..8403e672503 100644
--- a/packages/source-control-forgejo/src/server/ForgejoPullRequestProvider.ts
+++ b/packages/source-control-forgejo/src/server/ForgejoPullRequestProvider.ts
@@ -34,7 +34,7 @@ import {
forgejoReactions,
} from "./forgejoPullRequestJson.ts";
import { ForgejoBranchStatusChecks, markRequiredForgejoChecks } from "./forgejoRequiredChecks.ts";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
const isForgejoCliError = Schema.is(ForgejoCli.ForgejoCliError);
diff --git a/packages/source-control-forgejo/src/server/driver.ts b/packages/source-control-forgejo/src/server/driver.ts
index 129e2fae2c4..b935b35eb73 100644
--- a/packages/source-control-forgejo/src/server/driver.ts
+++ b/packages/source-control-forgejo/src/server/driver.ts
@@ -4,7 +4,7 @@ import {
} from "@t3tools/source-control-core/server/driver";
import * as Effect from "effect/Effect";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
import * as ForgejoCli from "./ForgejoCli.ts";
import * as ForgejoPullRequestProvider from "./ForgejoPullRequestProvider.ts";
diff --git a/packages/source-control-forgejo/src/client/definition.test.ts b/packages/source-control-forgejo/src/shared/definition.test.ts
similarity index 98%
rename from packages/source-control-forgejo/src/client/definition.test.ts
rename to packages/source-control-forgejo/src/shared/definition.test.ts
index f2d31320212..19628b44d3c 100644
--- a/packages/source-control-forgejo/src/client/definition.test.ts
+++ b/packages/source-control-forgejo/src/shared/definition.test.ts
@@ -1,5 +1,5 @@
-import type { ChangeRequestProjectIdentity } from "@t3tools/source-control-core/client/definition";
-import { recognizeRemoteWith } from "@t3tools/source-control-core/client/definition";
+import type { ChangeRequestProjectIdentity } from "@t3tools/source-control-core/shared/definition";
+import { recognizeRemoteWith } from "@t3tools/source-control-core/shared/definition";
import { describe, expect, it } from "vite-plus/test";
import { definition } from "./definition.ts";
diff --git a/packages/source-control-forgejo/src/client/definition.ts b/packages/source-control-forgejo/src/shared/definition.ts
similarity index 97%
rename from packages/source-control-forgejo/src/client/definition.ts
rename to packages/source-control-forgejo/src/shared/definition.ts
index 19be7e4d757..8be55644ef9 100644
--- a/packages/source-control-forgejo/src/client/definition.ts
+++ b/packages/source-control-forgejo/src/shared/definition.ts
@@ -3,14 +3,14 @@ import {
changeRequestUrlBelow,
type ChangeRequestHostIdentity,
type ChangeRequestProjectIdentity,
- defineSourceControlClient,
+ defineSourceControl,
isChangeRequestAuthorityOfProject,
isChangeRequestInProjectRepository,
isChangeRequestOnProjectHost,
parseChangeRequestPath,
projectChangeRequestHost,
remoteWebOrigin,
-} from "@t3tools/source-control-core/client/definition";
+} from "@t3tools/source-control-core/shared/definition";
import { icon } from "./icon.ts";
const CHECKOUT_COMMAND = /^tea\s+(?:pr|pulls)\s+checkout\s+(.+)$/i;
@@ -51,7 +51,7 @@ function changeRequestHost(identity: ChangeRequestHostIdentity): string {
return projectChangeRequestHost(identity, KIND);
}
-export const definition = defineSourceControlClient({
+export const definition = defineSourceControl({
kind: KIND,
label: "Forgejo",
pickerLabel: "Forgejo / Gitea",
diff --git a/packages/source-control-forgejo/src/client/icon.ts b/packages/source-control-forgejo/src/shared/icon.ts
similarity index 96%
rename from packages/source-control-forgejo/src/client/icon.ts
rename to packages/source-control-forgejo/src/shared/icon.ts
index 61c5ee88ba7..d3dded4d15d 100644
--- a/packages/source-control-forgejo/src/client/icon.ts
+++ b/packages/source-control-forgejo/src/shared/icon.ts
@@ -1,4 +1,4 @@
-import type { SourceControlIcon } from "@t3tools/source-control-core/client/definition";
+import type { SourceControlIcon } from "@t3tools/source-control-core/shared/definition";
// The view box starts at -6 to move the mark 6 units in, as the published artwork's group does.
export const icon: SourceControlIcon = {
diff --git a/packages/source-control-gitcafe/package.json b/packages/source-control-gitcafe/package.json
index 79f39dbb1f6..41621778c95 100644
--- a/packages/source-control-gitcafe/package.json
+++ b/packages/source-control-gitcafe/package.json
@@ -3,9 +3,9 @@
"private": true,
"type": "module",
"exports": {
- "./client/definition": {
- "types": "./src/client/definition.ts",
- "import": "./src/client/definition.ts"
+ "./shared/definition": {
+ "types": "./src/shared/definition.ts",
+ "import": "./src/shared/definition.ts"
},
"./server/driver": {
"types": "./src/server/driver.ts",
diff --git a/packages/source-control-gitcafe/src/server/GitCafeCredentials.ts b/packages/source-control-gitcafe/src/server/GitCafeCredentials.ts
index c8fe6856cd5..5cfcd9d8b8f 100644
--- a/packages/source-control-gitcafe/src/server/GitCafeCredentials.ts
+++ b/packages/source-control-gitcafe/src/server/GitCafeCredentials.ts
@@ -10,9 +10,9 @@ import * as Redacted from "effect/Redacted";
import * as Schema from "effect/Schema";
import * as HostProcess from "@t3tools/shared/HostProcess";
import * as SourceControlHost from "@t3tools/source-control-core/server/SourceControlHost";
-import { readSourceControlHostSettings } from "@t3tools/source-control-core/client/definition";
+import { readSourceControlHostSettings } from "@t3tools/source-control-core/shared/definition";
-import * as GitCafeClient from "../client/definition.ts";
+import * as GitCafeClient from "../shared/definition.ts";
const TOKEN_TTL = Duration.minutes(5);
const MISSING_TTL = Duration.seconds(10);
diff --git a/packages/source-control-gitcafe/src/server/GitCafePullRequestProvider.ts b/packages/source-control-gitcafe/src/server/GitCafePullRequestProvider.ts
index 88cd6294b17..04bf4c4b595 100644
--- a/packages/source-control-gitcafe/src/server/GitCafePullRequestProvider.ts
+++ b/packages/source-control-gitcafe/src/server/GitCafePullRequestProvider.ts
@@ -20,7 +20,7 @@ import {
import * as GitCafeApi from "./GitCafeApi.ts";
import * as GitCafeHosts from "./gitCafeHosts.ts";
import * as Json from "./gitCafePullRequestJson.ts";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
const CAPABILITIES: PullRequestCapabilities = {
diff: true,
diff --git a/packages/source-control-gitcafe/src/server/driver.ts b/packages/source-control-gitcafe/src/server/driver.ts
index 10e0d59b0fc..830ce04f6c0 100644
--- a/packages/source-control-gitcafe/src/server/driver.ts
+++ b/packages/source-control-gitcafe/src/server/driver.ts
@@ -5,7 +5,7 @@ import {
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
import * as GitCafeApi from "./GitCafeApi.ts";
import * as GitCafeCredentials from "./GitCafeCredentials.ts";
diff --git a/packages/source-control-gitcafe/src/client/definition.test.ts b/packages/source-control-gitcafe/src/shared/definition.test.ts
similarity index 99%
rename from packages/source-control-gitcafe/src/client/definition.test.ts
rename to packages/source-control-gitcafe/src/shared/definition.test.ts
index 9c491417150..5e99537fd96 100644
--- a/packages/source-control-gitcafe/src/client/definition.test.ts
+++ b/packages/source-control-gitcafe/src/shared/definition.test.ts
@@ -1,4 +1,4 @@
-import { recognizeRemoteWith } from "@t3tools/source-control-core/client/definition";
+import { recognizeRemoteWith } from "@t3tools/source-control-core/shared/definition";
import { describe, expect, it } from "vite-plus/test";
import { definition } from "./definition.ts";
diff --git a/packages/source-control-gitcafe/src/client/definition.ts b/packages/source-control-gitcafe/src/shared/definition.ts
similarity index 95%
rename from packages/source-control-gitcafe/src/client/definition.ts
rename to packages/source-control-gitcafe/src/shared/definition.ts
index dc0d5e4ba04..7984dced627 100644
--- a/packages/source-control-gitcafe/src/client/definition.ts
+++ b/packages/source-control-gitcafe/src/shared/definition.ts
@@ -8,12 +8,12 @@ import * as Effect from "effect/Effect";
import * as Schema from "effect/Schema";
import {
changeRequestUrlBelow,
- defineSourceControlClient,
+ defineSourceControl,
isChangeRequestInProjectRepository,
isChangeRequestOnProjectHost,
parseChangeRequestPath,
projectChangeRequestHost,
-} from "@t3tools/source-control-core/client/definition";
+} from "@t3tools/source-control-core/shared/definition";
import { icon } from "./icon.ts";
/** GitCafe has no self-hosted installs: production and staging are its only hosts. */
@@ -38,7 +38,7 @@ export const settings = makeProviderSettingsSchema({
});
export type GitCafeSettings = typeof settings.Type;
-export const definition = defineSourceControlClient({
+export const definition = defineSourceControl({
kind: KIND,
label: "GitCafe",
pickerLabel: "GitCafe",
diff --git a/packages/source-control-gitcafe/src/client/icon.ts b/packages/source-control-gitcafe/src/shared/icon.ts
similarity index 88%
rename from packages/source-control-gitcafe/src/client/icon.ts
rename to packages/source-control-gitcafe/src/shared/icon.ts
index 97f38fbf41e..37d7ad7dbb2 100644
--- a/packages/source-control-gitcafe/src/client/icon.ts
+++ b/packages/source-control-gitcafe/src/shared/icon.ts
@@ -1,4 +1,4 @@
-import type { SourceControlIcon } from "@t3tools/source-control-core/client/definition";
+import type { SourceControlIcon } from "@t3tools/source-control-core/shared/definition";
export const icon: SourceControlIcon = {
viewBox: "0 0 64 64",
diff --git a/packages/source-control-github/package.json b/packages/source-control-github/package.json
index 348d512b9ba..b1db9926f8c 100644
--- a/packages/source-control-github/package.json
+++ b/packages/source-control-github/package.json
@@ -3,9 +3,9 @@
"private": true,
"type": "module",
"exports": {
- "./client/definition": {
- "types": "./src/client/definition.ts",
- "import": "./src/client/definition.ts"
+ "./shared/definition": {
+ "types": "./src/shared/definition.ts",
+ "import": "./src/shared/definition.ts"
},
"./server/driver": {
"types": "./src/server/driver.ts",
diff --git a/packages/source-control-github/src/server/GitHubCredentials.ts b/packages/source-control-github/src/server/GitHubCredentials.ts
index 58aed003e3b..cf124eac2cf 100644
--- a/packages/source-control-github/src/server/GitHubCredentials.ts
+++ b/packages/source-control-github/src/server/GitHubCredentials.ts
@@ -14,10 +14,10 @@ import * as Schema from "effect/Schema";
import * as HostProcess from "@t3tools/shared/HostProcess";
import * as SourceControlHost from "@t3tools/source-control-core/server/SourceControlHost";
-import { readSourceControlHostSettings } from "@t3tools/source-control-core/client/definition";
+import { readSourceControlHostSettings } from "@t3tools/source-control-core/shared/definition";
import type { ServerSettings } from "@t3tools/contracts";
-import * as GitHubClient from "../client/definition.ts";
+import * as GitHubClient from "../shared/definition.ts";
/**
* Every gh run on the server shares this. A burst of them (a status poll across many checkouts)
diff --git a/packages/source-control-github/src/server/GitHubPullRequestProvider.ts b/packages/source-control-github/src/server/GitHubPullRequestProvider.ts
index 18d16de6a53..fa660d77af4 100644
--- a/packages/source-control-github/src/server/GitHubPullRequestProvider.ts
+++ b/packages/source-control-github/src/server/GitHubPullRequestProvider.ts
@@ -24,7 +24,7 @@ import type {
GitHubViewerAccess,
GitHubWorkflowRunApproval,
} from "./gitHubPullRequestJson.ts";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
const CAPABILITIES: PullRequestCapabilities = {
diff: true,
diff --git a/packages/source-control-github/src/server/GitHubSourceControlProvider.ts b/packages/source-control-github/src/server/GitHubSourceControlProvider.ts
index 22bbf99f2ab..55c9d78dcb1 100644
--- a/packages/source-control-github/src/server/GitHubSourceControlProvider.ts
+++ b/packages/source-control-github/src/server/GitHubSourceControlProvider.ts
@@ -61,9 +61,9 @@ import {
type SourceControlManagedCliDiscoverySpec,
} from "@t3tools/source-control-core/server/discovery";
import * as SourceControlHost from "@t3tools/source-control-core/server/SourceControlHost";
-import { readSourceControlHostSettings } from "@t3tools/source-control-core/client/definition";
+import { readSourceControlHostSettings } from "@t3tools/source-control-core/shared/definition";
-import * as GitHubClient from "../client/definition.ts";
+import * as GitHubClient from "../shared/definition.ts";
import {
PullRequestByNumber,
PullRequestNode,
diff --git a/packages/source-control-github/src/server/driver.ts b/packages/source-control-github/src/server/driver.ts
index 79a5ed896b8..a767cbbef85 100644
--- a/packages/source-control-github/src/server/driver.ts
+++ b/packages/source-control-github/src/server/driver.ts
@@ -5,7 +5,7 @@ import {
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
import * as GitHubMediaFetch from "./gitHubMediaFetch.ts";
import * as GitHubPullRequestApi from "./GitHubPullRequestApi.ts";
diff --git a/packages/source-control-github/src/server/gitHubAuthStatus.ts b/packages/source-control-github/src/server/gitHubAuthStatus.ts
index 2319e04cc5d..2766d305a01 100644
--- a/packages/source-control-github/src/server/gitHubAuthStatus.ts
+++ b/packages/source-control-github/src/server/gitHubAuthStatus.ts
@@ -1,4 +1,4 @@
-import type { GitHubSettings } from "../client/definition.ts";
+import type { GitHubSettings } from "../shared/definition.ts";
import * as Option from "effect/Option";
import * as Schema from "effect/Schema";
diff --git a/packages/source-control-github/src/server/gitHubMediaFetch.ts b/packages/source-control-github/src/server/gitHubMediaFetch.ts
index a360f873ae1..4dfb2a23e63 100644
--- a/packages/source-control-github/src/server/gitHubMediaFetch.ts
+++ b/packages/source-control-github/src/server/gitHubMediaFetch.ts
@@ -8,7 +8,7 @@ import {
type HttpClientResponse,
} from "effect/http";
-import { GITHUB_CREDENTIALED_MEDIA_HOSTS } from "../client/gitHubMedia.ts";
+import { GITHUB_CREDENTIALED_MEDIA_HOSTS } from "../shared/gitHubMedia.ts";
import * as GitHubCredentials from "./GitHubCredentials.ts";
diff --git a/packages/source-control-github/src/server/gitHubRepositoryResolution.ts b/packages/source-control-github/src/server/gitHubRepositoryResolution.ts
index ddf57a42c33..ab0d5975d84 100644
--- a/packages/source-control-github/src/server/gitHubRepositoryResolution.ts
+++ b/packages/source-control-github/src/server/gitHubRepositoryResolution.ts
@@ -1,7 +1,7 @@
import { normalizeGitRemoteUrl } from "@t3tools/shared/git";
import { isSshRemoteUrl } from "@t3tools/shared/sourceControl";
-import { parseGitRemoteHost } from "@t3tools/source-control-core/client/definition";
-import { definition } from "../client/definition.ts";
+import { parseGitRemoteHost } from "@t3tools/source-control-core/shared/definition";
+import { definition } from "../shared/definition.ts";
export interface GitHubRepositoryLocator {
readonly host: string;
diff --git a/packages/source-control-github/src/client/definition.test.ts b/packages/source-control-github/src/shared/definition.test.ts
similarity index 99%
rename from packages/source-control-github/src/client/definition.test.ts
rename to packages/source-control-github/src/shared/definition.test.ts
index 30fcf7ccc17..3aadd4697b6 100644
--- a/packages/source-control-github/src/client/definition.test.ts
+++ b/packages/source-control-github/src/shared/definition.test.ts
@@ -1,4 +1,4 @@
-import { recognizeRemoteWith } from "@t3tools/source-control-core/client/definition";
+import { recognizeRemoteWith } from "@t3tools/source-control-core/shared/definition";
import { describe, expect, it } from "vite-plus/test";
import { definition } from "./definition.ts";
diff --git a/packages/source-control-github/src/client/definition.ts b/packages/source-control-github/src/shared/definition.ts
similarity index 97%
rename from packages/source-control-github/src/client/definition.ts
rename to packages/source-control-github/src/shared/definition.ts
index e83e60bd25f..5d93895315e 100644
--- a/packages/source-control-github/src/client/definition.ts
+++ b/packages/source-control-github/src/shared/definition.ts
@@ -1,14 +1,14 @@
import { makeProviderSettingsSchema, SourceControlProviderKind } from "@t3tools/contracts";
import {
changeRequestUrlBelow,
- defineSourceControlClient,
+ defineSourceControl,
hostCredentialSettingsFields,
isChangeRequestInProjectRepository,
isChangeRequestOnProjectHost,
parseChangeRequestPath,
projectChangeRequestHost,
remoteWebOrigin,
-} from "@t3tools/source-control-core/client/definition";
+} from "@t3tools/source-control-core/shared/definition";
import { gitHubMediaUrl } from "./gitHubMedia.ts";
import { icon } from "./icon.ts";
@@ -45,7 +45,7 @@ function isRepositoryPath(repository: string): boolean {
export const settings = makeProviderSettingsSchema(hostCredentialSettingsFields);
export type GitHubSettings = typeof settings.Type;
-export const definition = defineSourceControlClient({
+export const definition = defineSourceControl({
kind: KIND,
label: "GitHub",
pickerLabel: "GitHub",
diff --git a/packages/source-control-github/src/client/gitHubMedia.ts b/packages/source-control-github/src/shared/gitHubMedia.ts
similarity index 98%
rename from packages/source-control-github/src/client/gitHubMedia.ts
rename to packages/source-control-github/src/shared/gitHubMedia.ts
index 51b9e0598fa..0bcc126fd7c 100644
--- a/packages/source-control-github/src/client/gitHubMedia.ts
+++ b/packages/source-control-github/src/shared/gitHubMedia.ts
@@ -1,4 +1,4 @@
-import type { SourceControlMediaUrl } from "@t3tools/source-control-core/client/definition";
+import type { SourceControlMediaUrl } from "@t3tools/source-control-core/shared/definition";
/**
* Only hosts where a credential is what decides the answer belong here. `objects.githubusercontent.com`
diff --git a/packages/source-control-github/src/client/icon.ts b/packages/source-control-github/src/shared/icon.ts
similarity index 97%
rename from packages/source-control-github/src/client/icon.ts
rename to packages/source-control-github/src/shared/icon.ts
index 45ee6149f12..fc67d0ba2c3 100644
--- a/packages/source-control-github/src/client/icon.ts
+++ b/packages/source-control-github/src/shared/icon.ts
@@ -1,4 +1,4 @@
-import type { SourceControlIcon } from "@t3tools/source-control-core/client/definition";
+import type { SourceControlIcon } from "@t3tools/source-control-core/shared/definition";
export const icon: SourceControlIcon = {
viewBox: "0 0 16 16",
diff --git a/packages/source-control-github/src/client/referenceAutolinks.test.ts b/packages/source-control-github/src/shared/referenceAutolinks.test.ts
similarity index 100%
rename from packages/source-control-github/src/client/referenceAutolinks.test.ts
rename to packages/source-control-github/src/shared/referenceAutolinks.test.ts
diff --git a/packages/source-control-github/src/client/referenceAutolinks.ts b/packages/source-control-github/src/shared/referenceAutolinks.ts
similarity index 98%
rename from packages/source-control-github/src/client/referenceAutolinks.ts
rename to packages/source-control-github/src/shared/referenceAutolinks.ts
index 93f7a5514e4..ebf31d86e17 100644
--- a/packages/source-control-github/src/client/referenceAutolinks.ts
+++ b/packages/source-control-github/src/shared/referenceAutolinks.ts
@@ -1,4 +1,4 @@
-import type { ReferenceAutolink } from "@t3tools/source-control-core/client/definition";
+import type { ReferenceAutolink } from "@t3tools/source-control-core/shared/definition";
// GitHub's autolinked references: `#12`, `repo#12` and `owner/repo#12`; a SHA of 7 to 40
// characters, optionally `repo@` or `owner/repo@` qualified; `@user` and `@org/team`.
diff --git a/packages/source-control-gitlab/package.json b/packages/source-control-gitlab/package.json
index 84ac8e17832..a4f9ca6c6d2 100644
--- a/packages/source-control-gitlab/package.json
+++ b/packages/source-control-gitlab/package.json
@@ -3,9 +3,9 @@
"private": true,
"type": "module",
"exports": {
- "./client/definition": {
- "types": "./src/client/definition.ts",
- "import": "./src/client/definition.ts"
+ "./shared/definition": {
+ "types": "./src/shared/definition.ts",
+ "import": "./src/shared/definition.ts"
},
"./server/driver": {
"types": "./src/server/driver.ts",
diff --git a/packages/source-control-gitlab/src/server/GitLabPullRequestProvider.ts b/packages/source-control-gitlab/src/server/GitLabPullRequestProvider.ts
index 987834a5e61..424295c48fa 100644
--- a/packages/source-control-gitlab/src/server/GitLabPullRequestProvider.ts
+++ b/packages/source-control-gitlab/src/server/GitLabPullRequestProvider.ts
@@ -14,7 +14,7 @@ import {
type ProviderChangeRequestDetail,
type PullRequestProviderApi,
} from "@t3tools/source-control-core/server/PullRequestProvider";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
const CAPABILITIES: PullRequestCapabilities = {
diff: true,
diff --git a/packages/source-control-gitlab/src/server/GitLabSourceControlProvider.test.ts b/packages/source-control-gitlab/src/server/GitLabSourceControlProvider.test.ts
index 37d5566ebea..6ef52973ffe 100644
--- a/packages/source-control-gitlab/src/server/GitLabSourceControlProvider.test.ts
+++ b/packages/source-control-gitlab/src/server/GitLabSourceControlProvider.test.ts
@@ -12,7 +12,7 @@ import * as TestSourceControlHost from "@t3tools/source-control-testing/TestSour
import * as GitLabCli from "./GitLabCli.ts";
import { parseGitLabAuthStatusHosts } from "./gitLabAuthStatus.ts";
import * as GitLabSourceControlProvider from "./GitLabSourceControlProvider.ts";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
function makeProvider(gitlab: Partial<GitLabCli.GitLabCli["Service"]>) {
return GitLabSourceControlProvider.make.pipe(
diff --git a/packages/source-control-gitlab/src/server/GitLabSourceControlProvider.ts b/packages/source-control-gitlab/src/server/GitLabSourceControlProvider.ts
index d8404c6dbb7..81cf7ec477c 100644
--- a/packages/source-control-gitlab/src/server/GitLabSourceControlProvider.ts
+++ b/packages/source-control-gitlab/src/server/GitLabSourceControlProvider.ts
@@ -6,7 +6,7 @@ import { SourceControlProviderError, type ChangeRequest } from "@t3tools/contrac
import {
parseGitRemoteHost,
unknownRemoteProvider as unknownHostProvider,
-} from "@t3tools/source-control-core/client/definition";
+} from "@t3tools/source-control-core/shared/definition";
import * as GitLabCli from "./GitLabCli.ts";
import * as GitLabChangeRequestTemplate from "./gitLabChangeRequestTemplate.ts";
diff --git a/packages/source-control-gitlab/src/server/driver.ts b/packages/source-control-gitlab/src/server/driver.ts
index 087b42eda53..1773bfd4bda 100644
--- a/packages/source-control-gitlab/src/server/driver.ts
+++ b/packages/source-control-gitlab/src/server/driver.ts
@@ -5,7 +5,7 @@ import {
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
-import { definition } from "../client/definition.ts";
+import { definition } from "../shared/definition.ts";
import * as GitLabCli from "./GitLabCli.ts";
import * as GitLabPullRequestCli from "./GitLabPullRequestCli.ts";
diff --git a/packages/source-control-gitlab/src/server/gitLabDiscovery.test.ts b/packages/source-control-gitlab/src/server/gitLabDiscovery.test.ts
index b7375a6b0f0..a30f676c9c9 100644
--- a/packages/source-control-gitlab/src/server/gitLabDiscovery.test.ts
+++ b/packages/source-control-gitlab/src/server/gitLabDiscovery.test.ts
@@ -1,7 +1,7 @@
import {
parseGitRemoteHost,
unknownRemoteProvider,
-} from "@t3tools/source-control-core/client/definition";
+} from "@t3tools/source-control-core/shared/definition";
import { refineUnknownRemoteProvider } from "@t3tools/source-control-core/server/discovery";
import { processOutput } from "@t3tools/source-control-testing/TestSourceControlHost";
import { assert, it } from "@effect/vitest";
diff --git a/packages/source-control-gitlab/src/client/definition.test.ts b/packages/source-control-gitlab/src/shared/definition.test.ts
similarity index 99%
rename from packages/source-control-gitlab/src/client/definition.test.ts
rename to packages/source-control-gitlab/src/shared/definition.test.ts
index 02514ee373d..a05ee047384 100644
--- a/packages/source-control-gitlab/src/client/definition.test.ts
+++ b/packages/source-control-gitlab/src/shared/definition.test.ts
@@ -1,4 +1,4 @@
-import { recognizeRemoteWith } from "@t3tools/source-control-core/client/definition";
+import { recognizeRemoteWith } from "@t3tools/source-control-core/shared/definition";
import { describe, expect, it } from "vite-plus/test";
import { definition } from "./definition.ts";
diff --git a/packages/source-control-gitlab/src/client/definition.ts b/packages/source-control-gitlab/src/shared/definition.ts
similarity index 95%
rename from packages/source-control-gitlab/src/client/definition.ts
rename to packages/source-control-gitlab/src/shared/definition.ts
index a99cabd21e4..14ef165f03b 100644
--- a/packages/source-control-gitlab/src/client/definition.ts
+++ b/packages/source-control-gitlab/src/shared/definition.ts
@@ -1,12 +1,12 @@
import { SourceControlProviderKind } from "@t3tools/contracts";
import {
changeRequestUrlBelow,
- defineSourceControlClient,
+ defineSourceControl,
isChangeRequestInProjectRepository,
isChangeRequestOnProjectHost,
parseChangeRequestPath,
projectChangeRequestHost,
-} from "@t3tools/source-control-core/client/definition";
+} from "@t3tools/source-control-core/shared/definition";
import { icon } from "./icon.ts";
const CHECKOUT_COMMAND = /^glab\s+mr\s+checkout\s+(.+)$/i;
@@ -18,7 +18,7 @@ const CHANGE_REQUEST_PATH = /^\/([^/]+(?:\/[^/]+)+)\/-\/merge_requests\/(\d+)(?:
const KIND = SourceControlProviderKind.make("gitlab");
-export const definition = defineSourceControlClient({
+export const definition = defineSourceControl({
kind: KIND,
label: "GitLab",
pickerLabel: "GitLab",
diff --git a/packages/source-control-gitlab/src/client/icon.ts b/packages/source-control-gitlab/src/shared/icon.ts
similarity index 97%
rename from packages/source-control-gitlab/src/client/icon.ts
rename to packages/source-control-gitlab/src/shared/icon.ts
index b825fac2198..359cdeefb22 100644
--- a/packages/source-control-gitlab/src/client/icon.ts
+++ b/packages/source-control-gitlab/src/shared/icon.ts
@@ -1,4 +1,4 @@
-import type { SourceControlIcon } from "@t3tools/source-control-core/client/definition";
+import type { SourceControlIcon } from "@t3tools/source-control-core/shared/definition";
export const icon: SourceControlIcon = {
viewBox: "0 0 32 32",
diff --git a/vite.config.ts b/vite.config.ts
index 92da9f57481..8e356ed1eab 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -354,6 +354,66 @@ export default defineConfig({
files: ["apps/web/src/components/pullRequest/pullRequestIcons.tsx"],
rules: { "eslint/no-restricted-imports": ["error", { paths: RESTRICTED_IMPORT_PATHS }] },
},
+ {
+ // The server and every client load a forge's shared definition, so a UI runtime
+ // imported there would break the server; client-only forge code goes in `src/client/`.
+ files: ["packages/source-control-*/src/shared/**"],
+ rules: {
+ "eslint/no-restricted-imports": [
+ "error",
+ {
+ paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS],
+ patterns: [
+ {
+ group: [
+ "react",
+ "react/*",
+ "react-*",
+ "expo",
+ "expo-*",
+ "lucide-react",
+ "@t3tools/client-runtime",
+ "@t3tools/client-runtime/*",
+ "../client/*",
+ "../server/*",
+ "../../client/*",
+ "../../server/*",
+ "../../../client/*",
+ "../../../server/*",
+ "@t3tools/source-control-*/client/*",
+ "@t3tools/source-control-*/server/*",
+ ],
+ message:
+ "Shared forge definitions load on the server and every client; keep UI and server code out.",
+ },
+ ],
+ },
+ ],
+ },
+ },
+ {
+ files: ["apps/server/src/**", "packages/source-control-*/src/server/**"],
+ rules: {
+ "eslint/no-restricted-imports": [
+ "error",
+ {
+ paths: [...RESTRICTED_IMPORT_PATHS, RESTRICTED_PULL_REQUEST_GLYPH_IMPORTS],
+ patterns: [
+ {
+ group: [
+ "@t3tools/source-control-*/client/*",
+ "../client/*",
+ "../../client/*",
+ "../../../client/*",
+ ],
+ message:
+ "A forge's client entry is UI-only; the server reads its `shared/definition`.",
+ },
+ ],
+ },
+ ],
+ },
+ },
{
files: ["apps/mobile/src/**"],
rules: { "t3code/no-mobile-uniwind-theme-escape-hatches": "error" },