Monorepo for Aesthetic.Computer
aesthetic.computer
1# System Scripts Omakase Menu 🍱
2
3Operational and maintenance scripts for Aesthetic Computer backend systems.
4
5## 📁 Directory Structure
6
7- **`atproto/`** - ATProto sync, backfill, and verification scripts
8- **`recovery/`** - Data recovery and repair scripts
9- **`migration/`** - One-off database migrations (historical)
10
11## 🦋 ATProto Scripts (`atproto/`)
12
13### Sync & Backfill
14- **`sync-atproto.mjs`** - Master sync script for all content types (kidlisp, paintings, tapes, moods)
15 - Usage: `node scripts/atproto/sync-atproto.mjs [live] [--type] [--user] [--anonymous-only]`
16 - Syncs MongoDB content to ATProto PDS and updates rkey backrefs
17
18- **`backfill-kidlisp-rkeys.mjs`** - Match existing ATProto kidlisp to MongoDB and update rkeys
19 - Usage: `node scripts/atproto/backfill-kidlisp-rkeys.mjs [live]`
20 - For @jeffrey, art-guest, and @fifi accounts
21
22- **`sync-jeffrey-kidlisp.mjs`** - Focused sync for @jeffrey's missing kidlisp
23 - Usage: `node scripts/atproto/sync-jeffrey-kidlisp.mjs [live]`
24 - Creates ATProto records for kidlisp missing from PDS
25
26- **`sync-fifi-kidlisp.mjs`** - Focused sync for @fifi's missing kidlisp
27 - Usage: `node scripts/atproto/sync-fifi-kidlisp.mjs [live]`
28 - Batch processes kidlisp records (10 at a time)
29
30### Verification & Debugging
31- **`check-kidlisp-atproto.mjs`** - Compare MongoDB vs PDS state for @jeffrey and art-guest
32 - Usage: `node scripts/atproto/check-kidlisp-atproto.mjs`
33 - Reports discrepancies and missing rkeys
34
35- **`check-fifi-kidlisp.mjs`** - Compare MongoDB vs PDS state for @fifi
36 - Usage: `node scripts/atproto/check-fifi-kidlisp.mjs`
37 - Detailed analysis of sync status
38
39### Development & Testing
40- **`sync-mongodb-from-atproto.mjs`** - Reverse sync: pull data from PDS into MongoDB
41 - Usage: `node scripts/atproto/sync-mongodb-from-atproto.mjs`
42 - Useful for testing and data recovery scenarios
43
44- **`test-mood-sync.mjs`** - Test mood syncing to ATProto
45 - Usage: `node scripts/atproto/test-mood-sync.mjs`
46 - Development/debugging script
47
48## 🔧 Recovery Scripts (`recovery/`)
49
50- **`recover-deleted-tapes.mjs`** - Recover tapes from DigitalOcean Spaces backups
51 - Usage: `node scripts/recovery/recover-deleted-tapes.mjs [--dry-run] [--codes=...] [--rebake] [--recreate]`
52 - Locates ZIP/MP4 files and optionally recreates MongoDB + ATProto records
53 - Requires: DO_SPACES_KEY, DO_SPACES_SECRET env vars
54
55- **`check-tape-zips-in-spaces.mjs`** - List all tape ZIP files in DigitalOcean Spaces
56 - Usage: `node scripts/recovery/check-tape-zips-in-spaces.mjs`
57 - Quick inventory of available tape backups
58
59## 🎯 Common Workflows
60
61### Check sync status for all users
62```bash
63node scripts/atproto/check-kidlisp-atproto.mjs
64node scripts/atproto/check-fifi-kidlisp.mjs
65```
66
67### Backfill missing rkeys
68```bash
69# Dry run first
70node scripts/atproto/backfill-kidlisp-rkeys.mjs
71
72# Then live
73node scripts/atproto/backfill-kidlisp-rkeys.mjs live
74```
75
76### Sync specific content types
77```bash
78# Kidlisp only
79node scripts/atproto/sync-atproto.mjs live --kidlisp-only
80
81# Anonymous content only (uses art-guest account)
82node scripts/atproto/sync-atproto.mjs live --anonymous-only
83
84# Specific user
85node scripts/atproto/sync-atproto.mjs live --user=jeffrey
86```
87
88### Recover deleted tapes
89```bash
90# Check what can be recovered
91node scripts/recovery/recover-deleted-tapes.mjs --dry-run
92
93# Recover specific codes
94node scripts/recovery/recover-deleted-tapes.mjs --codes=abc,xyz --recreate
95```
96
97## 📝 Notes
98
99- All scripts support `--dry-run` or run without `live` argument for safe preview
100- Scripts automatically use MongoDB from MONGODB_CONNECTION_STRING env var
101- ATProto scripts require PDS_URL and PDS_ADMIN_PASSWORD env vars
102- Always run verification scripts after sync/backfill operations
103
104## 🔗 Related
105
106- Backend modules: `system/backend/`
107- Netlify functions: `system/netlify/functions/`
108- AT Protocol tools: `at/scripts/atproto/` (external federation tools)