|
| 1 | +# Agent workflow |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +Neve is an open-source WordPress theme. It uses a hybrid PHP/React architecture: traditional WordPress PHP theme code with React-based admin interfaces (dashboard, customizer controls, metabox editor). |
| 6 | + |
| 7 | +## Build Commands |
| 8 | + |
| 9 | +```bash |
| 10 | +# Install dependencies |
| 11 | +yarn install --frozen-lockfile |
| 12 | +COMPOSER=composer-dev.json composer install # or: yarn run composer:install |
| 13 | + |
| 14 | +# Full production build (all apps + rollup + grunt + translations) |
| 15 | +yarn run build |
| 16 | + |
| 17 | +# Build individual apps |
| 18 | +yarn run build:dash # Dashboard React app |
| 19 | +yarn run build:customizer # Customizer controls React app |
| 20 | +yarn run build:metabox # Metabox editor React app |
| 21 | +yarn run build:ui-components # Shared React component library (@neve-wp/components) |
| 22 | +yarn run build:rollup # Frontend vanilla JS (Rollup → modern + legacy bundles) |
| 23 | +yarn run build:grunt # SCSS → CSS compilation |
| 24 | + |
| 25 | +# Watch mode (all apps) |
| 26 | +yarn run dev |
| 27 | +``` |
| 28 | + |
| 29 | +## Linting & Formatting |
| 30 | + |
| 31 | +```bash |
| 32 | +# PHP |
| 33 | +composer run-script phpcs # WordPress Coding Standards check |
| 34 | +composer run-script format # Auto-fix PHP style |
| 35 | +composer run-script phpstan # Static analysis (level 6) |
| 36 | + |
| 37 | +# JavaScript/TypeScript (per-app linting) |
| 38 | +yarn run lint:global # Frontend JS (assets/js/src/) |
| 39 | +yarn run lint:dash # Dashboard app |
| 40 | +yarn run lint:customizer # Customizer app |
| 41 | +yarn run format:global # Auto-fix frontend JS |
| 42 | +yarn run format:dash # Auto-fix dashboard JS |
| 43 | + |
| 44 | +# SCSS |
| 45 | +yarn run lint:scss |
| 46 | +yarn run format:scss |
| 47 | +``` |
| 48 | + |
| 49 | +## Testing |
| 50 | + |
| 51 | +```bash |
| 52 | +# PHP unit tests |
| 53 | +./vendor/bin/phpunit |
| 54 | +./vendor/bin/phpunit tests/test-neve.php # Single test file |
| 55 | + |
| 56 | +# E2E tests (Playwright, requires WordPress environment) |
| 57 | +yarn run test:playwright |
| 58 | +npx playwright test e2e-tests/specs/some-spec.spec.ts # Single spec |
| 59 | + |
| 60 | +# Bundle size check |
| 61 | +yarn run size |
| 62 | +``` |
| 63 | + |
| 64 | +## Architecture |
| 65 | + |
| 66 | +### PHP (Backend) |
| 67 | + |
| 68 | +Two PSR-4 autoloaded namespaces: |
| 69 | +- **`Neve\*`** → `inc/` — Core theme: customizer, views, compatibility layers, admin |
| 70 | +- **`HFG\*`** → `header-footer-grid/` — Header/footer drag-and-drop builder module |
| 71 | + |
| 72 | +Key entry points: |
| 73 | +- `functions.php` — Bootstrap, constants (`NEVE_VERSION`, `NEVE_INC_DIR`, etc.) |
| 74 | +- `inc/core/core_loader.php` — Main feature factory, loads all theme features |
| 75 | +- `header-footer-grid/Main.php` — HFG module entry point |
| 76 | + |
| 77 | +`inc/compatibility/` contains integrations for 20+ plugins (WooCommerce, Elementor, Beaver Builder, WPML, etc.). |
| 78 | + |
| 79 | +### JavaScript/React (Frontend & Admin) |
| 80 | + |
| 81 | +Three separate build systems: |
| 82 | +- **Rollup** → `assets/js/src/` → `assets/js/build/{modern,all}/` (frontend vanilla JS with modern/legacy bundles) |
| 83 | +- **Webpack** (`@wordpress/scripts`) → `assets/apps/*/src/` → `assets/apps/*/build/` (React admin apps) |
| 84 | +- **Grunt** → `assets/scss/` → compiled CSS + RTL variants |
| 85 | + |
| 86 | +React apps in `assets/apps/`: |
| 87 | +- `components/` — Shared component library published as `@neve-wp/components` (local file dependency) |
| 88 | +- `dashboard/` — Theme settings dashboard |
| 89 | +- `customizer-controls/` — WordPress Customizer React UI |
| 90 | +- `metabox/` — Post/page metabox editor |
| 91 | +- `starter-sites/` — Demo content installer notice |
| 92 | + |
| 93 | +### CSS |
| 94 | + |
| 95 | +SCSS source in `assets/scss/`, compiled via Grunt. Tailwind CSS is used in some apps. RTL stylesheets are auto-generated. |
| 96 | + |
| 97 | +## Sub-Folder Lookup Map |
| 98 | + |
| 99 | +Use this as a fast entry point before deeper grep/search. |
| 100 | + |
| 101 | +| Path | What lives here | Start here when... | |
| 102 | +|---|---|---| |
| 103 | +| `inc/` | Core theme PHP (`Neve\*`): feature bootstrapping, customizer options, admin, plugin compat, render helpers | You need to change theme behavior in PHP | |
| 104 | +| `inc/core/` | Main runtime wiring (feature loading, settings, styles, shared traits) | You are tracing initialization or global feature toggles | |
| 105 | +| `inc/customizer/` | Customizer option definitions, defaults, control types, traits | You are adding/changing Customizer settings | |
| 106 | +| `inc/views/` | PHP view layer (layouts, partials, inline output, pluggable pieces) | You are editing rendered markup/output structure | |
| 107 | +| `inc/compatibility/` | Integrations with plugins (WooCommerce, Elementor, WPML, etc.) | A bug appears only when a plugin is active | |
| 108 | +| `header-footer-grid/` | Header/Footer builder module (`HFG\*`): builder components, customizer integration, templates, assets | Work is specific to header/footer builder behavior | |
| 109 | +| `header-footer-grid/Core/Components/` | Individual HFG components and utilities | You are modifying one header/footer element | |
| 110 | +| `assets/apps/components/` | Shared React UI package (`@neve-wp/components`) consumed by other apps | Multiple apps need the same UI/control update | |
| 111 | +| `assets/apps/dashboard/` | Dashboard React app | Theme dashboard/admin UX changes | |
| 112 | +| `assets/apps/customizer-controls/` | React controls rendered in WordPress Customizer | Customizer-side React UI/control logic changes | |
| 113 | +| `assets/apps/metabox/` | Post/page metabox React app | Metabox UI or save behavior changes | |
| 114 | +| `assets/apps/starter-sites/` | Starter-sites notice/installer app | Demo/starter-site flows need updates | |
| 115 | +| `assets/js/src/` | Frontend vanilla JS sources (Rollup modern + legacy bundles) | Runtime frontend interactions outside React apps | |
| 116 | +| `assets/scss/` | Global/theme SCSS source split by components/elements/compat | Styling changes in frontend theme CSS | |
| 117 | +| `assets/customizer/` | Legacy/customizer-specific static CSS/JS | Issue is in older non-React customizer assets | |
| 118 | +| `template-parts/` | Reusable template chunks used by core theme templates | You need to adjust a reusable template fragment | |
| 119 | +| `views/` | Additional PHP view templates used by theme rendering | You are tracking frontend HTML generation | |
| 120 | +| `page-templates/` | Assignable WordPress page templates | You are changing template-level page layouts | |
| 121 | +| `woocommerce/` | WooCommerce template overrides | WooCommerce-only frontend markup/styles need changes | |
| 122 | +| `tests/` | PHPUnit tests and PHP test helpers | You are adding or updating PHP unit test coverage | |
| 123 | +| `tests/php/` | PHP static-analysis stubs (e.g. for Psalm/PHPStan) | You need or are adjusting PHP static-analysis support | |
| 124 | +| `e2e-tests/specs/` | Playwright end-to-end specs | Validating editor/admin/frontend behavior end-to-end | |
| 125 | +| `stories/` | Storybook stories and local UI playground assets | You need isolated component UI verification | |
| 126 | +| `docs/` | Project docs and contributor references | You need implementation conventions or team guidance | |
| 127 | +| `grunt/` + `Gruntfile.js` | CSS/asset build pipeline tasks | SCSS output/build-step behavior is wrong | |
| 128 | +| `rollup.config.js` | Frontend JS bundling config for `assets/js/src/` | Entry points/output/chunk behavior must change | |
| 129 | +| `webpack.config.js` | React app bundling config (`assets/apps/*`) | Build behavior for dashboard/customizer/metabox apps | |
0 commit comments