Migrate from Vercel to Cloudflare Pages, fix distill command symbol

Replace Vercel serverless functions with Cloudflare Pages static
rewrites and lightweight download functions. Pre-generate all API
JSON data at build time for zero-invocation static serving. Also
fix stale simplify→distill rename in framework-viz periodic table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-03-08 18:34:14 -07:00
co-authored by Claude Opus 4.6
parent 98d16686dc
commit 7d2d42da96
17 changed files with 366 additions and 4203 deletions
@@ -0,0 +1,55 @@
const VALID_ID = /^[a-zA-Z0-9_-]+$/;
const ALLOWED_PROVIDERS = [
'cursor', 'claude-code', 'gemini', 'codex', 'agents', 'kiro',
'universal', 'universal-prefixed',
];
const PROVIDER_CONFIG_DIRS = {
'cursor': '.cursor',
'claude-code': '.claude',
'gemini': '.gemini',
'codex': '.codex',
'agents': '.agents',
'kiro': '.kiro',
};
export async function onRequestGet(context) {
const { type, provider, id } = context.params;
if (type !== 'skill' && type !== 'command') {
return Response.json({ error: "Invalid type" }, { status: 400 });
}
if (!provider || !ALLOWED_PROVIDERS.includes(provider)) {
return Response.json({ error: "Invalid provider" }, { status: 400 });
}
if (!id || !VALID_ID.test(id)) {
return Response.json({ error: "Invalid file ID" }, { status: 400 });
}
const configDir = PROVIDER_CONFIG_DIRS[provider];
if (!configDir) {
return Response.json({ error: "Invalid provider" }, { status: 400 });
}
const url = new URL(context.request.url);
url.pathname = `/_data/dist/${provider}/${configDir}/skills/${id}/SKILL.md`;
const response = await context.env.ASSETS.fetch(url);
if (!response.ok) {
return Response.json({ error: "File not found" }, { status: 404 });
}
const content = await response.arrayBuffer();
return new Response(content, {
headers: {
'Content-Type': 'application/octet-stream',
'Content-Disposition': 'attachment; filename="SKILL.md"',
'Cache-Control': 'public, s-maxage=86400, stale-while-revalidate=3600',
}
});
}
@@ -0,0 +1,29 @@
const ALLOWED_PROVIDERS = ['universal', 'universal-prefixed'];
export async function onRequestGet(context) {
const { provider } = context.params;
if (!provider || !ALLOWED_PROVIDERS.includes(provider)) {
return Response.json({ error: "Invalid provider" }, { status: 400 });
}
const url = new URL(context.request.url);
url.pathname = `/_data/dist/${provider}.zip`;
const response = await context.env.ASSETS.fetch(url);
if (!response.ok) {
return Response.json({ error: "Bundle not found" }, { status: 404 });
}
const content = await response.arrayBuffer();
const safeProvider = provider.replace(/[^a-zA-Z0-9._-]/g, '');
return new Response(content, {
headers: {
'Content-Type': 'application/zip',
'Content-Disposition': `attachment; filename="impeccable-style-${safeProvider}.zip"`,
'Cache-Control': 'public, s-maxage=86400, stale-while-revalidate=3600',
}
});
}