MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / createFileNode

Method createFileNode

src/extraction/cfml-extractor.ts:120–138  ·  view source on GitHub ↗

Build the file's own `kind:'file'` node, spanning the whole source. Tag-based files need this explicitly — unlike `extractBareScript` (which delegates the whole file to `TreeSitterExtractor` and inherits its file node), `extractTagBased` walks the tree itself and has no other source of one.

()

Source from the content-addressed store, hash-verified

118
119 /** Build the file's own `kind:'file'` node, spanning the whole source. Tag-based files need this explicitly — unlike `extractBareScript` (which delegates the whole file to `TreeSitterExtractor` and inherits its file node), `extractTagBased` walks the tree itself and has no other source of one. */
120 private createFileNode(): Node {
121 const lines = this.source.split('\n');
122 const id = generateNodeId(this.filePath, 'file', this.filePath, 1);
123 const fileNode: Node = {
124 id,
125 kind: 'file',
126 name: this.filePath.split(/[/\\]/).pop() || this.filePath,
127 qualifiedName: this.filePath,
128 filePath: this.filePath,
129 language: this.language,
130 startLine: 1,
131 endLine: lines.length,
132 startColumn: 0,
133 endColumn: lines[lines.length - 1]?.length || 0,
134 updatedAt: Date.now(),
135 };
136 this.nodes.push(fileNode);
137 return fileNode;
138 }
139
140 /**
141 * Walks `program`'s named children with a single forward cursor (not an

Callers 1

extractTagBasedMethod · 0.95

Calls 1

generateNodeIdFunction · 0.90

Tested by

no test coverage detected