MCPcopy
hub / github.com/opentrace/opentrace / summarizeNode

Function summarizeNode

ui/src/components/pipeline/stages/summarizing.ts:38–61  ·  view source on GitHub ↗

Build a SymbolMetadata object from a graph node's properties.

(node: GraphNode)

Source from the content-addressed store, hash-verified

36
37/** Build a SymbolMetadata object from a graph node's properties. */
38function summarizeNode(node: GraphNode): string {
39 const kind = TYPE_TO_KIND[node.type];
40 if (!kind) {
41 // Fallback for Repository, Package, etc.
42 return `${node.type} ${node.name}`;
43 }
44
45 const props = node.properties ?? {};
46 return summarizeFromMetadata({
47 name: node.name,
48 kind,
49 signature: props.signature as string | undefined,
50 language: props.language as string | undefined,
51 lineCount:
52 typeof props.startLine === 'number' && typeof props.endLine === 'number'
53 ? props.endLine - props.startLine + 1
54 : undefined,
55 receiverType: props.receiver_type as string | undefined,
56 fileName:
57 kind === 'file' ? ((props.path as string) ?? node.name) : undefined,
58 childNames: props.childNames as string[] | undefined,
59 docs: props.docs as string | undefined,
60 });
61}
62
63/**
64 * Wrap an inner event generator, adding summaries to every node that

Callers 1

wrapWithSummariesFunction · 0.85

Calls 1

summarizeFromMetadataFunction · 0.90

Tested by

no test coverage detected