refactor(provider): flow branded ProviderID/ModelID through internal signatures (#17182)

This commit is contained in:
Kit Langton
2026-03-12 10:48:17 -04:00
committed by GitHub
parent a4f8d66a9b
commit 1cb7df7159
24 changed files with 227 additions and 205 deletions

View File

@@ -1,6 +1,7 @@
import type { Argv } from "yargs"
import { Instance } from "../../project/instance"
import { Provider } from "../../provider/provider"
import { ProviderID } from "../../provider/schema"
import { ModelsDev } from "../../provider/models"
import { cmd } from "./cmd"
import { UI } from "../ui"
@@ -36,7 +37,7 @@ export const ModelsCommand = cmd({
async fn() {
const providers = await Provider.list()
function printModels(providerID: string, verbose?: boolean) {
function printModels(providerID: ProviderID, verbose?: boolean) {
const provider = providers[providerID]
const sortedModels = Object.entries(provider.models).sort(([a], [b]) => a.localeCompare(b))
for (const [modelID, model] of sortedModels) {
@@ -56,7 +57,7 @@ export const ModelsCommand = cmd({
return
}
printModels(args.provider, args.verbose)
printModels(ProviderID.make(args.provider), args.verbose)
return
}
@@ -69,7 +70,7 @@ export const ModelsCommand = cmd({
})
for (const providerID of providerIDs) {
printModels(providerID, args.verbose)
printModels(ProviderID.make(providerID), args.verbose)
}
},
})