fix: Fix callers/callees for Liquid templates and improve context relevance

Three issues discovered testing CodeGraph against a Shopify Liquid theme:

1. Callers/callees only traversed 'calls' edges, missing 'references' and
   'imports' edges that Liquid extraction creates for {% render %} and
   {% section %} tags. Expanded edge filter in getCallers/getCallees.

2. Context builder only ran text search as a fallback when semantic search
   returned nothing. For template-heavy codebases, semantic search returns
   irrelevant results (e.g., "Toast" for a header navigation query) while
   text/path-based matching would find the right files. Now always runs
   text search alongside semantic search with multi-term boosting.

3. MCP findAllSymbols only matched nodes by exact name, missing file nodes
   whose basename (without extension) matched the symbol. This caused
   callers to find zero results even with correct edges, since references
   edges point to file nodes (e.g., "product-card.liquid") not component
   nodes (e.g., "product-card").

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Colby McHenry
2026-04-03 13:31:14 -05:00
co-authored by Claude Opus 4.6
parent 47ed47bf04
commit 68ec482bf4
3 changed files with 57 additions and 18 deletions
+6 -1
View File
@@ -874,7 +874,12 @@ export class ToolHandler {
return { nodes: [], note: '' };
}
const exactMatches = results.filter(r => r.node.name === symbol);
// Match by exact name, OR by file basename without extension
// (e.g., "product-card" matches file node named "product-card.liquid")
const exactMatches = results.filter(r =>
r.node.name === symbol ||
(r.node.kind === 'file' && r.node.name.replace(/\.[^.]+$/, '') === symbol)
);
if (exactMatches.length <= 1) {
const node = exactMatches[0]?.node ?? results[0]!.node;