/* What data exists that no agent can currently reach? */ import mongoose from 'mongoose'; import { connectMongo } from '../src/data/mongo.js'; await connectMongo(); const db = mongoose.connection.db; // Collections the tools actually query today. const COVERED = new Set([ 'leads', 'conversations', 'leadstages', 'analyticsevents', 'summarynotes', 'workshopstages', 'enrollmentlogs', 'calllogs', 'campaigns', 'followups', 'dsrreports', 'users', 'roles', 'courses', 'trainers', ]); const cols = await db.listCollections().toArray(); const rows = []; for (const c of cols) { const n = await db.collection(c.name).estimatedDocumentCount(); if (n > 0) rows.push([c.name, n, COVERED.has(c.name)]); } rows.sort((a, b) => b[1] - a[1]); console.log('UNREACHABLE by any current agent (non-empty):'); for (const [name, n, cov] of rows) { if (!cov) console.log(` ${String(n).padStart(6)} ${name}`); } // Peek at the biggest gaps to judge whether they're worth an agent. for (const name of ['capievents', 'instaadleads', 'commentleads', 'whatsapptemplleads', 'tags']) { const doc = await db.collection(name).findOne({}); if (!doc) continue; const keys = Object.keys(doc).filter((k) => k !== '_id' && k !== '__v').slice(0, 12); console.log(`\n${name} → ${keys.join(', ')}`); } process.exit(0);