Script for easily configuring, using, switching and comparing local offline coding models
at main 27 lines 748 B view raw
1import { log } from "../log.js"; 2import { commandExists, runPassthrough } from "../util.js"; 3import { getActiveTui } from "../runtime-config.js"; 4 5function brewInstallIfMissing(cmd: string, pkg?: string): void { 6 if (commandExists(cmd)) { 7 log(`${pkg ?? cmd} already installed.`); 8 } else { 9 log(`Installing ${pkg ?? cmd}...`); 10 runPassthrough(`brew install ${pkg ?? cmd}`); 11 } 12} 13 14export function installTools(): void { 15 brewInstallIfMissing("jq"); 16 brewInstallIfMissing("python3", "python@3.12"); 17 brewInstallIfMissing("pipx"); 18 19 const tui = getActiveTui(); 20 21 if (!commandExists(tui.checkCmd)) { 22 log(`Installing ${tui.name}...`); 23 runPassthrough(tui.installCmd); 24 } else { 25 log(`${tui.name} already installed.`); 26 } 27}