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

Method createFileNode

src/extraction/cfml-extractor.ts:184–202  ·  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

182
183 /** 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. */
184 private createFileNode(): Node {
185 const lines = this.source.split('\n');
186 const id = generateNodeId(this.filePath, 'file', this.filePath, 1);
187 const fileNode: Node = {
188 id,
189 kind: 'file',
190 name: this.filePath.split(/[/\\]/).pop() || this.filePath,
191 qualifiedName: this.filePath,
192 filePath: this.filePath,
193 language: this.language,
194 startLine: 1,
195 endLine: lines.length,
196 startColumn: 0,
197 endColumn: lines[lines.length - 1]?.length || 0,
198 updatedAt: Date.now(),
199 };
200 this.nodes.push(fileNode);
201 return fileNode;
202 }
203
204 /**
205 * Walks `program`'s named children with a single forward cursor (not an

Callers 1

extractTagBasedMethod · 0.95

Calls 2

generateNodeIdFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected