tractatus/scripts/check-sections.js
TheFlow dcb778726b docs: fix Introduction language violations and add database utility scripts
- Remove absolute claims from Introduction ("guarantees" -> "constraints")
- Align with TRA-VAL-0001 "Honest Limitations" principle
- Add compare-databases.js for dev/prod sync verification
- Add check-sections.js to audit card presentation status
- Add fix-category-mismatches.js for category corrections
- Fix Document.model.js metadata update handling

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-12 22:41:04 +13:00

21 lines
922 B
JavaScript

const { MongoClient } = require('mongodb');
(async () => {
const client = new MongoClient('mongodb://localhost:27017/tractatus_dev');
await client.connect();
const docs = await client.db('tractatus_dev').collection('documents')
.find({}, { projection: { slug: 1, title: 1, sections: 1, category: 1 } })
.sort({ slug: 1 })
.toArray();
const withSections = docs.filter(d => d.sections && d.sections.length > 0);
const without = docs.filter(d => !d.sections || d.sections.length === 0);
console.log('=== DOCUMENTS WITH SECTIONS (' + withSections.length + ') ===');
withSections.forEach(d => console.log('-', d.slug, '(' + d.sections.length + ' sections, cat:' + (d.category || 'none') + ')'));
console.log('\n=== DOCUMENTS WITHOUT SECTIONS (' + without.length + ') ===');
without.forEach(d => console.log('-', d.slug, '(cat:' + (d.category || 'none') + ')'));
await client.close();
})();