MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / writeConfigFile

Function writeConfigFile

packages/agent-core/src/config/toml.ts:451–458  ·  view source on GitHub ↗
(filePath: string, config: KimiConfig)

Source from the content-addressed store, hash-verified

449/* ------------------------------------------------------------------ */
450
451export async function writeConfigFile(filePath: string, config: KimiConfig): Promise<void> {
452 // Final guard: never persist the env-synthesized model/provider to disk,
453 // even if a caller passes back the runtime config as a patch (see
454 // stripEnvModelConfig / the getConfig -> setConfig round-trip).
455 const validated = validateConfig(stripEnvModelConfig(config));
456 await mkdir(dirname(filePath), { recursive: true, mode: 0o700 });
457 await atomicWrite(filePath, `${stringifyToml(configToTomlData(validated))}\n`);
458}
459
460export function configToTomlData(config: KimiConfig): Record<string, unknown> {
461 const out = cloneRecord(config.raw);

Callers 7

config.test.tsFile · 0.90
constructorMethod · 0.90
env-model.test.tsFile · 0.90
configs.test.tsFile · 0.90
constructorMethod · 0.90
setKimiConfigMethod · 0.90
removeKimiProviderMethod · 0.90

Calls 5

validateConfigFunction · 0.90
stripEnvModelConfigFunction · 0.90
atomicWriteFunction · 0.90
configToTomlDataFunction · 0.85
mkdirFunction · 0.50

Tested by

no test coverage detected