33 lines
1.2 KiB
PHP
33 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Support\Release\ShadowComparisonRunner;
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
final class ReleaseShadowCompareCommand extends Command
|
|
{
|
|
protected $signature = 'app:release-shadow-compare {--module=all}';
|
|
protected $description = 'Run shadow comparisons between legacy and modular outputs.';
|
|
|
|
public function handle(ShadowComparisonRunner $runner): int
|
|
{
|
|
$results = array_map(fn ($result): array => $result->toArray(), $runner->runAll());
|
|
$summary = [
|
|
'generated_at' => now()->toIso8601String(),
|
|
'results' => $results,
|
|
'status' => collect($results)->contains(fn ($result): bool => $result['status'] === 'fail') ? 'fail' : 'warning',
|
|
];
|
|
|
|
$path = storage_path('app/generated/shadow-comparisons/shadow-summary.json');
|
|
File::ensureDirectoryExists(dirname($path));
|
|
File::put($path, json_encode($summary, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
|
|
|
$this->warn('Shadow comparisons are scaffolded. Wire legacy comparisons before production cutover.');
|
|
$this->line(json_encode($summary, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|