update project

This commit is contained in:
root
2026-05-30 01:11:35 -04:00
parent 3a0628ecc7
commit 2225f6bc72
9743 changed files with 1122482 additions and 59 deletions
@@ -0,0 +1,51 @@
<?php declare(strict_types=1);
namespace App\Console\Commands;
use App\Support\Architecture\ArchitectureScanner;
use Illuminate\Console\Command;
final class ArchitectureScanCommand extends Command
{
protected $signature = 'app:architecture-scan {--format=console : console or json} {--fail-on=error : error, warning, or none}';
protected $description = 'Scan the codebase for modular architecture boundary violations.';
public function handle(ArchitectureScanner $scanner): int
{
$violations = $scanner->scan();
if ($this->option('format') === 'json') {
$this->line(json_encode(array_map(fn ($v) => $v->toArray(), $violations), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
} else {
if ($violations === []) {
$this->info('No architecture violations found. Suspiciously civilized.');
}
foreach ($violations as $violation) {
$this->line(sprintf(
'[%s] %s %s:%d %s',
strtoupper($violation->severity),
$violation->ruleId,
$violation->file,
$violation->line,
$violation->message
));
if ($violation->suggestedFix) {
$this->line(' Fix: '.$violation->suggestedFix);
}
}
}
$failOn = (string) $this->option('fail-on');
if ($failOn === 'none') {
return self::SUCCESS;
}
foreach ($violations as $violation) {
if ($violation->severity === 'error' || ($failOn === 'warning' && $violation->severity === 'warning')) {
return self::FAILURE;
}
}
return self::SUCCESS;
}
}