MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / resolveContent

Function resolveContent

yaml-flow-editor/src/utils/collectModules.ts:30–52  ·  view source on GitHub ↗
(modulePath: string)

Source from the content-addressed store, hash-verified

28
29 // Resolve module content by path: node overrides > global modulesByPath (with normalization)
30 function resolveContent(modulePath: string): string | undefined {
31 if (nodeOverrides[modulePath]) return nodeOverrides[modulePath];
32
33 // Direct lookup
34 if (modulesByPath[modulePath]) return modulesByPath[modulePath].content;
35
36 // Normalize: strip leading ./
37 const stripped = modulePath.replace(/^\.\//, '');
38 if (modulesByPath[stripped]) return modulesByPath[stripped].content;
39
40 // Strip workflows/ prefix
41 const noPrefix = stripped.replace(/^workflows\//, '');
42 if (modulesByPath[noPrefix]) return modulesByPath[noPrefix].content;
43
44 // Suffix match: find any key ending with the path
45 const keys = Object.keys(modulesByPath);
46 const suffixMatch = keys.find(
47 (k) => k.endsWith('/' + stripped) || k.endsWith('/' + noPrefix),
48 );
49 if (suffixMatch) return modulesByPath[suffixMatch].content;
50
51 return undefined;
52 }
53
54 // Extract module paths from a list of workflow steps
55 function extractModulePaths(steps: WorkflowStep[]): string[] {

Callers 2

processFunction · 0.85
collectDependentModulesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected