Skip to content

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.

test: guard rig convention docs drift

zerone0x667c3f95c53c
diff --git a/src/rig-report.js b/src/rig-report.js
index 36e9effd3..1714ee8c5 100644
--- a/src/rig-report.js
+++ b/src/rig-report.js
@@ -72,7 +72,7 @@ export const LIMB_GROUPS = Object.freeze([
// `schema` maps onto the avatar-manifest `skeleton` enum
// (packages/avatar-schema/schema/avatar.v1.json), so the generated manifest
// declares the right value instead of defaulting everything to `custom`.
-const CONVENTIONS = [
+export const CONVENTIONS = [
{
id: 'rpm', label: 'Ready Player Me', schema: 'rpm',
test: (ctx) => ctx.meshNames.some((n) => /^Wolf3D_/i.test(n)) && ctx.joints.some((n) => /Hips$/i.test(n)),
diff --git a/tests/rig-report.test.js b/tests/rig-report.test.js
index f2f002c65..948ec77bb 100644
--- a/tests/rig-report.test.js
+++ b/tests/rig-report.test.js
@@ -17,6 +17,7 @@ import {
CANONICAL_TOTAL,
CONVENTION_COUNT,
LIMB_GROUPS,
+ CONVENTIONS,
} from '../src/rig-report.js';
const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
@@ -30,6 +31,17 @@ function report(name) {
return analyzeGlb(load(name), { fileName: `${name}.glb` });
}
+function documentedRigConventions() {
+ const doc = readFileSync(join(ROOT, 'docs/rig-doctor.md'), 'utf8');
+ const rows = [];
+ for (const match of doc.matchAll(/^\|\s*([^|]+?)\s*\|\s*([^|]+?)\s*\|\s*`([^`]+)`\s*\|$/gm)) {
+ const convention = match[1].trim();
+ if (convention === 'Convention' || /^-+$/.test(convention)) continue;
+ rows.push({ convention, detectedBy: match[2].trim(), schema: match[3].trim() });
+ }
+ return rows;
+}
+
describe('readGlbJson', () => {
it('rejects a file that is not a GLB with a message a creator can act on', () => {
const notGlb = new TextEncoder().encode('this is plainly not a binary glTF file');
@@ -56,6 +68,19 @@ describe('readGlbJson', () => {
describe('detectConvention fingerprints', () => {
const ctx = (joints, meshNames = []) => ({ joints, meshNames, json: {} });
+ it('keeps documented rig conventions in sync with the detector', () => {
+ const implemented = CONVENTIONS.filter((c) => c.id !== 'unknown');
+ const docs = documentedRigConventions();
+ const implementedLabels = implemented.map((c) => c.label);
+ const documentedLabels = docs.map((row) => row.convention);
+
+ expect(documentedLabels).toEqual(implementedLabels);
+ for (const convention of implemented) {
+ expect(convention.evidence, `${convention.label} evidence`).toEqual(expect.any(String));
+ expect(convention.evidence.trim(), `${convention.label} evidence`).not.toBe('');
+ }
+ });
+
it('identifies an MMD rig from its Japanese PMX bone names', () => {
const c = detectConvention(ctx(['センター', '上半身', '左腕', '左ひじ', '右ひざ']));
expect(c.id).toBe('mmd');