MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / ghostsFor

Function ghostsFor

graph-ui/src/agents/agent-placement.ts:158–173  ·  view source on GitHub ↗
(pattern: string, index: PlacementIndex)

Source from the content-addressed store, hash-verified

156
157/** Die Knoten, deren Name das Suchmuster enthaelt. Hoechstens {@link GHOST_LIMIT}. */
158export function ghostsFor(pattern: string, index: PlacementIndex): number[] {
159 const needle = pattern.trim().toLowerCase();
160 if (needle.length < 2) {
161 return [];
162 }
163 const hits: GraphNode[] = [];
164 for (const node of index.named) {
165 if (node.name.toLowerCase().includes(needle)) {
166 hits.push(node);
167 }
168 }
169 return hits
170 .sort((a, b) => a.name.length - b.name.length || a.id - b.id)
171 .slice(0, GHOST_LIMIT)
172 .map((node) => node.id);
173}
174
175/**
176 * Die Datei, die ein Befehl nennt und die der Graph kennt.

Callers 2

placeEventFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected