* Render a config value for a warning message in a way that never leaks resolved * secrets from `{env:API_KEY}` / `{file:...}` substitution. * * Strings, numbers, booleans, and nulls are shown as type-plus-length so the * user can still diagnose the problem ("string, 48 chars", "number 200001")
(value: unknown)
| 199 | * `<missing>`. |
| 200 | */ |
| 201 | function redactConfigValue(value: unknown): string { |
| 202 | if (value === undefined) return "<missing>"; |
| 203 | if (value === null) return "null"; |
| 204 | if (typeof value === "string") |
| 205 | return `string, ${value.length} char${value.length === 1 ? "" : "s"}`; |
| 206 | if (typeof value === "number") return `number ${value}`; |
| 207 | if (typeof value === "boolean") return `boolean ${value}`; |
| 208 | if (Array.isArray(value)) return `array, ${value.length} item${value.length === 1 ? "" : "s"}`; |
| 209 | if (typeof value === "object") { |
| 210 | const keys = Object.keys(value as Record<string, unknown>); |
| 211 | return `object with keys [${keys.join(", ")}]`; |
| 212 | } |
| 213 | return typeof value; |
| 214 | } |
| 215 | |
| 216 | function parsePluginConfig( |
| 217 | rawConfig: Record<string, unknown>, |