-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.mjs
More file actions
82 lines (68 loc) Β· 3.65 KB
/
run.mjs
File metadata and controls
82 lines (68 loc) Β· 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env node
/**
* Elite Test Script - Atomic Swarm Gods v1.7.0
* Validates the auto-repair system with all elite features
*/
import { AtomicRepair } from './dist/index.js';
import { existsSync } from 'fs';
console.log('\nββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');
console.log('β β‘ ATOMIC SWARM GODS ELITE v1.7.0 - TEST SUITE β');
console.log('ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n');
const config = {
nodeVersion: process.version,
wasmSupport: true,
strictMode: true,
eliteMode: true,
dynamicShifting: true,
auditConfidence: 0.9997,
blockchainAudit: true,
maxRepairAttempts: 3,
shiftStrategy: 'adaptive',
enableWebhooks: true
};
console.log('π Configuration:');
console.log(` β’ Node Version: ${config.nodeVersion}`);
console.log(` β’ Elite Mode: ${config.eliteMode}`);
console.log(` β’ Dynamic Shifting: ${config.dynamicShifting}`);
console.log(` β’ Blockchain Audit: ${config.blockchainAudit}`);
console.log(` β’ Confidence: ${(config.auditConfidence * 100).toFixed(2)}%`);
console.log('');
if (!existsSync('./dist/index.js')) {
console.error('β dist/index.js not found. Run `npm run build` first.');
process.exit(1);
}
try {
const repair = new AtomicRepair(config);
// Safe event listener
if (typeof repair.on === 'function') {
repair.on('repair_complete', (data) => {
console.log(`\nπ’ Event: Repair completed with success=${data?.success ?? 'unknown'}`);
});
}
console.log('π§ Running elite auto-repair...\n');
const startTime = Date.now();
const success = await repair.repair();
const duration = ((Date.now() - startTime) / 1000).toFixed(2);
console.log('\nββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');
console.log(`β ${success ? 'β
' : 'β οΈ'} TEST COMPLETE - ${duration}s β`);
console.log('ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n');
console.log('π Results:');
console.log(` β’ Status: ${success ? 'SUCCESS' : 'PARTIAL'}`);
// Safe access to optional methods
const attempts = typeof repair.getRepairAttempts === 'function' ? repair.getRepairAttempts() : 'N/A';
const auditHistory = typeof repair.getAuditHistory === 'function' ? repair.getAuditHistory().length : 'N/A';
const shiftMetrics = typeof repair.getShiftMetrics === 'function' ? repair.getShiftMetrics().length : 'N/A';
const avgConfidence = typeof repair.getAverageConfidence === 'function' ? (repair.getAverageConfidence() * 100).toFixed(2) : 'N/A';
const blockchainVerified = typeof repair.verifyBlockchain === 'function' ? (repair.verifyBlockchain() ? 'β
' : 'β') : 'β οΈ N/A';
console.log(` β’ Repair Attempts: ${attempts}`);
console.log(` β’ Audits Performed: ${auditHistory}`);
console.log(` β’ Dynamic Shifts: ${shiftMetrics}`);
console.log(` β’ Average Confidence: ${avgConfidence}%`);
console.log(` β’ Blockchain Verified: ${blockchainVerified}`);
console.log('');
process.exit(success ? 0 : 1);
} catch (error) {
console.error('\nβ TEST FAILED:', error.message);
if (error.stack) console.error(error.stack);
process.exit(1);
}