LLM Outline For GitHub Refactor Large Language Models, Archive, Ipse Paideia, Generated Content

LLM Outline For GitHub Refactor

I gave my LLM enough background information to generate a basic outline of a refactoring process to put my Markdown note-taking pipeline into use for another, less technical, user. Saving for later.

Body

1. Workflow Isolation & Coexistence Strategy

To develop, test, and distribute the GitHub-based version without altering your personal, offline workflow, apply a strict separation of concerns utilizing environment detection and file overrides.

                  ┌──────────────────────────────┐
                  │   Common build_site.py Core  │
                  └──────────────┬───────────────┘
                                 │
                 Is "config.local.yaml" present?
                                 │
                ┌────────────────┴────────────────┐
                ▼ YES                             ▼ NO
     [Personal Offline Mode]            [GitHub Public Mode]
     - Load absolute paths              - Load relative repository paths
     - Execute local WSL rsync          - Output to root-relative "./dist"
     - Run locally on host F:\          - Deployment handled by CI runner

Isolation Rules

  1. Physical Folder Separation: Do not co-locate your private vault (F:\ipse_paideia) with the development repository of the public-facing project. Keep the public project in a completely separate root-level folder (e.g., D:\dev\public\markdown-notes-template).
  2. Configuration Overrides: Create a base config.yaml containing relative paths for the public version. Create a separate config.local.yaml for your personal offline settings containing your absolute path definitions (F:\ipse_paideia, D:\dev\personal\...).
  3. Strict Git Ignore Rules: Add config.local.yaml to the .gitignore file. This guarantees that your personal absolute paths and local paths are never pushed to GitHub.
  4. Compile-Time Feature Flags: Refactor the deployment function in build_site.py to run only if config.local.yaml is detected and a specific deploy_locally key is set to true. If absent, the script must exit silently after generating the HTML output, leaving final deployment tasks to the platform runner.

2. GitHub-Based Template Repository Structure

The distributed public version must be packaged as a clean, standardized repository template that a non-technical user can clone or duplicate.

markdown-notes-template/
├── .github/
│   └── workflows/
│       └── deploy.yml          # GitHub Actions CI/CD deployment pipeline
├── src/                        # Input directory for user's Markdown files
│   ├── index.md                # Homepage of the notes site
│   └── navigation_menu.md      # Simplified markdown navigation source
├── assets/                     # Front-end design assets
│   ├── css/                    # Custom overrides & Pico.css
│   └── templates/              # Pandoc HTML layout templates
├── system/                     # Critical files hidden from typical user paths
│   ├── favicons/
│   ├── robots.txt
│   └── .htaccess               # Kept for standard Apache compatibility if needed
├── requirements.txt            # Python dependencies (e.g., PyYAML)
├── build_site.py               # Path-abstracted Python compiler script
└── config.yaml                 # Repository-relative configuration defaults

3. Pathing & Script Refactoring Plan

The code base in build_site.py requires restructuring to transition from host-specific configurations to environment-aware pathing.

Step A: Dynamic Root Resolution

Replace absolute paths with dynamic lookups anchored to the script’s directory location:

import os
import yaml

# Determine repository root directory
REPO_ROOT = os.path.dirname(os.path.abspath(__file__))

# Determine which configuration file to load
local_config_path = os.path.join(REPO_ROOT, "config.local.yaml")
default_config_path = os.path.join(REPO_ROOT, "config.yaml")

if os.path.exists(local_config_path):
    with open(local_config_path, "r") as f:
        config = yaml.safe_load(f)
    print("Running in Local Personal Mode.")
else:
    with open(default_config_path, "r") as f:
        config = yaml.safe_load(f)
    print("Running in Public GitHub Mode.")

# Convert relative configuration paths to absolute paths at runtime
SRC_DIR = os.path.abspath(os.path.join(REPO_ROOT, config.get("src", "./src")))
DST_DIR = os.path.abspath(os.path.join(REPO_ROOT, config.get("dst", "./dist")))

Step B: Decouple External Systems

Isolate and wrap any shell invocations (WSL, rsync, rclone, or SSH commands) inside conditional checks:

def sync_to_server():
    # Only run if explicitly authorized by local configuration override
    if config.get("local_deploy_enabled", False):
        print("Executing local deployment commands...")
        # Invoke your existing WSL/rsync command logic here
    else:
        print("Skipping local deployment. Asset compilation complete.")

Step C: Automate Menu and Asset Processing

Reduce friction for non-technical users by automating complex tasks: * Asset Copying: The build script must parse the markdown for image tags (e.g., ![Alt text](media/image.png)), verify the existence of the target file, copy it to the dist/ mirror subdirectory, and automatically adjust any broken references. * Navigation Menu Generation: Refactor the script to parse navigation_menu.md (which should contain standard relative markdown links), convert those links to reference output .html files, and inject them into the main template dynamically.


4. GitHub Actions CI/CD Pipeline

To remove the need for local execution, local Python configurations, Pandoc local binaries, and terminal commands for the end-user, create a GitHub Actions workflow file.

Save the following configuration inside .github/workflows/deploy.yml:

name: Deploy Markdown Site

on:
  push:
    branches:
      - main  # Runs on every push to the main branch

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  build_and_deploy:
    environment:
      name: github-pages
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.12'

      - name: Install Python Dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt

      - name: Install Pandoc
        uses: pandoc/actions/setup@v1
        with:
          version: '3.1.11' # Explicit stable version tag

      - name: Run Build Script
        run: python build_site.py

      - name: Index Site with Pagefind
        run: npx pagefind --site dist

      - name: Upload Pages Artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: dist

      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

5. Implementation Roadmap for Dual Workflows

To execute this architectural shift successfully, complete the tasks in the following order:

  1. Clean up scripts: Refactor your local build_site.py file to resolve paths dynamically relative to __file__ rather than using hardcoded D: or F: strings.
  2. Isolate settings: Extract your personal folder locations and server synchronization settings into a new config.local.yaml file inside your development folder.
  3. Verify Gitignore: Add config.local.yaml to your global or local .gitignore.
  4. Confirm absolute offline functionality: Execute python build_site.py on your machine. Confirm that the script detects config.local.yaml, compiles your files, and executes the local WSL rsync step correctly.
  5. Create the public repository: Create a clean, separate folder and initialize a new git repository (markdown-notes-template). Copy the refactored build_site.py and the base config.yaml (which uses ./src and ./dist) into this folder.
  6. Add templates: Copy the .github/workflows/deploy.yml pipeline and standard default assets to the new public repository.
  7. Test public execution: Run git push to trigger the GitHub Pages compilation. Confirm the public pipeline compiles and indexes using Pages, independent of your offline architecture.

Search Titles & Keywords