Files
test-opencode/plugin/src/index.ts
abearxiong 17731be911 feat: add initial implementation of Opencode client and session handling
- 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.
2026-02-07 03:24:10 +08:00

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}!`;
},
}),
},
};
};