tractatus/scripts/check-glossary.js
TheFlow b199a3e265 fix(security): secure archived documents endpoint and reorganize docs UI
Security:
- Add authentication to /api/documents/archived endpoint (admin-only)
- Prevent public exposure of 108 archived/internal documents

Documentation UI:
- Remove duplicate hardcoded Resources section from docs.html
- Add Resources category to docs-app.js for implementation guides
- Move 3 implementation guides from Getting Started to Resources
- Move Glossary from Technical Reference to Getting Started
- Set Research & Theory section to collapsed by default
- Update service worker cache version to 0.1.4

Migration Scripts:
- Add scripts for document category reorganization
- Add scripts for research document migration to production
- Add scripts for glossary verification and comparison

Files changed:
- public/docs.html: Remove duplicate Resources section
- public/js/docs-app.js: Add Resources category, collapse Research
- public/service-worker.js: Bump cache to v0.1.4
- src/routes/documents.routes.js: Secure /archived endpoint
- scripts/*: Add 10 migration/diagnostic scripts

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 00:03:13 +13:00

48 lines
1.8 KiB
JavaScript

/**
* Check Glossary documents in production
*/
const { MongoClient } = require('mongodb');
require('dotenv').config({ path: '/var/www/tractatus/.env' });
async function run() {
const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017';
const DB_NAME = process.env.MONGODB_DB || 'tractatus_prod';
const client = new MongoClient(MONGODB_URI);
await client.connect();
console.log('═══════════════════════════════════════════════════════════');
console.log(' GLOSSARY DOCUMENTS IN PRODUCTION');
console.log('═══════════════════════════════════════════════════════════\n');
const docs = await client.db(DB_NAME).collection('documents').find({
slug: { $regex: 'glossary', $options: 'i' }
}).project({
slug: 1,
title: 1,
visibility: 1,
category: 1,
order: 1,
updated_at: 1
}).toArray();
if (docs.length === 0) {
console.log('❌ No glossary documents found\n');
} else {
docs.forEach((doc, idx) => {
console.log(`${idx + 1}. ${doc.title}`);
console.log(` Slug: ${doc.slug}`);
console.log(` Visibility: ${doc.visibility}`);
console.log(` Category: ${doc.category || 'none'}`);
console.log(` Order: ${doc.order || 'none'}`);
console.log(` Updated: ${doc.updated_at || 'unknown'}`);
console.log('');
});
}
await client.close();
console.log('═══════════════════════════════════════════════════════════\n');
}
run().catch(console.error);