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

Method getFrameworkChangesSinceIndex

src/index.ts:1145–1166  ·  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

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