MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / writeConfigKnob

Function writeConfigKnob

src/cli/dashboard-control.ts:66–75  ·  view source on GitHub ↗
(path: string, coerced: boolean | string | number)

Source from the content-addressed store, hash-verified

64
65// ── appliers (impure) ────────────────────────────────────────────────────────────
66
67async 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. */

Callers 1

dispatchActionFunction · 0.85

Calls 3

setDeepFunction · 0.85
writeFileAtomicFunction · 0.85
loadMethod · 0.80

Tested by

no test coverage detected