Skip to content

Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.

fix(core): add __tests__ pattern and handle filePath-less nodes in applyLLMLayers

Lum1104839166b2292b
diff --git a/packages/core/src/analyzer/layer-detector.ts b/packages/core/src/analyzer/layer-detector.ts
index 2cd5a028..07eb89fc 100644
--- a/packages/core/src/analyzer/layer-detector.ts
+++ b/packages/core/src/analyzer/layer-detector.ts
@@ -45,7 +45,7 @@ const LAYER_PATTERNS: Array<{ patterns: string[]; layerName: string; description
description: "Shared utilities, helpers, and common libraries",
},
{
- patterns: ["test", "spec", "__test__", "__spec__"],
+ patterns: ["test", "spec", "__test__", "__spec__", "__tests__", "__specs__"],
layerName: "Test Layer",
description: "Test files and test utilities",
},
@@ -227,7 +227,13 @@ export function applyLLMLayers(
for (const node of graph.nodes) {
if (node.type !== "file") continue;
- if (!node.filePath) continue;
+
+ if (!node.filePath) {
+ const other = layerMap.get("Other") ?? [];
+ other.push(node.id);
+ layerMap.set("Other", other);
+ continue;
+ }
const normalizedPath = node.filePath.replace(/\\/g, "/");
let assigned = false;