Files
upbeatBytes/tools/glb-split/diag-tail.mjs
T
thejayman77 89c0fbe1f6 Sync repo to deployed state: SEO recovery, Publishing Desk, Play games, emoji picker
The deploy pipeline runs from the working tree, so a wave of shipped features
had never been committed. This snapshots git to what's actually running.

SEO impression recovery (live + verified):
- Duplicate /a/{id} now 301-redirect to their canonical twin instead of 404
  (a hard 404 silently dropped already-indexed URLs and tanked impressions).
- Dedup representative selection reworked: accepted/serveable -> established
  rep (URL stability) -> quality score, so an accepted page never retires to a
  rejected rep and an indexed canonical doesn't churn when a newer twin arrives.
- HEAD /a/{id} returns the same status as GET (api_route GET+HEAD) instead of
  falling through to the static mount and 404ing.
- `dedup --force-recluster`: cycle-locked, model-free re-cluster to re-apply the
  policy to the existing corpus (shared cycle_lock context manager).
- CLI honors GOODNEWS_DB for its default --db (was silently ignored).

Publishing Desk (admin tool to post highlights to X via Web Intents):
- publishing.py queue/rank/handle-resolution; admin UI; full searchable emoji
  picker (bundled data, no CDN) for the blurb editor.

Play games + site:
- Bloom (word-wheel), Memory Match, daily ritual set, Zen Den (dev-gated).
- English-only language gate; source prospecting; paywall + dedup hardening.

Tests: full suite green (349). Ignores tightened (node_modules, data/*.db).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 11:32:27 -04:00

34 lines
1.7 KiB
JavaScript

import { NodeIO } from '@gltf-transform/core';
import { ALL_EXTENSIONS } from '@gltf-transform/extensions';
const io = new NodeIO().registerExtensions(ALL_EXTENSIONS);
const doc = await io.read(process.argv[2]);
const skin = doc.getRoot().listSkins()[0];
const joints = skin.listJoints();
const tailRoots = joints.filter((n) => /^Tail_Fork_(Top|Bottom)$/.test(n.getName()));
const tailSet = new Set();
const mark = (n) => { tailSet.add(n); n.listChildren().forEach(mark); };
tailRoots.forEach(mark);
const tailJoints = joints.filter((n) => tailSet.has(n));
console.log(`tail roots: ${tailRoots.map((n) => n.getName()).join(', ')}`);
console.log(`tail subtree joints (${tailJoints.length}): ${tailJoints.map((n) => n.getName()).join(', ')}`);
// classify vertices into body / tail / otherfin and count triangles per group
const isFin = joints.map((n) => !n.getName().startsWith('Spine'));
const isTail = joints.map((n) => tailSet.has(n));
const mesh = doc.getRoot().listMeshes()[0];
const prim = mesh.listPrimitives().reduce((a, b) => (b.getIndices().getCount() > a.getIndices().getCount() ? b : a));
const jA = prim.getAttribute('JOINTS_0'), wA = prim.getAttribute('WEIGHTS_0');
const n = prim.getAttribute('POSITION').getCount();
const vFin = new Uint8Array(n), vTail = new Uint8Array(n);
const j = [0, 0, 0, 0], w = [0, 0, 0, 0];
for (let i = 0; i < n; i++) {
jA.getElement(i, j); wA.getElement(i, w);
let f = 0, t = 0, tot = 0;
for (let k = 0; k < 4; k++) { tot += w[k]; if (isFin[j[k]]) f += w[k]; if (isTail[j[k]]) t += w[k]; }
vFin[i] = tot > 0 && f / tot >= 0.5 ? 1 : 0;
vTail[i] = tot > 0 && t / tot >= 0.5 ? 1 : 0;
}
console.log(`tail vertices: ${vTail.reduce((a, b) => a + b, 0)} / ${n}`);