Skip to content

Commit 583cb03

Browse files
committed
Support prereqs
1 parent b83d302 commit 583cb03

File tree

20 files changed

+73
-16
lines changed

20 files changed

+73
-16
lines changed

src/services/marketplace/schemas.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const mcpInstallationMethodSchema = z.object({
1717
name: z.string().min(1),
1818
content: z.string().min(1),
1919
parameters: z.array(mcpParameterSchema).optional(),
20+
prerequisites: z.array(z.string()).optional(),
2021
})
2122

2223
/**
@@ -36,6 +37,7 @@ export const marketplaceItemSchema = z.object({
3637
authorUrl: z.string().url("Author URL must be a valid URL").optional(),
3738
tags: z.array(z.string()).optional(),
3839
content: z.union([z.string().min(1), z.array(mcpInstallationMethodSchema)]), // Embedded content (YAML for modes, JSON for mcps, or named methods)
40+
prerequisites: z.array(z.string()).optional(),
3941
})
4042

4143
/**
@@ -61,6 +63,7 @@ export const modeMarketplaceItemYamlSchema = z.object({
6163
authorUrl: z.string().url().optional(),
6264
tags: z.array(z.string()).optional(),
6365
content: z.string(),
66+
prerequisites: z.array(z.string()).optional(),
6467
})
6568

6669
export const mcpMarketplaceItemYamlSchema = z.object({
@@ -73,6 +76,7 @@ export const mcpMarketplaceItemYamlSchema = z.object({
7376
tags: z.array(z.string()).optional(),
7477
content: z.union([z.string(), z.array(mcpInstallationMethodSchema)]),
7578
parameters: z.array(mcpParameterSchema).optional(),
79+
prerequisites: z.array(z.string()).optional(),
7680
})
7781

7882
// Export aliases for backward compatibility (these are the same as the YAML schemas)

src/services/marketplace/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface ModeMarketplaceItem {
2222
authorUrl?: string
2323
tags?: string[]
2424
content: string // Embedded YAML content for .roomodes
25+
prerequisites?: string[]
2526
}
2627

2728
export interface McpParameter {
@@ -35,6 +36,7 @@ export interface McpInstallationMethod {
3536
name: string
3637
content: string
3738
parameters?: McpParameter[]
39+
prerequisites?: string[]
3840
}
3941

4042
export interface McpMarketplaceItem {
@@ -47,6 +49,7 @@ export interface McpMarketplaceItem {
4749
tags?: string[]
4850
content: string | McpInstallationMethod[] // Can be a single config or array of named methods
4951
parameters?: McpParameter[]
52+
prerequisites?: string[]
5053
}
5154

5255
/**
@@ -63,6 +66,7 @@ export interface MarketplaceItem {
6366
tags?: string[]
6467
content: string | McpInstallationMethod[] // Can be a single config or array of named methods
6568
parameters?: McpParameter[] // Optional parameters for MCPs
69+
prerequisites?: string[]
6670
}
6771

6872
export interface InstallMarketplaceItemOptions {

webview-ui/src/components/marketplace/components/MarketplaceInstallModal.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,24 @@ export const MarketplaceInstallModal: React.FC<MarketplaceInstallModalProps> = (
7878
return Array.from(paramMap.values())
7979
}, [item, selectedMethodIndex])
8080

81+
// Get effective prerequisites for the selected method (global + method-specific)
82+
const effectivePrerequisites = useMemo(() => {
83+
if (!item) return []
84+
85+
const globalPrereqs = item.prerequisites || []
86+
let methodPrereqs: string[] = []
87+
88+
// Get method-specific prerequisites if content is an array
89+
if (Array.isArray(item.content)) {
90+
const selectedMethod = item.content[selectedMethodIndex] as McpInstallationMethod
91+
methodPrereqs = selectedMethod?.prerequisites || []
92+
}
93+
94+
// Combine and deduplicate prerequisites
95+
const allPrereqs = [...globalPrereqs, ...methodPrereqs]
96+
return Array.from(new Set(allPrereqs))
97+
}, [item, selectedMethodIndex])
98+
8199
// Update parameter values when method changes
82100
React.useEffect(() => {
83101
if (item) {
@@ -274,6 +292,20 @@ export const MarketplaceInstallModal: React.FC<MarketplaceInstallModalProps> = (
274292
</div>
275293
)}
276294

295+
{/* Prerequisites */}
296+
{effectivePrerequisites.length > 0 && (
297+
<div className="space-y-2">
298+
<div className="text-base font-semibold">{t("marketplace:install.prerequisites")}</div>
299+
<ul className="list-disc list-inside space-y-1 text-sm">
300+
{effectivePrerequisites.map((prereq, index) => (
301+
<li key={index} className="text-muted-foreground">
302+
{prereq}
303+
</li>
304+
))}
305+
</ul>
306+
</div>
307+
)}
308+
277309
{/* Parameters */}
278310
{effectiveParameters.length > 0 && (
279311
<div className="space-y-3">

webview-ui/src/i18n/locales/ca/marketplace.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
"goToMcp": "Anar a la pestanya MCP",
9494
"goToModes": "Anar a la pestanya Modes",
9595
"moreInfoMcp": "Veure documentació MCP de {{name}}",
96-
"validationRequired": "Si us plau, proporciona un valor per a {{paramName}}"
96+
"validationRequired": "Si us plau, proporciona un valor per a {{paramName}}",
97+
"prerequisites": "Prerequisits"
9798
},
9899
"sources": {
99100
"title": "Configurar fonts del marketplace",

webview-ui/src/i18n/locales/de/marketplace.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
"goToMcp": "Zum MCP-Tab gehen",
9494
"goToModes": "Zum Modi-Tab gehen",
9595
"moreInfoMcp": "{{name}} MCP-Dokumentation anzeigen",
96-
"validationRequired": "Bitte gib einen Wert für {{paramName}} an"
96+
"validationRequired": "Bitte gib einen Wert für {{paramName}} an",
97+
"prerequisites": "Voraussetzungen"
9798
},
9899
"sources": {
99100
"title": "Marketplace-Quellen konfigurieren",

webview-ui/src/i18n/locales/en/marketplace.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
"project": "Project (current workspace)",
8282
"global": "Global (all workspaces)",
8383
"method": "Installation Method",
84+
"prerequisites": "Prerequisites",
8485
"configuration": "Configuration",
8586
"configurationDescription": "Configure the parameters required for this MCP server",
8687
"button": "Install",

webview-ui/src/i18n/locales/es/marketplace.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
"goToMcp": "Ir a la pestaña MCP",
9494
"goToModes": "Ir a la pestaña Modos",
9595
"moreInfoMcp": "Ver documentación MCP de {{name}}",
96-
"validationRequired": "Por favor proporciona un valor para {{paramName}}"
96+
"validationRequired": "Por favor proporciona un valor para {{paramName}}",
97+
"prerequisites": "Requisitos previos"
9798
},
9899
"sources": {
99100
"title": "Configurar fuentes del marketplace",

webview-ui/src/i18n/locales/fr/marketplace.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
"goToMcp": "Aller à l'onglet MCP",
9494
"goToModes": "Aller à l'onglet Modes",
9595
"moreInfoMcp": "Voir la documentation MCP de {{name}}",
96-
"validationRequired": "Veuillez fournir une valeur pour {{paramName}}"
96+
"validationRequired": "Veuillez fournir une valeur pour {{paramName}}",
97+
"prerequisites": "Prérequis"
9798
},
9899
"sources": {
99100
"title": "Configurer les sources du marketplace",

webview-ui/src/i18n/locales/hi/marketplace.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
"goToMcp": "MCP टैब पर जाएं",
9494
"goToModes": "मोड टैब पर जाएं",
9595
"moreInfoMcp": "{{name}} MCP दस्तावेज़ देखें",
96-
"validationRequired": "कृपया {{paramName}} के लिए एक मान प्रदान करें"
96+
"validationRequired": "कृपया {{paramName}} के लिए एक मान प्रदान करें",
97+
"prerequisites": "आवश्यकताएं"
9798
},
9899
"sources": {
99100
"title": "Marketplace स्रोत कॉन्फ़िगर करें",

webview-ui/src/i18n/locales/it/marketplace.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
"goToMcp": "Vai alla scheda MCP",
9494
"goToModes": "Vai alla scheda Modalità",
9595
"moreInfoMcp": "Visualizza documentazione MCP {{name}}",
96-
"validationRequired": "Fornisci un valore per {{paramName}}"
96+
"validationRequired": "Fornisci un valore per {{paramName}}",
97+
"prerequisites": "Prerequisiti"
9798
},
9899
"sources": {
99100
"title": "Configura fonti del Marketplace",

0 commit comments

Comments
 (0)