summaryrefslogtreecommitdiffhomepage
path: root/packages/plugin/src/index.ts
diff options
context:
space:
mode:
authorJames Long <[email protected]>2026-04-13 13:33:13 -0400
committerGitHub <[email protected]>2026-04-13 13:33:13 -0400
commitbf50d1c028e973ccc0beffdf568fca417b62f020 (patch)
treecfbbaf0c18554bd442bb0058246480d4c79fe2e6 /packages/plugin/src/index.ts
parentb8801dbd22e561e3ddaf83744726d8d98744f255 (diff)
downloadopencode-bf50d1c028e973ccc0beffdf568fca417b62f020.tar.gz
opencode-bf50d1c028e973ccc0beffdf568fca417b62f020.zip
feat(core): expose workspace adaptors to plugins (#21927)
Diffstat (limited to 'packages/plugin/src/index.ts')
-rw-r--r--packages/plugin/src/index.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts
index 1afb55daa..49d995c6f 100644
--- a/packages/plugin/src/index.ts
+++ b/packages/plugin/src/index.ts
@@ -24,11 +24,44 @@ export type ProviderContext = {
options: Record<string, any>
}
+export type WorkspaceInfo = {
+ id: string
+ type: string
+ name: string
+ branch: string | null
+ directory: string | null
+ extra: unknown | null
+ projectID: string
+}
+
+export type WorkspaceTarget =
+ | {
+ type: "local"
+ directory: string
+ }
+ | {
+ type: "remote"
+ url: string | URL
+ headers?: HeadersInit
+ }
+
+export type WorkspaceAdaptor = {
+ name: string
+ description: string
+ configure(config: WorkspaceInfo): WorkspaceInfo | Promise<WorkspaceInfo>
+ create(config: WorkspaceInfo, from?: WorkspaceInfo): Promise<void>
+ remove(config: WorkspaceInfo): Promise<void>
+ target(config: WorkspaceInfo): WorkspaceTarget | Promise<WorkspaceTarget>
+}
+
export type PluginInput = {
client: ReturnType<typeof createOpencodeClient>
project: Project
directory: string
worktree: string
+ experimental_workspace: {
+ register(type: string, adaptor: WorkspaceAdaptor): void
+ }
serverUrl: URL
$: BunShell
}