MCPcopy Create free account
hub / github.com/Noumena-Network/code / parseSettingsFile

Function parseSettingsFile

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

Source from the content-addressed store, hash-verified

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