mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
- Replace mock data with real metrics from .claude-flow/metrics/ files - Fix MCP Server detection to properly show running status - Make agent spawn and task creation fully functional with file persistence - Update binary wrapper to prioritize local source over npm packages - Bump version to 2.0.0-alpha.111 Changes: - Created MetricsReader utility to read actual metrics files - Updated status.js to display real system metrics, not hardcoded values - Fixed agent.js to create real agent files in .claude-flow/agents/ - Fixed task.js to maintain actual task queue in .claude-flow/tasks/ - Modified ./claude-flow binary to use local source directly - Broadened MCP detection pattern to catch all MCP variants All status commands now show live, accurate data: - Real memory usage, CPU load, and disk stats - Actual agent counts and statuses from persisted files - Live task queue with real queued tasks - Correct MCP server running status - Accurate session and performance metrics 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
137 lines
3.6 KiB
JavaScript
137 lines
3.6 KiB
JavaScript
/**
|
|
* WebUI Cross-Platform Validator
|
|
* Validates that WebUI components work across Node.js and Deno
|
|
*/
|
|
|
|
import { compat } from '../runtime-detector.js';
|
|
import { promises as fs } from 'fs';
|
|
|
|
export class WebUIValidator {
|
|
constructor() {
|
|
this.tests = [];
|
|
this.results = {
|
|
passed: 0,
|
|
failed: 0,
|
|
total: 0,
|
|
};
|
|
}
|
|
|
|
async runValidation() {
|
|
console.log(`🔍 WebUI Cross-Platform Validation (${compat.runtime})`);
|
|
console.log('─'.repeat(50));
|
|
|
|
// Runtime Detection Test
|
|
this.test('Runtime Detection', () => {
|
|
const isValidRuntime = compat.runtime === 'node' || compat.runtime === 'deno';
|
|
const hasPlatform = compat.platform && compat.platform.os;
|
|
return isValidRuntime && hasPlatform;
|
|
});
|
|
|
|
// Terminal I/O Test
|
|
this.test('Terminal I/O Layer', () => {
|
|
const terminal = compat.terminal;
|
|
const hasRequiredMethods =
|
|
terminal &&
|
|
typeof terminal.write === 'function' &&
|
|
typeof terminal.read === 'function' &&
|
|
typeof terminal.exit === 'function';
|
|
return hasRequiredMethods;
|
|
});
|
|
|
|
// Component Import Test
|
|
await this.asyncTest('Component Imports', async () => {
|
|
try {
|
|
await import('./start-wrapper.js');
|
|
await import('./process-ui-enhanced.js');
|
|
return true;
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
});
|
|
|
|
// UI Instantiation Test
|
|
await this.asyncTest('UI Instantiation', async () => {
|
|
try {
|
|
const { EnhancedProcessUI } = await import('./process-ui-enhanced.js');
|
|
const ui = new EnhancedProcessUI();
|
|
return ui && ui.processes && ui.processes.size > 0;
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
});
|
|
|
|
// File Operations Test
|
|
await this.asyncTest('File Operations', async () => {
|
|
try {
|
|
await compat.safeCall(async () => {
|
|
if (compat.runtime === 'deno') {
|
|
await fs.writeFile('.webui-test', 'test', 'utf8');
|
|
await fs.unlink('.webui-test');
|
|
} else {
|
|
const fs = await import('fs/promises');
|
|
await fs.writeFile('.webui-test', 'test', 'utf8');
|
|
await fs.unlink('.webui-test');
|
|
}
|
|
});
|
|
return true;
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
});
|
|
|
|
this.printSummary();
|
|
return this.results.failed === 0;
|
|
}
|
|
|
|
test(name, testFn) {
|
|
this.results.total++;
|
|
try {
|
|
const result = testFn();
|
|
if (result) {
|
|
console.log(`✅ ${name}`);
|
|
this.results.passed++;
|
|
} else {
|
|
console.log(`❌ ${name}`);
|
|
this.results.failed++;
|
|
}
|
|
} catch (err) {
|
|
console.log(`❌ ${name}: ${err.message}`);
|
|
this.results.failed++;
|
|
}
|
|
}
|
|
|
|
async asyncTest(name, testFn) {
|
|
this.results.total++;
|
|
try {
|
|
const result = await testFn();
|
|
if (result) {
|
|
console.log(`✅ ${name}`);
|
|
this.results.passed++;
|
|
} else {
|
|
console.log(`❌ ${name}`);
|
|
this.results.failed++;
|
|
}
|
|
} catch (err) {
|
|
console.log(`❌ ${name}: ${err.message}`);
|
|
this.results.failed++;
|
|
}
|
|
}
|
|
|
|
printSummary() {
|
|
console.log('─'.repeat(50));
|
|
console.log(`📊 Results: ${this.results.passed}/${this.results.total} passed`);
|
|
if (this.results.failed === 0) {
|
|
console.log('🎉 All validations passed! WebUI is cross-platform compatible.');
|
|
} else {
|
|
console.log(`⚠️ ${this.results.failed} validation(s) failed.`);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Auto-run if called directly
|
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
const validator = new WebUIValidator();
|
|
const success = await validator.runValidation();
|
|
process.exit(success ? 0 : 1);
|
|
}
|