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 d69168e6969f6769ce7bb943c1712ae7b75efcf7
parent 9e5093f6478c0574b2f4c9244d09115e88d9fea3
Author: Henry Unite <unitehenry@gmail.com>
Date:   Sun, 15 Nov 2026 20:13:28 +0000

refactor(prompt): use context exec and extract target check

Call exec through OpenpodContext and move the target existence check into a private helper so targetExists can be a const.

Diffstat:
Mprompt/handle.ts | 21+++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/prompt/handle.ts b/prompt/handle.ts @@ -2,8 +2,6 @@ import type { OpenpodContext } from "../context"; import { access, mkdir, rm } from "node:fs/promises"; import * as path from "node:path"; -import { exec } from "../context/exec"; - export type HandleParams = { ctx: OpenpodContext; sessionId: string; @@ -13,7 +11,7 @@ export type HandleParams = { export async function handle(params: HandleParams): Promise<void> { const { ctx: deps, sessionId, dir, move } = params; - const { logger, openpodRoot } = deps; + const { logger, openpodRoot, exec } = deps; async function isGitEnabled(dir: string): Promise<boolean> { const result = await exec("git", [ @@ -87,6 +85,15 @@ export async function handle(params: HandleParams): Promise<void> { return true; } + async function hasTarget(target: string): Promise<boolean> { + try { + await access(target); + return true; + } catch { + return false; + } + } + const gitEnabled = await isGitEnabled(dir); logger.log(`session ${sessionId} prompt - gitEnabled: ${gitEnabled}`); @@ -103,13 +110,7 @@ export async function handle(params: HandleParams): Promise<void> { ); if (needsMove) { - let targetExists = false; - try { - await access(target); - targetExists = true; - } catch { - // target does not exist - } + const targetExists = await hasTarget(target); if (targetExists) { logger.log(`${target} already exists`);