MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / favoriteAreas

Function favoriteAreas

src/context/user-model.ts:43–50  ·  view source on GitHub ↗
(fileLists: string[][], topK = 3)

Source from the content-addressed store, hash-verified

41
42/** Directories the user works in most, from the files their episodes touched (2-level). PURE. */
43export function favoriteAreas(fileLists: string[][], topK = 3): string[] {
44 const freq = new Map<string, number>();
45 for (const files of fileLists) for (const f of files) {
46 const area = f.split('/').slice(0, 2).join('/');
47 if (area) freq.set(area, (freq.get(area) ?? 0) + 1);
48 }
49 return [...freq.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).slice(0, topK).map(([a]) => a);
50}
51
52export function buildUserModel(input: { userFacts: string[]; episodes: { prompt: string; files?: string[] }[] }): UserModel {
53 const preferences = input.userFacts

Callers 2

user-model.test.tsFile · 0.90
buildUserModelFunction · 0.85

Calls 2

setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected