From 42bdd559ef65fe71105ae3b35ee90633598fa368 Mon Sep 17 00:00:00 2001 From: lucaronin Date: Wed, 29 Apr 2026 13:39:05 +0200 Subject: [PATCH] fix: move mcp config copy to settings --- src/App.tsx | 3 +-- src/components/AiPanel.test.tsx | 10 +++----- src/components/AiPanel.tsx | 6 ----- src/components/AiPanelChrome.tsx | 18 -------------- src/components/Editor.tsx | 6 ----- src/components/EditorRightPanel.tsx | 3 --- src/components/SettingsPanel.test.tsx | 17 +++++++++++++ src/components/SettingsPanel.tsx | 36 +++++++++++++++++++++------ tests/smoke/mcp-config-copy.spec.ts | 17 +++---------- 9 files changed, 54 insertions(+), 62 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index d8ac7747..37814149 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1643,7 +1643,6 @@ function App() { onInitializeProperties={handleInitializeProperties} showAIChat={dialogs.showAIChat} onToggleAIChat={dialogs.toggleAIChat} - onCopyMcpConfig={handleCopyMcpConfig} vaultPath={resolvedPath} noteList={aiNoteList} noteListFilter={aiNoteListFilter} @@ -1726,7 +1725,7 @@ function App() { onCommit={conflictResolver.commitResolution} onClose={conflictFlow.handleCloseConflictResolver} /> - + diff --git a/src/components/AiPanel.test.tsx b/src/components/AiPanel.test.tsx index ef268173..ef31269d 100644 --- a/src/components/AiPanel.test.tsx +++ b/src/components/AiPanel.test.tsx @@ -201,14 +201,10 @@ describe('AiPanel', () => { expect(mockClearConversation).toHaveBeenCalledOnce() }) - it('copies the MCP config from the AI panel header action', () => { - const onCopyMcpConfig = vi.fn() - render() + it('keeps the MCP config action out of the AI panel header', () => { + render() - expect(screen.getByText('MCP config')).toBeVisible() - fireEvent.click(screen.getByRole('button', { name: 'Copy MCP config' })) - - expect(onCopyMcpConfig).toHaveBeenCalledOnce() + expect(screen.queryByRole('button', { name: 'Copy MCP config' })).toBeNull() }) it('renders empty state without context', () => { diff --git a/src/components/AiPanel.tsx b/src/components/AiPanel.tsx index 1f5fc534..098e7dc6 100644 --- a/src/components/AiPanel.tsx +++ b/src/components/AiPanel.tsx @@ -22,7 +22,6 @@ export type { AiAgentMessage } from '../hooks/useCliAiAgent' interface AiPanelProps { onClose: () => void - onCopyMcpConfig?: () => void onOpenNote?: (path: string) => void onUnsupportedAiPaste?: (message: string) => void defaultAiAgent?: AiAgentId @@ -45,7 +44,6 @@ interface AiPanelProps { interface AiPanelViewProps { controller: AiPanelController onClose: () => void - onCopyMcpConfig?: () => void onOpenNote?: (path: string) => void onUnsupportedAiPaste?: (message: string) => void defaultAiAgent?: AiAgentId @@ -63,7 +61,6 @@ function readinessFromReadyFlag(ready: boolean | undefined): AiAgentReadiness { export function AiPanelView({ controller, onClose, - onCopyMcpConfig, onOpenNote, onUnsupportedAiPaste, defaultAiAgent: providedDefaultAiAgent, @@ -126,7 +123,6 @@ export function AiPanelView({ permissionModeDisabled={isActive} onPermissionModeChange={handlePermissionModeChange} onClose={onClose} - onCopyMcpConfig={onCopyMcpConfig} onNewChat={handleNewChat} /> {activeEntry && ( @@ -160,7 +156,6 @@ export function AiPanelView({ export function AiPanel({ onClose, - onCopyMcpConfig, onOpenNote, onUnsupportedAiPaste, defaultAiAgent: providedDefaultAiAgent, @@ -202,7 +197,6 @@ export function AiPanel({ void onClose: () => void - onCopyMcpConfig?: () => void onNewChat: () => void } @@ -174,7 +172,6 @@ export function AiPanelHeader({ permissionModeDisabled, onPermissionModeChange, onClose, - onCopyMcpConfig, onNewChat, }: AiPanelHeaderProps) { const t = createTranslator(locale) @@ -195,21 +192,6 @@ export function AiPanelHeader({ {headerStatusText({ agentLabel, agentReadiness, modeLabel, t })} - {onCopyMcpConfig ? ( - - ) : null} + ) : null} ) } diff --git a/tests/smoke/mcp-config-copy.spec.ts b/tests/smoke/mcp-config-copy.spec.ts index 61a32366..a41679df 100644 --- a/tests/smoke/mcp-config-copy.spec.ts +++ b/tests/smoke/mcp-config-copy.spec.ts @@ -8,21 +8,12 @@ test.describe('MCP config copy', () => { await expect(page.getByTestId('note-list-container')).toBeVisible({ timeout: 5_000 }) }) - test('copies the active-vault MCP config from the AI panel using only the keyboard', async ({ context, page }) => { + test('copies the active-vault MCP config from the Settings AI section', async ({ context, page }) => { await context.grantPermissions(['clipboard-read', 'clipboard-write']) - await page.locator('.app__note-list .cursor-pointer').first().click() - await page.locator('.bn-editor').click() - await sendShortcut(page, 'L', ['Meta', 'Shift']) - await expect(page.getByTestId('ai-panel')).toBeVisible({ timeout: 3_000 }) - - await page.getByTestId('agent-input').focus() - await page.keyboard.press('Shift+Tab') - await page.keyboard.press('Shift+Tab') - await page.keyboard.press('Shift+Tab') - const copyButton = page.getByRole('button', { name: 'Copy MCP config' }) - await expect(copyButton).toBeFocused() - await copyButton.press('Enter') + await sendShortcut(page, ',', ['Control']) + await expect(page.getByTestId('settings-panel')).toBeVisible({ timeout: 3_000 }) + await page.getByTestId('settings-copy-mcp-config').click() await expect.poll(() => page.evaluate(() => navigator.clipboard.readText())).toContain('"mcpServers"') const copiedConfig = await page.evaluate(() => navigator.clipboard.readText())