Skip to content

fix: remove duplicate LLMProviders.fromEnv() method#48

Merged
stackbilt-admin merged 1 commit intomainfrom
fix/duplicate-from-env
Apr 21, 2026
Merged

fix: remove duplicate LLMProviders.fromEnv() method#48
stackbilt-admin merged 1 commit intomainfrom
fix/duplicate-from-env

Conversation

@stackbilt-admin
Copy link
Copy Markdown
Member

Summary

Commit `33aaf53` added a new feature-complete `fromEnv(env, overrides?)` at class-body top but left the older 3-provider `fromEnv(env)` in place at class-body bottom. TypeScript 5.x catches this as `TS2393 Duplicate function implementation` so downstream CI builds fail at `tsc` on `npm install`.

Blocks `Stackbilt-dev/foodfiles#116` (Charter CI green needed to merge FoodFiles auth path fix).

What changed

Deleted the older `fromEnv(env)` stub (src/index.ts:377-395). Surviving method at :218 is a strict superset:

  • 5 providers (anthropic, openai, groq, cerebras, cloudflare) vs the old 3 (cloudflare, groq, cerebras)
  • `FromEnvOverrides` hook for `defaultProvider`, `costOptimization`, `enableCircuitBreaker`, `enableRetries`, `fallbackRules`, `ledger`, `quotaHook`, `quotaFailPolicy`, `hooks`
  • Throws `ConfigurationError` on no providers detected (safer default than the old silent `defaultProvider: 'auto'` fallback)

Back-compatible with existing 1-arg callers (`LLMProviders.fromEnv(env)`) because the second param is optional.

Test plan

  • `npm run build` clean (TS2393 resolved)
  • All 229 tests pass (including the 21-test `from-env.test.ts` suite)
  • Downstream Charter CI green on foodfiles#116

🤖 Generated with Claude Code

Commit 33aaf53 added a new feature-complete `fromEnv(env, overrides?)`
at class-body top but left the older 3-provider `fromEnv(env)` in place
at class-body bottom. TypeScript 5.x catches this as TS2393 "Duplicate
function implementation" so downstream CI builds (e.g. foodfiles Charter
check) fail at `tsc` on `npm install`.

The surviving method is a strict superset:
- 5 providers (anthropic, openai, groq, cerebras, cloudflare) vs the
  old 3 (cloudflare, groq, cerebras)
- FromEnvOverrides hook for defaultProvider, costOptimization,
  enableCircuitBreaker, enableRetries, fallbackRules, ledger, quotaHook,
  quotaFailPolicy, hooks
- Throws ConfigurationError on no providers detected (safer default
  than the old silent `defaultProvider: 'auto'` fallback)

Back-compatible with existing 1-arg callers (`LLMProviders.fromEnv(env)`)
because the second param is optional.

All 229 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@stackbilt-admin stackbilt-admin merged commit ef4fffc into main Apr 21, 2026
3 checks passed
@stackbilt-admin stackbilt-admin deleted the fix/duplicate-from-env branch April 21, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant