MCPcopy Create free account
hub / github.com/SethGammon/Citadel / tracePath

Function tracePath

mcp-servers/codebase-memory/index.js:126–145  ·  view source on GitHub ↗
(from, to)

Source from the content-addressed store, hash-verified

124 return { file: resolved, dependencies: (index.graph && index.graph[resolved]) || [] };
125}
126
127function tracePath(from, to) {
128 const index = ensureIndex();
129 const a = resolveFile(index, from);
130 const b = resolveFile(index, to);
131 if (!a || Array.isArray(a) || !b || Array.isArray(b)) return { path: null, note: 'from/to not uniquely resolved' };
132 const graph = index.graph || {};
133 const queue = [[a]];
134 const seen = new Set([a]);
135 while (queue.length) {
136 const trail = queue.shift();
137 const head = trail[trail.length - 1];
138 if (head === b) return { path: trail };
139 for (const dep of graph[head] || []) {
140 if (seen.has(dep)) continue;
141 seen.add(dep);
142 queue.push(trail.concat(dep));
143 }
144 }
145 return { path: null, note: 'no dependency path' };
146}
147
148function impactOfChange(base) {

Callers 1

index.jsFile · 0.85

Calls 2

ensureIndexFunction · 0.85
resolveFileFunction · 0.85

Tested by

no test coverage detected