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

Method getDominantFile

src/db/queries.ts:1407–1421  ·  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

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