From e23e84655d89a431ce0a416c94b03c45f0d978ae Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Thu, 19 Feb 2026 19:15:28 -0800 Subject: [PATCH] Simplify activity hook script and remove unused activeWorktrees function --- src/vm.ts | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/vm.ts b/src/vm.ts index d404225..5672e27 100644 --- a/src/vm.ts +++ b/src/vm.ts @@ -97,9 +97,8 @@ export async function ensure(log?: (msg: string) => void): Promise { const activityTmp = `${home}/.sandlot/.sandlot-activity.tmp` await Bun.write(activityTmp, [ '#!/bin/bash', - 'DIR=$(dirname "$CLAUDE_PROJECT_DIR")', - 'BRANCH=$(basename "$CLAUDE_PROJECT_DIR")', - 'echo "$1" > "$DIR/.activity-$BRANCH"', + 'P="${CLAUDE_PROJECT_DIR%/}"', + 'echo "$1" > "$(dirname "$P")/.activity-$(basename "$P")"', '', ].join('\n')) await $`chmod +x ${activityTmp}`.quiet() @@ -181,21 +180,6 @@ export async function exec(workdir: string, command: string): Promise<{ exitCode } } -/** Get host paths of worktrees where claude is currently running in the container. */ -export async function activeWorktrees(): Promise { - const s = await status() - if (s !== "running") return [] - - const result = await $`container exec ${CONTAINER_NAME} bash -c ${'for pid in $(pgrep -x claude 2>/dev/null); do readlink /proc/$pid/cwd 2>/dev/null; done'}`.nothrow().quiet().text() - - const home = homedir() - return result.trim().split("\n").filter(Boolean).map(p => { - if (p.startsWith("/sandlot")) return `${home}/.sandlot${p.slice("/sandlot".length)}` - if (p.startsWith("/host")) return `${home}/dev${p.slice("/host".length)}` - return p - }) -} - /** Check if Claude is actively working in the given worktree (based on activity hook). */ export async function isClaudeActive(worktree: string, branch: string): Promise { const file = `${dirname(worktree)}/.activity-${branch}`