- Created agent.ts to export necessary components from the plugin source. - Implemented index.ts to initialize Opencode client and list projects and sessions. - Added functionality to prompt a session with specific tool instructions.
22 lines
516 B
TypeScript
22 lines
516 B
TypeScript
import { tool } from "@opencode-ai/plugin/tool";
|
|
import type { Plugin, PluginInput } from "@opencode-ai/plugin";
|
|
|
|
export const MyPlugin: Plugin = async (ctx: PluginInput) => {
|
|
console.log("Plugin loaded!", ctx.project.worktree);
|
|
|
|
return {
|
|
tool: {
|
|
greet: tool({
|
|
description: "Greet someone",
|
|
args: {
|
|
name: tool.schema.string().describe("The name to greet"),
|
|
},
|
|
async execute(args) {
|
|
return `Hello, ${args.name}!`;
|
|
},
|
|
}),
|
|
},
|
|
};
|
|
};
|
|
|