Fractal Thought Engine - Scripts & Tooling

This repository contains the source code and maintenance scripts for the Fractal Thought Engine static site. The project is built using Jekyll and utilizes a suite of custom Node.js and Shell/PowerShell scripts to manage content, validate links, handle assets, and deploy to AWS S3.

📋 Prerequisites

Before running these scripts, ensure you have the following installed:

Installation

  1. Install Node Dependencies:
    1
    
    npm install sharp gray-matter glob js-yaml
    
  2. Install Ruby Gems:
    1
    
    bundle install
    

🚀 Deployment

Automated scripts are provided for building the Jekyll site and syncing it to the S3 bucket (s3://fractalthoughtengine.com) with proper cache headers and CloudFront invalidation.

Linux / macOS (deploy.sh)

1
2
3
4
5
6
7
8
# Standard deployment
./scripts/deploy.sh

# Dry run (see what will happen without uploading)
./scripts/deploy.sh --dry-run

# Use a specific AWS profile
./scripts/deploy.sh --profile my-profile

Windows (deploy.ps1)

1
2
3
4
5
6
7
8
# Standard deployment
.\scripts\deploy.ps1

# Dry run
.\scripts\deploy.ps1 -DryRun

# Use a specific AWS profile
.\scripts\deploy.ps1 -Profile my-profile

Features:


📝 Content Management Workflows

The project uses a sophisticated “Export -> Transform -> Import” workflow to handle complex content structures and asset organization.

1. Exporting Posts (export-posts.js)

Converts standard Jekyll _posts/*.md files into a folder-based structure in post_data/.

1
node scripts/export-posts.js

2. Importing Posts (import-posts.js)

Reconstructs Jekyll markdown files from the post_data/ directory back into _posts/.

1
node scripts/import-posts.js

📊 Bulk Data Editing

These scripts allow you to edit Frontmatter (metadata) for all posts simultaneously using CSV files (e.g., in Excel or Google Sheets).

1. Extract Frontmatter (extract-frontmatter.js)

Scans all posts and creates CSV files in _data/ for every unique frontmatter key found.

1
node scripts/extract-frontmatter.js

2. Ingest Frontmatter (ingest-frontmatter.js)

Reads modified CSV files from _data/ and updates the actual Markdown files in _posts/.

1
node scripts/ingest-frontmatter.js

A powerful utility to ensure site integrity.

1
node scripts/validate-links.js

🎨 Asset & Housekeeping Tools

Generate Favicons (generate-favicons.js)

Generates a complete suite of favicons from a single source image.

1
node scripts/generate-favicons.js

Ensures every post has a valid featured_image.

1
node scripts/normalize-featured-images.js

Fix Post Dates (fix-post-dates.js)

Ensures the date in the Frontmatter matches the date in the filename.

1
node scripts/fix-post-dates.js

Rename Posts (rename_posts.sh)

Standardizes filenames based on the file creation/modification date and title.

1
./scripts/rename_posts.sh

🛠️ Common Workflows

Scenario: Bulk Retagging

  1. Run node scripts/extract-frontmatter.js.
  2. Open _data/tags.csv in Excel.
  3. Modify tags as needed.
  4. Run node scripts/ingest-frontmatter.js.

Scenario: Reorganizing a Post with Multiple Content Types

  1. Run node scripts/export-posts.js.
  2. Navigate to post_data/YYYY/MM/slug/.
  3. Add comic.md or socratic.md alongside content.md.
  4. Run node scripts/import-posts.js.
  5. The system will automatically build the tabs and update tags.

Scenario: Pre-Deployment Check

  1. Run node scripts/fix-post-dates.js.
  2. Run node scripts/validate-links.js to fix broken references.
  3. Run ./scripts/deploy.sh.