feat(plugin): add vcs backend registration api
This commit is contained in:
parent
38502f7268
commit
66878b4c53
12 changed files with 309 additions and 8 deletions
33
packages/plugin/src/v2/effect/vcs.ts
Normal file
33
packages/plugin/src/v2/effect/vcs.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
export * as Vcs from "./vcs.js"
|
||||
|
||||
import { FileDiff } from "@opencode-ai/schema/file-diff"
|
||||
import { FileStatus, Mode } from "@opencode-ai/schema/vcs"
|
||||
import { Schema, type Effect, type Scope } from "effect"
|
||||
|
||||
export class RegistrationError extends Schema.TaggedErrorClass<RegistrationError>()("Vcs.RegistrationError", {
|
||||
type: Schema.String,
|
||||
message: Schema.String,
|
||||
}) {}
|
||||
|
||||
export interface AdapterScope {
|
||||
readonly directory: string
|
||||
readonly worktree: string
|
||||
readonly store: string
|
||||
}
|
||||
|
||||
export interface Adapter {
|
||||
readonly status: () => Effect.Effect<readonly FileStatus[]>
|
||||
readonly diff: (
|
||||
mode: Mode,
|
||||
options?: { readonly context?: number },
|
||||
) => Effect.Effect<readonly FileDiff.Info[]>
|
||||
}
|
||||
|
||||
export interface Backend {
|
||||
readonly type: string
|
||||
readonly make: (scope: AdapterScope) => Adapter
|
||||
}
|
||||
|
||||
export interface VcsDomain {
|
||||
readonly register: (backend: Backend) => Effect.Effect<void, RegistrationError, Scope.Scope>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue