()
| 322 | if (!isGitlabRoute && owner?.toLowerCase() === "explore") return; |
| 323 | |
| 324 | const autoFetchAndIndex = async () => { |
| 325 | setLoading(true); |
| 326 | setError(null); |
| 327 | |
| 328 | try { |
| 329 | try { |
| 330 | const cached = await getCachedGraph(repoRef); |
| 331 | if (cached) { |
| 332 | setProgressText("Loading cached codebase graph..."); |
| 333 | setProgressValue(90); |
| 334 | await new Promise((r) => setTimeout(r, 100)); |
| 335 | setGraphData(cached); |
| 336 | setProgressText("Complete!"); |
| 337 | setProgressValue(100); |
| 338 | setLoading(false); |
| 339 | console.log(`[Cache] Loaded repository graph for ${repoRef.fullPath} from IndexedDB cache.`); |
| 340 | return; |
| 341 | } |
| 342 | } catch (cacheErr) { |
| 343 | console.warn("[Cache] Error reading from cache:", cacheErr); |
| 344 | } |
| 345 | |
| 346 | const { files, fileContents, latestCommitSha } = await fetchRepositoryFiles(repoRef, { |
| 347 | onProgressText: setProgressText, |
| 348 | onProgressValue: setProgressValue, |
| 349 | isPathIgnored, |
| 350 | fetchWithProgress, |
| 351 | fetchWithFallbackProxies, |
| 352 | }); |
| 353 | |
| 354 | // --- COMMON SEMANTIC INDEXING PHASE --- |
| 355 | setProgressText("Initializing WebAssembly semantic engine..."); |
| 356 | setProgressValue(60); |
| 357 | |
| 358 | // Load custom indexer settings from localStorage |
| 359 | let localConfig = { indexVariables: false, maxNodes: 100000, maxEdges: 50000 }; |
| 360 | try { |
| 361 | const saved = localStorage.getItem('cgc_indexer_config'); |
| 362 | if (saved) { |
| 363 | localConfig = { ...localConfig, ...JSON.parse(saved) }; |
| 364 | } |
| 365 | } catch (e) {} |
| 366 | |
| 367 | const graphData = await parseFilesIntoGraph( |
| 368 | files, |
| 369 | (msg, val, diagLog) => { |
| 370 | if (diagLog) { |
| 371 | setWorkerLogs(prev => [...prev, diagLog]); |
| 372 | } else { |
| 373 | setProgressText(msg); |
| 374 | setProgressValue(val); |
| 375 | } |
| 376 | }, |
| 377 | { |
| 378 | indexVariables: localConfig.indexVariables, |
| 379 | maxNodes: localConfig.maxNodes, |
| 380 | maxEdges: localConfig.maxEdges |
| 381 | } |
no test coverage detected