fix(structure): Correct case-sensitivity for Linux compatibility

Rename folders to match PHP PSR-4 autoloading conventions:
- schemas → Schemas
- shared → Shared
- Wordpress → WordPress (in all locations)

Fixes deployment issues on Linux servers where filesystem is case-sensitive.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-11-26 22:53:34 -06:00
parent a2548ab5c2
commit 90863cd8f5
92 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,210 @@
<?php
/**
* Script de validación de arquitectura ROI Theme
*
* Valida que un componente cumple con:
* - Clean Architecture (estructura de carpetas)
* - Fase 01: Schema JSON
* - Fase 02: Sincronización JSON→BD
* - Fase 03: Renderers (DB→HTML/CSS)
* - Fase 04: FormBuilders (UI Admin)
*
* Uso:
* cd wp-content/themes/roi-theme
* php shared/Infrastructure/Scripts/validate-architecture.php <nombre-componente>
*
* Ejemplos:
* php shared/Infrastructure/Scripts/validate-architecture.php top-notification-bar
* php shared/Infrastructure/Scripts/validate-architecture.php navbar
* php shared/Infrastructure/Scripts/validate-architecture.php hero-section
*
* Códigos de salida:
* 0 = Validación exitosa (sin errores)
* 1 = Validación fallida (errores encontrados)
*/
declare(strict_types=1);
// Validar argumentos
if ($argc < 2) {
echo "❌ Error: Falta nombre del componente\n\n";
echo "Uso: php shared/Infrastructure/Scripts/validate-architecture.php <nombre-componente>\n\n";
echo "Ejemplos:\n";
echo " php shared/Infrastructure/Scripts/validate-architecture.php top-notification-bar\n";
echo " php shared/Infrastructure/Scripts/validate-architecture.php navbar\n";
exit(1);
}
$componentName = $argv[1];
// Determinar ruta al tema (3 niveles arriba desde Scripts/)
$themePath = dirname(__DIR__, 3);
// Cargar WordPress
$wpLoadPath = dirname($themePath, 3) . '/wp-load.php';
if (!file_exists($wpLoadPath)) {
echo "❌ Error: No se pudo cargar WordPress\n";
echo "Ruta esperada: {$wpLoadPath}\n";
echo "Asegúrate de ejecutar el script desde el directorio del tema\n";
exit(1);
}
require_once $wpLoadPath;
// Cargar validadores manualmente
$validatorsPath = __DIR__ . '/../Validators/';
require_once $validatorsPath . 'ValidationResult.php';
require_once $validatorsPath . 'PhaseValidatorInterface.php';
require_once $validatorsPath . 'FolderStructureValidator.php';
require_once $validatorsPath . 'Phase01Validator.php';
require_once $validatorsPath . 'Phase02Validator.php';
require_once $validatorsPath . 'Phase03Validator.php';
require_once $validatorsPath . 'Phase04Validator.php';
require_once $validatorsPath . 'Phase05Validator.php';
require_once $validatorsPath . 'CSSConflictValidator.php';
require_once $validatorsPath . 'TemplateCallsValidator.php';
use ROITheme\Shared\Infrastructure\Validators\FolderStructureValidator;
use ROITheme\Shared\Infrastructure\Validators\Phase01Validator;
use ROITheme\Shared\Infrastructure\Validators\Phase02Validator;
use ROITheme\Shared\Infrastructure\Validators\Phase03Validator;
use ROITheme\Shared\Infrastructure\Validators\Phase04Validator;
use ROITheme\Shared\Infrastructure\Validators\Phase05Validator;
use ROITheme\Shared\Infrastructure\Validators\CSSConflictValidator;
use ROITheme\Shared\Infrastructure\Validators\TemplateCallsValidator;
// Header
printHeader($componentName);
// Crear validadores
$validators = [
new FolderStructureValidator(), // Estructura de carpetas (base)
new Phase01Validator(), // Schema JSON
new Phase02Validator(), // JSON→BD Sync
new Phase03Validator(), // Renderers
new Phase04Validator(), // FormBuilders
new Phase05Validator(), // General SOLID (todos los archivos)
new CSSConflictValidator(), // Conflictos CSS (Assets vs Renderers dinámicos)
new TemplateCallsValidator(), // Llamadas roi_render_component() en templates
];
// Ejecutar validaciones
$allSuccess = true;
$totalErrors = 0;
$totalWarnings = 0;
foreach ($validators as $validator) {
$result = $validator->validate($componentName, $themePath);
// Imprimir resultado
printValidationResult($validator, $result);
if (!$result->isSuccess()) {
$allSuccess = false;
}
$totalErrors += $result->getErrorCount();
$totalWarnings += $result->getWarningCount();
echo "\n";
}
// Resumen final
printSummary($allSuccess, $totalErrors, $totalWarnings);
// Código de salida
exit($allSuccess ? 0 : 1);
/**
* Imprime el header del script
*/
function printHeader(string $componentName): void
{
echo "\n";
echo "╔═══════════════════════════════════════════════════════════╗\n";
echo "║ ARCHITECTURE VALIDATOR - ROI THEME ║\n";
echo "╚═══════════════════════════════════════════════════════════╝\n";
echo "\n";
echo "Validando componente: {$componentName}\n";
echo "\n";
}
/**
* Imprime el resultado de una validación
*/
function printValidationResult($validator, $result): void
{
echo "═══════════════════════════════════════════════════════════\n";
echo "FASE {$validator->getPhaseNumber()}: {$validator->getPhaseDescription()}\n";
echo "═══════════════════════════════════════════════════════════\n";
// Info messages
if (!empty($result->getInfo())) {
foreach ($result->getInfo() as $info) {
echo " {$info}\n";
}
}
// Stats
if (!empty($result->getStats())) {
echo "\n📊 Estadísticas:\n";
foreach ($result->getStats() as $key => $value) {
echo "{$key}: {$value}\n";
}
}
// Warnings
if (!empty($result->getWarnings())) {
echo "\n⚠️ ADVERTENCIAS:\n";
foreach ($result->getWarnings() as $warning) {
echo "{$warning}\n";
}
}
// Errors
if (!empty($result->getErrors())) {
echo "\n❌ ERRORES CRÍTICOS:\n";
foreach ($result->getErrors() as $error) {
echo "{$error}\n";
}
}
// Result
echo "\n";
if ($result->isSuccess()) {
echo "✅ FASE {$validator->getPhaseNumber()}: EXITOSA\n";
} else {
echo "❌ FASE {$validator->getPhaseNumber()}: FALLIDA ({$result->getErrorCount()} errores)\n";
}
}
/**
* Imprime el resumen final
*/
function printSummary(bool $allSuccess, int $totalErrors, int $totalWarnings): void
{
echo "\n";
echo "╔═══════════════════════════════════════════════════════════╗\n";
echo "║ RESUMEN FINAL ║\n";
echo "╚═══════════════════════════════════════════════════════════╝\n";
echo "\n";
echo "Total errores: {$totalErrors}\n";
echo "Total advertencias: {$totalWarnings}\n";
echo "\n";
if ($allSuccess) {
echo "✅ ¡VALIDACIÓN EXITOSA!\n";
echo "El componente cumple con todos los estándares arquitectónicos.\n";
} else {
echo "❌ VALIDACIÓN FALLIDA\n";
echo "Corregir errores críticos antes de continuar.\n";
echo "\n";
echo "Acciones recomendadas:\n";
echo " • Revisar errores arriba\n";
echo " • Corregir violaciones arquitectónicas\n";
echo " • Ejecutar validación nuevamente\n";
}
echo "\n";
}