tractatus/scripts/seed-scaling-blog-post.js
TheFlow 2298d36bed fix(submissions): restructure Economist package and fix article display
- Create Economist SubmissionTracking package correctly:
  * mainArticle = full blog post content
  * coverLetter = 216-word SIR— letter
  * Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge

Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150

Next: Enhanced modal with tabs, validation, export

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00

109 lines
3.2 KiB
JavaScript

/**
* Seed Scaling Blog Post
* "How to Scale Tractatus: Breaking the Chicken-and-Egg Problem"
*/
const { getCollection, connect, close } = require('../src/utils/db.util');
const fs = require('fs');
const path = require('path');
// Read the markdown content
const markdown = fs.readFileSync(
path.join(__dirname, '../docs/outreach/Blog-Article-Scaling-Tractatus.md'),
'utf8'
);
// Extract content (skip frontmatter-style metadata at top)
const contentStart = markdown.indexOf('---', markdown.indexOf('---') + 3) + 3;
const content = markdown.substring(contentStart).trim();
const BLOG_POST = {
title: 'How to Scale Tractatus: Breaking the Chicken-and-Egg Problem',
slug: 'scaling-tractatus-roadmap',
author: {
type: 'human',
name: 'John Stroh'
},
content: content,
excerpt: 'Every governance framework faces the same chicken-and-egg problem: need deployments to validate, need validation to deploy. Here\'s our staged roadmap for breaking the cycle and scaling Tractatus from proof-of-concept to industry adoption.',
category: 'Implementation',
status: 'published',
published_at: new Date('2025-10-20'),
moderation: {
ai_analysis: null,
human_reviewer: 'John Stroh',
review_notes: 'Scaling roadmap and pilot partner call-to-action',
approved_at: new Date()
},
tractatus_classification: {
quadrant: 'STRATEGIC',
values_sensitive: false,
requires_strategic_review: false
},
tags: [
'scaling',
'roadmap',
'implementation',
'enterprise',
'governance',
'pilot-partners',
'stage-2',
'chicken-and-egg'
],
view_count: 0,
engagement: {
shares: 0,
comments: 0
}
};
async function seedBlogPost() {
try {
console.log('🌱 Seeding scaling blog post...');
await connect();
const collection = await getCollection('blog_posts');
// Check if post already exists
const existing = await collection.findOne({ slug: BLOG_POST.slug });
if (existing) {
console.log('📝 Blog post already exists:', BLOG_POST.slug);
console.log(' Deleting existing post and creating new one...');
await collection.deleteOne({ slug: BLOG_POST.slug });
}
// Insert the blog post
const result = await collection.insertOne(BLOG_POST);
console.log('✅ Blog post created successfully');
console.log(' ID:', result.insertedId);
console.log(' Slug:', BLOG_POST.slug);
console.log(' Title:', BLOG_POST.title);
console.log(' Status:', BLOG_POST.status);
console.log(' Category:', BLOG_POST.category);
console.log(' Tags:', BLOG_POST.tags.join(', '));
console.log('');
console.log('📍 View at: http://localhost:9000/blog-post.html?slug=' + BLOG_POST.slug);
console.log('📍 Blog list: http://localhost:9000/blog.html');
} catch (error) {
console.error('❌ Error seeding blog post:', error);
throw error;
} finally {
await close();
}
}
// Run if called directly
if (require.main === module) {
seedBlogPost()
.then(() => {
console.log('\n✨ Seeding complete');
process.exit(0);
})
.catch(error => {
console.error('\n💥 Seeding failed:', error);
process.exit(1);
});
}
module.exports = { seedBlogPost, BLOG_POST };