mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
- Reorganize v3/ into implementation/ subfolders: - planning/, architecture/, migration/, integration/ - security/, adrs/, research/, swarm-plans/ - Add 15-agent concurrent swarm implementation plans: - SWARM-OVERVIEW.md: Hierarchical mesh topology, 4 phases - AGENT-SPECIFICATIONS.md: 15 agent configs with capabilities - TDD-LONDON-SCHOOL-PLAN.md: Mock-first TDD methodology - BENCHMARK-OPTIMIZATION.md: Performance targets (2.49x-7.47x) - DEPLOYMENT-PLAN.md: Release strategy, CI/CD, rollback - GITHUB-ISSUE-TRACKING.md: Issue workflow with agent replies - Update .claude/settings.json with proper hooks format - Add bash aliases for claude --dangerously-skip-permissions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <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);
|
|
}
|