<?php
require '/var/www/html/vendor/autoload.php';
require '/var/www/html/public/index.php';

// Get container from global scope
$container = $GLOBALS['container'] ?? null;
if (!$container) {
    echo "ERROR: Container not available\n";
    exit(1);
}

try {
    $discoveryRegistry = $container->get('App\Framework\Discovery\Results\DiscoveryRegistry');
    $liveComponents = $discoveryRegistry->attributes()->get('App\Framework\LiveComponents\Attributes\LiveComponent');
    
    echo "Found " . count($liveComponents) . " LiveComponent(s)\n\n";
    
    foreach ($liveComponents as $discovered) {
        $attr = $discovered->createAttributeInstance();
        if ($attr) {
            echo "✓ " . $attr->name . " => " . $discovered->className->toString() . "\n";
        }
    }
} catch (Throwable $e) {
    echo "ERROR: " . $e->getMessage() . "\n";
    echo "File: " . $e->getFile() . ":" . $e->getLine() . "\n";
}
