- 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)
80 lines
2.6 KiB
PHP
80 lines
2.6 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
// Debug das TUI Navigation Problem
|
|
use App\Framework\Console\Components\TuiState;
|
|
use App\Framework\Console\TuiView;
|
|
use App\Framework\Console\CommandGroupRegistry;
|
|
use App\Framework\Discovery\Results\DiscoveryRegistry;
|
|
|
|
echo "=== TUI NAVIGATION DEBUG ===\n";
|
|
|
|
try {
|
|
// Mock Discovery Registry
|
|
$discoveryRegistry = new class implements DiscoveryRegistry {
|
|
public function interfaces() {
|
|
return new class {
|
|
public function get(string $interface) { return []; }
|
|
};
|
|
}
|
|
public function attributes() {
|
|
return new class {
|
|
public function get(string $attributeClass) { return []; }
|
|
};
|
|
}
|
|
};
|
|
|
|
$groupRegistry = new CommandGroupRegistry($discoveryRegistry);
|
|
$categories = $groupRegistry->getOrganizedCommands();
|
|
|
|
echo "📊 Categories loaded: " . count($categories) . "\n";
|
|
foreach ($categories as $index => $category) {
|
|
echo " [$index] {$category['name']} - Commands: " . count($category['commands']) . "\n";
|
|
}
|
|
echo "\n";
|
|
|
|
// Test TuiState Navigation
|
|
$state = new TuiState();
|
|
$state->setCategories($categories);
|
|
$state->setCurrentView(TuiView::CATEGORIES);
|
|
|
|
echo "🔍 Initial TUI State:\n";
|
|
echo " Selected Category: " . $state->getSelectedCategory() . "\n";
|
|
echo " Current View: " . $state->getCurrentView()->name . "\n";
|
|
echo " Current Category: " . ($state->getCurrentCategory()['name'] ?? 'NULL') . "\n";
|
|
echo "\n";
|
|
|
|
// Test Navigation Up/Down
|
|
echo "🧪 Testing Navigation:\n";
|
|
|
|
for ($i = 0; $i < 3; $i++) {
|
|
echo "Step $i - Before navigateDown(): " . $state->getSelectedCategory() . "\n";
|
|
$state->navigateDown();
|
|
echo "Step $i - After navigateDown(): " . $state->getSelectedCategory() . "\n";
|
|
}
|
|
|
|
echo "\n";
|
|
|
|
for ($i = 0; $i < 5; $i++) {
|
|
echo "Step $i - Before navigateUp(): " . $state->getSelectedCategory() . "\n";
|
|
$state->navigateUp();
|
|
echo "Step $i - After navigateUp(): " . $state->getSelectedCategory() . "\n";
|
|
}
|
|
|
|
echo "\n";
|
|
|
|
// Test Category Bounds
|
|
echo "🎯 Testing Bounds:\n";
|
|
$state->setSelectedCategory(99);
|
|
echo "Set to 99, actual: " . $state->getSelectedCategory() . "\n";
|
|
$state->setSelectedCategory(-5);
|
|
echo "Set to -5, actual: " . $state->getSelectedCategory() . "\n";
|
|
|
|
echo "\n✅ Navigation logic test completed\n";
|
|
|
|
} catch (\Throwable $e) {
|
|
echo "❌ ERROR: " . $e->getMessage() . "\n";
|
|
echo "File: " . $e->getFile() . ":" . $e->getLine() . "\n";
|
|
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
|
|
} |