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

Method buildFileRecord

src/extraction/index.ts:3613–3635  ·  view source on GitHub ↗

The FileRecord for a fresh-index store (nodeCount is the PRE-filter count).

(
    filePath: string,
    content: string,
    language: Language,
    stats: fs.Stats,
    nodeCount: number,
    resultErrors: ExtractionResult['errors']
  )

Source from the content-addressed store, hash-verified

3611 */
3612 /** The FileRecord for a fresh-index store (nodeCount is the PRE-filter count). */
3613 private buildFileRecord(
3614 filePath: string,
3615 content: string,
3616 language: Language,
3617 stats: fs.Stats,
3618 nodeCount: number,
3619 resultErrors: ExtractionResult['errors']
3620 ): FileRecord {
3621 return {
3622 path: filePath,
3623 contentHash: hashContent(content),
3624 language,
3625 size: stats.size,
3626 modifiedAt: stats.mtimeMs,
3627 indexedAt: Date.now(),
3628 nodeCount,
3629 errors: resultErrors.length > 0 ? resultErrors : undefined,
3630 // Decided here, once, while the content is already in memory — never at
3631 // query time (#1500). The header scan short-circuits on a single
3632 // substring test for ~every hand-written file.
3633 generated: detectGeneratedFile(filePath, content),
3634 };
3635 }
3636
3637 private buildFreshStoreBundle(
3638 filePath: string,

Callers 2

storeResultMethod · 0.95
buildFreshStoreBundleMethod · 0.95

Calls 2

detectGeneratedFileFunction · 0.90
hashContentFunction · 0.85

Tested by

no test coverage detected