diff --git a/scripts/add-blog-categories.js b/scripts/add-blog-categories.js new file mode 100644 index 00000000..da864ffa --- /dev/null +++ b/scripts/add-blog-categories.js @@ -0,0 +1,124 @@ +/** + * Add Category Field to Blog Posts + * Maps tags/content to standardized categories for filtering + */ + +const { MongoClient } = require('mongodb'); + +const DEV_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017'; +const DEV_DB = process.env.MONGODB_DB || 'tractatus_dev'; + +// Category assignments based on blog content and tags +const CATEGORY_ASSIGNMENTS = [ + { + slug: 'why-ai-safety-requires-architectural-boundaries-not-just-training', + category: 'Implementation', + reason: 'Technical implementation guide with actionable takeaways' + }, + { + slug: 'scaling-tractatus-roadmap', + category: 'Framework Updates', + reason: 'Roadmap and strategic plan for framework scaling' + }, + { + slug: 'introducing-tractatus-framework', + category: 'Framework Updates', + reason: 'Framework introduction and overview' + }, + { + slug: 'when-frameworks-fail-case-study', + category: 'Case Studies', + reason: 'Case study on framework failures' + }, + { + slug: 'five-component-tractatus-architecture', + category: 'Framework Updates', + reason: 'Framework architecture explanation' + }, + { + slug: 'tractatus-blog-system-launch', + category: 'Framework Updates', + reason: 'Framework feature announcement' + } +]; + +async function addCategories() { + const client = new MongoClient(DEV_URI); + + try { + console.log('\nš Adding Category Field to Blog Posts\n'); + console.log('ā'.repeat(70)); + + await client.connect(); + const db = client.db(DEV_DB); + const collection = db.collection('blog_posts'); + + let updated = 0; + let notFound = 0; + + for (const assignment of CATEGORY_ASSIGNMENTS) { + const blog = await collection.findOne({ slug: assignment.slug }); + + if (!blog) { + console.log(`\nā Blog not found: ${assignment.slug}`); + notFound++; + continue; + } + + console.log(`\nš ${blog.title}`); + console.log(` Slug: ${assignment.slug}`); + console.log(` Category: ${assignment.category}`); + console.log(` Reason: ${assignment.reason}`); + + const result = await collection.updateOne( + { slug: assignment.slug }, + { $set: { category: assignment.category } } + ); + + if (result.modifiedCount === 1) { + console.log(` ā Category added`); + updated++; + } else { + console.log(` ā ļø No change (may already have category)`); + } + } + + console.log('\n' + 'ā'.repeat(70)); + console.log(`\n⨠Complete: ${updated} categories added, ${notFound} not found\n`); + + // Show category distribution + console.log('Category Distribution:'); + const categories = await collection.aggregate([ + { $match: { status: 'published' } }, + { $group: { _id: '$category', count: { $sum: 1 } } }, + { $sort: { count: -1 } } + ]).toArray(); + + for (const cat of categories) { + console.log(` ${cat._id || '(no category)'}: ${cat.count}`); + } + console.log(''); + + return updated > 0; + + } catch (error) { + console.error('ā Error:', error.message); + throw error; + } finally { + await client.close(); + } +} + +// Run if called directly +if (require.main === module) { + addCategories() + .then((success) => { + process.exit(success ? 0 : 1); + }) + .catch(error => { + console.error('\nš„ Failed:', error); + process.exit(1); + }); +} + +module.exports = { addCategories, CATEGORY_ASSIGNMENTS }; diff --git a/scripts/add-vetting-notice-to-architectural-boundaries.js b/scripts/add-vetting-notice-to-architectural-boundaries.js new file mode 100644 index 00000000..39ff8ced --- /dev/null +++ b/scripts/add-vetting-notice-to-architectural-boundaries.js @@ -0,0 +1,107 @@ +/** + * Add Human Vetting Notice to Architectural Boundaries Banner + * Demonstrates AI-curated content requires extra scrutiny + */ + +const { MongoClient } = require('mongodb'); + +const DEV_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017'; +const DEV_DB = process.env.MONGODB_DB || 'tractatus_dev'; + +const SLUG = 'why-ai-safety-requires-architectural-boundaries-not-just-training'; + +const ENHANCED_BANNER = ` +
Human Vetting Process: This AI-curated blog was initially withheld from production deployment pending human review. After revision to meet inst_017 compliance, it was approved for publication.
+The original content contained absolute assurance language ("guarantees") that violated inst_017. The content has been revised to use evidence-based language:
+This demonstrates governance working end-to-end. AI-curated content triggers additional scrutiny. When violations are detected, content is withheld, revised, and approved by human reviewers before publication. Rather than silent editing, we document the entire process transparently.
+Note: The revised language is more precise and accurate. "Deterministic constraints" better describes what architecture provides than "guarantees," which implies perfection.
+