This file defines safe working rules for AI coding agents in this repository.
- MU load path starts at
000-vip-init.phpand001-core.php. - Root feature entry files (for example
security.php,vip-mail.php,vip-rest-api.php) wire feature modules. - Shared code lives in
lib/. - Automated tests:
- PHPUnit:
tests/viabin/test.sh(useCI=1 ./bin/test.sh --filter <test>for running specific tests). - e2e:
__tests__/e2e/
- PHPUnit:
See docs/architecture.md for full map.
- New platform logic: add to existing module directories (
001-core/,lib/,cache/,security/,vip-helpers/,wp-cli/) and keep a thin root entrypoint. - New unit tests: add to
tests/withtest-*.phpnaming. - New e2e tests: add to
__tests__/e2e/specs/.
Avoid direct edits in external/upstream directories unless the task is explicitly to update upstream code:
advanced-post-cache/http-concat/jetpack/lightweight-term-count-update/rewrite-rules-inspector/search/elasticpress/wp-parsely/gutenberg-ramp/drop-ins/hyperdb/
- Never commit credentials, API tokens, or secret constants.
- Keep secret-backed values in environment/site config only (
vip-config.phpor platform secrets), not in this repo. - Preserve and test capability checks when changing auth, REST, cache purge, or admin actions.
- Treat these paths as high-risk and require extra care + tests:
security.phpcache/class-vary-cache.phpvip-cache-manager/vip-cache-manager.php001-core/constants.php
- Run local checks before proposing merge:
npm run phplintnpm run phpcsnpm run test:smoke
- Keep changes minimal and module-local.
- Prefer extending existing helper classes/functions over introducing parallel abstractions.
- Update docs when changing setup/testing/release behavior.
- Avoid unbounded or repeated
WP_Querycalls inside loops (N+1 query patterns). - Avoid expensive operations on high-frequency hooks (
init,template_redirect,parse_request) without caching/guards. - Be careful with cache purge fan-out and auth-cookie variation changes; these can affect global cache hit rate.
- Confirm target area is not an upstream/submodule path.
- Add or update tests near changed behavior.
- Run lint + at least smoke tests locally.
- Validate no secret values were introduced in diffs.
- Update impacted docs in
docs/and rootREADME.md.