From 3b21a2afd1abb79b26e0b00d2a496d3b030081de Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Tue, 24 Feb 2026 08:49:33 -0800 Subject: [PATCH] Use nested paths for host mounts --- src/vm.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/vm.ts b/src/vm.ts index 260f12b..7310736 100644 --- a/src/vm.ts +++ b/src/vm.ts @@ -16,10 +16,10 @@ export function containerPath(hostPath: string): string { return "/sandlot" + hostPath.slice(`${home}/.sandlot`.length) } if (hostPath.startsWith(`${home}/dev`)) { - return "/host" + hostPath.slice(`${home}/dev`.length) + return "/host/dev" + hostPath.slice(`${home}/dev`.length) } if (hostPath.startsWith(`${home}/Code`)) { - return "/host-code" + hostPath.slice(`${home}/Code`.length) + return "/host/Code" + hostPath.slice(`${home}/Code`.length) } return hostPath } @@ -57,8 +57,8 @@ async function hostMounts(home: string): Promise<{ dev: boolean; code: boolean } async function createContainer(home: string): Promise { const mounts = await hostMounts(home) const args = ["container", "run", "-d", "--name", CONTAINER_NAME, "-m", "4G"] - if (mounts.dev) args.push("--mount", `type=bind,source=${home}/dev,target=/host,readonly`) - if (mounts.code) args.push("--mount", `type=bind,source=${home}/Code,target=/host-code,readonly`) + if (mounts.dev) args.push("--mount", `type=bind,source=${home}/dev,target=/host/dev,readonly`) + if (mounts.code) args.push("--mount", `type=bind,source=${home}/Code,target=/host/Code,readonly`) args.push("-v", `${home}/.sandlot:/sandlot`, "ubuntu:24.04", "sleep", "infinity") const result = await $`${args}`.nothrow().quiet() if (result.exitCode !== 0) { @@ -82,8 +82,8 @@ async function installPackages(cached: boolean): Promise { async function createHostSymlinks(home: string): Promise { const mounts = await hostMounts(home) const cmds = [`mkdir -p '${home}'`, `ln -s /sandlot '${home}/.sandlot'`] - if (mounts.dev) cmds.push(`ln -s /host '${home}/dev'`) - if (mounts.code) cmds.push(`ln -s /host-code '${home}/Code'`) + if (mounts.dev) cmds.push(`ln -s /host/dev '${home}/dev'`) + if (mounts.code) cmds.push(`ln -s /host/Code '${home}/Code'`) await run( $`container exec ${CONTAINER_NAME} bash -c ${cmds.join(" && ")}`, "Symlink creation") @@ -269,8 +269,8 @@ export async function claude(workdir: string, opts?: { prompt?: string; print?: "You are running inside a sandlot container (Apple Container, ubuntu:24.04).", `Your working directory is ${cwd}, a git worktree managed by sandlot.`, ] - if (mounts.dev) systemPromptLines.push("The host's ~/dev is mounted read-only at /host.") - if (mounts.code) systemPromptLines.push("The host's ~/Code is mounted read-only at /host-code.") + if (mounts.dev) systemPromptLines.push("The host's ~/dev is mounted read-only at /host/dev.") + if (mounts.code) systemPromptLines.push("The host's ~/Code is mounted read-only at /host/Code.") systemPromptLines.push( "The host's ~/.sandlot is mounted at /sandlot.", "Bun is installed at ~/.local/bin/bun. Use bun instead of node/npm.",