(filePath: string)
| 77 | * UIs surface it directly — instead of the raw validation details. |
| 78 | */ |
| 79 | export function readConfigFileForUpdate(filePath: string): KimiConfig { |
| 80 | try { |
| 81 | return readConfigFile(filePath); |
| 82 | } catch (error) { |
| 83 | if (error instanceof KimiError && error.code === ErrorCodes.CONFIG_INVALID) { |
| 84 | throw new KimiError( |
| 85 | ErrorCodes.CONFIG_INVALID, |
| 86 | `Cannot change settings while ${filePath} is invalid — fix it first (run \`kimi doctor\` for details).`, |
| 87 | { cause: error }, |
| 88 | ); |
| 89 | } |
| 90 | throw error; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Load the config for runtime consumption: the on-disk config plus any model |
no test coverage detected