Read AGENTS.md in this repository for a comprehensive overview of the project architecture, directory structure, governance rules system, development workflow, and testing setup.
- Main plugin file:
vip-governance.php - PHP backend:
governance/directory - JS frontend:
src/directory (builds tobuild/) - Tests:
tests/(PHPUnit),src/**/*.test.js(Jest),tests/e2e/(Playwright) - Rules schema:
governance-schema.json - Default rules:
governance-rules.json
npm run build— Production buildnpm run dev— Watch modenpm run lint— All linting (Prettier + ESLint + PHPCS)npm run test:js— Jest unit testscomposer run test— PHPUnit tests (requireswp-env start)npx playwright test— E2E tests (requireswp-env start)
- PHP: Add
tests/test-<name>.php, class inWPCOMVIP\Governance\Testsnamespace extendingTestCase - JS: Add
src/<name>.test.jsco-located with the source file - E2E: Add
tests/e2e/<name>.spec.jsusing@wordpress/e2e-test-utils-playwright - See AGENTS.md "Writing Tests" section for full patterns and examples
- Local dev at
http://localhost:8889(admin/password) - Inspect
VIP_GOVERNANCEglobal in browser devtools for resolved rules - Admin settings page (
VIP Block Governance) shows parsed rules and validation errors - REST API:
GET /wp-json/vip-governance/v1/<role>/rules - See AGENTS.md "Debugging" section for common debugging steps
- PHP follows WordPress-VIP-Go coding standards
- JS follows
@automattic/eslint-plugin-wpviprules - PHP 8.1+ required; WordPress 6.0+ required
- Plugin uses opt-in model: only explicitly allowed blocks are available
- Pre-commit hook runs
lint-stagedautomatically