Skip to content
Shell
1.8 KB
Raw Blame
/**
 * Reddit Research Agent
 * Extract market research gold from Reddit threads
 */

// Core exports
export * from './types.js';
export * from './reddit/index.js';
export * from './db/index.js';
export * from './agent/analyzer.js';
export * from './agent/runner.js';

// Production features
export * from './alerts/index.js';
export * from './sync/index.js';
export * from './dashboard/index.js';
export * from './agent/multiAgent.js';
export * from './utils/rateLimiter.js';

// Quick usage example
import { findGoldmineThreads, fetchThread } from './reddit/index.js';
import { analyzeThread } from './agent/analyzer.js';

export async function quickResearch(subreddit: string, query?: string) {
  console.log(`πŸ” Researching r/${subreddit}${query ? ` for "${query}"` : ''}...\n`);

  // Find goldmine threads
  const threads = await findGoldmineThreads(subreddit, query ? [query] : undefined);

  console.log(`Found ${threads.length} goldmine threads:\n`);

  // Show top 5
  for (const thread of threads.slice(0, 5)) {
    console.log(`[${thread.goldmineScore}] ${thread.title.slice(0, 60)}...`);
    console.log(`   πŸ“Š ${thread.score} pts | πŸ’¬ ${thread.numComments} comments`);
    console.log(`   πŸ”— ${thread.url}\n`);
  }

  // Analyze top thread
  if (threads.length > 0) {
    console.log('\nπŸ“ˆ Analyzing top thread...\n');
    const topThread = await fetchThread(threads[0].url);
    const insights = await analyzeThread(topThread);

    console.log('Summary:', insights.summary);
    console.log('\nPain Points:');
    for (const pp of insights.painPoints) {
      console.log(`  - ${pp.description}`);
    }
    console.log('\nOpportunities:');
    for (const opp of insights.opportunities) {
      console.log(`  - [${opp.confidence}] ${opp.description}`);
    }
  }

  return threads;
}