Files
arisingmedia-web-sops/wp-divi-pipeline-to-am-stack/08-run-order.md
T
2026-06-09 18:31:59 +02:00

231 lines
6.3 KiB
Markdown

# 08 — Run Order (DEPRECATED)
> **Superseded by `10-agent-breadcrumbs.md`.**
> This file described the WP → static HTML (Stack B) run order.
> The pipeline now targets Stack A (PHP router + SQLite).
> Use `10-agent-breadcrumbs.md` for the current ordered execution checklist.
---
Step-by-step execution sequence for a complete .wpress → AM HTML migration.
Run each command, verify the output, then proceed to the next.
## Prerequisites
```bash
# Python 3.8+ required
python3 --version
# cwebp for image conversion (optional — Python fallback available)
which cwebp || echo "cwebp not installed — will use Python Pillow fallback"
# Set project domain variable (use throughout)
export DOMAIN="vibrantyou.yoga"
export PROJECT="/home/sirdrez/arisingmedia-websites/$DOMAIN"
export SOPS="/home/sirdrez/arisingmedia-websites/.am-webdesign-sops"
export WPRESS=$(ls $PROJECT/.planning/*.wpress | head -1)
echo "Domain: $DOMAIN"
echo "Project: $PROJECT"
echo "Archive: $WPRESS"
```
---
## Phase 0 — Setup
```bash
# Create directory structure
mkdir -p $PROJECT/{src/{about,services,contact,blog,classes,components,assets/{css,js,images,svg,fonts}},build,infra,api,.planning/{data/{content},scripts,wpress-extract}}
# Verify archive
ls -lh $WPRESS
file $WPRESS
```
---
## Phase 1 — Extract archive
```bash
python3 $SOPS/wp-divi-pipeline/scripts/extract_wpress.py \
"$WPRESS" \
"$PROJECT/.planning/wpress-extract/"
# Verify
ls $PROJECT/.planning/wpress-extract/
cat $PROJECT/.planning/wpress-extract/package.json | python3 -m json.tool | head -20
ls -lh $PROJECT/.planning/wpress-extract/database.sql
```
Expected output: `DONE: N files | X MB`
---
## Phase 2 — Database analysis
```bash
python3 $SOPS/wp-divi-pipeline/scripts/analyze_db.py \
"$PROJECT/.planning/wpress-extract/" \
"$PROJECT/.planning/data/"
# Verify
cat $PROJECT/.planning/data/site-info.json
echo "Pages: $(python3 -c "import json; print(len(json.load(open('$PROJECT/.planning/data/pages.json'))))")"
cat $PROJECT/.planning/data/design-system.json
```
Expected output: `pages.json (N pages/posts)`
If pages = 0, check the SQL prefix detection in the script output.
---
## Phase 3 — Content extraction
### Divi 5 (most common — check design-system.json divi_version first)
```bash
python3 $SOPS/wp-divi-pipeline/scripts/extract_divi5.py \
"$PROJECT/.planning/data/pages.json" \
"$PROJECT/.planning/data/content/"
# Verify
ls $PROJECT/.planning/data/content/
cat $PROJECT/.planning/data/content/home.json | python3 -m json.tool | head -40
```
---
## Phase 4 — Design system
Read `$PROJECT/.planning/data/design-system.json` and seed `main.css`:
```bash
cat $PROJECT/.planning/data/design-system.json
```
Manually translate to CSS custom properties per `04-design-system-extraction.md`.
Write to: `$PROJECT/src/assets/css/main.css`
Key values for vibrantyou.yoga:
- Primary: #1a8a7a Dark: #0f5f53
- Body font: DM Sans Heading font: DM Serif Display
---
## Phase 5 — Media migration
```bash
# Catalog originals (skip WP-generated size variants)
find $PROJECT/.planning/wpress-extract/uploads -type f \
\( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.webp" \) | \
grep -v -E "\-[0-9]+x[0-9]+\.(jpg|jpeg|png|webp)$" | \
sort > $PROJECT/.planning/data/media-originals.txt
echo "Original images: $(wc -l < $PROJECT/.planning/data/media-originals.txt)"
# Copy to src/assets/images/
while IFS= read -r src; do
cp "$src" "$PROJECT/src/assets/images/$(basename $src)"
done < $PROJECT/.planning/data/media-originals.txt
# Convert to WebP (cwebp path)
cd $PROJECT/src/assets/images/
for img in *.jpg *.jpeg *.png; do
[ -f "$img" ] || continue
base="${img%.*}"
cwebp -q 82 "$img" -o "${base}.webp" 2>/dev/null && rm "$img"
done
echo "WebP count: $(ls *.webp 2>/dev/null | wc -l)"
cd $PROJECT
```
---
## Phase 6 — Build HTML
Per `05-content-migration.md`, build pages in this order:
```bash
# 1. Write src/assets/css/main.css (design tokens — manual)
# 2. Write src/assets/css/components.css (manual)
# 3. Write src/components/header.html (manual)
# 4. Write src/components/footer.html (manual)
# 5. Write src/assets/js/components.js (fetch + inject)
# 6. Write src/assets/js/main.js (scroll, animations)
# 7. Write src/index.html (home page — first, establishes design)
# 8. Write remaining pages
# After build, verify zero unreplaced placeholders
grep -r "{{" $PROJECT/src --include="*.html" && echo "FAIL: placeholders found" || echo "OK"
# Verify no Divi residue
grep -rn "et_pb_\|wp:divi\|\[et_pb" $PROJECT/src --include="*.html" && echo "FAIL: Divi residue" || echo "OK"
```
---
## Phase 7 — SEO audit
```bash
cd $PROJECT/src
# All pages have title
find . -name "*.html" | grep -v "_template" | xargs grep -L '<title>' | head
# All pages have canonical
find . -name "*.html" | grep -v "_template" | xargs grep -L 'rel="canonical"' | head
# All pages have JSON-LD
find . -name "*.html" | grep -v "_template" | xargs grep -L 'ld+json' | head
cd $PROJECT
```
All commands must return empty output.
---
## Phase 8 — Infra (Docker)
```bash
# Copy infra from reference project
cp /home/sirdrez/arisingmedia-websites/vibrantyoucoaching.com/Dockerfile $PROJECT/
cp /home/sirdrez/arisingmedia-websites/vibrantyoucoaching.com/docker-compose.yml $PROJECT/
cp -r /home/sirdrez/arisingmedia-websites/vibrantyoucoaching.com/infra/ $PROJECT/infra/
# Update nginx.conf: set server_name to $DOMAIN, add redirects from 07-seo-preservation.md
# Update docker-compose.yml: set container_name and port
# Test build
docker compose -f $PROJECT/docker-compose.yml build 2>&1 | tail -5
docker compose -f $PROJECT/docker-compose.yml up -d
curl -I http://localhost:PORT/ 2>&1 | head -5
```
---
## Phase 9 — Protection check
```bash
# Run after deploy
bash $SOPS/tools/verify-protection.sh https://$DOMAIN
# Must return exit 0 with no FAIL lines
```
---
## Checklist summary
- [ ] Phase 0: Directories created
- [ ] Phase 1: .wpress extracted, database.sql present
- [ ] Phase 2: pages.json > 0 entries, design-system.json has colors + fonts
- [ ] Phase 3: content/ dir has one JSON per page
- [ ] Phase 4: main.css written with full :root{} token block
- [ ] Phase 5: WebP images in src/assets/images/
- [ ] Phase 6: All HTML pages built, zero {{ placeholders, zero Divi residue
- [ ] Phase 7: All SEO audit commands return empty
- [ ] Phase 8: Docker container up, curl returns 200
- [ ] Phase 9: verify-protection.sh exits 0