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

Method createFileNode

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

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