instance(\App\Framework\DateTime\Clock::class, $clock); $container->instance(\App\Framework\Logging\Logger::class, new \App\Framework\Logging\DefaultLogger()); $container->instance(\App\Framework\Performance\Contracts\PerformanceCollectorInterface::class, $collector); // Initialize cache properly $cacheInitializer = new \App\Framework\Cache\CacheInitializer($collector, $container); $cache = $cacheInitializer(); $container->instance(\App\Framework\Cache\Cache::class, $cache); // Add PathProvider $container->instance(\App\Framework\Core\PathProvider::class, new \App\Framework\Core\PathProvider('/var/www/html')); // Add ExecutionContext properly - this is crucial! $env = \App\Framework\Config\Environment::fromFile('/var/www/html/.env'); $executionContext = \App\Framework\Context\ExecutionContext::detect($env); $container->instance(\App\Framework\Context\ExecutionContext::class, $executionContext); try { echo "Starting Discovery bootstrap test...\n"; $bootstrapper = new \App\Framework\Discovery\DiscoveryServiceBootstrapper($container, $clock); echo "DiscoveryServiceBootstrapper created successfully\n"; $results = $bootstrapper->bootstrap(); echo "Discovery bootstrap completed successfully\n"; if ($results instanceof \App\Framework\Discovery\Results\DiscoveryRegistry) { // Get the attributes from the registry $attributes = $results->attributes; // Check for routes $routeAttributes = $attributes->get('App\\Framework\\Http\\Routing\\Route'); echo "Routes found: " . count($routeAttributes) . "\n"; // Check for console commands $commandAttributes = $attributes->get('App\\Framework\\Console\\ConsoleCommand'); echo "Console commands found: " . count($commandAttributes) . "\n"; // Check for MCP tools $mcpToolAttributes = $attributes->get('App\\Framework\\Mcp\\Attributes\\McpTool'); echo "MCP tools found: " . count($mcpToolAttributes) . "\n"; // Check for initializers $initializerAttributes = $attributes->get('App\\Framework\\DI\\Initializer'); echo "Initializers found: " . count($initializerAttributes) . "\n"; // List all discovered attribute types echo "All discovered attribute types:\n"; foreach ($attributes->getAllTypes() as $type) { echo " - " . $type . " (" . $attributes->getCount($type) . ")\n"; } // Show a few routes if any if (! empty($routeAttributes)) { echo "First few routes:\n"; foreach (array_slice($routeAttributes, 0, 3) as $route) { echo " - " . ($route->getClassName()->getShortName()) . "::" . ($route->getMethodName()?->getName() ?? 'unknown') . "\n"; } } // Show console commands if any if (! empty($commandAttributes)) { echo "Console commands:\n"; foreach ($commandAttributes as $command) { $args = $command->getArguments(); echo " - " . ($args['name'] ?? 'unknown') . " (" . $command->getClassName()->getShortName() . ")\n"; } } } else { echo "No results returned or results not in expected format\n"; var_dump($results); } } catch (Exception $e) { echo "Discovery bootstrap failed: " . $e->getMessage() . "\n"; echo "File: " . $e->getFile() . ":" . $e->getLine() . "\n"; echo "Stack trace:\n" . $e->getTraceAsString() . "\n"; }