fix(vscode): match marketplace display labels in search

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
This commit is contained in:
markijbema
2026-06-24 10:03:28 +00:00
parent 47dfd5e688
commit ebcf81f58f
3 changed files with 15 additions and 5 deletions
@@ -95,7 +95,7 @@ describe("Marketplace installation metadata", () => {
id: "warehouse",
name: "Warehouse",
description: "Queries data",
category: "data",
category: "web-automation",
url: "https://example.com",
content: "{}",
},
@@ -114,6 +114,10 @@ describe("Marketplace installation metadata", () => {
const metadata = { project: { "mcp:warehouse": { type: "mcp" } }, global: {} }
expect(filterItems(items, metadata, "reviewer", "all", [], []).map((item) => item.id)).toEqual(["reviewer"])
expect(filterItems(items, metadata, "web automation", "all", [], []).map((item) => item.id)).toEqual(["warehouse"])
expect(
filterItems(items, metadata, "servidor mcp", "all", [], [], { mcp: "Servidor MCP" }).map((item) => item.id),
).toEqual(["warehouse"])
expect(filterItems(items, metadata, "", "all", ["business"], []).map((item) => item.id)).toEqual([
"campaign-writer",
])
@@ -87,7 +87,11 @@ export const MarketplaceListView = (props: Props) => {
}
const filtered = createMemo(() =>
filterItems(props.items, props.metadata, search(), status().value, categories(), types()),
filterItems(props.items, props.metadata, search(), status().value, categories(), types(), {
agent: typeLabel("agent"),
mcp: typeLabel("mcp"),
skill: typeLabel("skill"),
}),
)
return (
@@ -20,14 +20,15 @@ export function installedScopes(
return scopes
}
function matches(item: MarketplaceItem, query: string) {
function matches(item: MarketplaceItem, query: string, labels: Partial<Record<MarketplaceItem["type"], string>>) {
const skill = item.type === "skill" ? item : undefined
return (
item.id.toLowerCase().includes(query) ||
item.name.toLowerCase().includes(query) ||
item.description.toLowerCase().includes(query) ||
item.category.toLowerCase().includes(query) ||
item.category.replaceAll("-", " ").toLowerCase().includes(query) ||
item.type.includes(query) ||
(labels[item.type]?.toLowerCase().includes(query) ?? false) ||
(item.author?.toLowerCase().includes(query) ?? false) ||
(skill?.displayName.toLowerCase().includes(query) ?? false)
)
@@ -40,6 +41,7 @@ export function filterItems(
status: string,
categories: string[],
types: MarketplaceItem["type"][],
labels: Partial<Record<MarketplaceItem["type"], string>> = {},
): MarketplaceItem[] {
const query = search.trim().toLowerCase()
return items
@@ -49,7 +51,7 @@ export function filterItems(
if (types.length > 0 && !types.includes(item.type)) return false
if (categories.length > 0 && !categories.includes(item.category)) return false
if (!query) return true
return matches(item, query)
return matches(item, query, labels)
})
.sort((a, b) => a.name.localeCompare(b.name))
}