← back to Agent Cabinet

scripts/check-pyramid-syntax.js

15 lines

// Extracts the inline <script> from pyramid.html and validates it parses.
// Exits non-zero on a syntax error. Run: node scripts/check-pyramid-syntax.js
const fs = require('fs');
const path = require('path');
const html = fs.readFileSync(path.join(__dirname, '..', 'pyramid.html'), 'utf8');
const m = html.match(/<script>([\s\S]*?)<\/script>/);
if (!m) { console.error('no <script> block found'); process.exit(1); }
try {
  new Function(m[1]);
  console.log('pyramid.html inline script: SYNTAX OK');
} catch (e) {
  console.error('SYNTAX ERROR in pyramid.html inline script:', e.message);
  process.exit(1);
}