#!/usr/bin/env node /** * Installation verification script */ const { execSync } = require('child_process'); const fs = require('fs'); const path = require('path'); console.log('šŸ” Verifying MCP ProcFS Server Installation...\n'); const checks = []; // Check Node.js version try { const nodeVersion = process.version; const majorVersion = parseInt(nodeVersion.split('.')[0].replace('v', '')); if (majorVersion >= 18) { checks.push({ name: 'Node.js version', status: 'āœ“', message: nodeVersion }); } else { checks.push({ name: 'Node.js version', status: 'āœ—', message: `${nodeVersion} (requires >= 18)` }); } } catch (error) { checks.push({ name: 'Node.js version', status: 'āœ—', message: error.message }); } // Check if on Linux const platform = process.platform; if (platform === 'linux') { checks.push({ name: 'Operating System', status: 'āœ“', message: 'Linux' }); } else { checks.push({ name: 'Operating System', status: '⚠', message: `${platform} (designed for Linux)` }); } // Check procfs accessibility try { fs.accessSync('/proc/cpuinfo', fs.constants.R_OK); checks.push({ name: '/proc filesystem', status: 'āœ“', message: 'Accessible' }); } catch (error) { checks.push({ name: '/proc filesystem', status: 'āœ—', message: 'Not accessible' }); } // Check if built const distPath = path.join(__dirname, '..', 'dist'); if (fs.existsSync(distPath)) { const files = fs.readdirSync(distPath); if (files.length > 0) { checks.push({ name: 'TypeScript build', status: 'āœ“', message: 'Compiled' }); } else { checks.push({ name: 'TypeScript build', status: 'āœ—', message: 'Empty dist folder' }); } } else { checks.push({ name: 'TypeScript build', status: 'āœ—', message: 'Run npm run build' }); } // Check dependencies const packageJsonPath = path.join(__dirname, '..', 'package.json'); if (fs.existsSync(packageJsonPath)) { const nodeModulesPath = path.join(__dirname, '..', 'node_modules'); if (fs.existsSync(nodeModulesPath)) { checks.push({ name: 'Dependencies', status: 'āœ“', message: 'Installed' }); } else { checks.push({ name: 'Dependencies', status: 'āœ—', message: 'Run npm install' }); } } // Check for sysctl (optional) try { execSync('which sysctl', { stdio: 'pipe' }); checks.push({ name: 'sysctl utility', status: 'āœ“', message: 'Available' }); } catch (error) { checks.push({ name: 'sysctl utility', status: '⚠', message: 'Not found (optional)' }); } // Print results console.log('Installation Status:'); console.log('='.repeat(60)); checks.forEach(check => { console.log(`${check.status} ${check.name.padEnd(25)} ${check.message}`); }); console.log('='.repeat(60)); // Summary const passed = checks.filter(c => c.status === 'āœ“').length; const total = checks.length; const warnings = checks.filter(c => c.status === '⚠').length; const failed = checks.filter(c => c.status === 'āœ—').length; console.log(`\nāœ“ Passed: ${passed}/${total}`); if (warnings > 0) console.log(`⚠ Warnings: ${warnings}`); if (failed > 0) console.log(`āœ— Failed: ${failed}`); if (failed === 0) { console.log('\nāœ… Installation verified successfully!'); console.log('\nNext steps:'); console.log(' npm start # Start JSON-RPC server'); console.log(' npm run start:sse # Start HTTP/SSE server'); console.log(' npm test # Run tests'); process.exit(0); } else { console.log('\nāŒ Installation has issues. Please fix the failed checks above.'); process.exit(1); }