MCPcopy
hub / github.com/codeaashu/claude-code / parseSettingsFile

Function parseSettingsFile

src/utils/settings/settings.ts:178–199  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

176 * @returns Parsed settings data and validation errors
177 */
178export function parseSettingsFile(path: string): {
179 settings: SettingsJson | null
180 errors: ValidationError[]
181} {
182 const cached = getCachedParsedFile(path)
183 if (cached) {
184 // Clone so callers (e.g. mergeWith in getSettingsForSourceUncached,
185 // updateSettingsForSource) can't mutate the cached entry.
186 return {
187 settings: cached.settings ? clone(cached.settings) : null,
188 errors: cached.errors,
189 }
190 }
191 const result = parseSettingsFileUncached(path)
192 setCachedParsedFile(path, result)
193 // Clone the first return too — the caller may mutate before
194 // another caller reads the same cache entry.
195 return {
196 settings: result.settings ? clone(result.settings) : null,
197 errors: result.errors,
198 }
199}
200
201function parseSettingsFileUncached(path: string): {
202 settings: SettingsJson | null

Callers 6

loadManagedFileSettingsFunction · 0.85
loadSettingsFromDiskFunction · 0.85
getAddDirEnabledPluginsFunction · 0.85

Calls 4

getCachedParsedFileFunction · 0.85
cloneFunction · 0.85
setCachedParsedFileFunction · 0.85

Tested by

no test coverage detected