Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

VcsDriver.ts

31 lines1.2 KB

1import { Context, type Effect } from "effect";
2​
3import type {
4 VcsDriverCapabilities,
5 VcsError,
6 VcsInitInput,
7 VcsListRemotesResult,
8 VcsListWorkspaceFilesResult,
9 VcsRepositoryIdentity,
10} from "@t3tools/contracts";
11import * as VcsProcess from "./VcsProcess.ts";
12​
13export interface VcsDriverShape {
14 readonly capabilities: VcsDriverCapabilities;
15 readonly execute: (
16 input: Omit<VcsProcess.VcsProcessInput, "command">,
17 ) => Effect.Effect<VcsProcess.VcsProcessOutput, VcsError>;
18 readonly detectRepository: (cwd: string) => Effect.Effect<VcsRepositoryIdentity | null, VcsError>;
19 readonly isInsideWorkTree: (cwd: string) => Effect.Effect<boolean, VcsError>;
20 readonly listWorkspaceFiles: (
21 cwd: string,
22 ) => Effect.Effect<VcsListWorkspaceFilesResult, VcsError>;
23 readonly listRemotes: (cwd: string) => Effect.Effect<VcsListRemotesResult, VcsError>;
24 readonly filterIgnoredPaths: (
25 cwd: string,
26 relativePaths: ReadonlyArray<string>,
27 ) => Effect.Effect<ReadonlyArray<string>, VcsError>;
28 readonly initRepository: (input: VcsInitInput) => Effect.Effect<void, VcsError>;
30​
31export class VcsDriver extends Context.Service<VcsDriver, VcsDriverShape>()("t3/vcs/VcsDriver") {}