Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
#!/usr/bin/env node
// Mirror data/examples.json to public/examples.json so the browser can fetch it.
//
// scripts/build-examples-index.mjs derives the index by scanning the repo, but
// writes it under data/, which is never served: only public/ is copied into
// dist/ and published. Without this step the generated index is a file nothing
// reads, and the /examples page has to hand-list examples instead, which is
// exactly the drift the generator was written to prevent.
//
// This is a mirror, not a second generator: data/examples.json stays the single
// source of truth, and the copy is byte-identical apart from a banner marking
// it as generated. Run `npm run build:examples` to do both steps in order.
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const here = dirname(fileURLToPath(import.meta.url));
const root = resolve(here, '..');
const source = resolve(root, 'data/examples.json');
const target = resolve(root, 'public/examples.json');
if (!existsSync(source)) {
console.error('mirror-examples-index: data/examples.json is missing. Run scripts/build-examples-index.mjs first.');
process.exit(1);
}
let index;
try {
index = JSON.parse(readFileSync(source, 'utf8'));
} catch (err) {
console.error(`mirror-examples-index: data/examples.json is not valid JSON (${err.message}).`);
process.exit(1);
}
// Fail loudly rather than publishing an index the gallery would render as its
// empty state. An empty index always means the scan broke, never that the repo
// genuinely has no examples.
if (!Array.isArray(index.examples) || index.examples.length === 0) {
console.error('mirror-examples-index: the index carries no examples, so the scan is broken. Refusing to publish it.');
process.exit(1);
}
const missingFields = index.examples.filter((e) => !e || !e.id || !e.title || !e.path);
if (missingFields.length) {
console.error(
`mirror-examples-index: ${missingFields.length} entr(ies) lack id/title/path, which the gallery requires. Fix the generator.`,
);
process.exit(1);
}
// The banner goes last so it wins: data/examples.json carries its own
// $comment naming the generator, and a reader who opens the served copy needs
// to be told to edit neither this file nor that one by hand.
const payload = {
...index,
$comment:
'GENERATED by scripts/mirror-examples-index.mjs from data/examples.json. Do not edit; run `npm run build:examples`.',
};
const serialized = `${JSON.stringify(payload, null, '\t')}\n`;
const previous = existsSync(target) ? readFileSync(target, 'utf8') : '';
if (previous === serialized) {
console.log(`same public/examples.json (${index.examples.length} examples)`);
} else {
writeFileSync(target, serialized);
console.log(`wrote public/examples.json (${index.examples.length} examples)`);
}