Skip to content

The design language that makes your AI harness better at design.

JavaScript

Fix CI: relative img path in /visual-mode + sandbox flags for Puppeteer

Paul Bakausa6a58f712c50
diff --git a/scripts/build-sub-pages.js b/scripts/build-sub-pages.js
index 44bf701b4..6297862b3 100644
--- a/scripts/build-sub-pages.js
+++ b/scripts/build-sub-pages.js
@@ -450,7 +450,7 @@ function renderVisualModeMain() {
(item) => `
<a class="gallery-card" href="/antipattern-examples/${item.id}.html">
<div class="gallery-card-thumb">
- <img src="/antipattern-images/${item.id}.png" alt="${escapeAttr(item.title)} specimen" loading="lazy" width="540" height="540">
+ <img src="../antipattern-images/${item.id}.png" alt="${escapeAttr(item.title)} specimen" loading="lazy" width="540" height="540">
</div>
<div class="gallery-card-body">
<h3 class="gallery-card-title">${escapeHtml(item.title)}</h3>
diff --git a/src/detect-antipatterns.mjs b/src/detect-antipatterns.mjs
index d469596b8..c842a1b9a 100644
--- a/src/detect-antipatterns.mjs
+++ b/src/detect-antipatterns.mjs
@@ -2695,7 +2695,11 @@ async function detectUrl(url) {
throw new Error(`Browser script not found at ${browserScriptPath}`);
}
- const browser = await puppeteer.default.launch({ headless: true });
+ // CI runners (GitHub Actions Ubuntu) block unprivileged user namespaces, so
+ // Chrome can't initialize its sandbox there. Disable the sandbox only when
+ // running in CI; local users keep the default hardened launch.
+ const launchArgs = process.env.CI ? ['--no-sandbox', '--disable-setuid-sandbox'] : [];
+ const browser = await puppeteer.default.launch({ headless: true, args: launchArgs });
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 });
await page.goto(url, { waitUntil: 'networkidle0', timeout: 30000 });