openpod

An opencode plugin that spins up a dedicated virtual machine for each session to isolate agent work.
git clone https://unitehenry.com/git/openpod.git
Log | Files | Refs | README

commit eec758f353fd1f68ada655a3c51b516496ab2754
parent 48fa5281ca18df5bdbd1fe5d556a2afd1c723540
Author: Henry Unite <unitehenry@gmail.com>
Date:   Sat, 24 Oct 2026 23:32:22 +0000

refactor(command): move to /command directory

- Create command/ with index.ts (registerCommand) and clear.ts
- Rename clearAllOpenpod() -> clear()
- Update import paths (relative from subdir)
- registerCommand now imports clear from ./clear
- Delete top-level command.ts
- Consistent with context/ structure

Diffstat:
Dcommand.ts | 51---------------------------------------------------
Acommand/clear.ts | 29+++++++++++++++++++++++++++++
Acommand/index.ts | 25+++++++++++++++++++++++++
3 files changed, 54 insertions(+), 51 deletions(-)

diff --git a/command.ts b/command.ts @@ -1,51 +0,0 @@ -import type { Plugin } from "@opencode/plugin"; -import * as fs from "node:fs"; - -import type { OpenpodContext } from "./context"; - -export async function clearAllOpenpod(deps: OpenpodContext): Promise<void> { - const { logger, openpodRoot } = deps; - logger.log("[clear] starting full openpod cleanup"); - - try { - if (!fs.existsSync(openpodRoot)) { - logger.log("[clear] openpod root does not exist"); - return; - } - - // Clean up each session/pod individually (stops + deletes lima + removes dir) - const entries = fs.readdirSync(openpodRoot, { withFileTypes: true }); - for (const entry of entries) { - if (entry.isDirectory()) { - const sessionID = entry.name; - await deps.cleanup.execute(sessionID); - } - } - - // Remove the root directory entirely (includes .log etc.) - fs.rmSync(openpodRoot, { recursive: true, force: true }); - logger.log(`[clear] removed entire directory ${openpodRoot}`); - } catch (err) { - logger.log(`[clear] error during cleanup: ${err}`); - } -} - -export async function registerCommand( - ctx: Plugin.Context, - deps: OpenpodContext, -): Promise<void> { - const { logger } = deps; - logger.log("registering commands"); - - await ctx.command.transform((editor) => { - editor.add({ - name: "clear-openpod", - description: - "Stop and delete all openpod Lima instances and remove the entire ~/.local/share/openpod directory", - execute: async ({ sessionID }) => { - await clearAllOpenpod(deps); - await ctx.session.remove({ sessionID }); - }, - }); - }); -} diff --git a/command/clear.ts b/command/clear.ts @@ -0,0 +1,29 @@ +import type { OpenpodContext } from "../context"; +import * as fs from "node:fs"; + +export async function clear(deps: OpenpodContext): Promise<void> { + const { logger, openpodRoot } = deps; + logger.log("[clear] starting full openpod cleanup"); + + try { + if (!fs.existsSync(openpodRoot)) { + logger.log("[clear] openpod root does not exist"); + return; + } + + // Clean up each session/pod individually (stops + deletes lima + removes dir) + const entries = fs.readdirSync(openpodRoot, { withFileTypes: true }); + for (const entry of entries) { + if (entry.isDirectory()) { + const sessionID = entry.name; + await deps.cleanup.execute(sessionID); + } + } + + // Remove the root directory entirely (includes .log etc.) + fs.rmSync(openpodRoot, { recursive: true, force: true }); + logger.log(`[clear] removed entire directory ${openpodRoot}`); + } catch (err) { + logger.log(`[clear] error during cleanup: ${err}`); + } +} diff --git a/command/index.ts b/command/index.ts @@ -0,0 +1,25 @@ +import type { Plugin } from "@opencode/plugin"; + +import type { OpenpodContext } from "../context"; + +import { clear } from "./clear"; + +export async function registerCommand( + ctx: Plugin.Context, + deps: OpenpodContext, +): Promise<void> { + const { logger } = deps; + logger.log("registering commands"); + + await ctx.command.transform((editor) => { + editor.add({ + name: "clear-openpod", + description: + "Stop and delete all openpod Lima instances and remove the entire ~/.local/share/openpod directory", + execute: async ({ sessionID }) => { + await clear(deps); + await ctx.session.remove({ sessionID }); + }, + }); + }); +}