← back to Wallco Ai
scripts/cherry_blossoms_batch.js
42 lines
#!/usr/bin/env node
/**
* Fire a batch of N cherry-blossom + drunk/stoned animal designs through
* scripts/generate_designs.js. Hanami-style canopy, animals face UP, ukiyo-e
* heritage botanical (no neon, no Warhol).
*
* Usage: node scripts/cherry_blossoms_batch.js [N] (default 10)
*/
const { spawnSync } = require('child_process');
const path = require('path');
const { buildN } = require('./cherry_blossom_animal_prompts');
const N = parseInt(process.argv[2] || '10', 10);
const ROOT = path.join(__dirname, '..');
console.log(`\n=== Cherry-blossom animal batch: firing ${N} designs ===\n`);
const prompts = buildN(N);
let ok = 0, fail = 0;
for (let i = 0; i < prompts.length; i++) {
const p = prompts[i];
console.log(`\n--- [${i+1}/${N}] ${p.slice(0, 100)}…`);
const r = spawnSync('node', [
path.join(ROOT, 'scripts', 'generate_designs.js'),
'--n', '1',
'--kind', 'seamless_tile',
'--category', 'cherry-blossom-animals',
'--prompts', p,
], { stdio: 'inherit', cwd: ROOT });
if (r.status === 0) ok++; else fail++;
}
console.log(`\n=== Batch done: ${ok} ok, ${fail} failed ===`);
spawnSync('python3', [path.join(ROOT, 'scripts', 'refresh_designs_snapshot.py')],
{ stdio: 'inherit', cwd: ROOT, timeout: 180_000 });
spawnSync('curl', ['-sf', '-m', '5', '-X', 'POST', 'http://127.0.0.1:9878/admin/reload-designs'],
{ stdio: 'inherit', cwd: ROOT, timeout: 10_000 });
process.exit(fail === 0 ? 0 : 1);