index.ts (746B)
1 import type { Plugin } from "@opencode/plugin"; 2 3 import type { OpenpodContext } from "../context"; 4 5 import { clear } from "./clear"; 6 7 const COMMAND_NAME = "clear-openpod"; 8 9 const COMMAND_DESCRIPTION = 10 "Stop and delete all openpod Lima instances and remove the entire ~/.local/share/openpod directory"; 11 12 export async function registerCommand( 13 ctx: Plugin.Context, 14 deps: OpenpodContext, 15 ): Promise<void> { 16 const { logger } = deps; 17 logger.log("registering commands"); 18 19 await ctx.command.transform((editor) => { 20 editor.add({ 21 name: COMMAND_NAME, 22 description: COMMAND_DESCRIPTION, 23 execute: async ({ sessionID }) => { 24 await clear(deps); 25 await ctx.session.remove({ sessionID }); 26 }, 27 }); 28 }); 29 }