Ratatoskr/scripts/sync-poses.mjs
Void a1101e90a6
Some checks failed
Check PR title / lint (pull_request_target) Has been cancelled
Build pull request / Build pull request (pull_request) Has been cancelled
CLA Assistant / CLAssistant (pull_request_target) Failing after 1s
poses: read labels only from the catalogue; add a client-status pose line
The client's own SHARED_POSES/MIND_POSES lists and the committed webp art are gone.
catalogue.json (cast-art poses/catalogue.json, synced by npm run sync:poses) is the
only list of Minds, labels and art paths. RoomViewPoseStatus draws "Ratatoskr:
<Mind> is <pose>, since HH:MM" from the loaded timeline; it is never sent to a room.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 14:06:18 +00:00

24 lines
998 B
JavaScript

// Copies the pose catalogue and the art it names from the cast-art directory.
// The catalogue is the only list of poses the client knows; the art is not committed.
import { copyFileSync, mkdirSync, readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const src = process.argv[2] ?? '/opt/commons/cast-art/poses';
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
const catalogue = JSON.parse(readFileSync(join(src, 'catalogue.json'), 'utf8'));
copyFileSync(
join(src, 'catalogue.json'),
join(root, 'src/app/components/message/pose/catalogue.json')
);
const files = Object.values(catalogue.minds).flatMap((m) => [
...Object.values(m.shared),
...Object.values(m.signatures),
]);
files.forEach((f) => {
const dest = join(root, 'public/poses', f);
mkdirSync(dirname(dest), { recursive: true });
copyFileSync(join(src, f), dest);
});
console.log(`synced catalogue and ${files.length} images from ${src}`);