Aplicar Pint e formatação de frontend; delimitar o âmbito do lint

Só formatação automática (pint, vp check --fix), sem alterar comportamento.
Excluídos da formatação os registos e artefactos com bytes fixos: docs/,
integrations/, storage/, tmp/, output/, resources/data/, tests/Fixtures/,
compras-release.json e AGENTS*.md. Scripts operacionais, integrations e
auxiliares de teste ficam fora do lint (usam new Function; limpeza na fase 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 23:01:42 +02:00
co-authored by Claude Opus 5.5
parent 9f719695e3
commit ec934455e7
148 changed files with 9455 additions and 2413 deletions
+60 -21
View File
@@ -1,24 +1,63 @@
<?php
$root=dirname(__DIR__);
$old=json_decode(file_get_contents($root.'/docs/proofs/sgf-read-candidate.json'),true,32,JSON_THROW_ON_ERROR);
$manifest=json_decode(file_get_contents($old['directory'].'/manifest.json'),true,64,JSON_THROW_ON_ERROR);
$payload=[];
foreach($manifest['support_files'] as $file=>$hash){$text=file_get_contents($old['directory'].'/'.$file);if(hash('sha256',$text)!==$hash)throw new RuntimeException('Prior candidate changed');$payload[$file]=$text;}
foreach(['integrations/sgf/sourcing','packages/purchasing/src'] as $dir)foreach(new DirectoryIterator($root.'/'.$dir) as $file)if($file->isFile())$payload[$dir.'/'.$file->getFilename()]=file_get_contents($file->getPathname());
foreach(['integrations/sgf/operational/Installation.php','integrations/sgf/operational/CodeDeployment.php','integrations/sgf/access/AccessOverlay.php','integrations/sgf/operational/routes.php','integrations/sgf/internal-requisitions/Controller.php','integrations/sgf/internal-requisitions/screen.mjs'] as $file)$payload[$file]=file_get_contents($root.'/'.$file);
$payload['bootstrap.php']=file_get_contents($root.'/integrations/sgf/operational/entry.php');
$payload['scripts/sgf-sourcing-install.php']=file_get_contents($root.'/scripts/sgf-sourcing-install.php');
use App\Services\ComparisonPolicy;
use Tempo\Purchasing\Delivery\AccessOverlay;
$root = dirname(__DIR__);
$old = json_decode(file_get_contents($root.'/docs/proofs/sgf-read-candidate.json'), true, 32, JSON_THROW_ON_ERROR);
$manifest = json_decode(file_get_contents($old['directory'].'/manifest.json'), true, 64, JSON_THROW_ON_ERROR);
$payload = [];
foreach ($manifest['support_files'] as $file => $hash) {
$text = file_get_contents($old['directory'].'/'.$file);
if (hash('sha256', $text) !== $hash) {
throw new RuntimeException('Prior candidate changed');
}$payload[$file] = $text;
}
foreach (['integrations/sgf/sourcing', 'packages/purchasing/src'] as $dir) {
foreach (new DirectoryIterator($root.'/'.$dir) as $file) {
if ($file->isFile()) {
$payload[$dir.'/'.$file->getFilename()] = file_get_contents($file->getPathname());
}
}
}
foreach (['integrations/sgf/operational/Installation.php', 'integrations/sgf/operational/CodeDeployment.php', 'integrations/sgf/access/AccessOverlay.php', 'integrations/sgf/operational/routes.php', 'integrations/sgf/internal-requisitions/Controller.php', 'integrations/sgf/internal-requisitions/screen.mjs'] as $file) {
$payload[$file] = file_get_contents($root.'/'.$file);
}
$payload['bootstrap.php'] = file_get_contents($root.'/integrations/sgf/operational/entry.php');
$payload['scripts/sgf-sourcing-install.php'] = file_get_contents($root.'/scripts/sgf-sourcing-install.php');
require_once $root.'/app/Services/ComparisonPolicy.php';
$payload['integrations/sgf/sourcing/comparison-defaults.json']=json_encode(App\Services\ComparisonPolicy::DEFAULTS,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);
$file='app/Modules/Identity/Services/Permissions.php';
$payload[$file]=preg_replace('/public const UNIT = .*?;/s','public const UNIT = '.var_export(['unit.view','unit.edit',...requireRights($root)],true).';',$payload[$file],1);
$manifest['host_overlays'][$file]['after_sha256']=hash('sha256',$payload[$file]);
$payload['integrations/sgf/sourcing/comparison-defaults.json'] = json_encode(ComparisonPolicy::DEFAULTS, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
$file = 'app/Modules/Identity/Services/Permissions.php';
$payload[$file] = preg_replace('/public const UNIT = .*?;/s', 'public const UNIT = '.var_export(['unit.view', 'unit.edit', ...requireRights($root)], true).';', $payload[$file], 1);
$manifest['host_overlays'][$file]['after_sha256'] = hash('sha256', $payload[$file]);
// The same native catalogue and delegation workflow remain in use.
foreach($payload as $file=>$text)$manifest['support_files'][$file]=hash('sha256',$text);
$manifestText=json_encode($manifest,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);
$id='OPERATIONAL-CANDIDATE-'.substr(hash('sha256',$manifestText),0,16);$dir=$root.'/storage/app/private/candidates/'.$id;
if(file_exists($dir))throw new RuntimeException('Immutable candidate exists');mkdir($dir,0700,true);
foreach($payload+['manifest.json'=>$manifestText] as $file=>$text){if(!is_dir(dirname($dir.'/'.$file)))mkdir(dirname($dir.'/'.$file),0700,true);file_put_contents($dir.'/'.$file,$text);}
$archive=$root.'/storage/app/private/candidate-archives/'.$id.'.zip';$zip=new ZipArchive;if($zip->open($archive,ZipArchive::CREATE|ZipArchive::EXCL)!==true)throw new RuntimeException('Archive exists');foreach([...array_keys($payload),'manifest.json'] as $file)$zip->addFile($dir.'/'.$file,$file);$zip->close();
$out=['directory'=>$dir,'archive'=>['file'=>$archive,'sha256'=>hash_file('sha256',$archive),'manifest_sha256'=>hash('sha256',$manifestText)],'prior_manifest_sha256'=>$old['archive']['manifest_sha256'],'schema_extension'=>'sourcing revision 1; four ss_* tables and explicit catalogue extension','real_activated'=>false];file_put_contents($root.'/docs/proofs/sgf-sourcing-candidate.json',json_encode($out,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo json_encode($out,JSON_PRETTY_PRINT);
function requireRights(string $root):array{require_once $root.'/integrations/sgf/access/AccessOverlay.php';return Tempo\Purchasing\Delivery\AccessOverlay::RIGHTS;}
foreach ($payload as $file => $text) {
$manifest['support_files'][$file] = hash('sha256', $text);
}
$manifestText = json_encode($manifest, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
$id = 'OPERATIONAL-CANDIDATE-'.substr(hash('sha256', $manifestText), 0, 16);
$dir = $root.'/storage/app/private/candidates/'.$id;
if (file_exists($dir)) {
throw new RuntimeException('Immutable candidate exists');
}mkdir($dir, 0700, true);
foreach ($payload + ['manifest.json' => $manifestText] as $file => $text) {
if (! is_dir(dirname($dir.'/'.$file))) {
mkdir(dirname($dir.'/'.$file), 0700, true);
}file_put_contents($dir.'/'.$file, $text);
}
$archive = $root.'/storage/app/private/candidate-archives/'.$id.'.zip';
$zip = new ZipArchive;
if ($zip->open($archive, ZipArchive::CREATE | ZipArchive::EXCL) !== true) {
throw new RuntimeException('Archive exists');
}foreach ([...array_keys($payload), 'manifest.json'] as $file) {
$zip->addFile($dir.'/'.$file, $file);
}$zip->close();
$out = ['directory' => $dir, 'archive' => ['file' => $archive, 'sha256' => hash_file('sha256', $archive), 'manifest_sha256' => hash('sha256', $manifestText)], 'prior_manifest_sha256' => $old['archive']['manifest_sha256'], 'schema_extension' => 'sourcing revision 1; four ss_* tables and explicit catalogue extension', 'real_activated' => false];
file_put_contents($root.'/docs/proofs/sgf-sourcing-candidate.json', json_encode($out, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
echo json_encode($out, JSON_PRETTY_PRINT);
function requireRights(string $root): array
{
require_once $root.'/integrations/sgf/access/AccessOverlay.php';
return AccessOverlay::RIGHTS;
}