feat: Divi tree editor and quality warnings

TreeEditor (position/insert/move/remove/duplicate on the BlockTree) and
Warnings (post-write quality checks), plus S18's outline breadth limit
on the 2a Outline/DiviOutlineAbility.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-26 14:42:26 +02:00
co-authored by Claude Opus 5.5
parent 8688a02402
commit ea1fd607b2
8 changed files with 791 additions and 7 deletions
@@ -37,11 +37,25 @@ final class DiviReadAbilitiesTest extends TestCase
self::assertNotSame($result['tree_rev'], $result['rev']);
self::assertCount(16, $result['nodes']);
self::assertStringStartsWith('s0 section "Hero"', $result['outline']);
self::assertFalse($result['truncated']);
self::assertSame([], $result['hints']);
self::assertTrue($ability->isDirect());
self::assertTrue($ability->annotations()['readonly']);
}
/** Ruling S18: the "limit" input caps children per parent; "truncated" reports the cut. */
public function testOutlineBreadthLimitTruncatesAndReportsIt(): void
{
DiviPageLoaderTest::givenPost(DiviPageLoaderTest::fixture('synthetic-basic.html'));
$ability = new DiviOutlineAbility(new DiviPageLoader(DiviPageLoaderTest::schema()), $this->design());
$result = $ability->execute(['post_id' => 7, 'id' => 's0.r0.c1', 'limit' => 2]);
self::assertSame(['s0.r0.c1', 's0.r0.c1.m0', 's0.r0.c1.m1'], array_column($result['nodes'], 'id'));
self::assertTrue($result['nodes'][0]['truncated']);
self::assertTrue($result['truncated']);
}
public function testOutlineOfASubtreeAndUnknownNode(): void
{
DiviPageLoaderTest::givenPost(DiviPageLoaderTest::fixture('synthetic-basic.html'));