This commit is contained in:
2026-01-11 01:10:38 +08:00
commit 9830cbe735
10 changed files with 204 additions and 0 deletions

21
plugin/example.ts Normal file
View File

@@ -0,0 +1,21 @@
import { tool, type Plugin } from "@opencode-ai/plugin"
// 列出工具列表便能获取到更多示例
export const MyPlugin: Plugin = async ({ project, client, $, directory, worktree }) => {
console.log("Plugin initialized!")
return {
// Hook implementations go here
tool: {
mytool: tool({
description: "获取foo的问候语",
args: {
foo: tool.schema.string(),
},
async execute(args, ctx) {
return `Hello ${args.foo}!`
},
}),
}
}
}