MCPcopy Create free account
hub / github.com/cortexkit/magic-context / detectConfigFile

Function detectConfigFile

packages/plugin/src/shared/jsonc-parser.ts:122–138  ·  view source on GitHub ↗
(basePath: string)

Source from the content-addressed store, hash-verified

120}
121
122export function detectConfigFile(basePath: string): {
123 format: "json" | "jsonc" | "none";
124 path: string;
125} {
126 const jsoncPath = `${basePath}.jsonc`;
127 const jsonPath = `${basePath}.json`;
128
129 if (existsSync(jsoncPath)) {
130 return { format: "jsonc", path: jsoncPath };
131 }
132
133 if (existsSync(jsonPath)) {
134 return { format: "json", path: jsonPath };
135 }
136
137 return { format: "none", path: jsoncPath };
138}

Callers 1

loadPluginConfigDetailedFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected