From f7a8ff6a3c283bbb08621eb3a9a7c48263d63eeb Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Fri, 20 Mar 2026 10:59:37 -0700 Subject: [PATCH] Fix config command to pass actual key instead of hardcoded "memory" The config command already parsed the key but ignored it when calling set() and printing the result. Also clarify sync vs async convention in CLAUDE.md and log invalid memory config instead of silently falling back. --- CLAUDE.md | 2 +- src/commands/config.ts | 4 ++-- src/vm.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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`)