refactor: extract constants, parameterize validators, simplify factory #7

Merged
jleibl merged 1 commits from refactor/quick-wins-factory-validators-constants into main 2026-05-21 11:36:34 +00:00

1 Commits

Author SHA1 Message Date
bb37e61eaf refactor: extract constants, parameterize validators, simplify factory
Quick-win refactors from the Refactoring Guru catalog:

- Replace Magic Number with Symbolic Constant: extract DEFAULT_TIMEOUT_MS,
  DEFAULT_MAX_RETRIES, DEFAULT_MAX_TOKENS, DEFAULT_TEMPERATURE, default
  models per provider, and validation prompt into src/constants.ts.
- Parameterize Method: collapse validateTemperature / validateTopP /
  validateMaxTokens (and the inline timeout/maxRetries checks) into a
  single validateNumberInRange helper with bounds metadata.
- Inline Class / Remove Middle Man: drop the unused ProviderRegistry
  class from utils/factory.ts. createProvider now dispatches through
  the PROVIDER_REGISTRY const directly instead of a parallel switch.

Also fixes stale VERSION constant in src/index.ts (was 1.3.1).
2026-05-21 13:35:12 +02:00