MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getSettingsForSourceUncached

Function getSettingsForSourceUncached

src/utils/settings/settings.ts:319–368  ·  view source on GitHub ↗
(
  source: SettingSource,
)

Source from the content-addressed store, hash-verified

317}
318
319function getSettingsForSourceUncached(
320 source: SettingSource,
321): SettingsJson | null {
322 // For policySettings: first source wins (remote > HKLM/plist > file > HKCU)
323 if (source === 'policySettings') {
324 const remoteSettings = getRemoteManagedSettingsSyncFromCache()
325 if (remoteSettings && Object.keys(remoteSettings).length > 0) {
326 return remoteSettings
327 }
328
329 const mdmResult = getMdmSettings()
330 if (Object.keys(mdmResult.settings).length > 0) {
331 return mdmResult.settings
332 }
333
334 const { settings: fileSettings } = loadManagedFileSettings()
335 if (fileSettings) {
336 return fileSettings
337 }
338
339 const hkcu = getHkcuSettings()
340 if (Object.keys(hkcu.settings).length > 0) {
341 return hkcu.settings
342 }
343
344 return null
345 }
346
347 const settingsFilePath = getSettingsFilePathForSource(source)
348 const { settings: fileSettings } = settingsFilePath
349 ? parseSettingsFile(settingsFilePath)
350 : { settings: null }
351
352 // For flagSettings, merge in any inline settings set via the SDK
353 if (source === 'flagSettings') {
354 const inlineSettings = getFlagSettingsInline()
355 if (inlineSettings) {
356 const parsed = SettingsSchema().safeParse(inlineSettings)
357 if (parsed.success) {
358 return mergeWith(
359 fileSettings || {},
360 parsed.data,
361 settingsMergeCustomizer,
362 ) as SettingsJson
363 }
364 }
365 }
366
367 return fileSettings
368}
369
370/**
371 * Get the origin of the highest-priority active policy settings source.

Callers 2

getSettingsForSourceFunction · 0.85
updateSettingsForSourceFunction · 0.85

Calls 8

getMdmSettingsFunction · 0.85
loadManagedFileSettingsFunction · 0.85
getHkcuSettingsFunction · 0.85
parseSettingsFileFunction · 0.85
getFlagSettingsInlineFunction · 0.85
keysMethod · 0.80

Tested by

no test coverage detected