MCPcopy
hub / github.com/MiniMax-AI/cli / readConfigFile

Function readConfigFile

src/config/loader.ts:9–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7import type { GlobalFlags } from '../types/flags';
8
9export function readConfigFile(): ConfigFile {
10 const path = getConfigPath();
11 if (!existsSync(path)) return {};
12 try {
13 return parseConfigFile(JSON.parse(readFileSync(path, 'utf-8')));
14 } catch (err) {
15 const e = err as Error;
16 if (e instanceof SyntaxError || e.message.includes('JSON')) {
17 process.stderr.write(`Warning: config file is corrupted. Run 'mmx config set' to reset.\n`);
18 }
19 return {};
20 }
21}
22
23export async function writeConfigFile(data: Record<string, unknown>): Promise<void> {
24 await ensureConfigDir();

Callers 12

mainFunction · 0.90
loadCredentialsFunction · 0.90
saveCredentialsFunction · 0.90
clearCredentialsFunction · 0.90
runOAuthLoginFunction · 0.90
persistApiKeyFunction · 0.90
completeOAuthLoginFunction · 0.90
loginWithApiKeyFunction · 0.90
runFunction · 0.90
runFunction · 0.90
saveDetectedRegionFunction · 0.90
loadConfigFunction · 0.85

Calls 2

getConfigPathFunction · 0.90
parseConfigFileFunction · 0.90

Tested by

no test coverage detected