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.

refactor: extract endpoint label into variable to avoid duplicated template

Nikola Chetelyazov5593af76ca4c
diff --git a/understand-anything-plugin/packages/core/src/analyzer/graph-builder.ts b/understand-anything-plugin/packages/core/src/analyzer/graph-builder.ts
index f74cb7e7..d77155b0 100644
--- a/understand-anything-plugin/packages/core/src/analyzer/graph-builder.ts
+++ b/understand-anything-plugin/packages/core/src/analyzer/graph-builder.ts
@@ -328,14 +328,15 @@ export class GraphBuilder {
console.warn(`[GraphBuilder] Duplicate node ID "${childId}" — skipping`);
continue;
}
+ const name = `${ep.method ?? ""} ${ep.path}`.trim()
this.nodeIds.add(childId);
this.nodes.push({
id: childId,
type: "endpoint",
- name: `${ep.method ?? ""} ${ep.path}`.trim(),
+ name,
filePath,
lineRange: ep.lineRange,
- summary: `Endpoint: ${ep.method ?? ""} ${ep.path}`.trim(),
+ summary: `Endpoint: ${name}`,
tags: [],
complexity: meta.complexity,
});