feat(plugin): add vcs provider api (#44979)

This commit is contained in:
Shoubhit Dash
2026-08-25 19:37:06 +05:30
committed by GitHub
Unverified
parent 7601ab9fc4
commit 9c1787617c
22 changed files with 605 additions and 39 deletions
+1
View File
@@ -11,4 +11,5 @@ export { Model } from "@opencode-ai/schema/model"
export { Provider } from "@opencode-ai/schema/provider"
export { Reference } from "@opencode-ai/schema/reference"
export { Skill } from "@opencode-ai/schema/skill"
export { Vcs } from "@opencode-ai/schema/vcs"
export { WebSearch } from "@opencode-ai/schema/websearch"
+2
View File
@@ -15,6 +15,7 @@ import type { ShellDomain } from "./shell.js"
import type { SkillDomain } from "./skill.js"
import type { StorageDomain } from "./storage.js"
import type { ToolDomain } from "./tool.js"
import type { VcsDomain } from "./vcs.js"
import type { WebSearchDomain } from "./websearch.js"
export interface Context {
@@ -34,6 +35,7 @@ export interface Context {
readonly skill: SkillDomain
readonly storage: StorageDomain
readonly tool: ToolDomain
readonly vcs: VcsDomain
readonly websearch: WebSearchDomain
}
+45
View File
@@ -0,0 +1,45 @@
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
}
}