/** * Inspect the "Overview" cards to understand their content * so we can create better titles */ const { MongoClient } = require('mongodb'); const DOCS_WITH_OVERVIEW = ['core-concepts', 'implementation-guide-v1.1', 'technical-architecture']; async function run() { const client = new MongoClient('mongodb://localhost:27017'); await client.connect(); const db = client.db('tractatus_dev'); const collection = db.collection('documents'); console.log('═══════════════════════════════════════════════════════════'); console.log(' INSPECTING OVERVIEW CARDS'); console.log('═══════════════════════════════════════════════════════════\n'); for (const slug of DOCS_WITH_OVERVIEW) { const doc = await collection.findOne({ slug }); if (!doc) { console.log(`⚠️ NOT FOUND: ${slug}\n`); continue; } console.log(`\n📄 ${doc.title}`); console.log(` Slug: ${slug}`); const overviewCard = doc.sections?.find(s => s.title === 'Overview'); if (overviewCard) { console.log(`\n Card #${overviewCard.number}: "${overviewCard.title}"`); console.log(` Category: ${overviewCard.category}`); console.log(`\n Excerpt:`); console.log(` ${overviewCard.excerpt}\n`); console.log(` Content preview (first 300 chars):`); const textContent = overviewCard.content_html .replace(/<[^>]+>/g, ' ') .replace(/\s+/g, ' ') .trim(); console.log(` ${textContent.substring(0, 300)}...\n`); console.log(` Full content length: ${overviewCard.content_html.length} chars\n`); } else { console.log(` ❌ No "Overview" card found!\n`); } console.log(' ---'); } await client.close(); } run().catch(console.error);