feat: group tools by integration with inherited group mode and "nur lesen" switch
Tools tab shows one block per integration with a group mode (inherited by its tools) and a read-only switch that disables all non-readonly abilities of the group. ExposurePolicy resolves tool override > group override > tool default; lit/guide keeps its default, direct-only tools fall back to direct under a group "indirekt". Group entries live in lit_mcp_exposure under "@group:<id>" and "@readonly:<id>"; the old flat format stays valid. The ability->group map comes lazily from IntegrationRegistry (Divi is not loaded at plugins_loaded). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,28 @@ final class IntegrationRegistryTest extends TestCase
|
||||
self::assertSame([$direct, $indirect], $registry->abilities());
|
||||
}
|
||||
|
||||
public function testGroupsAbilitiesByIntegrationIdAndMapsNamesToGroups(): void
|
||||
{
|
||||
$guide = $this->ability('lit/guide', true);
|
||||
$outline = $this->ability('lit/divi-outline', true);
|
||||
$hidden = $this->ability('lit/pods-x', true);
|
||||
$divi = Mockery::mock(Integration::class);
|
||||
$divi->allows('id')->andReturn('divi');
|
||||
$divi->allows('isAvailable')->andReturn(true);
|
||||
$divi->expects('abilities')->once()->andReturn([$outline]);
|
||||
|
||||
$registry = new IntegrationRegistry(
|
||||
$this->integration('core', true, [$guide]),
|
||||
$divi,
|
||||
$this->integration('pods', false, [$hidden])
|
||||
);
|
||||
|
||||
self::assertSame([$guide, $outline], $registry->abilities());
|
||||
self::assertSame(['core' => [$guide], 'divi' => [$outline]], $registry->grouped());
|
||||
self::assertSame(['lit/guide' => 'core', 'lit/divi-outline' => 'divi'], $registry->groupMap());
|
||||
self::assertSame(['core', 'divi', 'pods'], $registry->ids());
|
||||
}
|
||||
|
||||
private function ability(string $name, bool $direct): Ability
|
||||
{
|
||||
$ability = Mockery::mock(Ability::class);
|
||||
|
||||
Reference in New Issue
Block a user