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.
This commit is contained in:
2026-02-07 03:24:10 +08:00
parent bf88cfab5c
commit 17731be911
5 changed files with 302 additions and 370 deletions

View File

@@ -1,8 +1,8 @@
import { tool } from "@opencode-ai/plugin/tool";
import type { Plugin, PluginInput } from "@opencode-ai/plugin";
const MyPlugin: Plugin = async (ctx: PluginInput) => {
console.log("Plugin loaded!", ctx.project.name);
export const MyPlugin: Plugin = async (ctx: PluginInput) => {
console.log("Plugin loaded!", ctx.project.worktree);
return {
tool: {
@@ -19,4 +19,3 @@ const MyPlugin: Plugin = async (ctx: PluginInput) => {
};
};
export default MyPlugin;