File size: 1,927 Bytes
481c960
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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);
});