diff --git a/CLAUDE.md b/CLAUDE.md index 5b60dac..97b979b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -62,7 +62,7 @@ src/ ## Architecture -Each module has a single responsibility. No classes — only exported async functions. +Each module has a single responsibility. No classes — only exported functions (async when they do I/O, sync when pure). **Session flow for `sandlot new `:** 1. `git.createWorktree()` → creates worktree at `~/.sandlot//` diff --git a/src/commands/config.ts b/src/commands/config.ts index 3c8565d..6ef89c5 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -27,6 +27,6 @@ export async function action(args: string[]) { let normalized: string try { normalized = config.validateMemory(rest[0]) } catch { return die("Must be a number followed by G or M, minimum 512M (e.g. 16G)") } - await config.set("memory", normalized) - console.log(`memory = ${normalized}`) + await config.set(key as config.Key, normalized) + console.log(`${key} = ${normalized}`) } diff --git a/src/vm.ts b/src/vm.ts index 9f33af1..6e1728d 100644 --- a/src/vm.ts +++ b/src/vm.ts @@ -68,7 +68,7 @@ function hostMounts(home: string): { dev: boolean; code: boolean } { async function createContainer(home: string): Promise { const mounts = hostMounts(home) let memory: string - try { memory = validateMemory((await getConfig("memory")) ?? DEFAULTS.memory) } catch { memory = DEFAULTS.memory } + try { memory = validateMemory((await getConfig("memory")) ?? DEFAULTS.memory) } catch (e) { info(`Invalid memory config, using default: ${e instanceof Error ? e.message : e}`); memory = DEFAULTS.memory } const args = ["container", "run", "-d", "--name", CONTAINER_NAME, "-m", memory] 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`)