MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / loadConfig

Function loadConfig

packages/baseai/src/utils/config/config-handler.ts:27–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25};
26
27export async function loadConfig(): Promise<BaseAIConfig> {
28 const explorer = cosmiconfig('baseai', {
29 searchPlaces: ['baseai/baseai.config.ts'],
30 loaders: {
31 '.ts': TypeScriptLoader()
32 }
33 });
34 try {
35 let result = await explorer.search();
36 if (!result) {
37 // throw new Error('No config file found');
38 p.cancel('Failed to create config file');
39 process.exit(1);
40 }
41
42 // BaseAI config is expected to be in the config key of the config file
43 const config = result.config.config;
44 if (config) {
45 return {
46 ...defaultConfig,
47 ...config,
48 log: {
49 ...defaultConfig.log,
50 ...config.log
51 }
52 };
53 }
54 } catch (error) {
55 // console.log(error);
56 p.cancel('Error: Unable to load config file');
57 process.exit(1);
58 }
59 return defaultConfig;
60}

Callers 7

index.tsFile · 0.90
initializeMethod · 0.90
retrieveAuthenticationFunction · 0.90
addContextFromMemoryFunction · 0.90
generateEmbeddingsFunction · 0.90
authFunction · 0.90
retrieveMemoryFunction · 0.90

Calls 1

cancelMethod · 0.45

Tested by

no test coverage detected