Skip to content

Commit a2abd8d

Browse files
committed
feat(package): register libcommons package
1 parent 931a5d3 commit a2abd8d

9 files changed

Lines changed: 72 additions & 20 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ elprobe run <package>
9898
- `libserializer`;
9999
- `libform`;
100100
- `libdb`;
101+
- `libcommons`;
101102
- `libplaceholder`;
102103
- `libworld`;
103104
- `agent-bridge`;
@@ -106,10 +107,15 @@ elprobe run <package>
106107
- `libhud`;
107108
- `libtrigger`;
108109
- `libwindow`.
109-
- Validated all 13 official packages as package-backed plugins in the local
110-
3.0-dev matrix.
110+
- Added `LibCommons` as the first new official 3.0-dev library repository. It
111+
ships as both a standalone PHAR and an EasyLibrary `classpath` package with
112+
release assets (`.phar`, `.easylib.zip`, `package.yml` and `checksums.txt`).
113+
- Registered `libcommons` in the package manager catalog and standalone library
114+
installer catalog.
115+
- Validated all 14 official packages as package-backed plugins in the local
116+
3.0-dev matrix after adding `LibCommons`.
111117
- Validated fresh installation from official GitHub Release `.easylib.zip`
112-
assets for all 13 official packages on a disposable PMMP server.
118+
assets for all 14 official packages on a disposable PMMP server.
113119
- Kept standalone plugins supported and protected by the standalone shadow
114120
guard.
115121

@@ -129,7 +135,7 @@ elprobe run <package>
129135
- Added package status/doctor detection for package-backed plugins that load
130136
before EasyLibrary itself.
131137
- Added staged validation waves for package-backed proxies, ending with all
132-
13 official packages active and healthy.
138+
14 official packages active and healthy.
133139
- Hardened the package-backed proxy loader so parked or stale proxy folders are
134140
never accepted as loadable plugins. A proxy now needs an armed `plugin.yml`
135141
and a matching installed `package-state.yml` entry before PMMP can load it.

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The 3.x direction is: EasyLibrary becomes the minimal manager, official libs bec
1717

1818
## What EasyLibrary provides
1919

20-
- A 3.x internal package manager foundation for official packages such as `libpacket`, `libcommand`, `libserializer`, `libform`, `libdb`, `libplaceholder`, `libworld` and `agent-bridge`.
20+
- A 3.x internal package manager foundation for official packages such as `libpacket`, `libcommand`, `libserializer`, `libform`, `libdb`, `libcommons`, `libplaceholder`, `libworld` and `agent-bridge`.
2121
- Dry-run package install plans, checksum-backed downloads, backups, restart-required state and package lock diagnostics.
2222
- Legacy standalone PHAR install planning through `/easylibrary libs install` while migration is in progress.
2323
- Official library runtime diagnostics through `/easylibrary libs`, `/easylibrary packages` and `/easylibrary doctor`.
@@ -67,7 +67,7 @@ Run these commands after installing or updating EasyLibrary:
6767
At minimum, a healthy server should report `Problems: 0`. When all official packages are installed and active, a full package-backed test server looks like this:
6868

6969
```txt
70-
Libraries: 13 / standalone: 0 / package-backed: 13 / not installed: 0
70+
Libraries: 14 / standalone: 0 / package-backed: 14 / not installed: 0
7171
Problems: 0
7272
Command provider: package-backed
7373
Command backend: libcommand-rich
@@ -193,6 +193,7 @@ while migrating one library at a time.
193193
| [LibForm](https://github.com/ImperaZim/LibForm) | `imperazim\form` | Long, modal, custom, paginated, conditional and chained forms |
194194
| [LibHud](https://github.com/ImperaZim/LibHud) | `imperazim\hud` | Boss bars, scoreboards, nametags, titles, notifications and tab lists |
195195
| [LibDB](https://github.com/ImperaZim/LibDB) | `imperazim\db` | SQLite/MySQL, query builder, models, migrations, seeds, cache and async queries |
196+
| [LibCommons](https://github.com/ImperaZim/LibCommons) | `imperazim\commons` | Arrays, text, numbers, time, durations and validation helpers |
196197
| [LibSerializer](https://github.com/ImperaZim/LibSerializer) | `imperazim\serializer` | Items, blocks, entities, inventories, positions, skins and schematics |
197198
| [LibTrigger](https://github.com/ImperaZim/LibTrigger) | `imperazim\trigger` | Scheduled global, per-player and item triggers with modes and priorities |
198199
| [LibWindow](https://github.com/ImperaZim/LibWindow) | `imperazim\window` | Virtual inventories, layouts, sessions, transactions and window presets |
@@ -322,7 +323,7 @@ The preferred 3.x command path is `/easylibrary packages`. The old `/easylibrary
322323
```
323324

324325

325-
Current asset-ready internal packages in this wave include `libpacket`, `libcommand`, `libserializer`, `libform`, `libdb`, `libplaceholder`, `libworld`, `agent-bridge`, `libcustom`, `libenchantment`, `libhud`, `libtrigger` and `libwindow`. Every package remains protected by the standalone shadow guard while a matching standalone plugin is installed.
326+
Current asset-ready internal packages in this wave include `libpacket`, `libcommand`, `libserializer`, `libform`, `libdb`, `libcommons`, `libplaceholder`, `libworld`, `agent-bridge`, `libcustom`, `libenchantment`, `libhud`, `libtrigger` and `libwindow`. Every package remains protected by the standalone shadow guard while a matching standalone plugin is installed.
326327

327328
### Internal package activation gate
328329

@@ -411,7 +412,7 @@ First package targets:
411412
- `libpacket` is the first dependency-safe classpath package and should be installed before command/runtime packages that depend on packet services.
412413
- `libcommand` is asset-ready too, but should be installed after `libpacket`.
413414

414-
The package-backed loader has now validated the base wave (`libserializer`, `libform`, `libdb`, `libpacket`, `libcommand`), the isolated runtime wave (`libwindow`, `libcustom`, `libenchantment`, `libtrigger`), the standalone `libhud` wave, the dependency-heavy placeholder wave, the world-service wave and the final Agent bridge wave.
415+
The package-backed loader has now validated the base wave (`libserializer`, `libform`, `libdb`, `libpacket`, `libcommand`), the isolated runtime wave (`libwindow`, `libcustom`, `libenchantment`, `libtrigger`), the standalone `libhud` wave, the dependency-heavy placeholder wave, the world-service wave, the final Agent bridge wave and the new `libcommons` classpath package wave.
415416

416417
`/easylibrary packages doctor` validates package paths, installed manifests, sha256 metadata, proxy marker data and stale restart markers. If a package is already active through the package-backed proxy, stale restart-required entries are cleared automatically.
417418

@@ -429,11 +430,11 @@ The package-backed loader has now validated the base wave (`libserializer`, `lib
429430

430431
`/easylibrary doctor` also reports the active command provider and the selected command backend. The provider explains where `imperazim\command\Command` was loaded from, while the backend explains how EasyLibrary registered its command surface: `libcommand-rich` for the full command tree or `native-pocketmine-recovery` for the minimal recovery command. EasyLibrary 3.x only treats package-backed or standalone `LibCommand` as rich command providers; if neither is available, the core registers the recovery-safe native command.
431432

432-
The package-backed command path has been validated in-game with all 13 official packages active: `/easylibrary doctor` should show `Command provider: package-backed`, `Command backend: libcommand-rich`, `rich: yes`, `overrides: yes` and no official library runtime problems.
433+
The package-backed command path has been validated in-game with all official packages active: `/easylibrary doctor` should show `Command provider: package-backed`, `Command backend: libcommand-rich`, `rich: yes`, `overrides: yes` and no official library runtime problems.
433434

434435
If LibCommand is unavailable, EasyLibrary registers a minimal recovery command that uses PocketMine's native command base instead of the rich LibCommand tree. That fallback intentionally exposes only recovery-safe commands: `doctor`, `config doctor`, `config reload`, `config migrate`, `config repair`, `packages doctor`, `packages install`, `packages repair` and `packages cleanup`. This means a broken or missing command provider can be recovered from console with `/easylibrary packages install libcommand confirm` after package writes are enabled.
435436

436-
During mixed-mode migration, installing `libpacket`, `libcommand`, `libserializer`, `libform`, `libdb`, `libwindow`, `libcustom`, `libenchantment`, `libtrigger`, `libhud`, `libplaceholder`, `libworld` or `agent-bridge` while the standalone PHAR is still in `plugins/` is allowed. After restart, the package is expected to show as `installed-shadowed-by-standalone`; the standalone plugin continues to provide the runtime and EasyLibrary does not autoload the duplicate internal package.
437+
During mixed-mode migration, installing `libpacket`, `libcommand`, `libserializer`, `libform`, `libdb`, `libcommons`, `libwindow`, `libcustom`, `libenchantment`, `libtrigger`, `libhud`, `libplaceholder`, `libworld` or `agent-bridge` while the standalone PHAR is still in `plugins/` is allowed. After restart, the package is expected to show as `installed-shadowed-by-standalone`; the standalone plugin continues to provide the runtime and EasyLibrary does not autoload the duplicate internal package.
437438

438439
Example dry-run:
439440

docs/smoke-tests.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ libcommand
5252
libserializer
5353
libform
5454
libdb
55+
libcommons
5556
libplaceholder
5657
libworld
5758
agent-bridge
@@ -94,7 +95,7 @@ Config: package-manager=split / library-installer=split / components=split
9495
For a full package-backed server, `/easylibrary packages doctor` should report:
9596

9697
```text
97-
Packages: 13 / installed: 13 / active: 13 / pending restart: 0 / shadowed: 0
98+
Packages: 14 / installed: 14 / active: 14 / pending restart: 0 / shadowed: 0
9899
Problems: 0
99100
```
100101

@@ -109,6 +110,7 @@ Each official package must pass both the source guard and the functional probe.
109110
| `libserializer` | `source=package-backed-plugin` | `functional=yes` for compact format roundtrip |
110111
| `libform` | `source=package-backed-plugin` | `functional=yes` for form builder output |
111112
| `libdb` | `source=package-backed-plugin` | `functional=yes` for SQLite CRUD |
113+
| `libcommons` | `source=package-backed-plugin` | `functional=yes` for pure array/text/number/time/validation helpers |
112114
| `libplaceholder` | `source=package-backed-plugin` | `functional=yes` for placeholder parse and registry state |
113115
| `libworld` | `source=package-backed-plugin` | `functional=yes` for world service/runtime checks |
114116
| `agent-bridge` | `source=package-backed-plugin` | `functional=yes` for bridge runtime status, heartbeat and PubSub state |
@@ -126,6 +128,7 @@ Run all package probes:
126128
/elprobe run libserializer
127129
/elprobe run libform
128130
/elprobe run libdb
131+
/elprobe run libcommons
129132
/elprobe run libplaceholder
130133
/elprobe run libworld
131134
/elprobe run agent-bridge
@@ -188,7 +191,7 @@ Status target: required before stable.
188191
Purpose:
189192

190193
```text
191-
Prove all 13 official packages can be active through EasyLibrary package-backed
194+
Prove all 14 official packages can be active through EasyLibrary package-backed
192195
proxies in one server session.
193196
```
194197

@@ -219,8 +222,8 @@ Then run every package probe from the package functional probe matrix.
219222
Expected:
220223

221224
```text
222-
Libraries: 13 / standalone: 0 / package-backed: 13
223-
Packages: 13 / installed: 13 / active: 13 / pending restart: 0 / shadowed: 0
225+
Libraries: 14 / standalone: 0 / package-backed: 14
226+
Packages: 14 / installed: 14 / active: 14 / pending restart: 0 / shadowed: 0
224227
Problems: 0
225228
Command provider: package-backed
226229
Command backend: libcommand-rich
@@ -433,6 +436,9 @@ LibWindow v2.0.0-dev
433436
LibWorld v1.0.0-dev
434437
```
435438

439+
LibCommons was not part of this older standalone-only run and must be included
440+
when this scenario is rerun for the final 3.0 release candidate.
441+
436442
Command checks:
437443

438444
```text
@@ -590,9 +596,9 @@ Pass criteria:
590596

591597
```text
592598
Before restart: libform / LibForm v2.0.0-dev [installed-pending-restart]
593-
Before restart: Packages: 13 / installed: 13 / active: 12 / pending restart: 1
599+
Before restart: Packages: 14 / installed: 14 / active: 13 / pending restart: 1
594600
After restart: libform / LibForm v2.0.0-dev [active]
595-
After restart: Packages: 13 / installed: 13 / active: 13 / pending restart: 0
601+
After restart: Packages: 14 / installed: 14 / active: 14 / pending restart: 0
596602
functional=yes
597603
```
598604

@@ -845,6 +851,8 @@ DevTools: absent
845851
EasyLibraryPackageProbe: absent
846852
PMMP plugins: 14 enabled, 0 disabled
847853
Packages: 13/13 installed, 13 active, 0 pending, 0 shadowed
854+
Note: this older PHAR smoke predates LibCommons; rerun with 14/14 packages
855+
before the final 3.0 release candidate.
848856
EasyLibrary doctor: Problems 0
849857
Package doctor: Problems 0
850858
Config doctor: Problems 0
@@ -952,7 +960,7 @@ Follow-up issues:
952960
Before tagging `3.0.0`, these must be true:
953961

954962
- `server-clean` passes.
955-
- `package-backed-all` passes with all 13 official packages.
963+
- `package-backed-all` passes with all 14 official packages.
956964
- `mixed-standalone`, `standalone-to-package` and `package-to-standalone` pass.
957965
- `command-provider-fallback` passes.
958966
- `config-split` passes.

docs/usage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ At minimum, a healthy server should report `Problems: 0`. When all official pack
3636
Problems: 0
3737
Command provider: package-backed
3838
Command backend: libcommand-rich
39-
Packages: 13 / installed: 13 / active: 13
39+
Packages: 14 / installed: 14 / active: 14
4040
Config: package-manager=split / library-installer=split / components=split
4141
```
4242

resources/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ package-manager:
5151
- libdb
5252
- libpacket
5353
- libcommand
54+
- libcommons
5455
- libwindow
5556
- libcustom
5657
- libenchantment

resources/config/package-manager.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ plugin-loader:
4848
- libdb
4949
- libpacket
5050
- libcommand
51+
- libcommons
5152
- libwindow
5253
- libcustom
5354
- libenchantment

src/imperazim/library/LibraryStatusService.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,10 @@ private function packageBackedStatus(
148148
];
149149
$version = $plugin->getDescription()->getVersion();
150150

151-
if ($version !== $source->getExpectedVersion()) {
151+
if (!$this->acceptsVersion($source, $version)) {
152152
$problems[] = "Expected {$source->getExpectedVersion()}, found {$version}.";
153+
} elseif ($version !== $source->getExpectedVersion()) {
154+
$notes[] = 'Development channel provider is active.';
153155
}
154156
if ($files !== []) {
155157
$notes[] = 'A standalone artifact also exists in /plugins, but the active provider is package-backed.';
@@ -179,8 +181,10 @@ private function standaloneStatus(
179181
$version = $standalone->getDescription()->getVersion();
180182
$state = LibraryRuntimeState::STANDALONE_ACTIVE;
181183

182-
if ($version !== $source->getExpectedVersion()) {
184+
if (!$this->acceptsVersion($source, $version)) {
183185
$problems[] = "Expected {$source->getExpectedVersion()}, found {$version}.";
186+
} elseif ($version !== $source->getExpectedVersion()) {
187+
$notes[] = 'Development channel provider is active.';
184188
}
185189

186190
if ($files === []) {
@@ -239,4 +243,9 @@ private function pluginDirectory(): ?string {
239243
$directory = $serverRoot . DIRECTORY_SEPARATOR . 'plugins';
240244
return is_dir($directory) ? $directory : null;
241245
}
246+
247+
private function acceptsVersion(OfficialLibrarySource $source, string $version): bool {
248+
return $version === $source->getExpectedVersion()
249+
|| $version === $source->getVersionForChannel('development');
250+
}
242251
}

src/imperazim/library/OfficialLibraryRegistry.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ public static function all(): array {
4646
'SQLite/MySQL access, query builders, models, migrations and cache helpers.',
4747
['database']
4848
),
49+
new OfficialLibrarySource(
50+
'commons',
51+
'LibCommons',
52+
'ImperaZim/LibCommons',
53+
'1.0.0',
54+
OfficialLibrarySource::PACKAGE_CLASSPATH,
55+
'Common helpers for arrays, text, numbers, time, durations and validation.',
56+
['common', 'utils', 'utilities']
57+
),
4958
new OfficialLibrarySource(
5059
'serializer',
5160
'LibSerializer',

src/imperazim/library/package/PackageRegistry.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,23 @@ public static function all(): array {
9696
PackageSource::CATALOG_PACKAGED,
9797
'imperazim\\db\\LibDB'
9898
),
99+
new PackageSource(
100+
'libcommons',
101+
'LibCommons',
102+
'ImperaZim/LibCommons',
103+
'1.0.0',
104+
'classpath',
105+
'imperazim\\commons',
106+
'Common utility helpers for arrays, text, numbers, time, durations and validation.',
107+
true,
108+
['commons', 'common', 'utils', 'utilities'],
109+
[],
110+
[],
111+
['commons', 'utilities'],
112+
'checksums.txt',
113+
PackageSource::CATALOG_PACKAGED,
114+
'imperazim\\commons\\LibCommons'
115+
),
99116
new PackageSource(
100117
'libplaceholder',
101118
'LibPlaceholder',

0 commit comments

Comments
 (0)