MCPcopy Index your code
hub / github.com/continuedev/continue / getComputeDeleteAddRemove

Function getComputeDeleteAddRemove

core/indexing/refreshIndex.ts:395–467  ·  view source on GitHub ↗
(
  tag: IndexTag,
  currentFiles: FileStatsMap,
  readFile: (path: string) => Promise<string>,
  repoName: string | undefined,
)

Source from the content-addressed store, hash-verified

393}
394
395export async function getComputeDeleteAddRemove(
396 tag: IndexTag,
397 currentFiles: FileStatsMap,
398 readFile: (path: string) => Promise<string>,
399 repoName: string | undefined,
400): Promise<[RefreshIndexResults, PathAndCacheKey[], MarkCompleteCallback]> {
401 const [add, remove, lastUpdated, markComplete] = await getAddRemoveForTag(
402 tag,
403 currentFiles,
404 readFile,
405 );
406
407 const compute: PathAndCacheKey[] = [];
408 const del: PathAndCacheKey[] = [];
409 const addTag: PathAndCacheKey[] = [];
410 const removeTag: PathAndCacheKey[] = [];
411
412 for (const { path, cacheKey } of add) {
413 const existingTags = await getTagsFromGlobalCache(cacheKey, tag.artifactId);
414 if (existingTags.length > 0) {
415 addTag.push({ path, cacheKey });
416 } else {
417 compute.push({ path, cacheKey });
418 }
419 }
420
421 for (const { path, cacheKey } of remove) {
422 const existingTags = await getTagsFromGlobalCache(cacheKey, tag.artifactId);
423 if (existingTags.length > 1) {
424 removeTag.push({ path, cacheKey });
425 } else {
426 if (existingTags.length === 0) {
427 // console.warn("Existing tags should not be empty when trying to remove");
428 }
429
430 del.push({ path, cacheKey });
431 }
432 }
433
434 const results = {
435 compute,
436 del,
437 addTag,
438 removeTag,
439 };
440
441 const globalCacheIndex = await GlobalCacheCodeBaseIndex.create();
442
443 return [
444 results,
445 lastUpdated,
446 async (items, resultType) => {
447 // Update tag catalog
448 await markComplete(items, resultType);
449
450 // Update the global cache
451 const results: any = {
452 compute: [],

Callers 3

getIndexPlanFunction · 0.85
refreshFileMethod · 0.85
indexFilesMethod · 0.85

Calls 6

getAddRemoveForTagFunction · 0.85
getTagsFromGlobalCacheFunction · 0.85
markCompleteFunction · 0.85
pushMethod · 0.65
updateMethod · 0.65
createMethod · 0.45

Tested by 1

getIndexPlanFunction · 0.68