MCPcopy Index your code
hub / github.com/BlockRunAI/ClawRouter / loadExcludeList

Function loadExcludeList

src/exclude-models.ts:23–42  ·  view source on GitHub ↗
(filePath: string = DEFAULT_FILE_PATH)

Source from the content-addressed store, hash-verified

21 * Returns an empty set if the file does not exist.
22 */
23export function loadExcludeList(filePath: string = DEFAULT_FILE_PATH): Set<string> {
24 try {
25 const mtimeMs = statSync(filePath).mtimeMs;
26 const cached = loadCache.get(filePath);
27 if (cached && cached.mtimeMs === mtimeMs) {
28 // Copy: callers may mutate the returned set
29 return new Set(cached.set);
30 }
31 const raw = readFileSync(filePath, "utf-8");
32 const arr: unknown = JSON.parse(raw);
33 const set = Array.isArray(arr)
34 ? new Set(arr.filter((x): x is string => typeof x === "string"))
35 : new Set<string>();
36 loadCache.set(filePath, { mtimeMs, set });
37 return new Set(set);
38 } catch {
39 loadCache.delete(filePath);
40 return new Set();
41 }
42}
43
44/**
45 * Save a set of model IDs to disk as a sorted JSON array.

Callers 6

startProxyInBackgroundFunction · 0.85
proxyRequestFunction · 0.85
addExclusionFunction · 0.85
removeExclusionFunction · 0.85
createExcludeCommandFunction · 0.85

Calls 2

getMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected