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

Function parseConfigString

packages/agent-core/src/config/toml.ts:265–280  ·  view source on GitHub ↗
(tomlText: string, filePath = 'config.toml')

Source from the content-addressed store, hash-verified

263}
264
265export function parseConfigString(tomlText: string, filePath = 'config.toml'): KimiConfig {
266 if (tomlText.trim().length === 0) {
267 return getDefaultConfig();
268 }
269
270 let data: Record<string, unknown>;
271 try {
272 data = parseToml(tomlText) as Record<string, unknown>;
273 } catch (error) {
274 throw new KimiError(ErrorCodes.CONFIG_INVALID, `Invalid TOML in ${filePath}: ${error instanceof Error ? error.message : String(error)}`, {
275 cause: error,
276 });
277 }
278
279 return parseConfigData(data, filePath);
280}
281
282function parseConfigData(data: Record<string, unknown>, filePath: string): KimiConfig {
283 const raw = cloneRecord(data);

Callers 4

config.test.tsFile · 0.90
validateConfigTomlMethod · 0.90
configs.test.tsFile · 0.90
readConfigFileFunction · 0.85

Calls 2

getDefaultConfigFunction · 0.90
parseConfigDataFunction · 0.85

Tested by

no test coverage detected