4 lines
1.6 KiB
JavaScript
4 lines
1.6 KiB
JavaScript
import fs from 'node:fs';import path from 'node:path';import crypto from 'node:crypto';
|
|
const read=p=>JSON.parse(fs.readFileSync(p,'utf8')),hash=b=>crypto.createHash('sha256').update(b).digest('hex'),state=read('C:/laragon/data/sgf-tempo/run/modular-regression-current.json'),file='docs/GENERAL_LEDGER_DIRECT_COST_CORRECTION_SCOPE.md',expected=read('docs/proofs/common-ledger-direct-cost-20261103.json').next_scope.sha256,archive=path.join(state.root,'private/ledger-cost-correction-approved-scope.md');if(state.port!==55439)throw Error('Owned scope archive required');const current=fs.readFileSync(file,'utf8');
|
|
if(fs.existsSync(archive)){if(hash(fs.readFileSync(archive))!==expected)throw Error('Approved archive changed');}else{if(hash(current)!==expected)throw Error('Scope differs from presented proposal');fs.writeFileSync(archive,current);}const original=fs.readFileSync(archive,'utf8'),updated=original.replace(/^03\/11\/2026\..+$/m,'03/11/2026. **Autorização expressa recebida: «Autorizar a correcção sintética proposta». Implementação/provas concluídas; ver [entrega e limites](GENERAL_LEDGER_DIRECT_COST_CORRECTION_DELIVERY.md).** O texto seguinte conserva o recorte apresentado. A decisão pedida no final é histórica; não constitui aceitação, reabertura ou autorização operacional.');if(current!==original&¤t!==updated)throw Error('Unexpected scope edits; preserve and inspect');if(current!==updated)fs.writeFileSync(file,updated);console.log(JSON.stringify({scope_archive_matches_presented_proposal:true,approved_scope_sha256:expected,authorization_recorded:true}));
|