(repoDir: string)
| 2249 | * Used by content search to rank results. |
| 2250 | */ |
| 2251 | export 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 | |
| 2278 | export async function isRuntimeGitDirectory(params: IsGitDirectoryParams): Promise<IsGitDirectoryResponse> { |
| 2279 | return handleIsGitDirectory(params) |
no test coverage detected