MCPcopy Index your code
hub / github.com/Opencode-DCP/opencode-dynamic-context-pruning / getConfig

Function getConfig

lib/config.ts:969–1007  ·  view source on GitHub ↗
(ctx: PluginInput)

Source from the content-addressed store, hash-verified

967}
968
969export function getConfig(ctx: PluginInput): PluginConfig {
970 let config = deepCloneConfig(defaultConfig)
971 const configPaths = getConfigPaths(ctx)
972
973 if (!configPaths.global) {
974 createDefaultConfig()
975 }
976
977 const layers: Array<{ path: string | null; name: string; isProject: boolean }> = [
978 { path: configPaths.global, name: "config", isProject: false },
979 { path: configPaths.configDir, name: "configDir config", isProject: true },
980 { path: configPaths.project, name: "project config", isProject: true },
981 ]
982
983 for (const layer of layers) {
984 if (!layer.path) {
985 continue
986 }
987
988 const result = loadConfigFile(layer.path)
989 if (result.parseError) {
990 scheduleParseWarning(
991 ctx,
992 `DCP: Invalid ${layer.name}`,
993 `${layer.path}\n${result.parseError}\nUsing previous/default values`,
994 )
995 continue
996 }
997
998 if (!result.data) {
999 continue
1000 }
1001
1002 showConfigWarnings(ctx, layer.path, result.data, layer.isProject)
1003 config = mergeLayer(config, result.data)
1004 }
1005
1006 return config
1007}

Callers 2

index.tsFile · 0.90
loadConfigFunction · 0.90

Calls 7

deepCloneConfigFunction · 0.85
getConfigPathsFunction · 0.85
createDefaultConfigFunction · 0.85
loadConfigFileFunction · 0.85
scheduleParseWarningFunction · 0.85
showConfigWarningsFunction · 0.85
mergeLayerFunction · 0.85

Tested by

no test coverage detected