WPTransformer β€” Build Prompt

Crumbforest Β· Bits With Attitude Β· MIT Β· CKL v1.0

Du bist ein Coding-Agent im Crumbforest-Γ–kosystem. Lies dieses Dokument vollstΓ€ndig bevor du eine Zeile schreibst. Dann schreibe Code der atmet.


Kontext & Haltung

WPTransformer ist ein CLI-Prozess, kein Framework, kein SaaS. Er konvertiert Legacy-CMS-Inhalte (WordPress, Joomla) in statische Vektoren.

Kernprinzipien β€” nicht verhandelbar:

  • Offline by Default β€” kein externes Netz wΓ€hrend der Transformation
  • No Central Command β€” kein Cloud-Dienst, keine API-Keys, keine Telemetrie
  • Data doesn't exist β€” kein Logging von Kundendaten nach außen
  • ls -la β€” alles prΓΌfbar, alles lesbar, fΓΌr immer
  • Human Loop β€” Maschine hΓ€lt inne, Mensch entscheidet

Repo-Struktur

wptransformer/
β”‚
β”œβ”€β”€ PROMPT.md               ← diese Datei
β”œβ”€β”€ README.md               ← kurz, direkt, kein Marketing
β”œβ”€β”€ LICENSE                 ← MIT + CKL v1.0
β”‚
β”œβ”€β”€ bin/
β”‚   └── wpt                 ← CLI-Einstiegspunkt (PHP-Script, Shebang)
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ Parser/
β”‚   β”‚   β”œβ”€β”€ WPSQLParser.php         ← SQL-Dump β†’ strukturierte Daten
β”‚   β”‚   β”œβ”€β”€ WPCrawler.php           ← Live-Crawl (geplant, stub)
β”‚   β”‚   └── JoomlaParser.php        ← Joomla-Export (in Entwicklung, stub)
β”‚   β”‚
β”‚   β”œβ”€β”€ Intermediate/
β”‚   β”‚   β”œβ”€β”€ IntermediateDB.php      ← SQLite-Layer (editierbar, lokal)
β”‚   β”‚   β”œβ”€β”€ PostModel.php           ← Datenmodell: Post/Page/Draft
β”‚   β”‚   └── MediaModel.php          ← Bilder, AnhΓ€nge
β”‚   β”‚
β”‚   β”œβ”€β”€ Builder/
β”‚   β”‚   β”œβ”€β”€ StaticBuilder.php       ← HTML/CSS/JS Generator
β”‚   β”‚   β”œβ”€β”€ HugoBuilder.php         ← Hugo-kompatibles Markdown + config.toml
β”‚   β”‚   └── AssetHandler.php        ← Bilder kopieren, Pfade korrigieren
β”‚   β”‚
β”‚   β”œβ”€β”€ Output/
β”‚   β”‚   β”œβ”€β”€ ZipExporter.php         ← ZIP-Download
β”‚   β”‚   β”œβ”€β”€ FTPDeploy.php           ← Klassisches Shared Hosting
β”‚   β”‚   β”œβ”€β”€ VPNSync.php             ← Nullfeld-Sync (194.164.194.191)
β”‚   β”‚   └── USBExport.php           ← Lokale Kopie, kein Netz nΓΆtig
β”‚   β”‚
β”‚   └── HumanLoop/
β”‚       β”œβ”€β”€ ReviewInterface.php     ← CLI-Ausgabe: Was geht live, was ins Archiv
β”‚       └── ConfirmStep.php         ← HOLD-Schritt vor Deploy
β”‚
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ base.html                   ← Minimales HTML-GerΓΌst
β”‚   β”œβ”€β”€ post.html                   ← Einzelseite
β”‚   β”œβ”€β”€ index.html                  ← Übersicht
β”‚   └── hugo/
β”‚       β”œβ”€β”€ config.toml             ← Hugo-Basiskonfiguration
β”‚       └── archetypes/
β”‚           └── default.md          ← Hugo Post-Template
β”‚
β”œβ”€β”€ data/
β”‚   └── .gitkeep                    ← Intermediate SQLite lebt hier (nicht im Repo)
β”‚
β”œβ”€β”€ public/
β”‚   └── .gitkeep                    ← Static Output lebt hier (nicht im Repo)
β”‚
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ fixtures/
β”‚   β”‚   β”œβ”€β”€ sample_wp.sql           ← Minimal-WP-Dump zum Testen
β”‚   β”‚   └── sample_joomla.xml       ← Minimal-Joomla-Export
β”‚   └── ParserTest.php
β”‚
└── .gitignore

Der Prozess β€” Schritt fΓΌr Schritt

INPUT
  └── SQL-Dump / Joomla-Export / Leerer Brief (Neukunde)
        β”‚
        β–Ό
STEP 1: Parser
  WPSQLParser::parse($file)
  β†’ gibt Array zurΓΌck: [ posts[], pages[], drafts[], media[] ]
  β†’ keine Datenbankverbindung nΓΆtig β€” pure PHP, regex + DOM
        β”‚
        β–Ό
STEP 2: Intermediate Layer
  IntermediateDB::import($parsed)
  β†’ speichert in lokaler SQLite (data/intermediate.sqlite)
  β†’ Schema: wpt_posts (id, type, status, title, content, slug, date, meta)
  β†’ wpt_media (id, post_id, filename, path, alt)
        β”‚
        β–Ό
STEP 3: [ HUMAN LOOP β€” HOLD ]
  ReviewInterface::show()
  β†’ Übersicht: X Posts Β· Y Pages Β· Z Drafts Β· W Medien
  β†’ Mensch markiert: deploy | archive | skip
  β†’ ConfirmStep::confirm() β€” kein Deploy ohne explizites OK
        β”‚
        β–Ό
STEP 4: Builder
  StaticBuilder::build() oder HugoBuilder::build()
  β†’ iteriert ΓΌber wpt_posts WHERE deploy = 1
  β†’ schreibt nach public/
  β†’ kopiert Assets nach public/assets/
        β”‚
        β–Ό
STEP 5: Output
  Je nach Flag:
  --zip         β†’ ZipExporter
  --ftp         β†’ FTPDeploy (config via .env, nie im Repo)
  --hugo        β†’ HugoBuilder β†’ hugo --minify
  --nullfeld    β†’ VPNSync (194.164.194.191)
  --usb         β†’ USBExport (Pfad als Argument)

CLI-Interface

# Basis-Workflow
./bin/wpt parse --input dump.sql
./bin/wpt review
./bin/wpt build --output hugo
./bin/wpt deploy --target nullfeld

# Kurzform
./bin/wpt run --input dump.sql --output hugo --deploy ftp

# Nur Archiv exportieren (kein Deploy)
./bin/wpt export --archive --format zip

Code-Standards

Sprache PHP 8.1+, kein Framework
AbhΓ€ngigkeiten KEINE externen Composer-Pakete wenn vermeidbar
Erlaubt SQLite3 (PHP built-in), DOMDocument (PHP built-in)
Stil PSR-12
Fehlerbehandlung Exceptions mit klaren Messages, kein silent fail
Tests PHPUnit, Fixtures in tests/fixtures/
Kommentare Deutsch oder Englisch β€” konsistent pro Datei

Was NICHT gebaut wird

  • Admin-OberflΓ€che (Browser-UI)
  • Cloud-Sync zu Dritten
  • Automatisches Deployment ohne Human Loop
  • Telemetrie / Logging nach außen
  • Dependency auf Node.js / npm
  • Subscription-Modell / Lizenz-Check online

Umgebungsvariablen (.env β€” nie committen)

WPT_FTP_HOST=
WPT_FTP_USER=
WPT_FTP_PASS=
WPT_VPN_HOST=194.164.194.191
WPT_VPN_USER=
WPT_VPN_PATH=/var/www/nullfeld/
WPT_HUGO_BIN=/usr/local/bin/hugo

Erster Build-Schritt (was als erstes gebaut wird)

  1. bin/wpt β€” Shebang + Argument-Router
  2. src/Parser/WPSQLParser.php β€” SQL β†’ Array (Core-Logik)
  3. src/Intermediate/IntermediateDB.php β€” SQLite-Import
  4. src/HumanLoop/ReviewInterface.php β€” CLI-Ausgabe der importierten Posts
  5. tests/ParserTest.php β€” Fixture-basierter Test

Danach: StaticBuilder. Dann HugoBuilder. Dann Output-Layer.


Verbindung zum Γ–kosystem

Crumbforest Infrastruktur, Haltung, Lizenz
WPTransformer dieser Repo
Hugo externer Deploy-Knoten (Binary, kein Lock-in)
Nullfeld Sync VPN 194.164.194.191 Β· Crumbforest-intern
Waldatlas zukΓΌnftig: transformierte Inhalte als Vektoren indizierbar

Lizenz

MIT License Β· CKL v1.0
Crumbforest Β· Bits With Attitude Β· Hamburg
ls -la. Alles prΓΌfbar. Alles lesbar. FΓΌr immer.