Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.
JavaScript 3d3d-assets3d-modelingagent-skillsagent-toolsai-agentsasset-pipelinecligame-assetsglbgltfmcpmcp-servermodel-context-protocolprocedural-generationprocedural-modelingtext-to-3dthreejstypescript
import { existsSync, readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import release from '../../../.github/published-candidate.json';
import foundryFloor from '../data/foundry-floor.json';
import { featuredWorlds, worldCover } from './site-curation';
import { farm, vehicles, bridge } from './catalog';
import { PACKS_ENABLED, SITE } from './config';
import { SOCIAL_CARD, socialCardAlt, socialCardPath, socialCards } from './social-cards.mjs';
import textTo3d from '../data/text-to-3d-card.json';
/** The cards `scripts/build-site-media.mjs` drew for this build, from the same inputs (it runs before the Astro build). */
const archiveIndex = resolve('public/assets/index.json');
const cards = new Map(
socialCards({
packsEnabled: PACKS_ENABLED,
release,
farm,
vehicles,
bridge,
hero: { poster: worldCover(featuredWorlds[0]!.id)! },
foundryFloor,
archive: existsSync(archiveIndex) ? JSON.parse(readFileSync(archiveIndex, 'utf8')) : [],
textTo3d,
}).map((card) => [card.slug, card]),
);
/** A page's share card: its URL, format, size and a description of the card itself. Unknown cards fail the build. */
export function socialCard(slug: string) {
const card = cards.get(slug);
if (!card)
throw new Error(
`No share card "${slug}": scripts/build-site-media.mjs draws ${[...cards.keys()].slice(0, 12).join(', ')}…`,
);
return {
url: new URL(socialCardPath(slug), SITE).href,
type: SOCIAL_CARD.type,
width: SOCIAL_CARD.width,
height: SOCIAL_CARD.height,
alt: socialCardAlt(card),
};
}