UNPKG

sourcesailor

Version:

A CLI tool for analyzing and documenting codebases

33 lines (32 loc) 1.19 kB
import ModelUtils from "../modelUtils.mjs"; import chalk from "chalk"; export const command = 'listModels [verbose]'; export const describe = 'List all available models grouped by provider'; export function builder(yargs) { return yargs.option('verbose', { alias: 'v', type: 'boolean', description: 'Show detailed model information', default: false }); } // eslint-disable-next-line @typescript-eslint/no-unused-vars export async function handler(argv) { console.log(chalk.blue('Listing all available models grouped by provider:')); try { const modelUtils = ModelUtils.getInstance(); await modelUtils.initializeModels(); const modelsByProvider = modelUtils.getModelsByProvider(); for (const [provider, models] of Object.entries(modelsByProvider)) { console.log(chalk.green(`\n${provider}:`)); models.forEach(model => { console.log(chalk.yellow(` - ${model}`)); }); } } catch (error) { console.error(chalk.red('Error listing models:'), error); } } export const usage = '$0 <cmd> [args]'; export const aliases = ['models', 'lm'];