# CHRNX WordPress Theme Implementation Plan > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. **Goal:** Build a fast, accessible WordPress block theme for the bilingual CHRNX journal, including editorial discovery, projects, The No Names, podcasts, and durable light/dark preference. **Architecture:** Use a native block theme with `theme.json` v3, HTML templates, PHP patterns, and focused dynamic blocks for queries, metadata, settings, and controls that core blocks cannot express. Keep content in standard posts and pages; use three single-value taxonomies for topic, language, and podcast show. Develop against a pinned local WordPress 6.9.6 environment, use PHP unit tests for content/query behavior, and use Playwright for rendered behavior. **Tech Stack:** WordPress 6.9.6, PHP 8.3 in `@wordpress/env` 11.12.0, Node.js LTS for project tooling, `@wordpress/scripts` 34.0.0, Playwright 1.62.1, WordPress Coding Standards 3.x, CSS, SVG, WOFF2. --- ## Preconditions and boundaries - The current directory has `NO_GIT_METADATA`. Task 1 initializes a local repository only; it creates no remote and publishes nothing. - Colima 0.10.3 and Docker 29.6.2 are installed, but Colima is stopped and Docker is available at `/opt/homebrew/opt/docker/bin/docker`. Prefix Docker-dependent commands with `PATH="/opt/homebrew/opt/docker/bin:$PATH"`. - No local PHP or Composer binary is available. Run PHP, Composer, PHPCS, PHPUnit, and WP-CLI inside `wp-env`. - Do not connect to `chrnx.dev`, Buzzsprout, DistroKid, or any production database during implementation. - Run the alter-ego asset plan after Task 1 and complete its human approval gate before Task 6 uses those topic portraits. - Official implementation references: - - - - - ## File map ```text style.css Theme metadata and tiny compatibility layer theme.json Design tokens, typography, layout, block defaults functions.php Version constant and focused includes only inc/setup.php Theme supports, menus, image sizes inc/assets.php Local fonts, CSS, frontend/editor scripts inc/taxonomies.php Topic, language, show registration and defaults inc/editor.php Single-value editor panels and save validation inc/podcast-meta.php Episode post meta, sanitization, editor controls inc/settings.php Subscribe page setting and validated URL helper inc/queries.php Pure query/selection services inc/blocks.php Dynamic-block registration inc/theme-preference.php Early no-flash preference bootstrap blocks/featured-stories/ Sticky primary plus diverse secondary stories blocks/journal-stream/ URL-filtered chronological list blocks/latest-podcast/ Latest eligible podcast card blocks/podcast-meta/ Episode number, duration, participants, fallback link blocks/topic-hero/ Approved alter-ego image mapped to current topic blocks/related-posts/ Related post query and cards blocks/subscribe-cta/ CTA omitted unless configured page is published blocks/theme-toggle/ Accessible light/dark/system control assets/css/base.css Resets, tokens not expressible in theme.json, prose assets/css/layout.css Shell, grids, responsive rules assets/css/components.css Cards, badges, buttons, forms, empty states assets/js/editor-taxonomies.js Radio UI for single-value taxonomies assets/js/editor-podcast.js Episode metadata controls for podcast posts assets/js/theme-toggle.js User preference state and control behavior assets/fonts/ Zen Maru Gothic 500/700 plus OFL license assets/icons/chrnx-cat.svg Compact cat mark assets/icons/chrnx-wordmark.svg Full mark and accessible wordmark parts/header.html Sticky site header parts/footer.html Compact site footer templates/*.html Core block templates patterns/*.php Editable homepage, project, music, podcast patterns tests/php/ WP_UnitTestCase tests tests/js/ Pure JS tests tests/e2e/ Playwright behavior and accessibility tests tests/fixtures/ Synthetic WP content only scripts/seed-test-content.sh Idempotent WP-CLI fixture setup scripts/verify-theme-package.mjs Archive/content validation ``` ### Task 1: Initialize the local project and reproducible environment **Files:** - Create: `.gitignore` - Create: `.nvmrc` - Create: `package.json` - Create: `composer.json` - Create: `phpcs.xml.dist` - Create: `phpunit.xml.dist` - Create: `.wp-env.json` - Create: `playwright.config.mjs` - Create: `tests/smoke/project-config.test.mjs` - Create: `README.md` - [ ] **Step 1: Initialize Git locally and record the approved design baseline** ```bash git init -b main git add docs/superpowers/specs docs/superpowers/plans assets/images git commit -m "docs: define CHRNX theme design" ``` Expected: a local `main` branch with no remote. - [ ] **Step 2: Write the failing project-config test** ```js // tests/smoke/project-config.test.mjs import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; test('tooling is pinned and wp-env maps this repo as chrnx', async () => { const pkg = JSON.parse(await readFile('package.json', 'utf8')); const env = JSON.parse(await readFile('.wp-env.json', 'utf8')); assert.equal(pkg.devDependencies['@wordpress/env'], '11.12.0'); assert.equal(pkg.devDependencies['@wordpress/scripts'], '34.0.0'); assert.equal(pkg.devDependencies['@playwright/test'], '1.62.1'); assert.equal(pkg.devDependencies.lighthouse, '13.4.1'); assert.equal(env.core, 'https://wordpress.org/wordpress-6.9.6.zip'); assert.equal(env.phpVersion, '8.3'); assert.equal(env.mappings['wp-content/themes/chrnx'], '.'); }); ``` - [ ] **Step 3: Run the test and verify red** ```bash node --test tests/smoke/project-config.test.mjs ``` Expected: FAIL because `package.json` and `.wp-env.json` do not exist. - [ ] **Step 4: Create project manifests** Use this `package.json` contract: ```json { "name": "chrnx-wordpress-theme", "version": "0.1.0", "private": true, "engines": { "node": ">=22 <27" }, "scripts": { "build": "wp-scripts build", "start": "wp-scripts start", "env:start": "wp-env start --update", "env:stop": "wp-env stop", "env:activate": "wp-env run cli wp theme activate chrnx", "composer": "wp-env run cli --env-cwd=wp-content/themes/chrnx composer", "phpcs": "npm run composer -- exec phpcs -- -q", "test:smoke": "node --test tests/smoke/*.test.mjs", "test:js": "wp-scripts test-unit-js --runInBand", "test:php": "wp-env run cli --env-cwd=wp-content/themes/chrnx phpunit -- --configuration=phpunit.xml.dist", "test:e2e": "playwright test", "lint:js": "wp-scripts lint-js assets/js tests/js scripts", "lint:css": "wp-scripts lint-style 'assets/css/**/*.css' 'blocks/**/*.css'", "lint:md": "wp-scripts lint-md-docs docs README.md", "test": "npm run test:smoke && npm run lint:js && npm run lint:css && npm run phpcs && npm run test:js && npm run test:php && npm run test:e2e" }, "devDependencies": { "@playwright/test": "1.62.1", "@wordpress/env": "11.12.0", "@wordpress/scripts": "34.0.0", "axe-playwright": "2.2.2", "lighthouse": "13.4.1" } } ``` Use `.wp-env.json` with schema, pinned core/PHP, `autoPort: false`, port `8888`, `WP_DEBUG`, `SCRIPT_DEBUG`, and the explicit `wp-content/themes/chrnx` mapping. Do not add lifecycle scripts that reset content. `.gitignore` must include `.superpowers/`, `node_modules/`, `vendor/`, `dist/`, `.wp-env.override.json`, `test-results/`, `playwright-report/`, `.DS_Store`, and disposable `tmp/imagegen/*.png` files. Keep the approved design spec, plans, and final assets tracked. Use `composer.json` with `wp-coding-standards/wpcs:^3.0`, `dealerdirect/phpcodesniffer-composer-installer:^1.0`, and the required Composer plugin permission. Configure `phpcs.xml.dist` for `WordPress-Core` plus `WordPress-Extra`, PHP files only, text domain `chrnx`, and prefix `chrnx_`. - [ ] **Step 5: Run the smoke test and install dependencies** ```bash node --test tests/smoke/project-config.test.mjs npm install npx playwright install chromium firefox webkit ``` Expected: smoke PASS; `package-lock.json` created; Chromium, Firefox, and WebKit executables installed. - [ ] **Step 6: Start the local runtime without altering production** ```bash colima start PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run env:start PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run composer -- install ``` Expected: WordPress available at `http://localhost:8888`; Composer dependencies installed inside the mapped theme. - [ ] **Step 7: Commit** ```bash git add .gitignore .nvmrc package.json package-lock.json composer.json phpcs.xml.dist phpunit.xml.dist .wp-env.json playwright.config.mjs tests/smoke README.md git commit -m "chore: scaffold CHRNX theme tooling" ``` ### Task 2: Establish the block-theme foundation and design tokens **Files:** - Create: `style.css` - Create: `theme.json` - Create: `functions.php` - Create: `inc/setup.php` - Create: `inc/assets.php` - Create: `assets/css/base.css` - Create: `assets/fonts/zen-maru-gothic-latin-500.woff2` - Create: `assets/fonts/zen-maru-gothic-latin-700.woff2` - Create: `assets/fonts/OFL.txt` - Create: `templates/index.html` - Create: `tests/smoke/theme-contract.test.mjs` - Create: `tests/php/bootstrap.php` - Create: `tests/php/ThemeSetupTest.php` - [ ] **Step 1: Write failing token and setup tests** The Node test must assert: - `style.css` declares `Theme Name: CHRNX`, `Text Domain: chrnx`, `Requires at least: 6.9`, and `Requires PHP: 8.1`. - `theme.json` has schema, `version: 3`, content width `720px`, wide width `1120px`, and exact dark/light design tokens from the spec. - both WOFF2 files and `OFL.txt` exist. - `templates/index.html` includes header, main query/content, and footer blocks. The PHP test must assert `add_theme_support('title-tag')`, `post-thumbnails`, `responsive-embeds`, `editor-styles`, and the `chrnx-card` image size. - [ ] **Step 2: Run tests and verify red** ```bash node --test tests/smoke/theme-contract.test.mjs PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:php ``` Expected: FAIL because the theme foundation is absent. - [ ] **Step 3: Add the minimal theme** `functions.php` must only define `CHRNX_VERSION` and require focused files: ```php 'Research', 'code' => 'Code', 'literature' => 'Literature', 'music' => 'Music', 'podcasts' => 'Podcasts', 'life' => 'Life', 'gaming' => 'Gaming', ); $languages = array( 'en' => 'English', 'es' => 'Español' ); $shows = array( 'silicon-ranch' => 'Silicon Ranch' ); ``` Create terms on `after_switch_theme` only when absent. Never rewrite legacy categories or assign a default to old posts. - [ ] **Step 4: Add the editor radio panels** Enqueue a no-JSX script using WordPress globals. Remove the native taxonomy panels with `removeEditorPanel`, render one radio group per taxonomy through `PluginDocumentSettingPanel`, and call `editPost({ [taxonomyRestBase]: [termId] })`. A “Not set” choice sends an empty array. Guard against non-post editors and missing terms. On `set_object_terms`, normalize accidental multi-term writes to the first valid term ordered by term ID. Add an admin notice when normalization occurs. - [ ] **Step 5: Register and edit episode metadata** Use `register_post_meta()` with explicit REST schemas and sanitizers. `chrnx_episode_participants` uses this schema: ```php array( 'type' => 'array', 'items' => array( 'type' => 'string' ), ) ``` `canonical_episode_url` accepts only `https` after `esc_url_raw()`. The editor script adds number, duration, participants, and canonical URL controls to a `PluginDocumentSettingPanel` only when the selected topic slug is `podcasts`; it writes through `editPost( { meta: ... } )`. Participants use one name per line in the editor and persist as an array. Never store Buzzsprout embed HTML in post meta. - [ ] **Step 6: Run tests and commit** ```bash PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:php -- --filter 'Taxonomies|Podcast_Meta' npm run test:js -- --runTestsByPath tests/js/editor-taxonomies.test.js tests/js/editor-podcast.test.js PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run phpcs git add inc/taxonomies.php inc/editor.php inc/podcast-meta.php assets/js/editor-taxonomies.js assets/js/editor-podcast.js tests/php/TaxonomiesTest.php tests/php/PodcastMetaTest.php tests/js/editor-taxonomies.test.js tests/js/editor-podcast.test.js git commit -m "feat: add CHRNX editorial metadata" ``` ### Task 4: Build query services and dynamic editorial blocks **Files:** - Create: `inc/queries.php` - Create: `inc/blocks.php` - Create: `inc/settings.php` - Create: `blocks/featured-stories/block.json` - Create: `blocks/featured-stories/render.php` - Create: `blocks/featured-stories/style.css` - Create: `blocks/journal-stream/block.json` - Create: `blocks/journal-stream/render.php` - Create: `blocks/journal-stream/style.css` - Create: `blocks/latest-podcast/block.json` - Create: `blocks/latest-podcast/render.php` - Create: `blocks/latest-podcast/style.css` - Create: `blocks/podcast-meta/block.json` - Create: `blocks/podcast-meta/render.php` - Create: `blocks/topic-hero/block.json` - Create: `blocks/topic-hero/render.php` - Create: `blocks/related-posts/block.json` - Create: `blocks/related-posts/render.php` - Create: `blocks/subscribe-cta/block.json` - Create: `blocks/subscribe-cta/render.php` - Create: `tests/php/EditorialQueriesTest.php` - Create: `tests/php/BlockRenderingTest.php` - Create: `tests/php/SettingsTest.php` - [ ] **Step 1: Write failing feature-selection tests** Create posts with multiple sticky dates/topics and assert: 1. newest sticky post is primary; 2. other sticky posts return to chronological eligibility; 3. secondaries prefer topics distinct from primary and each other; 4. date order fills any remaining slot; 5. fewer than three posts returns a shorter array without placeholders; 6. drafts, private posts, and empty titles are excluded. - [ ] **Step 2: Write failing podcast and filter tests** Assert that: - latest podcast requires `chrnx_topic=podcasts` and a registered `chrnx_show` term; - a podcast post missing `chrnx_show` remains in Journal results but not podcast surfaces; - Silicon Ranch queries require `chrnx_show=silicon-ranch`; - `chrnx_topic`, `chrnx_language`, page number, and search filters are sanitized and preserved in generated URLs; - malformed values are ignored, not passed to SQL. Assert related/subscription/topic behavior: - related posts exclude the current post, prefer the same `chrnx_topic`, then shared tags, then recent posts, with no duplicates; - a configured Subscribe page renders only while its post status is `publish`; - an unset, deleted, draft, or non-page `chrnx_subscribe_page_id` yields no CTA markup; - each topic maps to the exact approved alter-ego filename; unknown/missing topic yields no portrait; - podcast metadata rendering omits unknown fields, renders participants as text, and uses `canonical_episode_url` only as an HTTPS fallback link. - [ ] **Step 3: Run the tests and verify red** ```bash PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:php -- --filter 'Editorial_Queries|Block_Rendering|Settings' ``` Expected: FAIL with missing query functions/blocks. - [ ] **Step 4: Implement pure query helpers first** Expose focused functions: ```php chrnx_get_featured_story_ids( int $limit = 3 ): array chrnx_get_journal_query_args( array $request ): array chrnx_get_latest_podcast_id(): int chrnx_get_show_query_args( string $show_slug, int $page = 1 ): array chrnx_get_related_post_ids( int $post_id, int $limit = 3 ): array chrnx_get_topic_art_asset( string $topic_slug ): string chrnx_get_subscribe_url(): string ``` Return IDs/query arguments, not markup. Cache only within the request; avoid persistent transients in version one. - [ ] **Step 5: Render escaped, semantic blocks** Use `
`, real heading levels controlled by block context, `get_permalink()`, `wp_get_attachment_image()`, escaped badges, and a CSS-generated fallback when no featured image exists. The latest-podcast block renders a card/link only; the Buzzsprout player stays inside the single episode content. `podcast-meta` renders number, duration, participants, and an HTTPS fallback link without duplicating an embed. `related-posts` delegates all selection to the query helper. - [ ] **Step 6: Add validated subscription configuration and topic-art mapping** Register `chrnx_subscribe_page_id` on the existing Settings > Reading screen with `wp_dropdown_pages()`. Sanitize it to `0` unless it references a Page the current administrator may edit. `chrnx_get_subscribe_url()` returns a permalink only for a published page. The dynamic `subscribe-cta` block returns an empty string otherwise. Map each topic slug to one fixed asset basename in `chrnx_get_topic_art_asset()`. The `topic-hero` block uses the current queried taxonomy term or an explicit validated `topic` attribute; it never accepts arbitrary file paths. - [ ] **Step 7: Run tests and commit** ```bash PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:php -- --filter 'Editorial_Queries|Block_Rendering|Settings' PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run phpcs git add inc/queries.php inc/blocks.php inc/settings.php blocks tests/php git commit -m "feat: add editorial query blocks" ``` ### Task 5: Implement the theme shell, durable preference, and CHRNX mark **Files:** - Create: `inc/theme-preference.php` - Create: `blocks/theme-toggle/block.json` - Create: `blocks/theme-toggle/render.php` - Create: `assets/js/theme-toggle.js` - Create: `assets/icons/chrnx-cat.svg` - Create: `assets/icons/chrnx-wordmark.svg` - Create: `parts/header.html` - Create: `parts/footer.html` - Create: `assets/css/layout.css` - Create: `tests/js/theme-preference.test.js` - Create: `tests/e2e/theme-preference.spec.mjs` - Create: `tests/e2e/navigation.spec.mjs` - [ ] **Step 1: Write failing preference tests** Cover precedence: ```text saved light/dark choice > prefers-color-scheme > dark fallback ``` Test explicit `system` removal, invalid stored values, storage denial, toggle accessible name, no initial flash, and persistence across reloads. - [ ] **Step 2: Write failing navigation tests** At desktop and mobile, assert header landmarks, skip link, visible focus, menu open/close, Escape close, focus restoration, 44px targets, and correct destinations for Journal, Projects, Music, Podcasts, and About. - [ ] **Step 3: Run tests and verify red** ```bash npm run test:js -- --runTestsByPath tests/js/theme-preference.test.js PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:e2e -- tests/e2e/theme-preference.spec.mjs tests/e2e/navigation.spec.mjs ``` Expected: FAIL because the shell and control are absent. - [ ] **Step 4: Implement the no-flash bootstrap and control** Print a minimal inline script at `wp_head` priority `0` that sets `document.documentElement.dataset.theme` before styles paint. Store only explicit `light` or `dark`; selecting system removes the key. Listen to system changes only while no explicit choice exists. Content/navigation remain functional without JavaScript. - [ ] **Step 5: Draw the compact and full SVG marks** Create code-native SVGs: front-facing rounded purple cat head, two pointed ears, terminal-like eyes, no raster text. Verify the compact mark at 32px and wordmark in both themes. Present both to the user and pause for the required visual approval before header integration. - [ ] **Step 6: Add approved header/footer** Use core Navigation/Search blocks, the dynamic toggle block, stable CSS `position: sticky`, no scroll animation, and no permanent sidebar. - [ ] **Step 7: Run tests and commit** ```bash npm run test:js -- --runTestsByPath tests/js/theme-preference.test.js PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:e2e -- tests/e2e/theme-preference.spec.mjs tests/e2e/navigation.spec.mjs git add inc/theme-preference.php blocks/theme-toggle assets/js/theme-toggle.js assets/icons parts assets/css/layout.css tests git commit -m "feat: add CHRNX shell and theme preference" ``` ### Task 6: Add page templates and editable patterns **Dependency:** Complete and approve the alter-ego asset plan before this task references `alter-ego-*.png`. **Files:** - Create: `templates/home.html` - Create: `templates/single.html` - Create: `templates/page.html` - Create: `templates/archive.html` - Create: `templates/search.html` - Create: `templates/404.html` - Create: `patterns/home-intro.php` - Create: `patterns/home-projects.php` - Create: `patterns/home-music.php` - Create: `patterns/about.php` - Create: `patterns/project-detail.php` - Create: `patterns/music-landing.php` - Create: `patterns/music-release.php` - Create: `patterns/podcast-landing.php` - Create: `patterns/podcast-show.php` - Create: `patterns/podcast-episode.php` - Create: `tests/smoke/templates.test.mjs` - Create: `tests/php/PatternsTest.php` - [ ] **Step 1: Write failing template/pattern tests** Assert that every required template has one header, one `
`, one footer, no sidebar, and valid block comments. Assert every pattern has a valid PHP header, `chrnx` text domain, escaped dynamic values, and no production URLs/placeholders. For music, assert approved public facts and exact draft states from the spec. For podcast patterns, assert structure and editor instructions only—no invented hosts, biographies, cover art, or listening links. - [ ] **Step 2: Run tests and verify red** ```bash node --test tests/smoke/templates.test.mjs PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:php -- --filter Patterns ``` Expected: FAIL naming missing files. - [ ] **Step 3: Build templates from small pattern/block units** `home.html` order: 1. header; 2. identity intro; 3. `chrnx/featured-stories`; 4. `chrnx/journal-stream`; 5. selected projects; 6. The No Names preview; 7. `chrnx/latest-podcast`; 8. short About preview; 9. `chrnx/subscribe-cta`; 10. footer. `single.html` uses an approximately `70ch` content column, metadata, optional featured image, post content, `chrnx/podcast-meta` when eligible, `chrnx/related-posts`, and `chrnx/subscribe-cta`. Archive/search templates expose topic/language filters, include `chrnx/topic-hero` on known topic archives, and provide useful empty states. - [ ] **Step 4: Add public music starter copy** Use `assets/images/the-no-names-collage.jpeg` and the approved music cutout. Include The No Names tagline, the three draft release cards, the studio-project statement, and plain AI/human-voice disclosure. Hide all platform destinations until editors add real URLs. Never scan or expose `/Users/chrnx/projects/suno` at runtime. Map approved portraits into section surfaces: - Code, Literature, Research, Life, and Gaming topic archives use `chrnx/topic-hero`. - The No Names pattern uses `the-no-names-musician-cutout.png`. - Podcast landing/show patterns use `alter-ego-podcasts.png` as optional decorative art. - Individual posts without featured images continue to use CSS topic treatments, not the portrait files. - [ ] **Step 5: Add structural podcast patterns** Provide clearly labeled editor slots for description, hosts, cover, destinations, latest episode query, and archive. Do not print editorial instructions on the frontend after content is replaced. The episode pattern contains slots/checklist for show term, number, duration, participants, `canonical_episode_url`, one optional embed, and show notes. - [ ] **Step 6: Run tests and commit** ```bash node --test tests/smoke/templates.test.mjs PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:php -- --filter Patterns PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run phpcs git add templates patterns tests git commit -m "feat: add CHRNX templates and editorial patterns" ``` ### Task 7: Finish visual states, responsive behavior, and accessibility **Files:** - Create: `scripts/seed-test-content.sh` - Create: `tests/fixtures/posts.json` - Create: `tests/fixtures/pages.json` - Create: `assets/css/components.css` - Modify: `assets/css/base.css` - Modify: `assets/css/layout.css` - Modify: `theme.json` - Create: `tests/e2e/layout.spec.mjs` - Create: `tests/e2e/accessibility.spec.mjs` - Create: `tests/e2e/content-edge-cases.spec.mjs` - [ ] **Step 1: Define and seed the edge-case fixtures** Create an idempotent WP-CLI script and synthetic JSON fixtures for long titles, missing metadata, no image/excerpt, unbroken code, one/two-story homepage states, empty searches, malformed filters, a podcast post missing `chrnx_show`, a podcast with canonical fallback but no embed, and a published/unpublished Subscribe page. Run the script twice and assert post/page counts and slugs do not change on the second run. ```bash PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run env:activate PATH="/opt/homebrew/opt/docker/bin:$PATH" npx wp-env run cli --env-cwd=wp-content/themes/chrnx bash scripts/seed-test-content.sh PATH="/opt/homebrew/opt/docker/bin:$PATH" npx wp-env run cli --env-cwd=wp-content/themes/chrnx bash scripts/seed-test-content.sh ``` Expected: both runs exit `0`; the second reports existing fixture slugs and creates nothing. - [ ] **Step 2: Write failing visual-behavior tests** Cover 375x812, 768x1024, 1440x900, and 2560x1440. Test long titles, missing image/excerpt/topic/language, unbroken code, fewer than three stories, empty search/filter, missing podcast metadata, blocked embed fallback, and reduced motion. - [ ] **Step 3: Write failing accessibility tests** Use Playwright plus `axe-playwright` for WCAG 2.2 AA automated checks. Add manual assertions for landmark uniqueness, heading sequence, names, focus, skip link, keyboard-only operation, and no hidden focus inside a closed menu. - [ ] **Step 4: Run tests and verify red** ```bash PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:e2e -- tests/e2e/layout.spec.mjs tests/e2e/accessibility.spec.mjs tests/e2e/content-edge-cases.spec.mjs ``` Expected: FAIL until states and styles exist. - [ ] **Step 5: Implement the approved visual system** Use the exact tokens from the spec, warm paper light mode, local Zen Maru headings, system body copy, limited monospace metadata, 44px controls, fluid spacing/type, CSS fallback artwork, responsive images, and `prefers-reduced-motion`. Keep decorative art outside the accessibility tree and meaningful images accurately described. - [ ] **Step 6: Run tests, lint, and commit** ```bash npm run lint:css PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:e2e -- tests/e2e/layout.spec.mjs tests/e2e/accessibility.spec.mjs tests/e2e/content-edge-cases.spec.mjs git add scripts/seed-test-content.sh tests/fixtures assets/css theme.json tests/e2e git commit -m "feat: complete responsive accessible theme states" ``` ### Task 8: Seed realistic synthetic fixtures and run browser compatibility **Files:** - Modify: `playwright.config.mjs` - Create: `tests/e2e/full-site.spec.mjs` - [ ] **Step 1: Extend synthetic fixtures for the full-site matrix** Create no real family data and no production podcast claims. Include: - sticky posts across several topics/languages; - old Jinko-era block content; - posts missing images, excerpts, and CHRNX metadata; - one synthetic Silicon Ranch episode with a fake canonical `example.invalid` URL and no live embed; - music/project/About pages created from patterns; - malformed filter URLs and a no-results query. Rerun the idempotent seeder so the newly added fixtures exist before browser tests: ```bash PATH="/opt/homebrew/opt/docker/bin:$PATH" npx wp-env run cli --env-cwd=wp-content/themes/chrnx bash scripts/seed-test-content.sh ``` Expected: new fixture slugs created once; all earlier fixture slugs reported as already present. - [ ] **Step 2: Run the full browser matrix** ```bash PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:e2e -- --project=chromium PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:e2e -- --project=firefox PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:e2e -- --project=webkit ``` Expected: PASS in all three engines with screenshots/traces only on failure. - [ ] **Step 3: Commit** ```bash git add scripts/seed-test-content.sh tests/fixtures tests/e2e/full-site.spec.mjs playwright.config.mjs git commit -m "test: add CHRNX full-site fixtures" ``` ### Task 9: Performance, packaging, and final verification **Files:** - Create: `scripts/verify-theme-package.mjs` - Create: `scripts/verify-lighthouse.mjs` - Create: `scripts/build-theme-archive.sh` - Create: `tests/smoke/package.test.mjs` - Create: `screenshot.png` - Modify: `README.md` - Modify: `package.json` - [ ] **Step 1: Write the failing package test** The verifier must reject archives containing `.git`, `.superpowers`, `node_modules`, `vendor`, tests, tmp files, source chroma intermediates, OS metadata, absolute paths, or missing required theme files. It must require final fonts, license, approved SVGs, approved alter-ego PNGs, templates, patterns, and PHP modules. - [ ] **Step 2: Run and verify red** ```bash node --test tests/smoke/package.test.mjs ``` Expected: FAIL because the build/verification scripts and archive are absent. - [ ] **Step 3: Capture the distributable theme screenshot** ```bash npx playwright screenshot \ --viewport-size="1200,900" \ --wait-for-timeout=1000 \ http://localhost:8888 \ screenshot.png file screenshot.png ``` Expected: `screenshot.png` is a 1200x900 PNG showing the seeded CHRNX homepage without browser chrome, open menus, cookie banners, or test overlays. - [ ] **Step 4: Add deterministic packaging** Build `dist/chrnx-theme-0.1.0.zip` from an explicit allowlist, then inspect every archive member. Do not package `.superpowers` mockups or `assets/images/the-no-names-musician-chroma.png`; package the full approved collage and final transparent cutout. Run the build before verification: ```bash bash scripts/build-theme-archive.sh node scripts/verify-theme-package.mjs dist/chrnx-theme-0.1.0.zip ``` Expected: archive created, then verifier exits `0` and prints the validated member count. - [ ] **Step 5: Run performance checks** Against seeded wp-env pages, run local Lighthouse 13.4.1 on mobile and desktop. Record results in `docs/verification/0.1.0.md`. Required gates: - no failed accessibility audit; - CLS <= 0.1; - no external font request; - no theme-added tracker/cookie request; - no console error; - no layout overflow at tested widths. Treat Lighthouse scores as evidence, not a design target; investigate individual failures. Use Playwright's installed Chromium explicitly: ```bash CHROME_PATH="$(node -e "console.log(require('playwright').chromium.executablePath())")" \ npx lighthouse http://localhost:8888 \ --chrome-flags="--headless --no-sandbox" \ --only-categories=performance,accessibility,best-practices,seo \ --output=json \ --output-path=docs/verification/lighthouse-mobile.json CHROME_PATH="$(node -e "console.log(require('playwright').chromium.executablePath())")" \ npx lighthouse http://localhost:8888 \ --preset=desktop \ --chrome-flags="--headless --no-sandbox" \ --only-categories=performance,accessibility,best-practices,seo \ --output=json \ --output-path=docs/verification/lighthouse-desktop.json node scripts/verify-lighthouse.mjs \ docs/verification/lighthouse-mobile.json \ docs/verification/lighthouse-desktop.json ``` `verify-lighthouse.mjs` must fail on any accessibility audit failure, CLS above `0.1`, or runtime/console error recorded by Lighthouse. The Playwright network test separately fails on remote font, tracker, or theme-added cookie requests. - [ ] **Step 6: Run the complete fresh verification suite** ```bash npm run test:smoke npm run lint:js npm run lint:css PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run phpcs npm run test:js PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:php PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run test:e2e bash scripts/build-theme-archive.sh node scripts/verify-theme-package.mjs dist/chrnx-theme-0.1.0.zip git diff --check git status --short ``` Expected: every command exits `0`; Git shows only intentionally uncommitted verification notes, if any. - [ ] **Step 7: Commit the verified package inputs and report evidence** ```bash git add scripts tests/smoke screenshot.png README.md package.json package-lock.json docs/verification git commit -m "chore: verify CHRNX theme package" git status --short ``` Expected: clean worktree. Do not create a remote, push, deploy, activate on production, or publish Silicon Ranch data.