Files
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

61 lines
2.8 KiB
JavaScript

// Independent structural audit of UB. Groups every vertex by its dominant bone,
// then reports each anatomical group's vertex count, centroid, and bounding box in
// model space. Reveals off-midline parts (dorsal), mis-located parts (lip), and
// which primitive/material each region landed in after the split.
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 root = doc.getRoot();
const joints = root.listSkins()[0].listJoints();
const groupOf = (name) => {
if (name.startsWith('Spine')) return 'body';
if (name.startsWith('Dorsal')) return 'dorsal';
if (name.startsWith('Pec_Fin_Left')) return 'pec_L';
if (name.startsWith('Pec_Fin_Right')) return 'pec_R';
if (name.startsWith('Left_Rear_Belly')) return 'belly_L';
if (name.startsWith('Right_Rear_Belly')) return 'belly_R';
if (name.startsWith('Rear_Center_Fin')) return 'anal';
if (name.startsWith('Tail_Fork')) return 'tail';
if (name.startsWith('Joint')) return 'joint(tail-ray?)';
return `?:${name}`;
};
const jointGroup = joints.map((n) => groupOf(n.getName()));
const mesh = root.listMeshes()[0];
const prim = mesh.listPrimitives().reduce((a, b) => (b.getIndices().getCount() > a.getIndices().getCount() ? b : a));
const pos = prim.getAttribute('POSITION');
const jA = prim.getAttribute('JOINTS_0');
const wA = prim.getAttribute('WEIGHTS_0');
const n = pos.getCount();
const G = {};
const p = [0, 0, 0], 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 best = 0, bestW = -1;
for (let k = 0; k < 4; k++) if (w[k] > bestW) { bestW = w[k]; best = j[k]; }
const g = jointGroup[best];
pos.getElement(i, p);
const e = G[g] || (G[g] = { c: 0, sum: [0, 0, 0], min: [1e9, 1e9, 1e9], max: [-1e9, -1e9, -1e9] });
e.c++;
for (let d = 0; d < 3; d++) { e.sum[d] += p[d]; e.min[d] = Math.min(e.min[d], p[d]); e.max[d] = Math.max(e.max[d], p[d]); }
}
const f = (x) => x.toFixed(3).padStart(8);
console.log('axes: X Y Z (model space)\n');
for (const [g, e] of Object.entries(G).sort((a, b) => b[1].c - a[1].c)) {
const ctr = e.sum.map((s) => s / e.c);
const sz = e.max.map((m, d) => m - e.min[d]);
console.log(`${g.padEnd(16)} n=${String(e.c).padStart(5)} centroid[${ctr.map(f).join(',')}] size[${sz.map(f).join(',')}]`);
}
// whole-model bbox to know which axis is length/height/depth
const bb = Object.values(G).reduce((acc, e) => {
for (let d = 0; d < 3; d++) { acc.min[d] = Math.min(acc.min[d], e.min[d]); acc.max[d] = Math.max(acc.max[d], e.max[d]); }
return acc;
}, { min: [1e9, 1e9, 1e9], max: [-1e9, -1e9, -1e9] });
console.log(`\nwhole bbox min[${bb.min.map(f).join(',')}] max[${bb.max.map(f).join(',')}] size[${bb.max.map((m, d) => f(m - bb.min[d])).join(',')}]`);