refactor: reorganize project structure for better maintainability
- Move 45 debug/test files from root to organized scripts/ directories - Secure public/ directory by removing debug files (security improvement) - Create structured scripts organization: • scripts/debug/ (20 files) - Framework debugging tools • scripts/test/ (18 files) - Test and validation scripts • scripts/maintenance/ (5 files) - Maintenance utilities • scripts/dev/ (2 files) - Development tools Security improvements: - Removed all debug/test files from public/ directory - Only production files remain: index.php, health.php Root directory cleanup: - Reduced from 47 to 2 PHP files in root - Only essential production files: console.php, worker.php This improves: ✅ Security (no debug code in public/) ✅ Organization (clear separation of concerns) ✅ Maintainability (easy to find and manage scripts) ✅ Professional structure (clean root directory)
This commit is contained in:
102
scripts/test/test_framework_agents.php
Normal file
102
scripts/test/test_framework_agents.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use App\Framework\Core\AppBootstrapper;
|
||||
use App\Framework\Mcp\Tools\FrameworkAgents;
|
||||
use App\Framework\Performance\EnhancedPerformanceCollector;
|
||||
use App\Framework\DateTime\SystemClock;
|
||||
use App\Framework\DateTime\SystemHighResolutionClock;
|
||||
use App\Framework\Performance\MemoryMonitor;
|
||||
|
||||
try {
|
||||
// Bootstrap the application (similar to console.php)
|
||||
$clock = new SystemClock();
|
||||
$highResClock = new SystemHighResolutionClock();
|
||||
$memoryMonitor = new MemoryMonitor();
|
||||
$collector = new EnhancedPerformanceCollector($clock, $highResClock, $memoryMonitor, enabled: false);
|
||||
$bootstrapper = new AppBootstrapper(__DIR__, $collector, $memoryMonitor);
|
||||
|
||||
$consoleApp = $bootstrapper->bootstrapConsole();
|
||||
// Extract container from the ConsoleApplication via reflection
|
||||
$reflection = new \ReflectionClass($consoleApp);
|
||||
$containerProperty = $reflection->getProperty('container');
|
||||
$containerProperty->setAccessible(true);
|
||||
$container = $containerProperty->getValue($consoleApp);
|
||||
|
||||
// Get the FrameworkAgents instance
|
||||
$frameworkAgents = $container->get(FrameworkAgents::class);
|
||||
|
||||
echo "=== Testing Framework Agents ===\n\n";
|
||||
|
||||
// Test Framework Core Agent
|
||||
echo "🔧 Testing Framework Core Agent:\n";
|
||||
$coreResult = $frameworkAgents->frameworkCoreAgent(
|
||||
'Analyze current framework architecture and patterns',
|
||||
'architecture'
|
||||
);
|
||||
|
||||
echo "✅ Framework Core Agent Response:\n";
|
||||
echo "- Agent: " . $coreResult['agent_identity'] . "\n";
|
||||
echo "- Principles: " . count($coreResult['core_principles']) . " core principles\n";
|
||||
echo "- Framework Health: " . $coreResult['framework_health']['status'] . "\n";
|
||||
echo "- Recommendations: " . count($coreResult['recommendations']) . " recommendations\n";
|
||||
echo "\n";
|
||||
|
||||
// Test MCP Specialist Agent
|
||||
echo "🤖 Testing MCP Specialist Agent:\n";
|
||||
$mcpResult = $frameworkAgents->mcpSpecialistAgent(
|
||||
'Analyze MCP integration capabilities',
|
||||
'tools'
|
||||
);
|
||||
|
||||
echo "✅ MCP Specialist Agent Response:\n";
|
||||
echo "- Agent: " . $mcpResult['agent_identity'] . "\n";
|
||||
echo "- Principles: " . count($mcpResult['core_principles']) . " core principles\n";
|
||||
echo "- Available Tools: " . count($mcpResult['mcp_framework_integration']['available_tools']) . " MCP tools\n";
|
||||
echo "- Routes: " . $mcpResult['mcp_framework_integration']['routes_analysis']['total_routes'] . " total routes\n";
|
||||
echo "\n";
|
||||
|
||||
// Test Value Object Agent
|
||||
echo "💎 Testing Value Object Agent:\n";
|
||||
$voResult = $frameworkAgents->valueObjectAgent(
|
||||
'Analyze current value object usage and suggest improvements',
|
||||
'core'
|
||||
);
|
||||
|
||||
echo "✅ Value Object Agent Response:\n";
|
||||
echo "- Agent: " . $voResult['agent_identity'] . "\n";
|
||||
echo "- Principles: " . count($voResult['core_principles']) . " core principles\n";
|
||||
echo "- VO Categories: " . count($voResult['value_object_categories']) . " categories\n";
|
||||
echo "- Recommendations: " . count($voResult['recommendations']) . " recommendations\n";
|
||||
echo "\n";
|
||||
|
||||
// Test Discovery Expert Agent
|
||||
echo "🔍 Testing Discovery Expert Agent:\n";
|
||||
$discoveryResult = $frameworkAgents->discoveryExpertAgent(
|
||||
'Analyze attribute discovery system performance',
|
||||
'routing'
|
||||
);
|
||||
|
||||
echo "✅ Discovery Expert Agent Response:\n";
|
||||
echo "- Agent: " . $discoveryResult['agent_identity'] . "\n";
|
||||
echo "- Principles: " . count($discoveryResult['core_principles']) . " core principles\n";
|
||||
echo "- Attribute Systems: " . count($discoveryResult['attribute_expertise']) . " expertise areas\n";
|
||||
echo "- Components: " . count($discoveryResult['attribute_components']) . " components analyzed\n";
|
||||
echo "\n";
|
||||
|
||||
echo "🎉 All Framework Agents are working successfully!\n";
|
||||
echo "\nThese agents are now available as MCP tools:\n";
|
||||
echo "- framework_core_agent\n";
|
||||
echo "- mcp_specialist_agent\n";
|
||||
echo "- value_object_agent\n";
|
||||
echo "- discovery_expert_agent\n";
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
echo "❌ Error testing framework agents:\n";
|
||||
echo "Error: " . $e->getMessage() . "\n";
|
||||
echo "File: " . $e->getFile() . ":" . $e->getLine() . "\n";
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user