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

Method getFrameworkChangesSinceIndex

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

1122 * one the last full index had, covers that.
1123 */
1124 getFrameworkChangesSinceIndex(): { added: string[]; removed: string[] } | null {
1125 const names = (list: unknown): string[] => (Array.isArray(list) ? list.filter((n): n is string => typeof n === 'string') : []);
1126 const added = new Set<string>();
1127 const removed = new Set<string>();
1128 try {
1129 const value = this.queries.getMetadata(FRAMEWORKS_SINCE_INDEX_KEY);
1130 if (value) {
1131 const parsed = JSON.parse(value) as { added?: unknown; removed?: unknown };
1132 for (const name of names(parsed.added)) added.add(name);
1133 for (const name of names(parsed.removed)) removed.add(name);
1134 }
1135 } catch { /* metadata is advisory */ }
1136 try {
1137 const atIndex = parseNameList(this.queries.getMetadata(RESOLVER_FRAMEWORKS_AT_INDEX_KEY));
1138 if (atIndex) {
1139 const now = this.resolver.getDetectedFrameworks();
1140 for (const name of now) if (!atIndex.includes(name)) added.add(name);
1141 for (const name of atIndex) if (!now.includes(name)) removed.add(name);
1142 }
1143 } catch { /* metadata is advisory */ }
1144 return added.size > 0 || removed.size > 0 ? { added: [...added].sort(), removed: [...removed].sort() } : null;
1145 }
1146
1147 async sync(options: IndexOptions = {}): Promise<SyncResult> {
1148 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