opencode/packages/plugin/src/effect/vcs.ts
2026-08-25 19:37:06 +05:30

45 lines
1.3 KiB
TypeScript

import type { VcsApi } from "@opencode-ai/client/effect/api"
import type { FileDiff } from "@opencode-ai/schema/file-diff"
import type { Vcs } from "@opencode-ai/schema/vcs"
import type { Effect } from "effect"
import type { Transform } from "./registration.js"
export interface VcsScope {
readonly directory: string
readonly worktree: string
readonly canonical: string
readonly store?: string
}
export interface VcsBranchesInput extends VcsScope {
readonly search?: string
readonly limit?: number
}
export interface VcsDiffInput extends VcsScope {
readonly mode: Vcs.Mode
readonly context: number
readonly maxOutputBytes: number
}
export interface VcsDefinition {
readonly id: string
readonly name: string
readonly info: (input: VcsScope) => Effect.Effect<Vcs.Info, unknown>
readonly branches: (input: VcsBranchesInput) => Effect.Effect<Vcs.BranchList, unknown>
readonly status: (input: VcsScope) => Effect.Effect<readonly Vcs.FileStatus[], unknown>
readonly diff: (input: VcsDiffInput) => Effect.Effect<readonly FileDiff.Info[], unknown>
}
export interface VcsDomain extends VcsApi<unknown> {
readonly transform: Transform<VcsDraft>
readonly reload: () => Effect.Effect<void>
}
export interface VcsDraft {
add(definition: VcsDefinition): void
readonly default: {
get(): string | undefined
set(selection: string): void
}
}