# Phase 3 Build Plan — WordPress Ecosystem (4 Docs) **Purpose:** This is a single instruction set for Claude Code to build all 4 Phase 3 execution documents. Read this entire file, then build each doc one at a time. --- ## CRITICAL BASELINE RULES (from V2-Execution-Docs-Updated) Before writing ANY doc, internalize these codebase-verified facts: ### Primary Keys - ALL models use `BigAutoField` (integer PKs, NOT UUIDs) - `DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'` - Every ID in API requests/responses is an integer ### Model Names (PLURAL) - `Clusters` (not Cluster), `Keywords` (not Keyword), `Tasks` (not Task) - `ContentIdeas` (not ContentIdea), `Images` (not Image), `Content` (stays singular) ### App Structure - Project root: `igny8_core/` - SAG app: `igny8_core/sag/` - App labels: `igny8_core_auth`, `planner`, `writer`, `automation`, `integration`, etc. - All tables use `igny8_` prefix (e.g., `igny8_content`, `igny8_clusters`) ### Frontend Stack - TypeScript (`.tsx` files, NOT `.jsx`) - Zustand for state management (NOT Redux) - Vite ^6.1.0 as build tool - React ^19.0.0 - Vitest + Playwright for testing (NOT Selenium/Cypress) ### Verified Codebase Versions (what actually runs today) - Python 3.11-slim (Dockerfile) - Django >=5.2.7 (requirements.txt) - Node 18-alpine (Dockerfile.dev) - Celery >=5.3.0 - WP Plugin: IGNY8 WordPress Bridge v1.5.2 - These are CURRENT versions. Upgrade targets (Python 3.14, Django 6.0, etc.) are in 00B but are SEPARATE tasks. ### Model Inheritance - `AccountBaseModel` provides: `account` FK, `created_by`, `created_at`, `updated_at` - `SiteSectorBaseModel` extends AccountBaseModel with: `site` FK, `sector` FK - `SoftDeletableModel` mixin provides soft delete via `SoftDeleteManager` ### Source of Truth - Start every doc with: `**Source of Truth:** Codebase at /data/app/igny8/` - Codebase overrides any planning doc --- ## DOC STRUCTURE STANDARD Every doc MUST follow this structure: ``` # [Phase.Sub] — Title **Source of Truth:** Codebase at `/data/app/igny8/` **Version:** 1.0 **Date:** 2026-03-23 ## 1. Current State What exists today relevant to this sub-phase. ## 2. What to Build Complete scope. ## 3. Data Models & APIs New/modified models, endpoints, serializers, database tables. ## 4. Implementation Steps Ordered steps with exact commands, file paths, code snippets. ## 5. Acceptance Criteria Testable checkboxes. ## 6. Claude Code Instructions Specific execution guidance — file creation order, test commands, verification. ``` --- ## EXISTING WORDPRESS PLUGIN CONTEXT The IGNY8 WordPress Bridge Plugin v1.5.2 ALREADY EXISTS. Key facts: - Location: `/data/app/igny8/plugins/wordpress/source/igny8-wp-bridge/` - Current capabilities: Content sync from IGNY8 → WordPress, site data collection, basic REST endpoints - Already has: API key authentication, connection management, content push endpoint - Plugin headers: `IGNY8 WordPress Bridge`, version 1.5.2 - Existing REST namespace: `/wp-json/igny8/v1/` - Authentication: `X-IGNY8-API-KEY` header validation Phase 3 docs describe building the NEXT GENERATION plugin (v2) which is a completely new plugin, not a patch to v1.5.2. The v1.5.2 bridge becomes deprecated once v2 is deployed. --- ## EXISTING IGNY8 BACKEND CONTEXT (relevant to WordPress integration) ### Models that WordPress interacts with: - `Content` (writer app) — content_type: post/page/product/taxonomy; content_structure: article/guide/comparison/review/listicle/landing_page/etc. - `Tasks` (writer app) — writing tasks, status: pending/generating/completed/failed - `Images` (writer app) — generated images for content - `Clusters` (planner app) — keyword clusters, linked to SAGCluster via optional FK - `SAGBlueprint`, `SAGAttribute`, `SAGCluster` (sag app) — Phase 1 models - `SiteIntegration` (integration app) — stores WordPress connection details - `SyncEvent` (integration app) — logs sync operations - `PublishingSettings`, `PublishingRecord` (publishing app) ### Backend endpoints the plugin consumes: - `GET /api/v1/writer/content/?site_id=X&status=approved` — content ready for sync - `GET /api/v1/writer/content/{id}/` — single content with HTML, images, taxonomy data - `GET /api/v1/planner/clusters/?site_id=X` — cluster data - `GET /api/v1/sag/blueprints/?site_id=X` — SAG blueprint (Phase 1) - `POST /api/v1/integration/sync-events/` — log sync results - `POST /api/v1/publishing/records/` — log publishing ### Backend endpoints the plugin exposes (plugin → IGNY8): - `POST /wp-json/igny8/v1/sync/push` — content push from IGNY8 - `POST /wp-json/igny8/v1/sag/sync-blueprint` — SAG blueprint sync - `POST /wp-json/igny8/v1/sag/create-taxonomies` — taxonomy creation - `POST /wp-json/igny8/v1/event` — webhook events ### WordPress Requirements: - Minimum: WordPress 5.9+, PHP 7.4+ - GPL v2+ license - WordPress.org coding standards compliance - All user-facing strings translatable via `igny8` text domain - Sanitize all inputs (`sanitize_text_field`, `wp_kses_post`), escape all outputs (`esc_html`, `esc_attr`, `esc_url`) - Use WP APIs (Settings API, REST API, WP_Query) — no direct DB queries where WP functions exist --- ## DOC 03A: wp-plugin-standalone.md **File:** `V2-Execution-Docs/03A-wp-plugin-standalone.md` **Scope:** 10 standalone modules that work WITHOUT an IGNY8 SaaS subscription — a complete free SEO plugin. **Depends On:** 02D (Linker internal — IGNY8 backend linking logic feeds plugin's linking module), 02G (Rich Schema — IGNY8 schema generation feeds plugin's schema module) ### Source Material: - temp/IGNY8-Project-Files/IGNY8-Plugin-Build-Plan.md - temp/IGNY8-Project-Files/DocC-WordPress-Ecosystem-Dev-Guide.md ### What to Cover: **1. Current State:** - WP Bridge v1.5.2 exists but is sync-only (no standalone SEO features) - No standalone SEO capabilities currently - Users currently rely on Yoast/RankMath alongside IGNY8 **2. What to Build — 10 Standalone Modules:** **Module 1: SEO Core** - Focus keyword per post/page/product (primary + secondary keywords) - SEO title + meta description editor with live SERP preview - Content analysis: keyword density, heading structure, readability score (Flesch-Kincaid) - Title tag templates (per post type, taxonomy, author, date archives) - Breadcrumbs (shortcode `[igny8_breadcrumbs]` + function `igny8()->seo->get_breadcrumbs()`) - Open Graph meta tags (Facebook: og:title, og:description, og:image, og:type) + Twitter Cards (twitter:card, twitter:title, twitter:description, twitter:image) - Robots meta per post (noindex, nofollow, noarchive) - Canonical URL override - Webmaster verification codes (Google, Bing, Yandex, Pinterest) - Frontend head output: consolidate all `