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:
37
src/Framework/Mcp/Tools/RouteInspectorTool.php
Normal file
37
src/Framework/Mcp/Tools/RouteInspectorTool.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Framework\Mcp\Tools;
|
||||
|
||||
use App\Framework\Mcp\McpTool;
|
||||
use App\Framework\Router\CompiledRoutes;
|
||||
use App\Framework\Router\RouteInspector;
|
||||
|
||||
/**
|
||||
* MCP tool exposing routing sanity checks
|
||||
*/
|
||||
final readonly class RouteInspectorTool
|
||||
{
|
||||
public function __construct(
|
||||
private CompiledRoutes $compiledRoutes
|
||||
) {
|
||||
}
|
||||
|
||||
#[McpTool(
|
||||
name: 'route_sanity_check',
|
||||
description: 'Analyze compiled routes for common issues (missing controllers/actions, parameter mismatches, duplicates)'
|
||||
)]
|
||||
public function routeSanityCheck(): array
|
||||
{
|
||||
try {
|
||||
$inspector = new RouteInspector($this->compiledRoutes);
|
||||
|
||||
return $inspector->analyze();
|
||||
} catch (\Throwable $e) {
|
||||
return [
|
||||
'error' => $e->getMessage(),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user