feat: jedes Divi-Tool und lit/content-create erklärt seine Divi-Fähigkeiten (RequiresDiviFeatures, DeclaresRequirements, FeatureSets); Tabelle Tool → Fähigkeiten als Test
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
e387d8d29e
commit
fdbda8012c
@@ -6,6 +6,9 @@ namespace LIT\MCP\Integrations\Divi\Pages;
|
||||
|
||||
use LIT\MCP\Abilities\Ability;
|
||||
use LIT\MCP\Abilities\ToolResult;
|
||||
use LIT\MCP\Integrations\Divi\Release\DiviFeature;
|
||||
use LIT\MCP\Integrations\Divi\Release\FeatureSets;
|
||||
use LIT\MCP\Integrations\Divi\Release\RequiresDiviFeatures;
|
||||
use WP_Error;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -17,7 +20,7 @@ defined('ABSPATH') || exit;
|
||||
* validated, all or nothing (ruling S39) – and DiviWriter::commit() stores it (library entries:
|
||||
* GlobalEdits) and builds the result. The composition is bound to the page (DiviWriter::composition(), ruling S22).
|
||||
*/
|
||||
abstract class DiviWriteAbility implements Ability
|
||||
abstract class DiviWriteAbility implements Ability, RequiresDiviFeatures
|
||||
{
|
||||
public function __construct(protected DiviWriter $writer)
|
||||
{
|
||||
@@ -31,6 +34,19 @@ abstract class DiviWriteAbility implements Ability
|
||||
*/
|
||||
abstract protected function change(DiviPage $page, array $input, DiviComposition $composition): DiviChange|WP_Error;
|
||||
|
||||
/**
|
||||
* What the tool needs whatever entry it changes; diviFeatures() adds what the entry post_id names (a library
|
||||
* entry or Theme Builder layout is saved with its own capability, D5).
|
||||
*
|
||||
* @return list<DiviFeature>
|
||||
*/
|
||||
abstract protected function baseFeatures(): array;
|
||||
|
||||
public function diviFeatures(array $input): array
|
||||
{
|
||||
return FeatureSets::merge($this->baseFeatures(), FeatureSets::ofEntry($input['post_id'] ?? null, true));
|
||||
}
|
||||
|
||||
public function outputSchema(): ?array
|
||||
{
|
||||
return ToolResult::schema([
|
||||
|
||||
Reference in New Issue
Block a user