From 9238e81e6a0223701fcb6b3a2ac074f0ddcb388e Mon Sep 17 00:00:00 2001 From: tianma-if Date: Thu, 10 Sep 2026 23:52:26 +0800 Subject: [PATCH] fix(plugins): stop listing every command and panel on cards and menus Marketplace cards keep launcher commands only. The toolbar menu keeps editor commands and dashboard panels, and drops workflow dialogs plus commands that only open a dashboard already in the menu. --- .../components/plugins/PluginCatalogCard.tsx | 24 ++------- .../settings/PluginManagerCard.test.mjs | 6 +++ .../components/settings/PluginManagerCard.tsx | 34 ++----------- apps/web/src/lib/plugins/plugin-host.ts | 14 +++++- .../lib/plugins/plugin-navigation.test.mjs | 49 ++++++++++++++++++- apps/web/src/lib/plugins/plugin-navigation.ts | 32 +++++++++++- docs/plugin-development.md | 26 ++++++++++ docs/plugin-development.zh-CN.md | 26 ++++++++++ packages/plugin-api/dist/index.d.ts | 11 +++++ packages/plugin-api/src/index.ts | 11 +++++ 10 files changed, 177 insertions(+), 56 deletions(-) diff --git a/apps/web/src/components/plugins/PluginCatalogCard.tsx b/apps/web/src/components/plugins/PluginCatalogCard.tsx index 39f764d6..fb902e05 100644 --- a/apps/web/src/components/plugins/PluginCatalogCard.tsx +++ b/apps/web/src/components/plugins/PluginCatalogCard.tsx @@ -1,4 +1,4 @@ -import { BadgeCheck, Download, PanelRightOpen, Play, Settings2, Trash2 } from "lucide-react"; +import { BadgeCheck, Download, Play, Settings2, Trash2 } from "lucide-react"; import { Link } from "react-router"; import { useTranslation } from "react-i18next"; import { Button } from "@/components/ui/button"; @@ -13,9 +13,9 @@ import { getPluginCatalogVersion, type PluginCatalogItem, } from "@/lib/plugins/plugin-catalog"; -import { getPluginDetailPath, hasPluginSettings } from "@/lib/plugins/plugin-navigation"; +import { getPluginDetailPath, hasPluginSettings, isPluginCardCommand } from "@/lib/plugins/plugin-navigation"; import type { PluginUpdateInfo } from "@/lib/plugins/plugin-updates"; -import type { RegisteredPluginCommand, RegisteredPluginPanel } from "@/lib/plugins/plugin-host"; +import type { RegisteredPluginCommand } from "@/lib/plugins/plugin-host"; const permissionLabel = (permission: string) => permission.replace(":", " · "); @@ -28,27 +28,23 @@ export const PluginCatalogCard = ({ item, update, commands, - panels, pendingId, onOpenPlugin, onToggle, onInstallMarketplace, onUpdate, onRunCommand, - onOpenPanel, onUninstall, }: { item: PluginCatalogItem; update?: PluginUpdateInfo; commands: RegisteredPluginCommand[]; - panels: RegisteredPluginPanel[]; pendingId: string | null; onOpenPlugin?: (pluginId: string) => void; onToggle: (enabled: boolean) => void; onInstallMarketplace: () => void; onUpdate: () => void; onRunCommand: (command: RegisteredPluginCommand) => void; - onOpenPanel: (panel: RegisteredPluginPanel) => void; onUninstall: () => void; }) => { const { t } = useTranslation(); @@ -195,7 +191,7 @@ export const PluginCatalogCard = ({ {pendingId === marketplaceActionId ? t("plugins.installing") : t("plugins.marketplace.installVerified")} ) : null} - {extension ? commands.map((command) => ( + {extension ? commands.filter(isPluginCardCommand).map((command) => ( - )) : null} {extension ? ( ) : null} - {commands.map((command) => ( + {commands.filter(isPluginCardCommand).map((command) => ( ))} - {panels.map((panel) => ( - - ))}