fix: divi-node-get rev + short type, divi-outline id validation
- lit/divi-node-get now also returns the post-level rev (Rev::ofPost, same
optimistic lock lit-content-update needs) next to tree_rev, and reports a
node's type as the short name ("button"), matching lit-divi-outline instead
of the namespaced "divi/button". description() notes that $variable(...)$
values shown are re-validated when written, never taken over unchecked.
- lit/divi-outline validates its optional `id` input against the same
path-ID pattern lit-divi-node-get uses (a malformed id is now a validation
error, not a "not found"), and its outputSchema's per-node `required` list
now includes info/presets/children, which are always present.
- NodeSummary::label() (the admin label shown in outlines and node-get)
whitespace-normalizes and bounds its result via Text::shorten(), like every
other summary string, instead of returning a raw, unbounded value.
- docs/superpowers/notes/.../etappe-2a-abnahme.md corrected: only a global
module is "nur lesbar" - a specialty section is a normal, editable
divi/section block; the outline just marks it "[specialty]".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ namespace LIT\MCP\Integrations\Divi\Pages;
|
||||
use LIT\MCP\Abilities\Ability;
|
||||
use LIT\MCP\Abilities\Errors;
|
||||
use LIT\MCP\Abilities\JsonMap;
|
||||
use LIT\MCP\Abilities\Rev;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\AttrMap;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\NodeIndex;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\NodeSummary;
|
||||
@@ -38,7 +39,9 @@ final class DiviNodeGetAbility implements Ability
|
||||
{
|
||||
return 'Liest einen Knoten der Divi-Seite vollständig: attrs als Attributpfad → Werte je Breakpoint '
|
||||
. '(Vollform, z. B. "title.decoration.font.font": {"desktop": {"value": {…}}}), die Kurzform-Werte, '
|
||||
. 'Presets und die IDs der Kinder. Pfad-IDs aus lit-divi-outline.';
|
||||
. 'Presets und die IDs der Kinder. Pfad-IDs aus lit-divi-outline. Werte wie $variable(…)$ (globale '
|
||||
. 'Farben, Variablen, dynamische Inhalte) werden unverändert angezeigt, beim Schreiben aber erneut '
|
||||
. 'geprüft, nie ungeprüft übernommen.';
|
||||
}
|
||||
|
||||
public function inputSchema(): array
|
||||
@@ -61,6 +64,7 @@ final class DiviNodeGetAbility implements Ability
|
||||
'properties' => [
|
||||
'post_id' => ['type' => 'integer'],
|
||||
'tree_rev' => ['type' => 'string'],
|
||||
'rev' => ['type' => 'string'],
|
||||
'id' => ['type' => 'string'],
|
||||
'parent' => ['type' => ['string', 'null']],
|
||||
'type' => ['type' => 'string'],
|
||||
@@ -79,7 +83,7 @@ final class DiviNodeGetAbility implements Ability
|
||||
'builder_version' => ['type' => ['string', 'null']],
|
||||
'children' => ['type' => 'array', 'items' => ['type' => 'string']],
|
||||
],
|
||||
'required' => ['post_id', 'tree_rev', 'id', 'type', 'editable', 'attrs', 'shortform', 'children'],
|
||||
'required' => ['post_id', 'tree_rev', 'rev', 'id', 'type', 'editable', 'attrs', 'shortform', 'children'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -124,9 +128,10 @@ final class DiviNodeGetAbility implements Ability
|
||||
return [
|
||||
'post_id' => (int) $page->post->ID,
|
||||
'tree_rev' => $page->treeRev(),
|
||||
'rev' => Rev::ofPost($page->post),
|
||||
'id' => $id,
|
||||
'parent' => $page->index->parentId($block),
|
||||
'type' => $block->name(),
|
||||
'type' => $block->isDivi() ? $block->shortName() : $block->name(),
|
||||
'label' => NodeSummary::label($block),
|
||||
'editable' => $editable,
|
||||
'attrs' => JsonMap::of(AttrMap::flatten($block->attrs())),
|
||||
|
||||
@@ -5,7 +5,9 @@ declare(strict_types=1);
|
||||
namespace LIT\MCP\Integrations\Divi\Pages;
|
||||
|
||||
use LIT\MCP\Abilities\Ability;
|
||||
use LIT\MCP\Abilities\Errors;
|
||||
use LIT\MCP\Abilities\Rev;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\NodeIndex;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\Outline;
|
||||
use LIT\MCP\Integrations\Divi\Design\DesignSystemReader;
|
||||
use WP_Error;
|
||||
@@ -82,7 +84,9 @@ final class DiviOutlineAbility implements Ability
|
||||
'editable' => ['type' => 'boolean'],
|
||||
'depth' => ['type' => 'integer'],
|
||||
],
|
||||
'required' => ['id', 'type', 'label', 'excerpt', 'editable', 'depth'],
|
||||
'required' => [
|
||||
'id', 'type', 'label', 'excerpt', 'info', 'presets', 'children', 'editable', 'depth',
|
||||
],
|
||||
],
|
||||
],
|
||||
'edit_url' => ['type' => 'string'],
|
||||
@@ -117,6 +121,9 @@ final class DiviOutlineAbility implements Ability
|
||||
}
|
||||
|
||||
$rootId = isset($input['id']) && is_string($input['id']) && $input['id'] !== '' ? $input['id'] : null;
|
||||
if ($rootId !== null && preg_match(NodeIndex::ID_PATTERN, $rootId) !== 1) {
|
||||
return Errors::invalidInput('id ist keine Pfad-ID.', ['id' => 'z. B. "s0.r1.c0.m2"']);
|
||||
}
|
||||
if ($rootId !== null && $page->index->find($rootId) === null) {
|
||||
return DiviPageLoader::unknownNode($rootId, $page->post);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user