20 lines
479 B
TypeScript
20 lines
479 B
TypeScript
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}!`
|
|
},
|
|
}),
|
|
}
|
|
}
|
|
} |