|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `MslsMenu.php` is the WordPress bootstrap; add hooks here or split helpers into new subdirectories under `mslsmenu/` as needed. |
| 5 | +- `mslsmenu/` mirrors the shipping bundle; keep source and bundle in sync before release. |
| 6 | +- `languages/` stores translation assets; regenerate via `wp i18n make-pot` when strings move. |
| 7 | +- `tests/` houses Pest specs with Brain Monkey shims in `tests/Pest.php`; colocate fixtures with their specs. |
| 8 | +- `bin/` contains release tooling (`bin/git-release.sh`); prefer extending scripts over one-off commands. |
| 9 | + |
| 10 | +## Build, Test, and Development Commands |
| 11 | +- Run `composer install` after cloning to pull dev dependencies. |
| 12 | +- `composer test` executes the Pest suite with mocked WordPress APIs. |
| 13 | +- `composer analyze` runs PHPStan (level 5) against `MslsMenu.php`; keep it passing before pushing. |
| 14 | +- `composer coverage` enables Xdebug coverage for pull request evidence. |
| 15 | +- `composer build` triggers `bin/git-release.sh`, refreshing `mslsmenu/` and `mslsmenu.zip` for distribution. |
| 16 | + |
| 17 | +## Coding Style & Naming Conventions |
| 18 | +- Follow WordPress PHP standards: tabs for indentation, braces on new lines, no trailing commas. |
| 19 | +- Include `declare(strict_types=1);` in new entry points and document public APIs with PHPDoc. |
| 20 | +- Use `snake_case` for hook callbacks, `PascalCase` for classes, and `camelCase` for internal helpers unless a hook signature dictates otherwise. |
| 21 | + |
| 22 | +## Testing Guidelines |
| 23 | +- Place new specs in `tests/YourFeatureTest.php`; keep case names descriptive (`it('renders menu item')`). |
| 24 | +- Stub external WP functions with Brain Monkey setup blocks to keep tests deterministic. |
| 25 | +- Run `composer coverage` for behavioral changes and share the summary when coverage changes noticeably. |
| 26 | + |
| 27 | +## Commit & Pull Request Guidelines |
| 28 | +- Write short imperative subjects (≈50 chars) such as `Clean menu walker output`; batch related edits together. |
| 29 | +- Reference GitHub issues in the body (`Refs #123`) and list the commands you ran. |
| 30 | +- PRs should explain the problem, outline the fix, attach UI evidence when relevant, and confirm `composer test` plus `composer analyze`. |
| 31 | + |
| 32 | +## Release Packaging Tips |
| 33 | +- Bump the plugin header version in `MslsMenu.php` and sync the same value into `readme.txt` before building. |
| 34 | +- Run `composer build`, inspect the refreshed `mslsmenu/` contents, and spot-check the generated `mslsmenu.zip` before tagging. |
0 commit comments