MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / findByQualifiedName

Method findByQualifiedName

src/graph/queries.ts:164–197  ·  view source on GitHub ↗

* Find symbols by qualified name pattern * * @param pattern - Pattern to match (supports * wildcard) * @returns Array of matching nodes

(pattern: string)

Source from the content-addressed store, hash-verified

162 * @returns Array of matching nodes
163 */
164 findByQualifiedName(pattern: string): Node[] {
165 // Convert glob pattern to regex
166 const regexPattern = pattern
167 .replace(/[.+^${}()|[\]\\]/g, '\\$&')
168 .replace(/\*/g, '.*')
169 .replace(/\?/g, '.');
170
171 const regex = new RegExp(`^${regexPattern}$`);
172
173 // This is inefficient for large graphs - would need FTS index on qualified_name
174 // For now, use kind-based filtering if possible
175 const allNodes: Node[] = [];
176 const kinds: Node['kind'][] = [
177 'class',
178 'union',
179 'function',
180 'method',
181 'interface',
182 'type_alias',
183 'variable',
184 'constant',
185 ];
186
187 for (const kind of kinds) {
188 const nodes = this.queries.getNodesByKind(kind);
189 for (const node of nodes) {
190 if (regex.test(node.qualifiedName)) {
191 allNodes.push(node);
192 }
193 }
194 }
195
196 return allNodes;
197 }
198
199 /**
200 * Get the module/package structure

Callers

nothing calls this directly

Calls 2

pushMethod · 0.80
getNodesByKindMethod · 0.65

Tested by

no test coverage detected