import fs from 'node:fs';import path from 'node:path';import {spawnSync} from 'node:child_process'; const s=JSON.parse(fs.readFileSync('C:/laragon/data/sgf-tempo/run/modular-regression-current.json','utf8')),tag=process.argv[2];if(s.port!==55439||!/^[a-f0-9]{12}$/.test(tag||''))throw Error('Private QA context required'); const root=path.join(s.root,'private/stock-receipt-'+tag),app=path.join(root,'app'),native=path.resolve('../compras'),config=path.join(root,'native-payable-page-phpstan.neon'); const owned=JSON.parse(fs.readFileSync(path.join(root,'state.json'),'utf8'));if(path.resolve(owned.app)!==path.resolve(app))throw Error('Private app mismatch'); const quote=p=>JSON.stringify(p.replaceAll('\\','/'));fs.writeFileSync(config,`includes:\n - ${quote(path.join(native,'phpstan.neon'))}\nparameters:\n tmpDir: ${quote(path.join(root,'phpstan-payable-page-cache'))}\n`); const r=spawnSync('C:/laragon/tools/sgf-tempo/php-8.4.27/php.exe',[path.join(native,'vendor/phpstan/phpstan/phpstan'),'analyse','--configuration',config,'--error-format=json','--no-progress','--memory-limit=1G','app/Services/SupplierPayablePage.php','app/Services/SupplierPayables.php','app/Http/Controllers/SupplierPayablesController.php'],{cwd:app,encoding:'utf8',windowsHide:true,maxBuffer:4*1024*1024,env:{...process.env,APP_ENV:'testing',APP_BASE_PATH:app,COMMON_PAYABLES_PATH:path.resolve('packages/payables'),SGF_ISOLATED_REGRESSION_RUN:s.id}}); fs.writeFileSync(path.join(root,'native-payable-page-phpstan.json'),r.stdout||'');fs.writeFileSync(path.join(root,'native-payable-page-phpstan-stderr.txt'),r.stderr||'');console.log(r.stdout);if(r.stderr)console.log(r.stderr);process.exitCode=r.status??1;