MCPcopy Create free account
hub / github.com/Opencode-DCP/opencode-dynamic-context-pruning / getConfigKeyPaths

Function getConfigKeyPaths

lib/config.ts:139–155  ·  view source on GitHub ↗
(obj: Record<string, any>, prefix = "")

Source from the content-addressed store, hash-verified

137])
138
139function getConfigKeyPaths(obj: Record<string, any>, prefix = ""): string[] {
140 const keys: string[] = []
141 for (const key of Object.keys(obj)) {
142 const fullKey = prefix ? `${prefix}.${key}` : key
143 keys.push(fullKey)
144
145 // model*Limits are dynamic maps keyed by providerID/modelID; do not recurse into arbitrary IDs.
146 if (fullKey === "compress.modelMaxLimits" || fullKey === "compress.modelMinLimits") {
147 continue
148 }
149
150 if (obj[key] && typeof obj[key] === "object" && !Array.isArray(obj[key])) {
151 keys.push(...getConfigKeyPaths(obj[key], fullKey))
152 }
153 }
154 return keys
155}
156
157export function getInvalidConfigKeys(userConfig: Record<string, any>): string[] {
158 const userKeys = getConfigKeyPaths(userConfig)

Callers 1

getInvalidConfigKeysFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected