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.
TypeScript antigravity-skillsbusiness-knowledgeclaude-codeclaude-skillscodebase-analysiscodexcodex-skillsdeveloper-tools-ai-agentgemini-cli-skillskarpathy-llm-wikiknowledge-baseknowledge-graphmemoryopencode-skillspi-agentunderstandcodevibe-coding
feat(core): add domain/flow/step prefixes to node ID normalization
Lum1104d89d7f6e9302
diff --git a/understand-anything-plugin/packages/core/src/__tests__/domain-normalize.test.ts b/understand-anything-plugin/packages/core/src/__tests__/domain-normalize.test.tsnew file mode 100644index 00000000..77bd37f3--- /dev/null+++ b/understand-anything-plugin/packages/core/src/__tests__/domain-normalize.test.ts@@ -0,0 +1,37 @@+import { describe, it, expect } from "vitest";+import { normalizeNodeId } from "../analyzer/normalize-graph.js";++describe("domain node ID normalization", () => {+ it("normalizes domain node IDs", () => {+ const result = normalizeNodeId("domain:order-management", {+ type: "domain",+ name: "Order Management",+ });+ expect(result).toBe("domain:order-management");+ });++ it("normalizes flow node IDs", () => {+ const result = normalizeNodeId("flow:create-order", {+ type: "flow",+ name: "Create Order",+ });+ expect(result).toBe("flow:create-order");+ });++ it("normalizes step node IDs with filePath", () => {+ const result = normalizeNodeId("step:create-order:validate", {+ type: "step",+ name: "Validate",+ filePath: "src/validators/order.ts",+ });+ expect(result).toBe("step:src/validators/order.ts:validate");+ });++ it("normalizes step node IDs without filePath", () => {+ const result = normalizeNodeId("step:validate", {+ type: "step",+ name: "Validate",+ });+ expect(result).toBe("step:validate");+ });+});diff --git a/understand-anything-plugin/packages/core/src/analyzer/normalize-graph.ts b/understand-anything-plugin/packages/core/src/analyzer/normalize-graph.tsindex 94096932..f8c76981 100644--- a/understand-anything-plugin/packages/core/src/analyzer/normalize-graph.ts+++ b/understand-anything-plugin/packages/core/src/analyzer/normalize-graph.ts@@ -2,6 +2,7 @@ const VALID_PREFIXES = new Set(["file", "func", "class", "module", "concept","config", "document", "service", "table", "endpoint","pipeline", "schema", "resource",+ "domain", "flow", "step",]);const TYPE_TO_PREFIX: Record<string, string> = {@@ -18,6 +19,9 @@ const TYPE_TO_PREFIX: Record<string, string> = {pipeline: "pipeline",schema: "schema",resource: "resource",+ domain: "domain",+ flow: "flow",+ step: "step",};/**@@ -68,6 +72,13 @@ export function normalizeNodeId(const { prefix, path } = stripToValidPrefix(trimmed);if (prefix) {+ // For step nodes with filePath, reconstruct as step:filePath:stepSlug+ if (node.type === "step" && node.filePath) {+ // Use the last colon-separated segment of the path as the step slug+ const lastColon = path.lastIndexOf(":");+ const stepSlug = lastColon >= 0 ? path.slice(lastColon + 1) : path;+ return `${prefix}:${node.filePath}:${stepSlug}`;+ }return `${prefix}:${path}`;}