Skip to content

Commit 24cfeac

Browse files
committed
feat: lock configured MCP servers and platforms with existing installs
1 parent 8e3850e commit 24cfeac

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/webview/client/homescreen.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,22 @@ const PLATFORM_DEFS = [
107107
{ id: "windsurf", label: "Windsurf" },
108108
];
109109

110-
function renderPlatformRows(activePlatforms: string[]): void {
110+
function renderPlatformRows(
111+
activePlatforms: string[],
112+
installedByPlatform: Record<string, string[]>
113+
): void {
111114
const list = el("hs-ai-platform-list");
112115
if (!list) { return; }
113116
const activeSet = new Set(activePlatforms);
114117
list.innerHTML = PLATFORM_DEFS.map((p) => {
118+
const hasInstalls = (installedByPlatform[p.id] ?? []).length > 0;
115119
const checked = activeSet.has(p.id) ? "checked" : "";
120+
const disabled = hasInstalls ? "disabled" : "";
116121
const sublabel = p.sublabel
117122
? `<span class="hs-ai-platform-sub">${escapeHtml(p.sublabel)}</span>`
118123
: "";
119124
return `<label class="hs-ai-item hs-ai-platform-row">
120-
<input type="checkbox" class="hs-ai-cb hs-ai-platform-cb" data-platform="${escapeHtml(p.id)}" ${checked}>
125+
<input type="checkbox" class="hs-ai-cb hs-ai-platform-cb" data-platform="${escapeHtml(p.id)}" ${checked} ${disabled}>
121126
<span class="hs-ai-item-name">${escapeHtml(p.label)}${sublabel}</span>
122127
</label>`;
123128
}).join("");
@@ -176,7 +181,7 @@ function renderMcpRows(
176181
const statusClass = isConfigured ? "hs-ai-item-status--ok" : "hs-ai-item-status--none";
177182
const statusText = isConfigured ? "configured" : "—";
178183
return `<label class="hs-ai-item">
179-
<input type="checkbox" class="hs-ai-cb" data-mcp="${escapeHtml(s.key)}" ${isConfigured ? "" : "checked"}>
184+
<input type="checkbox" class="hs-ai-cb" data-mcp="${escapeHtml(s.key)}" checked ${isConfigured ? "disabled" : ""}>
180185
<span class="hs-ai-item-name" title="${escapeHtml(s.description)}">${escapeHtml(s.label)}</span>
181186
<span class="hs-ai-item-status ${statusClass}">${statusText}</span>
182187
</label>`;
@@ -263,7 +268,7 @@ function handleAiToolsData(msg: AiToolsDataMessage): void {
263268
};
264269

265270
const checkedPlatforms = msg.activePlatforms;
266-
renderPlatformRows(checkedPlatforms);
271+
renderPlatformRows(checkedPlatforms, msg.installedByPlatform);
267272
renderSkillRows(msg.skills, msg.installedByPlatform, checkedPlatforms);
268273
renderMcpRows(msg.mcpServers, msg.configuredMcpKeys);
269274
showPanelState("ready");

src/webview/homescreenView.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ export class HomescreenViewProvider implements vscode.WebviewViewProvider {
720720
<div>
721721
<div class="hs-ai-section-head">MCP Servers</div>
722722
<div id="hs-ai-mcp-list"></div>
723+
<div class="hs-ai-hint">Configured servers are locked. Delete config entries to remove.</div>
723724
</div>
724725
<button class="hs-ai-apply" id="hs-ai-apply" disabled>Apply</button>
725726
</div>

0 commit comments

Comments
 (0)