sovereign-intelligence
Front door to Drake Stapleton's sovereign stack.
Brought by drakestapleton
sovereign-intelligence / docs / archive / drakestapleton.com-old / scripts / verify-build.mjs
| 1 | import { existsSync, readFileSync, readdirSync } from "node:fs"; |
| 2 | import { join } from "node:path"; |
| 3 | |
| 4 | const mode = process.argv[2]; |
| 5 | if (!new Set(["waitlist", "portfolio"]).has(mode)) throw new Error("Expected waitlist or portfolio mode"); |
| 6 | |
| 7 | function assert(condition, message) { |
| 8 | if (!condition) throw new Error(message); |
| 9 | } |
| 10 | |
| 11 | const index = readFileSync("dist/index.html", "utf8"); |
| 12 | const scripts = readdirSync("dist/assets") |
| 13 | .filter((name) => name.endsWith(".js")) |
| 14 | .map((name) => readFileSync(join("dist/assets", name), "utf8")) |
| 15 | .join("\n"); |
| 16 | const requiredPages = [ |
| 17 | "404.html", |
| 18 | "aegis/index.html", |
| 19 | "aien/index.html", |
| 20 | "research/index.html", |
| 21 | "atlas/index.html", |
| 22 | "what-i-learned/index.html", |
| 23 | "path/index.html", |
| 24 | "software/index.html", |
| 25 | "evidence/index.html", |
| 26 | "interest/index.html", |
| 27 | "symphony/index.html", |
| 28 | "symphony/first/index.html", |
| 29 | "symphony/workflow/index.html", |
| 30 | "symphony/map/index.html", |
| 31 | ]; |
| 32 | |
| 33 | assert(!index.includes("__SITE_"), "HTML metadata placeholders remain"); |
| 34 | assert(index.includes(`name="site-mode" content="${mode}"`), `Incorrect ${mode} marker`); |
| 35 | assert(index.includes("Content-Security-Policy"), "Content Security Policy metadata is missing"); |
| 36 | assert(index.includes("style-src 'self';"), "Production style policy is missing"); |
| 37 | assert(!index.includes("style-src 'self' 'unsafe-inline'"), "Development style policy leaked into the production build"); |
| 38 | assert(existsSync("dist/og.png"), "Social preview image is missing"); |
| 39 | assert(existsSync("dist/favicon.svg"), "Favicon is missing"); |
| 40 | requiredPages.forEach((page) => assert(existsSync(join("dist", page)), `Missing ${page}`)); |
| 41 | |
| 42 | if (mode === "waitlist") { |
| 43 | assert(index.includes("noindex, nofollow, noarchive"), "Waitlist build is indexable"); |
| 44 | assert(scripts.includes("Join the waiting list"), "Waitlist copy is missing from the public bundle"); |
| 45 | assert(!scripts.includes("I keep finding "), "Portrait copy leaked into the waitlist bundle"); |
| 46 | assert(readFileSync("dist/robots.txt", "utf8").includes("Disallow: /"), "Waitlist robots file is open"); |
| 47 | assert(!existsSync("dist/sitemap.xml"), "Waitlist build includes a sitemap"); |
| 48 | } else { |
| 49 | assert(index.includes("index, follow"), "Portfolio build is hidden from search"); |
| 50 | assert(index.includes("AI Architect"), "Homepage AI Architect metadata is missing"); |
| 51 | assert(index.includes("application/ld+json"), "Homepage structured data is missing"); |
| 52 | assert(index.includes('property="og:site_name" content="Drake Stapleton"'), "Homepage og:site_name missing"); |
| 53 | assert(index.includes("Drake Stapleton"), "Homepage Drake Stapleton missing"); |
| 54 | assert(scripts.includes("I keep finding "), "Portrait copy is missing from the portfolio bundle"); |
| 55 | assert(!scripts.includes("Join the waiting list"), "Waitlist copy leaked into the portfolio bundle"); |
| 56 | assert(existsSync("dist/sitemap.xml"), "Portfolio sitemap is missing"); |
| 57 | const interest = readFileSync("dist/interest/index.html", "utf8"); |
| 58 | assert(interest.includes("Start a Conversation"), "Conversation metadata is missing"); |
| 59 | const atlas = readFileSync("dist/atlas/index.html", "utf8"); |
| 60 | assert(atlas.includes("Why Atlas Exists"), "Atlas static metadata is missing"); |
| 61 | assert(atlas.includes("https://www.drakestapleton.com/atlas"), "Atlas canonical URL is missing"); |
| 62 | const aegis = readFileSync("dist/aegis/index.html", "utf8"); |
| 63 | assert(aegis.includes("AEGIS Defensive Atlas Extension"), "AEGIS static metadata is missing"); |
| 64 | assert(aegis.includes("https://www.drakestapleton.com/aegis"), "AEGIS canonical URL is missing"); |
| 65 | const aien = readFileSync("dist/aien/index.html", "utf8"); |
| 66 | assert(aien.includes("AIEN Sovereign Cognitive Architecture"), "AIEN static metadata is missing"); |
| 67 | assert(aien.includes("https://www.drakestapleton.com/aien"), "AIEN canonical URL is missing"); |
| 68 | const research = readFileSync("dist/research/index.html", "utf8"); |
| 69 | assert(research.includes("LLM Inference Research & Architecture"), "Research static metadata is missing"); |
| 70 | assert(research.includes("https://www.drakestapleton.com/research"), "Research canonical URL is missing"); |
| 71 | assert(scripts.includes("59/62"), "AEGIS evaluation result is missing from the portfolio bundle"); |
| 72 | assert(!scripts.includes("Discuss a partnership"), "Sales language remains in the portfolio bundle"); |
| 73 | assert(!scripts.includes("License AEGIS"), "AEGIS sales language remains in the portfolio bundle"); |
| 74 | assert(existsSync("dist/llms.txt"), "Portfolio llms.txt is missing"); |
| 75 | const whatBroke = readFileSync("dist/what-broke/index.html", "utf8"); |
| 76 | assert(whatBroke.includes("noindex, follow"), "what-broke is indexable"); |
| 77 | assert(whatBroke.includes("https://www.drakestapleton.com/what-i-learned"), "what-broke missing canonical link"); |
| 78 | const atlasSymphony = readFileSync("dist/atlas-symphony/index.html", "utf8"); |
| 79 | assert(atlasSymphony.includes("noindex, follow"), "atlas-symphony is indexable"); |
| 80 | assert(atlasSymphony.includes("https://www.drakestapleton.com/symphony"), "atlas-symphony missing canonical link"); |
| 81 | const sitemap = readFileSync("dist/sitemap.xml", "utf8"); |
| 82 | assert( |
| 83 | !sitemap.includes("https://www.drakestapleton.com/what-broke</loc>"), |
| 84 | "sitemap lists the what-broke alias", |
| 85 | ); |
| 86 | assert( |
| 87 | !sitemap.includes("https://www.drakestapleton.com/atlas-symphony</loc>"), |
| 88 | "sitemap lists the atlas-symphony alias", |
| 89 | ); |
| 90 | const fourOhFour = readFileSync("dist/404.html", "utf8"); |
| 91 | assert(fourOhFour.includes("noindex, follow"), "404 is indexable"); |
| 92 | |
| 93 | } |
| 94 | console.log(`${mode} build verified`); |