mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 19:11:03 +08:00
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:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user