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

Method getDominantFile

src/db/queries.ts:1409–1423  ·  view source on GitHub ↗

* Find the file that holds the densest concentration of the project's * internal call graph — the "core" file. Used by context-builder to * boost ranking of symbols in that file's directory (so e.g. sinatra * queries surface `lib/sinatra/base.rb`'s `route!` instead of * `sinatra-contrib/

()

Source from the content-addressed store, hash-verified

1407 * stamp: recomputed only after something wrote to the database.
1408 */
1409 getDominantFile(): { filePath: string; edgeCount: number; nextEdgeCount: number } | null {
1410 // total_changes() counts writes that are later rolled back, so a result
1411 // read inside a transaction could outlive a ROLLBACK under an unchanged
1412 // stamp. Never keep one; `undefined` (a runtime without the getter) is
1413 // treated the same way.
1414 if (this.db.inTransaction !== false) {
1415 this.dominantFileMemo = undefined;
1416 return this.computeDominantFile();
1417 }
1418 const stamp = this.getChangeStamp();
1419 if (this.dominantFileMemo?.stamp === stamp) return this.dominantFileMemo.value;
1420 const value = this.computeDominantFile();
1421 this.dominantFileMemo = { stamp, value };
1422 return value;
1423 }
1424
1425 /**
1426 * A value that differs whenever the database content may have changed

Calls 2

computeDominantFileMethod · 0.95
getChangeStampMethod · 0.95

Tested by

no test coverage detected