File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 "./tui" : " ./src/tui.ts" ,
1616 "./v2/effect" : " ./src/v2/effect/index.ts" ,
1717 "./v2/effect/*" : " ./src/v2/effect/*.ts" ,
18- "./v2/tui/* " : " ./src/v2/tui/* .ts" ,
18+ "./v2/tui" : " ./src/v2/tui/index .ts" ,
1919 "./v2" : " ./src/v2/promise/index.ts" ,
2020 "./v2/*" : " ./src/v2/promise/*.ts"
2121 },
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ export interface UI {
105105}
106106
107107export interface Context {
108- readonly options : Record < string , any >
108+ readonly options : Readonly < Record < string , unknown > >
109109 readonly client : OpenCodeClient
110110 readonly data : Data
111111 readonly ui : UI
Original file line number Diff line number Diff line change 1+ export * as Plugin from "./plugin.js"
Original file line number Diff line number Diff line change 1+ import type { Context } from "./context.js"
2+
3+ export type { Context }
4+
5+ export type Cleanup = ( ) => Promise < void > | void
6+
7+ export interface Definition {
8+ readonly id : string
9+ readonly setup : ( context : Context ) => Promise < Cleanup | void > | Cleanup | void
10+ }
11+
12+ export function define ( plugin : Definition ) {
13+ return plugin
14+ }
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { Skill } from "@opencode-ai/schema/skill"
1111
1212const Plugin = await import ( "../src/v2/effect/index" )
1313const PromisePlugin = await import ( "../src/v2/promise/index" )
14+ const TuiPlugin = await import ( "../src/v2/tui/index" )
1415
1516test . each ( [
1617 [ "effect" , Plugin ] ,
@@ -38,3 +39,8 @@ test.each([
3839 "Skill" ,
3940 ] )
4041} )
42+
43+ test ( "tui entrypoint exposes the V2 plugin definition" , ( ) => {
44+ const plugin = TuiPlugin . Plugin . define ( { id : "demo" , setup ( ) { } } )
45+ expect ( plugin . id ) . toBe ( "demo" )
46+ } )
You can’t perform that action at this time.
0 commit comments