Skip to content

Commit a8007f6

Browse files
author
X2NX
committed
fix: because the cached discoveryState does not use ->setDiscoveryState(), it is found that the discoveryState cannot be used
1 parent e4a82f7 commit a8007f6

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/Capability/Discovery/Discoverer.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,7 @@ public function discover(string $basePath, array $directories, array $excludeDir
9494
'configured_paths' => $directories,
9595
'base_path' => $basePath,
9696
]);
97-
98-
$emptyState = new DiscoveryState();
99-
$this->registry->setDiscoveryState($emptyState);
100-
101-
return $emptyState;
97+
return new DiscoveryState();
10298
}
10399

104100
$finder->files()
@@ -125,11 +121,7 @@ public function discover(string $basePath, array $directories, array $excludeDir
125121
'resourceTemplates' => $discoveredCount['resourceTemplates'],
126122
]);
127123

128-
$discoveryState = new DiscoveryState($tools, $resources, $prompts, $resourceTemplates);
129-
130-
$this->registry->setDiscoveryState($discoveryState);
131-
132-
return $discoveryState;
124+
return new DiscoveryState($tools, $resources, $prompts, $resourceTemplates);
133125
}
134126

135127
/**

src/Capability/Registry/Loader/DiscoveryLoader.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public function load(ReferenceRegistryInterface $registry): void
4444
? new CachedDiscoverer($discoverer, $this->cache, $this->logger)
4545
: $discoverer;
4646

47-
$cachedDiscoverer->discover($this->basePath, $this->scanDirs, $this->excludeDirs);
47+
$discoveryState =$cachedDiscoverer->discover($this->basePath, $this->scanDirs, $this->excludeDirs);
48+
49+
$registry->setDiscoveryState($discoveryState);
4850
}
4951
}

0 commit comments

Comments
 (0)