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

Function bindSubstitutionFailures

packages/plugin/src/config/index.ts:410–425  ·  view source on GitHub ↗
(
    loaded: LoadedConfigFileDetailed | null,
)

Source from the content-addressed store, hash-verified

408}
409
410function bindSubstitutionFailures(
411 loaded: LoadedConfigFileDetailed | null,
412): Array<{ keyPath: string; source: "user" | "project"; message: string }> {
413 if (!loaded || loaded.warnings.length === 0 || loaded.outcome !== "substitution-failure") {
414 return [];
415 }
416
417 const emptyPaths = collectEmptyStringPaths(loaded.config);
418 return loaded.warnings.map((message) => {
419 const matchedPath = emptyPaths.find((path) => {
420 const tail = path.split(".").at(-1) ?? path;
421 return message.includes(path) || message.toLowerCase().includes(tail.toLowerCase());
422 });
423 return { keyPath: matchedPath ?? "<unknown>", source: loaded.source, message };
424 });
425}
426
427function combinedOutcome(args: {
428 sources: LoadResultDetailed["sources"];

Callers 1

loadPluginConfigDetailedFunction · 0.70

Calls 1

collectEmptyStringPathsFunction · 0.70

Tested by

no test coverage detected