Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 87 lines 2.7 kB view raw
1#!/usr/bin/env node 2 3/** 4 * Simple script to regenerate KidLisp playlists with provenance blocks 5 * Just runs the three playlist generation scripts in sequence 6 * 7 * Usage: FEED_API_SECRET=your_secret node update-kidlisp-playlists-simple.mjs 8 */ 9 10import { spawn } from 'child_process'; 11 12const API_SECRET = process.env.FEED_API_SECRET; 13 14if (!API_SECRET || API_SECRET === 'YOUR_FEED_API_SECRET_HERE') { 15 console.error('❌ Error: FEED_API_SECRET environment variable must be set'); 16 console.error('Usage: FEED_API_SECRET=your_secret node update-kidlisp-playlists-simple.mjs'); 17 process.exit(1); 18} 19 20const scripts = [ 21 { name: 'Top 100 KidLisp', path: './feed/create-top-kidlisp-playlist.mjs' }, 22 { name: 'Colors', path: './feed/create-kidlisp-colors-playlist.mjs' }, 23 { name: 'Chords', path: './feed/create-kidlisp-chords-playlist.mjs' } 24]; 25 26async function runScript(scriptInfo) { 27 return new Promise((resolve, reject) => { 28 console.log(`\n🎨 Running ${scriptInfo.name}...`); 29 console.log(` Script: ${scriptInfo.path}`); 30 31 const child = spawn('node', [scriptInfo.path], { 32 env: { ...process.env, FEED_API_SECRET: API_SECRET }, 33 stdio: 'inherit', 34 cwd: '/workspaces/aesthetic-computer' 35 }); 36 37 child.on('close', (code) => { 38 if (code === 0) { 39 console.log(`${scriptInfo.name} completed successfully\n`); 40 resolve({ success: true, name: scriptInfo.name }); 41 } else { 42 console.error(`${scriptInfo.name} failed with code ${code}\n`); 43 resolve({ success: false, name: scriptInfo.name, code }); 44 } 45 }); 46 47 child.on('error', (err) => { 48 console.error(`❌ Failed to run ${scriptInfo.name}:`, err.message); 49 reject(err); 50 }); 51 }); 52} 53 54async function main() { 55 console.log('🔄 Regenerating KidLisp Playlists with Provenance Blocks\n'); 56 console.log('This will create/update all KidLisp playlists with proper provenance blocks.\n'); 57 58 const results = []; 59 60 for (const script of scripts) { 61 const result = await runScript(script); 62 results.push(result); 63 } 64 65 console.log('\n📊 Summary:'); 66 const succeeded = results.filter(r => r.success).length; 67 const failed = results.filter(r => !r.success).length; 68 69 console.log(`✅ Succeeded: ${succeeded}`); 70 console.log(`❌ Failed: ${failed}`); 71 72 if (failed > 0) { 73 console.log('\nFailed scripts:'); 74 results.filter(r => !r.success).forEach(r => { 75 console.log(` - ${r.name}`); 76 }); 77 process.exit(1); 78 } 79 80 console.log('\n🎉 All playlists regenerated successfully!'); 81 console.log('All playlists now include provenance blocks according to DP-1 spec.'); 82} 83 84main().catch(error => { 85 console.error('❌ Fatal error:', error); 86 process.exit(1); 87});