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 a65967faedb9841f7f8494a2a304604dce032777
parent 1f76bf9296ef14c2090aec3194b238da8447f758
Author: Henry Unite <unitehenry@gmail.com>
Date:   Sun, 25 Oct 2026 20:08:08 +0000

test(opencode): prompt in non-git directory returns early

Add E2E test that creates a session in a non-git temp directory,
triggers the prompt hook, and verifies:
- The log contains "git is not enabled"
- No session directory was created under ~/.local/share/openpod/

Log file is cleared before and after the test to avoid cross-test
interference.

Diffstat:
Mopencode.test.ts | 41+++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+), 0 deletions(-)

diff --git a/opencode.test.ts b/opencode.test.ts @@ -1,8 +1,13 @@ import { OpenCode } from "@opencode/sdk"; import { describe, it, expect, beforeEach, afterEach } from "vitest"; +import * as fs from "node:fs"; +import * as path from "node:path"; +import * as os from "node:os"; import openpod from "./index"; describe("opencode", () => { + const openpodRoot = path.join(os.homedir(), ".local", "share", "openpod"); + let opencode: Awaited<ReturnType<typeof OpenCode.create>>; beforeEach(async () => { @@ -33,4 +38,40 @@ describe("opencode", () => { commands!.data.some((c: { name: string }) => c.name === "clear-openpod"), ).toBe(true); }); + + it('not create openpod instance for uninitialized git repo', async () => { + // Create a temp directory that is not a git repo + const tempDir = fs.mkdtempSync( + path.join(os.tmpdir(), "openpod-e2e-"), + ); + + // Register the plugin and create a session, then move it to the non-git directory + await opencode.plugin(openpod); + const session = await opencode.sessions.create(); + + // Move the session to the non-git temp directory so the prompt hook + // fires in a non-git context + await opencode.sessions.move({ + sessionID: session.id, + directory: tempDir, + }); + + // Wait for the move to take effect + await new Promise((r) => setTimeout(r, 200)); + + // Trigger a prompt via the session API to fire the prompt hook. + await opencode.sessions.prompt({ + sessionID: session.id, + text: "hello", + }); + + expect(fs.existsSync(path.join(openpodRoot, session.id))).toBe(false); + + // Clean up temp directory + try { + fs.rmSync(tempDir, { recursive: true, force: true }); + } catch { + // ignore cleanup failures + } + }); });