Spaces:
Runtime error
Runtime error
| import { Pipeline } from './src/core/Pipeline.js'; | |
| import { ScoutStage } from './src/stages/scoutStage.js'; | |
| import { GenerateStage } from './src/stages/generateStage.js'; | |
| import { ScoreStage } from './src/stages/scoreStage.js'; | |
| import { BuildStage } from './src/stages/buildStage.js'; | |
| // --- Example seed input -------------------------------------------------- | |
| // Swap this for real data from an actual scraper later (App Store reviews, | |
| // Reddit complaints, trending sounds, competitor charts, etc). For now it's | |
| // hand-fed so you can test the pipeline shape and see real cost/output. | |
| const seed = { | |
| niche: 'casual browser games', | |
| rawSignal: | |
| 'Several absurd one-joke browser games (you play as an inanimate object, ' + | |
| 'single dumb mechanic, finish in under 2 minutes) have been trending on ' + | |
| 'CrazyGames and getting picked up in short-form clips because the concept ' + | |
| 'alone is the hook, not the gameplay depth.', | |
| }; | |
| const mode = process.argv[2] || 'pipeline'; // "scout" = just run stage 1 to sanity-check cost | |
| async function main() { | |
| if (mode === 'scout') { | |
| const scout = new ScoutStage(); | |
| const result = await scout.run(seed); | |
| console.log(JSON.stringify(result, null, 2)); | |
| return; | |
| } | |
| const pipeline = new Pipeline( | |
| [new ScoutStage(), new GenerateStage(), new ScoreStage(), new BuildStage()], | |
| { | |
| onStageComplete: (r) => { | |
| console.log(`\n=== [${r.stage}] cost so far: $${r.spentUsd.toFixed(4)} ===`); | |
| console.log(JSON.stringify(r.output, null, 2)); | |
| }, | |
| } | |
| ); | |
| const result = await pipeline.run(seed); | |
| console.log('\n\n========== FINAL RESULT =========='); | |
| if (result.killed) { | |
| console.log(`Pipeline stopped at [${result.killedAt}]: ${result.reason}`); | |
| } else { | |
| console.log(JSON.stringify(result.final, null, 2)); | |
| } | |
| } | |
| main().catch((err) => { | |
| console.error('Pipeline failed:', err.message); | |
| process.exit(1); | |
| }); | |