1# CLAUDE.md
2
3This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
5## Project Overview
6
7GoDaddy Launch is a WordPress plugin (PHP 8.0+, WP 5.9+) that provides a guided launch experience for new WordPress sites on the GoDaddy hosting platform. It has two main features: a **Publish Guide** (multi-step onboarding) and **Live Site Control** (site launch workflow).
8
9## Commands
10
11### Development Setup
12```bash
13composer install && npm install
14nvm use # Node 18 (from .nvmrc)
15wp-env start # Start WordPress dev environment
16npm run start:wp # Webpack dev server (watch mode)
17npm run build # Production build
18```
19
20### Testing
21```bash
22npm run test:js # Jest unit tests
23npm run test:js -- --testPathPattern="site-content" # Single test file
24npm run test:e2e # Cypress E2E (headless Chrome)
25npm run test:e2e:headed # Cypress E2E (headed)
26npx cypress run --spec "**/__tests__/publish-guide.cypress.js" # Single E2E spec
27npm run test:unit:php # PHPUnit (starts wp-env with xdebug)
28npm run test:php # PHP lint + PHPUnit
29```
30
31### Linting
32```bash
33npm run lint # All linters (CSS, JS, PHP)
34npm run lint:js # ESLint only
35npm run lint:css # Stylelint only
36npm run lint:php # PHPCS (runs inside wp-env container)
37npm run lint:js:fix # ESLint autofix
38npm run lint:css:fix # Stylelint autofix
39```
40
41### State Reset (wp-env)
42```bash
43npm run reset # Reset all plugin options to defaults
44```
45
46### Release
47```bash
48npm version [major|minor|patch] # Bumps version in 3 files, builds, commits, tags, pushes
49```
50
51## Architecture
52
53### Dual-Stack: PHP Backend + React Frontend
54
55**PHP backend** (`includes/`): Service provider pattern using Illuminate Container (IoC). Main entry point is `godaddy-launch.php` which bootstraps `Application` (extends Container) and registers four service providers:
56- `GoDaddyStylesServiceProvider` - GoDaddy brand styles
57- `LiveSiteControl\LiveSiteControlProvider` - Launch workflow logic
58- `PublishGuide\PublishGuideServiceProvider` - Guide step management
59- `PageMetaServiceProvider` - Page metadata
60
61Namespace: `GoDaddy\WordPress\Plugins\Launch\`
62
63**React frontend** (`src/`): Two independent Webpack entry points that register as WordPress editor plugins:
64- `src/publish-guide/` - Multi-step guide with 6 items (SiteInfo, SiteMedia, SiteContent, SiteDesign, AddDomain, SEO)
65- `src/live-site-control/` - Site launch modals and confirmation flow
66- `src/common/` - Shared components and utilities
67
68### State Management
69
70Uses `@wordpress/data` (Redux wrapper). Store name: `godaddy-launch/publish-guide`. Store files in `src/publish-guide/store/` (actions, reducer, selectors, constants).
71
72Entity state (site title, logo, etc.) is managed via `@wordpress/core-data` with `useEntityProp()` hooks and debounced saves (`debouncedSaveEntityRecord` at 1000ms).
73
74### Key Patterns
75
76- **Query-param actions**: Deep linking via `?gdl_action=` params (e.g., `add-site-logo`, `edit-site-title`, `launch-now`, `share-on-social`)
77- **Milestone API**: Custom REST endpoints at `gdl/v1/milestone/{name}` for tracking user progress
78- **React 17/18 compat**: Conditionally uses `createRoot` vs `render` based on `shouldUseReact18Syntax` flag
79- **Instrumentation**: `EidWrapper` component and `_expDataLayer` global for analytics (page, interaction, impression events)
80- **Cypress reset**: Tests use `?gdl_cypress_reset=true` query param to reset state
81
82### Build & Deployment
83
84- Webpack config extends `@wordpress/scripts` with two entry points
85- The `build/` directory is committed to git (required for system plugin deployment)
86- Composer `vendor/` dependencies use Mozart for namespace isolation (`Dependencies/` prefix)
87- Deployed as a Composer dependency in `wp-paas-system-plugin`
88- Version lives in 3 places: `package.json`, `godaddy-launch.php`, `includes/Application.php` (managed by `.dev/bin/update-version.js`)
89
90### Testing Structure
91
92- **Jest**: `@wordpress/jest-preset-default`, config at `.dev/tests/jest/jest.config.js`, tests in `**/__tests__/*.test.js`
93- **Cypress**: Config at `cypress.config.js`, support commands at `.dev/tests/cypress/support/commands.js`, specs in `**/__tests__/*.cypress.js`
94- **PHPUnit**: Config at `phpunit.xml.dist`, runs inside wp-env container
95
96### Linting Config
97
98- ESLint: `@godaddy-wordpress/eslint-config` with cypress plugin
99- Stylelint: `@godaddy-wordpress/stylelint-config`
100- PHPCS: WordPress-Extra + WordPress-Docs standards, text domain `godaddy-launch`
101
102### Styling
103
104SCSS with WordPress base-styles mixins. Color palette uses GoDaddy Everyday Blue (`$godaddy-everyday-blue-600: #09757a`). Scoped under `#gdl-publish-guide`.
105
106## Pull Request Format
107
108PRs should include: Description, Jira Ticket (usually matches branch name, e.g., AIWD-504), How to Test, Screenshots (if applicable), Checklist (tested, tests updated, docs updated), and Release Notes (bullets starting with Added/Removed/Fixed/Changed).
109
110## Working Style
111
112Be direct and honest. Challenge incorrect assumptions. Verify requests by inspecting code before acting. Prioritize accuracy over agreeableness.
113