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

Add __tests__ and __specs__ (plural inside underscores) to Test Layer
patterns for the common convention. Also assign file nodes without
filePath to "Other" layer in applyLLMLayers for consistency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lum1104
2026-03-14 18:55:57 +08:00
co-authored by Claude Opus 4.6
parent 305fb4055b
commit 839166b229
+8 -2
View File
@@ -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;