(
prompts: PromptIO,
allModels: string[],
role: ModelRole,
)
| 69 | * — never block setup behind an empty list. |
| 70 | */ |
| 71 | export async function pickModel( |
| 72 | prompts: PromptIO, |
| 73 | allModels: string[], |
| 74 | role: ModelRole, |
| 75 | ): Promise<string> { |
| 76 | const copy = ROLE_COPY[role]; |
| 77 | prompts.note(copy.blurb, copy.title); |
| 78 | |
| 79 | const options = modelOptions(allModels); |
| 80 | if (options.length === 0) { |
| 81 | return ( |
| 82 | await prompts.text(`${copy.pickMessage} (type a provider/model id)`, { |
| 83 | placeholder: "e.g. anthropic/claude-haiku-4-5", |
| 84 | validate: (value) => |
| 85 | value.trim().length === 0 ? "A model id is required" : undefined, |
| 86 | }) |
| 87 | ).trim(); |
| 88 | } |
| 89 | return prompts.selectAutocomplete(copy.pickMessage, options, { |
| 90 | placeholder: copy.placeholder, |
| 91 | }); |
| 92 | } |
no test coverage detected