chore: establish YCode replication baseline and TODO
This commit is contained in:
commit
6dc59f89ba
1118 files changed
+196002
No files matched your search
@@ -0,0 +1,13 @@
|
||||
/** Original access goes exclusively through formal public REA directory CLI. */
|
||||
import fs from 'node:fs'
|
||||
import {spawnSync} from 'node:child_process'
|
||||
import crypto from 'node:crypto'
|
||||
const saved=JSON.parse(fs.readFileSync(process.argv[2],'utf8')),analysis=saved.normalized_result?saved:saved.details.partial_observation
|
||||
const inventory=process.argv[3]==='--inventory'
|
||||
const r=spawnSync(process.execPath,['.tmp/rea-css-runtime/scripts/rea.mjs',...(inventory?['inspect-selected-directory-text-root',analysis.normalized_result.input_path]:['export-selected-directory-text',analysis.normalized_result.input_path,analysis.normalized_result.root_artifact_sha256,JSON.stringify(process.argv.slice(3))])],{encoding:'utf8',maxBuffer:32*1024*1024})
|
||||
if(r.status!==0)throw Error(r.stderr||r.stdout)
|
||||
const evidence=JSON.parse(r.stdout)
|
||||
if(evidence.normalized_result.root_sha256!==analysis.normalized_result.root_artifact_sha256)throw Error('Inventory root pin mismatch')
|
||||
for(const f of evidence.normalized_result.files??[])if(crypto.createHash('sha256').update(f.text).digest('hex')!==f.sha256)throw Error('Export SHA mismatch')
|
||||
const output=`.tmp/rea-cpp-${inventory?'inventory':'text'}-${evidence.evidence_id}.json`;fs.writeFileSync(output,JSON.stringify(evidence))
|
||||
console.log(JSON.stringify({output,evidenceId:evidence.evidence_id,root:evidence.normalized_result.root_sha256,files:inventory?evidence.normalized_result.members:evidence.normalized_result.files.map(({text,...m})=>m)},null,2))
|
||||
Reference in new issue
Block a user