Minimal instructions for coding agents working in this repository.
- CRITICAL: Keep
CLAUDE.mdas a pointer to this file (@AGENTS.md). - CRITICAL: Maintain PHP
7.4+compatibility unless project requirements change. - CRITICAL: Do not edit WordPress core,
vendor/, ornode_modules/. - CRITICAL: For frontend work, edit
modules/*/resources/*. - CRITICAL: Never revert unrelated local changes.
- MUST: Run relevant lint/tests before claiming completion.
- This is a modular WooCommerce/WordPress plugin using Syde Modularity.
- Key entry points:
woocommerce-paypal-payments.php(plugin bootstrap/constants)bootstrap.php(container + module boot)modules.php(module registration and feature-flag loading)
- Most feature code is in
modules/*. - Service wiring is module-based (
services.php,factories.php,extensions.php). - Architecture reference:
docs/plugin-architecture.md.
- Preferred local env: DDEV.
npm run ddev:setup(start + orchestrate).- If WP is missing after startup, run
ddev orchestrate. - Use
ddev describefor active URLs/ports. - If
.ddev.siterouting fails, use the direct host mapping shown inddev describeforweb:80(for examplehttp://127.0.0.1:60792). - Admin defaults:
admin/adminat/wp-admin. - Common DDEV issues and fixes are documented in the README under "Troubleshooting DDEV setup" (vmnetd/port errors, Docker CLI path, SSL trust, Mutagen warnings).
- Non-DDEV setup:
composer install && npm ci && npm run build.
npm run lint(PHPCS + PHPStan)npm run lint-js(currently unreliable for full-repo linting in this project)npx wp-scripts lint-js <file-or-dir>(recommended; works for targeted JS/TS paths)npm run unit-testsnpm run test:unit-jsnpm run integration-testsnpm run test(full suite)npm run ddev:unit-tests:coverage(coverage in DDEV)
- Add or extend behavior through module services/extensions, not ad-hoc globals.
- If adding/removing a module, update
modules.phpand validate feature-flag behavior. - Keep i18n text domain as
woocommerce-paypal-payments. - PRs should include reproducible test steps and a changelog summary.
- The plugin is intentionally modular; do not collapse it into a monolith.
- Some modules are intentionally conditional via
PCP_*_ENABLEDandwoocommerce.feature-flags.*. - JS/SCSS build output is intentionally centralized in root
/assetsvia webpack. - WordPress hook-based integration and service registration are intentional patterns.
- Editing generated
/assetsfiles instead of moduleresources. - Forgetting to rebuild after JS/SCSS source changes.
- Introducing PHP syntax that is not PHP 7.4 compatible.
- Accessing plugin container/services before initialization.
- Skipping integration tests for checkout, payment, onboarding, or webhook changes.
- Changing module load order/feature flags without validating side effects.
- Assuming
.ddev.siteURLs always resolve locally.
- PHP-only change:
npm run unit-tests && npm run lint - JS-only change:
npm run test:unit-js && npx wp-scripts lint-js <changed-js-files-or-dir> - Checkout/payment/onboarding/webhook change:
npm run test