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:
parent
3b3820f95f
commit
f7a8ff6a3c
|
|
@ -62,7 +62,7 @@ src/
|
||||||
|
|
||||||
## Architecture
|
## 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>`:**
|
**Session flow for `sandlot new <branch>`:**
|
||||||
1. `git.createWorktree()` → creates worktree at `~/.sandlot/<repo>/<branch>`
|
1. `git.createWorktree()` → creates worktree at `~/.sandlot/<repo>/<branch>`
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,6 @@ export async function action(args: string[]) {
|
||||||
|
|
||||||
let normalized: 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)") }
|
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)
|
await config.set(key as config.Key, normalized)
|
||||||
console.log(`memory = ${normalized}`)
|
console.log(`${key} = ${normalized}`)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ function hostMounts(home: string): { dev: boolean; code: boolean } {
|
||||||
async function createContainer(home: string): Promise<void> {
|
async function createContainer(home: string): Promise<void> {
|
||||||
const mounts = hostMounts(home)
|
const mounts = hostMounts(home)
|
||||||
let memory: string
|
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]
|
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.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`)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user