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

Method getFrameworkChangesSinceIndex

src/index.ts:1146–1167  ·  view source on GitHub ↗

* The frameworks that came or went since the last full index (#2516): files * indexed before the change were read without the frameworks added, and with * the ones removed, so a full re-index brings them in line. Null when nothing * changed; an index built before a half of this was recorded

()

Source from the content-addressed store, hash-verified

1144 * one the last full index had, covers that.
1145 */
1146 getFrameworkChangesSinceIndex(): { added: string[]; removed: string[] } | null {
1147 const names = (list: unknown): string[] => (Array.isArray(list) ? list.filter((n): n is string => typeof n === 'string') : []);
1148 const added = new Set<string>();
1149 const removed = new Set<string>();
1150 try {
1151 const value = this.queries.getMetadata(FRAMEWORKS_SINCE_INDEX_KEY);
1152 if (value) {
1153 const parsed = JSON.parse(value) as { added?: unknown; removed?: unknown };
1154 for (const name of names(parsed.added)) added.add(name);
1155 for (const name of names(parsed.removed)) removed.add(name);
1156 }
1157 } catch { /* metadata is advisory */ }
1158 try {
1159 const atIndex = parseNameList(this.queries.getMetadata(RESOLVER_FRAMEWORKS_AT_INDEX_KEY));
1160 if (atIndex) {
1161 const now = this.resolver.getDetectedFrameworks();
1162 for (const name of now) if (!atIndex.includes(name)) added.add(name);
1163 for (const name of atIndex) if (!now.includes(name)) removed.add(name);
1164 }
1165 } catch { /* metadata is advisory */ }
1166 return added.size > 0 || removed.size > 0 ? { added: [...added].sort(), removed: [...removed].sort() } : null;
1167 }
1168
1169 async sync(options: IndexOptions = {}): Promise<SyncResult> {
1170 const {

Callers 3

mainFunction · 0.80

Calls 6

parseNameListFunction · 0.85
getMetadataMethod · 0.80
parseMethod · 0.80
namesFunction · 0.50
addMethod · 0.45
getDetectedFrameworksMethod · 0.45

Tested by

no test coverage detected