# 00 — WP + Divi to AM Stack A Pipeline — Overview Converts a .wpress archive (All-in-One WP Migration) into a Stack A deployment: PHP router + SQLite databases + vanilla JS/CSS. Never a 1:1 Divi copy. Every migration is a content extraction and redesign, not a port. ## Stack A output (what this pipeline produces) ``` src/api/router.php URL dispatcher src/api/contact.php form handler (Resend via curl) src/api/templates/*.php home | static | classes | schedule | glossary | blog src/api/components/_header.php nav from nav.sqlite src/api/components/_footer.php src/api/data/*.sqlite one DB per content domain (see 09-stack-a-output.md) build/seed_databases.py creates + seeds all SQLite DBs — THE source of truth assets/ vanilla CSS/JS/images infra/nginx.conf, supervisord.conf, php-fpm-pool.conf Dockerfile (php:8.3-fpm-alpine) docker-compose.yml ``` ## Why NOT static HTML Any site with a glossary, blog, schedule, or recurring content model gets Stack A. Editing content = edit seed_databases.py → reseed → rebuild. No PHP file edits. ## Divi is the data source, not the design target Extract from Divi: - Page content (headings, body copy, CTAs) - Navigation menus (wp_terms + wp_termmeta) - Header logo + tagline (wp_options: blogname, blogdescription, et_divi) - Media (uploads/ → WebP → assets/images/) - Design tokens (colors, fonts → tokens.css) - SEO (Yoast wp_postmeta → pages.sqlite meta_description) - Blog posts (wp_posts where post_type=post) - Custom post types (testimonials, FAQs, glossary terms if present) Do NOT replicate: - Divi section/row/column grid structure - Divi module types (blurbs, toggles, CTAs, pricing tables) - WordPress page slugs (map to clean slugs per nginx.conf pattern) - WordPress menu item IDs ## Pipeline phases ``` Phase 0 Setup Point pipeline at .wpress file; create working dirs Phase 1 Extract Unpack .wpress → wpress-extract/ Phase 2 DB Analysis Parse SQL dump; detect Divi version; inventory pages, posts, menus Phase 3 Content Extract page sections + nav menus + blog posts from Divi Phase 4 Design Pull colors + fonts → tokens.css draft Phase 5 Media Catalog uploads/; convert to WebP; build media-manifest.json Phase 6 Staging Map extracted JSON → seed_databases.py skeleton (content on standby) Phase 7 Fill Agent fills each SQLite table row by row from staged JSON Phase 8 Templates Scaffold PHP templates + components from AM reference Phase 9 SEO Port titles, metas, canonicals, schema.org, redirect map Phase 10 Build docker compose build && docker compose up -d Phase 11 QA Lighthouse, protection check, grep for Divi residue ``` ## CLI launcher ``` python3 scripts/migrate.py --wpress /path/to/backup.wpress --domain example.com ``` Runs phases 0-6 automatically, then prints agent breadcrumbs for phases 7-11. ## Key missed items from prior migrations (REQUIRED fixes) 1. **NAV MENUS**: Must extract wp_terms (taxonomy=nav_menu) + wp_termmeta for label/URL/order. Output: nav.json → seeded into nav.sqlite (label, href, display_order, is_cta). 2. **DIVI HEADER**: Must extract et_divi options from wp_options for logo, header layout, colors. The _header.php must be written from scratch using AM design tokens, not copied from Divi. 3. **MEDIA**: All uploads/ files must be: cataloged → copied to assets/images/ → converted to WebP. Every image reference in content JSON must be updated to /assets/images/{filename}.webp. 4. **SECTION REMAPPING**: Divi modules must be remapped to AM section types. - blurb_module → feature_cards item - toggle_module → accordion item - cta_module → cta_band section - pricing_module → booking_options section - testimonial_mod → testimonials.sqlite row - text_module → text_block section ## Related SOPs - **09-stack-a-output.md** — SQLite schema + sections_json spec - **10-agent-breadcrumbs.md** — Step-by-step ordered checklist for agent execution - **00-stack-philosophy.md** — Stack A vs Stack B decision rationale