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

Function withoutHostManagedProviderVars

src/utils/managedEnv.ts:45–59  ·  view source on GitHub ↗

* When the host owns inference routing (sets * CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST in spawn env), strip * provider-selection / model-default vars from settings-sourced env so a * user's ~/.claude/settings.json can't redirect requests away from the * host-configured provider.

(
  env: Record<string, string> | undefined,
)

Source from the content-addressed store, hash-verified

43 * host-configured provider.
44 */
45function withoutHostManagedProviderVars(
46 env: Record<string, string> | undefined,
47): Record<string, string> {
48 if (!env) return {}
49 if (!isEnvTruthy(process.env.CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST)) {
50 return env
51 }
52 const out: Record<string, string> = {}
53 for (const [key, value] of Object.entries(env)) {
54 if (!isProviderManagedEnvVar(key)) {
55 out[key] = value
56 }
57 }
58 return out
59}
60
61/**
62 * Snapshot of env keys present before any settings.env is applied — for CCD,

Callers 1

filterSettingsEnvFunction · 0.85

Calls 3

isEnvTruthyFunction · 0.85
isProviderManagedEnvVarFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected