import chalk from "chalk"; import { loadConfig, getConfigPath } from "../auth/config"; export function showConfig(): void { const configPath = getConfigPath(); try { const config = loadConfig(); console.log(chalk.bold("\nConfiguration\n")); console.log(` Config file: ${chalk.cyan(configPath)}`); const apiKey = config.apiKey as string | undefined const apiBase = config.apiBase as string | undefined const defaultModel = config.defaultModel as string | undefined console.log(` API base: ${chalk.cyan(apiBase ?? "(not set)")}`); console.log(` Default model: ${chalk.cyan(defaultModel || "(not set)")}`); if (apiKey) { const masked = apiKey.length > 12 ? `${apiKey.slice(0, 6)}...${apiKey.slice(-4)}` : "(set)"; console.log(` API key: ${chalk.green(masked)}`); } else { console.log(` API key: ${chalk.red("(not set)")}`); console.log( chalk.dim(`\n Run ${chalk.bold("llmtune login")} to configure your API key.`) ); } console.log(); } catch { console.log(chalk.dim(`\n No config found at ${configPath}`)); console.log( chalk.dim(` Run ${chalk.bold("llmtune login")} to get started.\n`) ); } }