#!/usr/bin/env node /** * Glossary Auto-Revision Script * * This script: * 1. Reads the current glossary-data.json * 2. Scans source files for new terms (SMP tags, code comments, etc.) * 3. Updates the glossary with new terms * 4. Generates updated static HTML for all domains * 5. Deploys to S3/CloudFront */ const fs = require('fs'); const path = require('path'); const GLOSSARY_PATH = path.join(__dirname, 'glossary-data.json'); const OUTPUT_DIR = path.join(__dirname, 'dist'); // Load current glossary function loadGlossary() { const data = fs.readFileSync(GLOSSARY_PATH, 'utf8'); return JSON.parse(data); } // Save glossary function saveGlossary(data) { fs.writeFileSync(GLOSSARY_PATH, JSON.stringify(data, null, 2)); } // Generate static HTML for a domain function generateStaticHTML(data, domain, baseUrl) { const terms = data.terms.filter(t => { if (domain === 'all') return true; return t.domains.includes(domain); }); // Group by letter const grouped = {}; terms.forEach(term => { const letter = term.name.charAt(0).toUpperCase(); if (!grouped[letter]) grouped[letter] = []; grouped[letter].push(term); }); const letters = Object.keys(grouped).sort(); // Build HTML let html = '\n\n\n'; html += '\n'; html += '\n'; html += 'Glossary — ' + (domain === 'all' ? 'Landvex Ecosystem' : domain) + '\n'; html += '\n'; html += '\n'; html += '\n'; html += '