(path: string, coerced: boolean | string | number)
| 64 | |
| 65 | // ── appliers (impure) ──────────────────────────────────────────────────────────── |
| 66 | |
| 67 | async function writeConfigKnob(path: string, coerced: boolean | string | number): Promise<void> { |
| 68 | const fs = await import('fs/promises'); |
| 69 | const yaml = await import('js-yaml'); |
| 70 | const { QODEX_CONFIG_FILE } = await import('../config/defaults.js'); |
| 71 | const { writeFileAtomic } = await import('../utils/atomic-write.js'); |
| 72 | let raw = ''; try { raw = await fs.readFile(QODEX_CONFIG_FILE, 'utf-8'); } catch { /* new file */ } |
| 73 | const cfg: any = raw.trim() ? (yaml.load(raw) ?? {}) : {}; |
| 74 | setDeep(cfg, path, coerced); |
| 75 | await writeFileAtomic(QODEX_CONFIG_FILE, yaml.dump(cfg, { lineWidth: 100, noRefs: true })); |
| 76 | } |
| 77 | |
| 78 | /** Dispatch a dashboard action by name. Unknown actions are rejected. */ |
no test coverage detected