File size: 2,008 Bytes
67be617
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Backend Loader — discovers and validates all Python backend modules."""

import importlib
import os
import sys

# Ensure project root is importable.
_PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
if _PROJECT_ROOT not in sys.path:
    sys.path.insert(0, _PROJECT_ROOT)

# Registry of expected backend modules: (dotted_path, class_name)
BACKEND_MODULES = [
    ("TIA.worker", "TIAWorker"),
    ("citadel.primeSchema", "PrimeSchema"),
    ("citadel.holo3d.ui.commandCentre", "CommandCentre"),
    ("citadel.lineage", "Lineage"),
    ("citadel.peace_vortex", "PeaceVortex"),
    ("citadel.alpha_nex", "AlphaNex"),
    ("harvester.washed_harvest", "WashedHarvest"),
    ("bio.vessel_firewall", "VesselFirewall"),
]


def load_all():
    """Import every registered backend module and return a status dict.



    Returns:

        dict mapping ``"module.Class"`` to either the class object or an error

        string.

    """
    results = {}
    for mod_path, cls_name in BACKEND_MODULES:
        key = f"{mod_path}.{cls_name}"
        try:
            mod = importlib.import_module(mod_path)
            cls = getattr(mod, cls_name)
            results[key] = {"status": "loaded", "class": cls}
        except Exception as exc:
            results[key] = {"status": "error", "error": str(exc)}
    return results


def print_report():
    """Print a human-readable status report for all backend modules."""
    results = load_all()
    print("\n=== TIA Backend Loader Report ===\n")
    for key, info in results.items():
        mark = "\u2705" if info["status"] == "loaded" else "\u274c"
        detail = "" if info["status"] == "loaded" else f'  ({info["error"]})'
        print(f"  {mark} {key}{detail}")
    loaded = sum(1 for v in results.values() if v["status"] == "loaded")
    total = len(results)
    print(f"\n  {loaded}/{total} modules loaded successfully.\n")
    return results


if __name__ == "__main__":
    print_report()