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.
This commit is contained in:
Chris Wanstrath 2026-03-20 10:59:37 -07:00
parent 3b3820f95f
commit f7a8ff6a3c
3 changed files with 4 additions and 4 deletions

View File

@ -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 <branch>`:**
1. `git.createWorktree()` → creates worktree at `~/.sandlot/<repo>/<branch>`

View File

@ -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}`)
}

View File

@ -68,7 +68,7 @@ function hostMounts(home: string): { dev: boolean; code: boolean } {
async function createContainer(home: string): Promise<void> {
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`)