refactor: Kern ohne Divi – Ports BuilderDetector, MediaUsageSource, EnvironmentComponent und ausgeschlossene Post-Typen im ContentSchema; Divi-Implementierungen und Verdrahtung über DiviIntegration/Plugin; CoreIndependenceTest

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-18 21:49:28 +02:00
co-authored by Claude Sonnet 5.5
parent abeb4b0eed
commit 06148fb8c1
33 changed files with 952 additions and 154 deletions
+3 -2
View File
@@ -12,7 +12,8 @@ defined('ABSPATH') || exit;
final class CoreIntegration implements Integration
{
public function __construct(private string $guidesDirectory)
/** @param list<EnvironmentComponent> $components What lit-site-status reports besides Pods and Events Calendar. */
public function __construct(private string $guidesDirectory, private array $components = [])
{
}
@@ -35,7 +36,7 @@ final class CoreIntegration implements Integration
{
return [
new GuideAbility(new GuideRepository($this->guidesDirectory)),
new SiteStatusAbility(new EnvironmentProbe(), new Access()),
new SiteStatusAbility(new EnvironmentProbe($this->components), new Access()),
];
}
}
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Integrations\Core;
defined('ABSPATH') || exit;
/**
* Port: one theme or plugin LIT MCP integrates with, as lit-site-status reports it. EnvironmentProbe lists the
* components it is given; the integration that owns the component (Divi) implements it, Plugin wires it in.
*/
interface EnvironmentComponent
{
/**
* @return array{id: string, active: bool, version: ?string, problems: list<string>, release: ?array<string, mixed>}
* problems: what the component misses or has changed; release: whether LIT MCP may write with it
* (null for components without such a lock).
*/
public function describe(): array;
}
+9 -17
View File
@@ -4,19 +4,16 @@ declare(strict_types=1);
namespace LIT\MCP\Integrations\Core;
use LIT\MCP\Integrations\Divi\DiviCompatibility;
use LIT\MCP\Integrations\Divi\Release\DiviEnvironment;
use LIT\MCP\Integrations\Divi\Release\ReleaseGate;
defined('ABSPATH') || exit;
/**
* Detects the themes/plugins LIT MCP integrates with; for Divi also the internals that are missing
* (DiviCompatibility).
* Detects the themes/plugins LIT MCP integrates with: the components it is given (Divi, wired in Plugin) first, then
* Pods and The Events Calendar.
*/
class EnvironmentProbe
{
public function __construct(private ?DiviCompatibility $divi = null)
/** @param list<EnvironmentComponent> $components Components of integrations, reported in this order. */
public function __construct(private array $components = [])
{
}
@@ -26,19 +23,14 @@ class EnvironmentProbe
*/
public function components(): array
{
$diviVersion = DiviEnvironment::version();
$isDivi = $diviVersion !== null;
$tecActive = class_exists('Tribe__Events__Main');
$described = array_map(
static fn (EnvironmentComponent $component): array => $component->describe(),
$this->components
);
return [
[
'id' => 'divi',
'active' => $isDivi,
'version' => $diviVersion,
'problems' => $isDivi ? ($this->divi ?? new DiviCompatibility())->problems() : [],
'release' => $isDivi ? ReleaseGate::status()->toArray() : null,
],
...$described,
[
'id' => 'pods',
'active' => defined('PODS_VERSION'),