/** * Check KSP setup for ksp-mcp requirements * * Verifies: * - KSP_DIR environment variable is set * - Required addons are installed in GameData */ import { existsSync } from 'fs'; import { join } from 'path'; const REQUIRED_ADDONS = [ { name: 'kOS', path: 'kOS', required: true }, { name: 'MechJeb2', path: 'MechJeb2', required: true }, { name: 'kOS.MechJeb2.Addon', path: 'kOS.MechJeb2.Addon', required: true }, ]; const OPTIONAL_ADDONS = [ { name: 'KSP-AutoLoad', path: 'KSP-AutoLoad', required: false }, ]; function checkSetup(): void { const kspDir = process.env.KSP_DIR; let hasWarnings = false; console.log('\nšŸš€ ksp-mcp Setup Check\n'); // Check KSP_DIR if (!kspDir) { console.log('āš ļø KSP_DIR environment variable not set'); console.log(' Set it to your KSP installation path:'); console.log(' export KSP_DIR="/path/to/Kerbal Space Program"\n'); console.log(' Addon check skipped.\n'); printRerunInstructions(); return; } if (!existsSync(kspDir)) { console.log(`āš ļø KSP_DIR path does not exist: ${kspDir}\n`); printRerunInstructions(); return; } console.log(`āœ“ KSP_DIR: ${kspDir}\n`); const gameDataPath = join(kspDir, 'GameData'); // Check required addons console.log('Required Addons:'); for (const addon of REQUIRED_ADDONS) { const addonPath = join(gameDataPath, addon.path); if (existsSync(addonPath)) { console.log(` āœ“ ${addon.name}`); } else { console.log(` āœ— ${addon.name} - NOT FOUND`); hasWarnings = true; } } // Check optional addons console.log('\nOptional Addons:'); for (const addon of OPTIONAL_ADDONS) { const addonPath = join(gameDataPath, addon.path); if (existsSync(addonPath)) { console.log(` āœ“ ${addon.name}`); } else { console.log(` - ${addon.name} - not installed`); } } console.log(''); if (hasWarnings) { console.log('āš ļø Some required addons are missing.'); console.log(' Install them to use all ksp-mcp features.\n'); } else { console.log('āœ“ All required addons installed!\n'); } printRerunInstructions(); } function printRerunInstructions(): void { console.log('To rerun this check: npx ksp-mcp-check'); console.log('Or: npm exec ksp-mcp-check\n'); } checkSetup();