History

Add pluggable source control routing

- Route git workflows through source control providers - Replace git status broadcaster with VCS status service - Update orchestration, server, and web contracts for provider-aware git

Julius Marminge committed 6 months ago

Commit 38185dc1 parent 87c2e3e40 files · +1648 −686Browse files

Showing the changes to apps/server/src/sourceControl/SourceControlProvider.ts (1 of 40 files). Show all

Unified · Split

apps/server/src/sourceControl/SourceControlProvider.ts+46−0
@@ -0,0 +1,46 @@
1+import { Context, Effect } from "effect";
2+import type {
3+ ChangeRequest,
4+ ChangeRequestState,
5+ SourceControlProviderError,
6+ SourceControlProviderKind,
7+ SourceControlRepositoryCloneUrls,
8+} from "@t3tools/contracts";
9+
10+export interface SourceControlProviderShape {
11+ readonly kind: SourceControlProviderKind;
12+ readonly listChangeRequests: (input: {
13+ readonly cwd: string;
14+ readonly headSelector: string;
15+ readonly state: ChangeRequestState | "all";
16+ readonly limit?: number;
17+ }) => Effect.Effect<ReadonlyArray<ChangeRequest>, SourceControlProviderError>;
18+ readonly getChangeRequest: (input: {
19+ readonly cwd: string;
20+ readonly reference: string;
21+ }) => Effect.Effect<ChangeRequest, SourceControlProviderError>;
22+ readonly createChangeRequest: (input: {
23+ readonly cwd: string;
24+ readonly baseRefName: string;
25+ readonly headSelector: string;
26+ readonly title: string;
27+ readonly bodyFile: string;
28+ }) => Effect.Effect<void, SourceControlProviderError>;
29+ readonly getRepositoryCloneUrls: (input: {
30+ readonly cwd: string;
31+ readonly repository: string;
32+ }) => Effect.Effect<SourceControlRepositoryCloneUrls, SourceControlProviderError>;
33+ readonly getDefaultBranch: (input: {
34+ readonly cwd: string;
35+ }) => Effect.Effect<string | null, SourceControlProviderError>;
36+ readonly checkoutChangeRequest: (input: {
37+ readonly cwd: string;
38+ readonly reference: string;
39+ readonly force?: boolean;
40+ }) => Effect.Effect<void, SourceControlProviderError>;
41+}
42+
43+export class SourceControlProvider extends Context.Service<
44+ SourceControlProvider,
45+ SourceControlProviderShape
46+>()("t3/source-control/SourceControlProvider") {}