MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / getHotFiles

Function getHotFiles

projects/electron/src/modules/code/git.ts:2251–2276  ·  view source on GitHub ↗
(repoDir: string)

Source from the content-addressed store, hash-verified

2249 * Used by content search to rank results.
2250 */
2251export async function getHotFiles(repoDir: string): Promise<Record<string, number>> {
2252 const startTime = Date.now()
2253
2254 // Check cache
2255 const cached = hotFilesCache.get(repoDir)
2256 if (cached && Date.now() - cached.timestamp < HOT_FILES_CACHE_TTL) {
2257 logger.info("[Git:getHotFiles] Returning cached hot files", JSON.stringify({
2258 repoDir,
2259 fileCount: Object.keys(cached.files).length,
2260 cacheAge: Math.round((Date.now() - cached.timestamp) / 1000) + "s",
2261 }))
2262 return cached.files
2263 }
2264
2265 // Build cache
2266 const files = await buildHotFilesCache(repoDir)
2267 hotFilesCache.set(repoDir, { files, timestamp: Date.now() })
2268
2269 logger.info("[Git:getHotFiles] Built hot files cache", JSON.stringify({
2270 repoDir,
2271 fileCount: Object.keys(files).length,
2272 duration: Date.now() - startTime,
2273 }))
2274
2275 return files
2276}
2277
2278export async function isRuntimeGitDirectory(params: IsGitDirectoryParams): Promise<IsGitDirectoryResponse> {
2279 return handleIsGitDirectory(params)

Callers 1

handleContentSearchFunction · 0.90

Calls 3

buildHotFilesCacheFunction · 0.85
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected