trigger-ingestion.js•1.58 kB
// Trigger one-time RSS ingestion
require('dotenv').config();
const { initDatabase } = require('./dist/config/database');
const { OpmlService } = require('./dist/services/OpmlService');
const { RssService } = require('./dist/services/RssService');
const opmlFilePath = process.env.OPML_FILE_PATH || './engblogs.opml';
async function ingest() {
console.log('Starting RSS feed ingestion...\n');
try {
console.log('1. Initializing database connection...');
await initDatabase();
console.log(' ✅ Database connected\n');
console.log('2. Parsing OPML file:', opmlFilePath);
const opmlService = new OpmlService();
await opmlService.parseAndSaveFeeds(opmlFilePath);
console.log(' ✅ OPML parsed and feeds imported\n');
console.log('3. Fetching articles from all RSS feeds...');
console.log(' (This may take a while if generating embeddings)\n');
const rssService = new RssService();
await rssService.fetchAllFeeds();
console.log(' ✅ All feeds fetched and articles saved\n');
console.log('🎉 Ingestion complete!');
console.log('\nYou can now:');
console.log('- Restart Claude Desktop to use the new data');
console.log('- Use get_content to browse articles');
console.log('- Use search_articles to find specific topics');
if (process.env.OPENAI_API_KEY) {
console.log('- Use semantic_search for AI-powered discovery');
}
process.exit(0);
} catch (error) {
console.error('❌ Ingestion failed:', error.message);
console.error(error);
process.exit(1);
}
}
ingest();