Skip to content

Commit 6c636f9

Browse files
authored
Merge pull request #24 from lloc/chore/documentation
Documenation added
2 parents c4f157d + abd7276 commit 6c636f9

5 files changed

Lines changed: 59 additions & 18 deletions

File tree

.distignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ coverage.xml
1010
.distignore
1111
.gitattributes
1212
.gitignore
13+
.phpcs.cache
1314
.phpunit.result.cache
1415
.scrutinizer.yml
16+
Changelog.md
1517
composer.lock
1618
mslsmenu.zip
1719
package.json
@@ -22,3 +24,4 @@ phpdoc.xml
2224
.phpcs.xml.dist
2325
phpunit.xml
2426
README.md
27+
AGENTS.md

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
.phpunit.result.cache
33
.phpcs.cache
44
.idea/
5+
.phpcs.cache
56
vendor/
67
reports/
78
mslsmenu/
89
composer.lock
910
mslsmenu.zip
10-
coverage.xml
11+
coverage.xml

AGENTS.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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.

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ MslsMenu
44
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/lloc/MslsMenu/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/lloc/MslsMenu/?branch=master)
55
[![codecov](https://codecov.io/gh/lloc/MslsMenu/graph/badge.svg?token=902NM9H2BW)](https://codecov.io/gh/lloc/MslsMenu)
66

7-
Adds the output of the Multisite Language Switcher to the one (or more) of your navigation menus(s)
7+
MslsMenu extends the Multisite Language Switcher by injecting a language picker into any registered WordPress navigation menu. Install it when you want users to toggle sites and languages without custom walkers.
88

9-
[Latest stable](https://wordpress.org/plugins/mslsmenu/)
9+
## Install
10+
- From WordPress: search for “MslsMenu” under Plugins → Add New and activate it.
11+
- Manual: copy the `mslsmenu/` directory to `wp-content/plugins/` and activate the plugin.
12+
13+
## Usage
14+
- Head to Appearance → Menus, add the “MslsMenu” item to your chosen menu, and arrange it like any other menu entry.
15+
- Configure Multisite Language Switcher as usual; MslsMenu reuses its site mappings automatically.
16+
17+
## Develop
18+
- `composer install` pulls dev tools (Pest, PHPStan, Brain Monkey).
19+
- `composer test` runs the Pest suite; `composer analyze` performs static analysis.
20+
21+
## Contribute
22+
- Review `AGENTS.md` for project conventions and release steps.
23+
- Latest release: https://wordpress.org/plugins/mslsmenu/

composer.json

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,19 @@
1313
"brain/monkey": "2.*",
1414
"phpstan/phpstan": "^1.8",
1515
"szepeviktor/phpstan-wordpress": "^1.1",
16-
"phpstan/extension-installer": "^1.1",
17-
"wp-coding-standards/wpcs": "^3.0"
16+
"phpstan/extension-installer": "^1.1"
1817
},
1918
"autoload-dev": {
2019
"files": [ "MslsMenu.php" ]
2120
},
2221
"scripts": {
2322
"test": "vendor/bin/pest",
2423
"coverage": "php -d xdebug.mode=coverage vendor/bin/pest --coverage",
25-
"phpstan": "vendor/bin/phpstan analyze",
24+
"analyze": "vendor/bin/phpstan analyze",
2625
"git-release": "bin/git-release.sh",
2726
"build": [
27+
"@composer update --no-dev",
2828
"@git-release"
29-
],
30-
"githooks": [
31-
"if [ -e bin/githooks/pre-commit ]; then cp bin/githooks/pre-commit ./.git/hooks/; fi",
32-
"if [ -e .git/hooks/pre-commit ]; then chmod 0755 .git/hooks/pre-commit; fi"
33-
],
34-
"post-install-cmd": [
35-
"@githooks"
36-
],
37-
"post-update-cmd": [
38-
"@githooks"
3929
]
4030
},
4131
"authors": [
@@ -56,8 +46,7 @@
5646
"allow-plugins": {
5747
"composer/installers": true,
5848
"phpstan/extension-installer": true,
59-
"pestphp/pest-plugin": true,
60-
"dealerdirect/phpcodesniffer-composer-installer": true
49+
"pestphp/pest-plugin": true
6150
}
6251
}
6352
}

0 commit comments

Comments
 (0)