mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-21 19:02:07 +00:00
Plugin command API shim (#26564)
This commit is contained in:
parent
dcdbdb218f
commit
9a8b54fe62
5 changed files with 225 additions and 0 deletions
|
|
@ -77,6 +77,42 @@ export type TuiKeys = {
|
|||
|
||||
export type TuiKeymap = Keymap<Renderable, KeyEvent>
|
||||
|
||||
/**
|
||||
* Legacy `api.command` shape kept so v1 plugins can initialize. Remove in v2.
|
||||
*
|
||||
* @deprecated Use `api.keymap.registerLayer({ commands, bindings })` instead.
|
||||
*/
|
||||
export type TuiCommand = {
|
||||
title: string
|
||||
value: string
|
||||
description?: string
|
||||
category?: string
|
||||
keybind?: string
|
||||
suggested?: boolean
|
||||
hidden?: boolean
|
||||
enabled?: boolean
|
||||
slash?: {
|
||||
name: string
|
||||
aliases?: string[]
|
||||
}
|
||||
onSelect?: (dialog?: TuiDialogStack) => void | Promise<void>
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy `api.command` API kept so v1 plugins can initialize. Remove in v2.
|
||||
*
|
||||
* @deprecated Use `api.keymap.registerLayer`, `api.keymap.dispatchCommand`, and
|
||||
* `api.keymap.dispatchCommand("command.palette.show")` instead.
|
||||
*/
|
||||
export type TuiCommandApi = {
|
||||
/** @deprecated Use `api.keymap.registerLayer({ commands, bindings })` instead. */
|
||||
register: (cb: () => TuiCommand[]) => () => void
|
||||
/** @deprecated Use `api.keymap.dispatchCommand(name)` instead. */
|
||||
trigger: (value: string) => void
|
||||
/** @deprecated Use `api.keymap.dispatchCommand("command.palette.show")` instead. */
|
||||
show: () => void
|
||||
}
|
||||
|
||||
export type TuiDialogProps = {
|
||||
size?: "medium" | "large" | "xlarge"
|
||||
onClose: () => void
|
||||
|
|
@ -461,6 +497,13 @@ export type TuiWorkspace = {
|
|||
|
||||
export type TuiPluginApi = {
|
||||
app: TuiApp
|
||||
/**
|
||||
* Legacy `api.command` API kept so v1 plugins can initialize. Remove in v2.
|
||||
*
|
||||
* @deprecated Use `api.keymap.registerLayer`, `api.keymap.dispatchCommand`, and
|
||||
* `api.keymap.dispatchCommand("command.palette.show")` instead.
|
||||
*/
|
||||
command?: TuiCommandApi
|
||||
keys: TuiKeys
|
||||
keymap: TuiKeymap
|
||||
route: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue