Normalize ~/Code path to lowercase ~/code
This commit is contained in:
parent
7442d6c6a1
commit
8e62ce1a59
12
src/vm.ts
12
src/vm.ts
|
|
@ -18,8 +18,8 @@ export function containerPath(hostPath: string): string {
|
|||
if (hostPath.startsWith(`${home}/dev`)) {
|
||||
return "/host/dev" + hostPath.slice(`${home}/dev`.length)
|
||||
}
|
||||
if (hostPath.startsWith(`${home}/Code`)) {
|
||||
return "/host/Code" + hostPath.slice(`${home}/Code`.length)
|
||||
if (hostPath.startsWith(`${home}/code`)) {
|
||||
return "/host/code" + hostPath.slice(`${home}/code`.length)
|
||||
}
|
||||
return hostPath
|
||||
}
|
||||
|
|
@ -48,7 +48,7 @@ async function run(cmd: ReturnType<typeof $>, step: string): Promise<void> {
|
|||
async function hostMounts(home: string): Promise<{ dev: boolean; code: boolean }> {
|
||||
const [dev, code] = await Promise.all([
|
||||
Bun.file(`${home}/dev`).exists().catch(() => false),
|
||||
Bun.file(`${home}/Code`).exists().catch(() => false),
|
||||
Bun.file(`${home}/code`).exists().catch(() => false),
|
||||
])
|
||||
return { dev, code }
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ async function createContainer(home: string): Promise<void> {
|
|||
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/dev,readonly`)
|
||||
if (mounts.code) args.push("--mount", `type=bind,source=${home}/Code,target=/host/Code,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) {
|
||||
|
|
@ -83,7 +83,7 @@ async function createHostSymlinks(home: string): Promise<void> {
|
|||
const mounts = await hostMounts(home)
|
||||
const cmds = [`mkdir -p '${home}'`, `ln -s /sandlot '${home}/.sandlot'`]
|
||||
if (mounts.dev) cmds.push(`ln -s /host/dev '${home}/dev'`)
|
||||
if (mounts.code) cmds.push(`ln -s /host/Code '${home}/Code'`)
|
||||
if (mounts.code) cmds.push(`ln -s /host/code '${home}/code'`)
|
||||
await run(
|
||||
$`container exec ${CONTAINER_NAME} bash -c ${cmds.join(" && ")}`,
|
||||
"Symlink creation")
|
||||
|
|
@ -270,7 +270,7 @@ export async function claude(workdir: string, opts?: { prompt?: string; print?:
|
|||
`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/dev.")
|
||||
if (mounts.code) systemPromptLines.push("The host's ~/Code is mounted read-only at /host/Code.")
|
||||
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.",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user