fix(docs): locale translations
This commit is contained in:
@@ -11,7 +11,7 @@ description: 编写您自己的插件来扩展 opencode。
|
||||
|
||||
## 使用插件
|
||||
|
||||
有兩種加載插件的方法。
|
||||
有两种加載插件的方法。
|
||||
|
||||
---
|
||||
|
||||
@@ -22,7 +22,7 @@ description: 编写您自己的插件来扩展 opencode。
|
||||
- `.opencode/plugins/` - 项目级插件
|
||||
- `~/.config/opencode/plugins/` - 全局插件
|
||||
|
||||
這些目錄中的文件會在啟動時自動加載。
|
||||
这些目录中的文件会在启动時自动加載。
|
||||
|
||||
---
|
||||
|
||||
@@ -43,7 +43,7 @@ description: 编写您自己的插件来扩展 opencode。
|
||||
|
||||
---
|
||||
|
||||
### 插件是如何安裝的
|
||||
### 插件是如何安装的
|
||||
|
||||
**npm 插件** 在启动时使用 Bun 自动安装。包及其依赖项缓存在 `~/.cache/opencode/node_modules/` 中。
|
||||
|
||||
@@ -51,9 +51,9 @@ description: 编写您自己的插件来扩展 opencode。
|
||||
|
||||
---
|
||||
|
||||
### 加載順序
|
||||
### 加載顺序
|
||||
|
||||
插件從所有源加載,所有掛鉤按順序運行。加載順序為:
|
||||
插件從所有源加載,所有掛鉤按顺序運行。加載顺序为:
|
||||
|
||||
1. 全局配置 (`~/.config/opencode/opencode.json`)
|
||||
2. 项目配置(`opencode.json`)
|
||||
@@ -64,10 +64,10 @@ description: 编写您自己的插件来扩展 opencode。
|
||||
|
||||
---
|
||||
|
||||
## 創建一個插件
|
||||
## 创建一个插件
|
||||
|
||||
插件是一个 **JavaScript/TypeScript 模块多个**,它导出一个或插件
|
||||
功能。每個函數接收一個上下文對象並返回一個鉤子對象。
|
||||
功能。每个函數接收一个上下文对象并返回一个鉤子对象。
|
||||
|
||||
---
|
||||
|
||||
@@ -139,7 +139,7 @@ export const MyPlugin: Plugin = async ({ project, client, $, directory, worktree
|
||||
|
||||
---
|
||||
|
||||
### 活動
|
||||
### 活动
|
||||
|
||||
插件可以訂閱事件,如下面的示例部分所示。以下是可用的不同事件的列表。
|
||||
|
||||
@@ -152,7 +152,7 @@ export const MyPlugin: Plugin = async ({ project, client, $, directory, worktree
|
||||
- `file.edited`
|
||||
- `file.watcher.updated`
|
||||
|
||||
#### 安裝活動
|
||||
#### 安装活动
|
||||
|
||||
- `installation.updated`
|
||||
|
||||
@@ -168,7 +168,7 @@ export const MyPlugin: Plugin = async ({ project, client, $, directory, worktree
|
||||
- `message.removed`
|
||||
- `message.updated`
|
||||
|
||||
#### 權限事件
|
||||
#### 权限事件
|
||||
|
||||
- `permission.asked`
|
||||
- `permission.replied`
|
||||
@@ -177,7 +177,7 @@ export const MyPlugin: Plugin = async ({ project, client, $, directory, worktree
|
||||
|
||||
- `server.connected`
|
||||
|
||||
#### 會議活動
|
||||
#### 会话活动
|
||||
|
||||
- `session.created`
|
||||
- `session.compacted`
|
||||
@@ -188,11 +188,11 @@ export const MyPlugin: Plugin = async ({ project, client, $, directory, worktree
|
||||
- `session.status`
|
||||
- `session.updated`
|
||||
|
||||
#### 都都活動
|
||||
#### 都都活动
|
||||
|
||||
- `todo.updated`
|
||||
|
||||
#### 殼牌活動
|
||||
#### 殼牌活动
|
||||
|
||||
- `shell.env`
|
||||
|
||||
@@ -201,7 +201,7 @@ export const MyPlugin: Plugin = async ({ project, client, $, directory, worktree
|
||||
- `tool.execute.after`
|
||||
- `tool.execute.before`
|
||||
|
||||
#### TUI 活動
|
||||
#### TUI 活动
|
||||
|
||||
- `tui.prompt.append`
|
||||
- `tui.command.execute`
|
||||
@@ -217,7 +217,7 @@ export const MyPlugin: Plugin = async ({ project, client, $, directory, worktree
|
||||
|
||||
### 發送通知
|
||||
|
||||
當某些事件發生時發送通知:
|
||||
当某些事件發生時發送通知:
|
||||
|
||||
```js title=".opencode/plugins/notification.js"
|
||||
export const NotificationPlugin = async ({ project, client, $, directory, worktree }) => {
|
||||
@@ -306,7 +306,7 @@ export const CustomToolsPlugin: Plugin = async (ctx) => {
|
||||
- `args`:Zod 模式的工具参数
|
||||
- `execute`:调用工具时运行的函数
|
||||
|
||||
您的自定義工具將可與內置工具一起用於opencode。
|
||||
您的自定義工具将可与内置工具一起用于opencode。
|
||||
|
||||
---
|
||||
|
||||
@@ -333,7 +333,7 @@ export const MyPlugin = async ({ client }) => {
|
||||
|
||||
### 壓實鉤
|
||||
|
||||
自定義壓縮會話時包含的上下文:
|
||||
自定義壓縮会话時包含的上下文:
|
||||
|
||||
```ts title=".opencode/plugins/compaction.ts"
|
||||
import type { Plugin } from "@opencode-ai/plugin"
|
||||
|
||||
Reference in New Issue
Block a user