diff --git a/.opencode/plans/1773656570427-mighty-tiger.md b/.opencode/plans/1773656570427-mighty-tiger.md index f622b79..8d601b2 100644 --- a/.opencode/plans/1773656570427-mighty-tiger.md +++ b/.opencode/plans/1773656570427-mighty-tiger.md @@ -127,7 +127,13 @@ export interface CloseSessionResult { // src/core/utils.ts // All helper functions extracted from current multi-model.ts -export function runCommand(command: string): Promise<{ stdout: string; stderr: string; exitCode: number }> { +export type CommandResult = { + ok: boolean; + stdout: string; + stderr: string; +}; + +export async function runCommand(parts: string[]): Promise { // Implementation using Bun.$ } @@ -180,7 +186,7 @@ export interface WorktreeInfo { export async function getWorktreesForSession(sessionName: string): Promise { // Get all worktrees and filter for this session - const { stdout } = await runCommand("git worktree list --porcelain"); + const { stdout } = await runCommand(["git", "worktree", "list", "--porcelain"]); const worktrees: WorktreeInfo[] = []; const homedir = process.env.HOME || process.env.USERPROFILE || "/tmp"; @@ -292,8 +298,7 @@ export async function closeMultiModel(options: CloseSessionOptions): Promise/dev/null`); - const sessionExists = exitCode === 0; + const { ok: sessionExists } = await runCommand(["tmux", "has-session", "-t", options.sessionName]); // Get list of worktrees for this session before killing tmux const worktrees = await getWorktreesForSession(options.sessionName); @@ -315,7 +320,7 @@ export async function closeMultiModel(options: CloseSessionOptions): Promise/dev/null || true`); + await runCommand(["rmdir", worktreeBase]); } catch { // Ignore errors if directory not empty }