Download automation/scripts/capture-baselines.js from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/automation/scripts/capture-baselines.js
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/automation/scripts/capture-baselines.js
-
curl -L -o capture-baselines.js https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/automation/scripts/capture-baselines.js
1.57 kB
| // Captures the MOCK app's pain.001 element structure as a self-baseline (REST contract for P2P-INT-006 is hand-authored in fixtures/contracts/, never captured). | |
| // Honest note: these are mock self-baselines, NOT pre-patch Fusion pod snapshots (none exist). | |
| const fs = require('fs'); const path = require('path'); | |
| const S = require('../../mock-app/store'); | |
| const out = path.join(__dirname, '../fixtures/baselines'); fs.mkdirSync(out, { recursive: true }); | |
| S.reset(); | |
| const po = S.createPo('buyer', { bu: 'US1', supplierId: 'SUP-0001', lines: [{ description: 'x', quantity: 10, unitPrice: 25 }] }); S.submitPo('buyer', po.id); | |
| S.createReceipt('receiver', { poId: po.id, lines: [{ lineNum: 1, quantity: 10 }] }); | |
| const inv = S.createInvoice('ap_specialist', { poId: po.id, invoiceNumber: 'BASE-1', lines: [{ poLineNum: 1, quantity: 10, unitPrice: 25 }] }); S.validateInvoice('ap_specialist', inv.id); | |
| const ppr = S.submitPpr('payments_user', { name: 'BASELINE', ppp: 'MOCK ISO20022 PPP' }); | |
| const xml = S.find('paymentFiles', ppr.fileId).content; | |
| const paths = new Set(); const stack = []; | |
| for (const m of xml.replace(/<\?xml[^>]*\?>/, '').matchAll(/<(\/?)([A-Za-z][\w.-]*)[^>]*?(\/?)>/g)) { if (m[1]) { stack.pop(); continue; } stack.push(m[2]); paths.add(stack.join('/')); if (m[3]) stack.pop(); } | |
| fs.writeFileSync(path.join(out, 'iso20022-pain001-structure.json'), JSON.stringify({ note: 'MOCK self-baseline (pain.001.001.03 element paths); not a pod/bank baseline', paths: [...paths].sort() }, null, 2)); | |
| console.log('baseline written', paths.size); | |