feat: lit-library-insert as copy or global instance in the builder's format (E5)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 02:27:16 +02:00
co-authored by Claude Opus 5.5
parent 5035092805
commit 7fe91c2bdb
9 changed files with 580 additions and 8 deletions
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace LIT\MCP\Integrations\Divi\Library;
use Closure;
use LIT\MCP\ChangeLog\ChangeLog;
use LIT\MCP\Integrations\Divi\Design\DesignSystemReader;
use LIT\MCP\Integrations\Divi\Pages\DiviPageLoader;
@@ -15,13 +16,14 @@ use LIT\MCP\Integrations\Integration;
defined('ABSPATH') || exit;
/**
* The group "Divi-Bibliothek" (E9): lit/library-list, lit/library-save, later lit-library-insert.
* The group "Divi-Bibliothek" (E9): lit/library-list, lit/library-save and lit-library-insert (direct).
* Built by DiviIntegration::library() so it shares the library access (rights, Tools-tab gates –
* its id LibraryAccess::GROUP is what the P9 hiding and the write gate ask). Available with the
* Divi 5 builder, like the Divi group.
*/
final class LibraryIntegration implements Integration
{
/** @param (Closure(): bool)|null $diviWritable Whether lit/divi-insert is enabled (audit M2); null = always. */
public function __construct(
private LibraryAccess $access,
private DiviPageLoader $loader,
@@ -29,7 +31,8 @@ final class LibraryIntegration implements Integration
private DiviWriter $writer,
private DiviSaver $saver,
private ChangeLog $log,
private DiviModules $modules
private DiviModules $modules,
private ?Closure $diviWritable = null
) {
}
@@ -60,6 +63,7 @@ final class LibraryIntegration implements Integration
$this->log,
$this->modules
),
new LibraryInsertAbility($this->writer, $this->access, $this->diviWritable),
];
}
}