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

Method createFileNode

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

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