Skip to content

Commit a1a23a9

Browse files
committed
fix(command): reject legacy embedded LibCommand provider
1 parent 957e035 commit a1a23a9

5 files changed

Lines changed: 25 additions & 22 deletions

File tree

CONTRIBUTING.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ All pull requests should target the `development` branch.
77
| Change | Repository |
88
|---|---|
99
| EasyLibrary core, module system, components, or utility APIs | This repository |
10-
| A bundled library (e.g., LibCommand, LibForm, LibWorld) | The respective standalone repository |
10+
| An official library package (e.g., LibCommand, LibForm, LibWorld) | The respective standalone/package repository |
1111
| Documentation or examples | This repository |
1212

1313
## Core Contributions
@@ -22,16 +22,18 @@ find src -name '*.php' -print0 | xargs -0 -n1 php -l
2222
composer validate --strict
2323
```
2424

25-
## Bundled Library Changes
25+
## Official Library Changes
2626

27-
Each bundled library lives in its own standalone repository. Changes to a
28-
library's source code, API, or behavior should target that repository's
29-
`development` branch. The EasyLibrary repository mirrors those sources.
27+
Each official library lives in its own repository. Changes to a library's
28+
source code, API, or behavior should target that repository's `development`
29+
branch.
3030

31-
When a change in a standalone library affects EasyLibrary's embedded copy:
31+
EasyLibrary 3.x does not embed official library source. When a library changes:
3232

3333
1. Open the pull request in the standalone repository first.
34-
2. After merge, update the embedded source in EasyLibrary to match.
34+
2. Update package metadata, docs or release assets if EasyLibrary needs to
35+
install or describe the new version.
36+
3. Do not copy library source back into `EasyLibrary/src/imperazim`.
3537

3638
## Module System
3739

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Standalone installed:
211211
for the same runtime during mixed mode
212212
an installed internal package reports installed-shadowed-by-standalone instead of active
213213
214-
Legacy embedded fallback:
214+
Legacy 2.x full-bundle fallback:
215215
removed from the EasyLibrary 3.x core
216216
use EasyLibrary 2.x if a server still depends on full-bundle behavior
217217
```
@@ -446,7 +446,7 @@ Runtime states:
446446
| `standalone-installed-disabled` | A standalone plugin or PHAR was found, but it is not enabled. |
447447
| `embedded-runtime` | Historical/legacy state from older migration builds. New 3.x core builds do not provide embedded runtimes. |
448448
| `embedded-classpath` | Historical/legacy state from older migration builds. New 3.x core builds do not provide embedded classpath libs. |
449-
| `embedded-disabled` | No package/standalone provider is active and the old embedded fallback is not available in 3.x. |
449+
| `embedded-disabled` | No package/standalone provider is active and the legacy 2.x full-bundle fallback is not available in 3.x. |
450450
| `duplicate-runtime` | A standalone plugin is active while another provider appears to own the same runtime. This should be fixed. |
451451
| `missing` | No standalone or package-backed provider is available for that library. |
452452

plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ permissions:
4747
description: Inspect EasyLibrary runtime providers
4848
easylibrary.command.runtime.control:
4949
default: op
50-
description: Enable, disable and reload EasyLibrary-owned embedded runtimes
50+
description: Access retired runtime-control compatibility commands
5151
easylibrary.command.config:
5252
default: op
5353
description: Inspect EasyLibrary modular configuration state

src/imperazim/library/command/backend/CommandBackendResolver.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use imperazim\components\plugin\PluginToolkit;
88
use imperazim\library\command\provider\CommandClassAvailability;
99
use imperazim\library\command\provider\CommandProviderResolver;
10+
use imperazim\library\command\provider\CommandProviderStatus;
1011

1112
final class CommandBackendResolver {
1213

@@ -16,8 +17,12 @@ public function __construct(
1617
) {}
1718

1819
public function resolve(): CommandBackend {
19-
(new CommandProviderResolver($this->host))->resolve();
20-
if (CommandClassAvailability::richCommandsAvailable()) {
20+
$provider = (new CommandProviderResolver($this->host))->resolve();
21+
if (CommandClassAvailability::richCommandsAvailable() && in_array($provider->getProvider(), [
22+
CommandProviderStatus::PACKAGE_BACKED,
23+
CommandProviderStatus::PACKAGE_CLASSPATH,
24+
CommandProviderStatus::STANDALONE,
25+
], true)) {
2126
return new LibCommandBackend($this->host, $this->agentManager);
2227
}
2328

src/imperazim/library/command/provider/CommandProviderResolver.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,9 @@ public function resolve(): CommandProviderStatus {
4040
$notes = [];
4141

4242
if ($provider === CommandProviderStatus::EMBEDDED_LEGACY) {
43-
if (\LibraryModules::isLegacyEmbeddedEnabled($this->host)) {
44-
$warnings[] = 'EasyLibrary internal commands are currently using the embedded legacy LibCommand classes.';
45-
$notes[] = 'Do not remove src/imperazim/command until package-backed or standalone LibCommand is guaranteed for command registration.';
46-
} else {
47-
$notes[] = 'Embedded legacy LibCommand classes were removed from EasyLibrary 3.x.';
48-
$notes[] = 'EasyLibrary will use the native recovery command unless package-backed or standalone LibCommand is active.';
49-
}
43+
$warnings[] = 'LibCommand classes appear to be loaded from the removed EasyLibrary embedded source path.';
44+
$notes[] = 'EasyLibrary 3.x does not accept embedded LibCommand as a rich command provider.';
45+
$notes[] = 'Install package-backed or standalone LibCommand, then restart.';
5046
}
5147
if ($provider === CommandProviderStatus::MISSING) {
5248
$warnings[] = 'imperazim\\command\\Command is not loaded; EasyLibrary command registration would fail.';
@@ -65,7 +61,7 @@ public function resolve(): CommandProviderStatus {
6561
} elseif ($plugin instanceof Plugin) {
6662
$notes[] = 'LibCommand plugin exists but is not recognized as active package-backed or standalone.';
6763
} else {
68-
$notes[] = 'No LibCommand plugin identity is active; EasyLibrary can only rely on embedded command classes right now.';
64+
$notes[] = 'No LibCommand plugin identity is active; EasyLibrary will use the native recovery command.';
6965
}
7066

7167
return new CommandProviderStatus(
@@ -123,7 +119,7 @@ private function hookProvider(): string {
123119
return 'unavailable';
124120
}
125121
if (\imperazim\command\LibCommandHooker::isHostedBy($this->host)) {
126-
return 'EasyLibrary embedded hook';
122+
return 'legacy EasyLibrary hook';
127123
}
128124
if (\imperazim\command\LibCommandHooker::isRegistered()) {
129125
return 'external LibCommand hook';
@@ -178,7 +174,7 @@ private function embeddedConsumers(): array {
178174
'Module command tree: imperazim\\module\\command\\*',
179175
'Default command overrides: imperazim\\library\\command\\override\\PluginsCommand and VersionCommand',
180176
'PluginToolkit command registration helper: imperazim\\components\\plugin\\PluginToolkit',
181-
'Embedded runtime commands while legacy packages exist: LibPlaceholder, LibWorld and Agent Bridge command classes',
177+
'External package commands when their package-backed or standalone providers are active',
182178
];
183179
}
184180
}

0 commit comments

Comments
 (0)