How bariskisir/opencodemodelupdater works
OpenCode Model Updater is a CLI that fetches model listings from selected providers, preserves existing provider settings, and writes generated entries to OpenCode configuration. Its other user-facing branches list providers and remove generated entries. The sampled source shows the command orchestration, config operations, provider registry, and shared OpenAI-compatible fetch implementation; README documents 24 providers, whose individual adapter implementations were not all sampled.
Main entry points: src/index.ts Command workflow · config.ts Config operations · providers/index.ts Provider registry · openai-compatible-factory.ts Compatible fetcher
Components 11
CLI workflow
- Command workflow
src/index.ts
Provider integration
- Provider registry
src/providers/index.ts - 24 provider adapters
src/providers - Compatible fetcher
src/providers/openai-compatible-factory.ts
Configuration
- Config operations
src/config.ts - Domain types
src/types.ts
Other components
- CLI user
- Provider model APIs
- OpenCode config file
- Timestamped backup
- Updated OpenCode config
Connections 14
- CLI user → Command workflow: runs
- Command workflow → Provider registry: selects providers
- Command workflow → Config operations: reads config
- Command workflow → Config operations: backs up config
- Command workflow → Config operations: merges or removes
- Command workflow → Config operations: writes config
- Provider registry → 24 provider adapters: resolves handlers
- Command workflow → Compatible fetcher: invokes handler fetch
- Compatible fetcher → Provider model APIs: fetches models
- Config operations → OpenCode config file: reads
- Config operations → Timestamped backup: copies
- Config operations → OpenCode config file: writes
- Config operations → Updated OpenCode config: produces config
- Command workflow → Updated OpenCode config: reports result