opencode/packages/cli-rs/crates/plugin/examples/pipe/effectprobe/tui.ts
Simon Klee 6b1df0cceb
feat(cli-rs): add the native CLI and TUI (#63477)
Add packages/cli-rs, an OpenCode client written in Rust on OpenTUI's Rust crates. It is a client only.
2026-11-22 00:07:01 +01:00

13 lines
588 B
TypeScript

// Imports a deliberately unavailable package to check the loader diagnostic.
import { Plugin } from "@opencode/plugin/tui"
import { Option, Schema } from "effect"
import { appendFileSync } from "node:fs"
export default Plugin.define({
id: "example.effectprobe",
setup(context) {
const decoded = Schema.decodeUnknownSync(Schema.Struct({ name: Schema.String }))({ name: "probe" })
const log = (entry: unknown) => appendFileSync(String(context.options.log), JSON.stringify(entry) + "\n")
log({ name: decoded.name, some: Option.getOrElse(Option.some(2), () => 0) })
},
})