105 líneas
3.4 KiB
JavaScript
Archivo Ejecutable
105 líneas
3.4 KiB
JavaScript
Archivo Ejecutable
#!/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);
|
|
}
|