Painting Tools & CLI Suite#
Command-line tools for managing, inspecting, and orchestrating the painting short codes feature.
Tools Overview#
Inspection Tools#
inspect-spaces.mjs- Browse Digital Ocean Spaces bucketsinspect-mongodb.mjs- Query paintings collectioninspect-api.mjs- Test API endpoints (local or live)check-lifecycle.mjs- Check bucket lifecycle/expiration policies
Management Tools#
generate-codes.mjs- Generate short codes for paintingsmigrate-codes.mjs- Add codes to existing paintingsaudit-orphans.mjs- Find paintings in S3 but not in MongoDB
Analysis Tools#
stats.mjs- Database statistics and reportsduplicates.mjs- Find duplicate paintings by hashverify.mjs- Verify data integrity
Setup#
cd paintings
npm install
Environment#
Tools can target local or live environments:
# Local development server
export AC_ENV=local
export AC_API=http://localhost:8888
# Live production
export AC_ENV=live
export AC_API=https://aesthetic.computer
Quick Start#
# Inspect Digital Ocean Spaces
node inspect-spaces.mjs --list
# Check bucket lifecycle policies (expiration rules)
node check-lifecycle.mjs
# Check MongoDB paintings collection
node inspect-mongodb.mjs --count
node inspect-mongodb.mjs --recent 10
# Test API endpoints
node inspect-api.mjs --endpoint /api/tv
# Generate codes for new paintings
node generate-codes.mjs --user auth0|123 --dry-run
# Audit for orphaned files
node audit-orphans.mjs --report
Configuration#
Create .env file:
# Digital Ocean Spaces
DO_SPACES_KEY=your-key
DO_SPACES_SECRET=your-secret
DO_SPACES_ENDPOINT=nyc3.digitaloceanspaces.com
DO_SPACES_BUCKET=aesthetic-computer
# MongoDB (local or live)
MONGODB_URI=mongodb://localhost:27017/aesthetic
# Or production:
# MONGODB_URI=mongodb+srv://...
# API
AC_API=http://localhost:8888
# Or production:
# AC_API=https://aesthetic.computer
Development Workflow#
-
Inspect current state:
node inspect-mongodb.mjs --stats node inspect-spaces.mjs --count -
Test code generation:
node generate-codes.mjs --sample 10 --dry-run -
Run migration:
node migrate-codes.mjs --dry-run node migrate-codes.mjs --execute -
Verify results:
node verify.mjs --all node stats.mjs
Architecture#
All tools use shared modules from /system/backend where possible:
database.mjs- MongoDB connectionpainting-code-generator.mjs- Code generation logic- S3 client configuration