import assert from 'node:assert/strict'; import {readFileSync, readdirSync, existsSync} from 'node:fs'; import {join} from 'node:path'; const read = p => readFileSync(p, 'utf8'); const config = read('docusaurus.config.ts'); assert(config.includes("baseUrl: '/eldorado-v1/documentation/'")); assert(config.includes("onBrokenLinks: 'throw'")); assert(config.includes("hashed: 'filename'")); for (const file of readdirSync('docs', {recursive: true}).filter(f => /\.mdx?$/.test(f))) { const doc = read(join('docs', file)); assert(/^---\n[\s\S]*?title: .+\n[\s\S]*?description: .+\n/.test(doc), `Missing metadata: ${file}`); } const css = read('src/css/custom.css'); assert(css.includes('#ffc950') && css.includes('@fontsource/lato/400.css')); const workflow = read('.gitea/workflows/pages.yml'); assert(workflow.includes('mountpoint -q')); assert(workflow.includes("gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'")); if (process.argv.includes('--build')) { const model = JSON.parse(read('research/ai-adoption/strategy-model.json')); const indexes = readdirSync('build').filter(f => /^search-index.*\.json$/.test(f)).map(f => read(join('build',f))).join('\n'); const redirect = read('build/strategy/index.html'); assert(redirect.includes('/eldorado-v1/documentation/strategy/target-operating-model/')); assert(redirect.includes('window.location.href') && redirect.includes('http-equiv="refresh"') && !redirect.includes('archify-panel'), 'Landing must redirect, not duplicate Target'); for (const {id, title} of model.pages) { const route = `strategy/${id === 'index' ? '' : `${id}/`}index.html`; const page = read(join('build',route)); assert(page.includes(title) && page.includes('Target operating model'), route); assert(indexes.includes(title), `Missing indexed Strategy page: ${id}`); for (const match of page.matchAll(/href="(\/eldorado-v1\/documentation\/[^"?#]*)/g)) { const local = decodeURIComponent(match[1].replace('/eldorado-v1/documentation/','')); assert(existsSync(join('build', local.endsWith('/') ? `${local}index.html` : local)), `Broken built link: ${local}`); } } assert(!existsSync('build/research'), 'Background research must remain private source'); assert(!readdirSync('build/diagrams', {recursive:true}).some(f => f.endsWith('.json')), 'No public diagram JSON'); assert(read('build/diagrams/ai-adoption-target/index.html').includes('TO-BE')); for (const route of ['index.html','docs/overview/index.html','docs/maintain/index.html','docs/reference/index.html','404.html','organization/structure/index.html','organization/collaboration/index.html','organization/sdlc/index.html','strategy/index.html','contribution/index.html','contribution/diagrams/index.html','diagrams/organization-structure/index.html']) { assert(existsSync(join('build',route)), `Missing route: ${route}`); } assert(!readdirSync('build/diagrams', {recursive: true}).some(f => f.endsWith('.delivery.json')), 'Private build receipts must not be published'); const diagram = read('build/diagrams/organization-structure/index.html'); assert(diagram.includes('node-product-team-2') && diagram.includes('node-technology-team-5')); assert(!diagram.includes('shared-delivery')); assert(!/A: placement|E: careers|J: advertised/.test(diagram)); assert(!diagram.includes('Example leadership')); for (const [dept, count] of [['product', 2], ['technology', 5]]) { for (let i = 1; i <= count; i++) assert(diagram.includes(`node-${dept}-team-${i}`)); } const reporting = read('build/diagrams/organization-reporting/index.html'); assert(reporting.includes('AI Architect') && reporting.includes('Leads')); assert(!/A: assumed|J: direct/.test(reporting)); const structure = read('build/organization/structure/index.html'); assert(structure.includes('Vladas Jurkevičius') && structure.includes('operating model')); assert(!/Research snapshot|Job-advertised|careers\.eldorado\.gg|Assumed/.test(structure)); assert(!structure.includes('Illustrative integration example')); assert(!diagram.includes('/opt/data/'), 'No build paths in published diagrams'); const home = read('build/index.html'); assert(/]*>Eldorado Powered By AI<\/title>/.test(home)); assert(home.includes('Powered By AI')); assert(home.includes('Strategy and direction for an AI-powered Eldorado.')); assert(!home.includes('Purpose to be defined') && !home.includes('what comes next.')); assert(home.includes('/eldorado-v1/documentation/assets/')); const search = readdirSync('build').filter(f => /^search-index.*\.json$/.test(f)); assert(search.length > 0, 'Missing search index'); assert(search.some(f => read(join('build',f)).includes('publish')), 'Missing indexed content'); assert(readdirSync('build/assets/fonts').some(f => f.endsWith('.woff2')), 'Missing bundled fonts'); assert(!home.includes('Docusaurus tutorial')); } console.log('PASS: ' + (process.argv.includes('--build') ? 'source + built routes, search and fonts' : 'source contracts'));