MCPcopy Create free account
hub / github.com/codeaashu/claude-code / loadCachedRestrictions

Function loadCachedRestrictions

src/services/policyLimits/index.ts:392–405  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

390 */
391// sync IO: called from sync context (getRestrictionsFromCache -> isPolicyAllowed)
392function loadCachedRestrictions(): PolicyLimitsResponse['restrictions'] | null {
393 try {
394 const content = fsReadFileSync(getCachePath(), 'utf-8')
395 const data = safeParseJSON(content, false)
396 const parsed = PolicyLimitsResponseSchema().safeParse(data)
397 if (!parsed.success) {
398 return null
399 }
400
401 return parsed.data.restrictions
402 } catch {
403 return null
404 }
405}
406
407/**
408 * Save restrictions to cache file

Callers 2

fetchAndLoadPolicyLimitsFunction · 0.85
getRestrictionsFromCacheFunction · 0.85

Calls 1

getCachePathFunction · 0.70

Tested by

no test coverage detected