mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-21 02:26:31 +03:00
Fix browser script serving: run build after skill sync, serve via /js/
The skill sync wipes .claude/skills/ and re-copies from dist, deleting the generated browser script. Moved build-browser-detector.js to run AFTER the sync. Dev server's /js/* route now falls through to .claude/skills/critique/scripts/ for built artifacts. All fixture HTML references use /js/detect-antipatterns-browser.js (clean URL). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
fbfe525f4f
commit
d8803c8151
+8
-20
@@ -19,19 +19,6 @@ const server = serve({
|
||||
"/cheatsheet": cheatsheet,
|
||||
"/gallery": gallery,
|
||||
|
||||
// Built skill scripts (.claude/skills/)
|
||||
"/.claude/skills/*": async (req) => {
|
||||
const url = new URL(req.url);
|
||||
if (url.pathname.includes('..')) return new Response("Bad Request", { status: 400 });
|
||||
const filePath = `.${url.pathname}`;
|
||||
const assetFile = file(filePath);
|
||||
if (await assetFile.exists()) {
|
||||
return new Response(assetFile, {
|
||||
headers: { "Content-Type": "application/javascript", "X-Content-Type-Options": "nosniff" }
|
||||
});
|
||||
}
|
||||
return new Response("Not Found", { status: 404 });
|
||||
},
|
||||
// Static assets - all public subdirectories
|
||||
"/assets/*": async (req) => {
|
||||
const url = new URL(req.url);
|
||||
@@ -60,13 +47,14 @@ const server = serve({
|
||||
"/js/*": async (req) => {
|
||||
const url = new URL(req.url);
|
||||
if (url.pathname.includes('..')) return new Response("Bad Request", { status: 400 });
|
||||
const filePath = `./public${url.pathname}`;
|
||||
const assetFile = file(filePath);
|
||||
if (await assetFile.exists()) {
|
||||
return new Response(assetFile, {
|
||||
headers: { "Content-Type": "application/javascript", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "DENY" }
|
||||
});
|
||||
}
|
||||
// Check public/js/ first, then fall back to built artifacts
|
||||
const headers = { "Content-Type": "application/javascript", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "DENY" };
|
||||
const publicFile = file(`./public${url.pathname}`);
|
||||
if (await publicFile.exists()) return new Response(publicFile, { headers });
|
||||
// Built browser detector served at /js/detect-antipatterns-browser.js
|
||||
const basename = url.pathname.split('/').pop();
|
||||
const builtFile = file(`./.claude/skills/critique/scripts/${basename}`);
|
||||
if (await builtFile.exists()) return new Response(builtFile, { headers });
|
||||
return new Response("Not Found", { status: 404 });
|
||||
},
|
||||
// Test fixtures (for browser visual testing)
|
||||
|
||||
Reference in New Issue
Block a user