Polish bundled plugin discovery

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-05-26 13:21:43 +00:00
1 parent 7e21c5b872
commit 10e1ba9e0f
1 file changed
+11 -1
+11 -1
View File
@@ -153,8 +153,10 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
const REPO_ROOT = path.resolve(__dirname, "../../..");
const EXPERIMENTAL_BUNDLED_PLUGIN_PACKAGE_NAMES = new Set([
"@paperclipai/plugin-llm-wiki",
"@paperclipai/plugin-modal",
"@paperclipai/plugin-workspace-diff",
]);
let bundledPluginsCache: Promise<AvailableBundledPlugin[]> | null = null;
function titleCasePluginName(packageName: string): string {
const localName = packageName.split("/").pop() ?? packageName;
@@ -262,7 +264,7 @@ function isExperimentalBundledPlugin(packageRoot: string, packageName: string):
);
}
async function listBundledPlugins(): Promise<AvailableBundledPlugin[]> {
async function discoverBundledPlugins(): Promise<AvailableBundledPlugin[]> {
const pluginRoot = path.resolve(REPO_ROOT, "packages/plugins");
const bundledPlugins: AvailableBundledPlugin[] = [];
for (const packageJsonPath of await findPackageJsonFiles(pluginRoot)) {
@@ -301,6 +303,14 @@ async function listBundledPlugins(): Promise<AvailableBundledPlugin[]> {
});
}
async function listBundledPlugins(): Promise<AvailableBundledPlugin[]> {
bundledPluginsCache ??= discoverBundledPlugins().catch((error: unknown) => {
bundledPluginsCache = null;
throw error;
});
return bundledPluginsCache;
}
/**
* Resolve a plugin by either database ID or plugin key.
*