fix(extensions): avoid misleading mcp diagnostics command copy
This commit is contained in:
parent
e2c5c8e99b
commit
0287f83274
2 changed files with 53 additions and 17 deletions
|
|
@ -219,10 +219,6 @@ export const McpServersPanel = ({
|
||||||
const displayServers = useMemo(() => sortMcpServers(rawServers, mcpSort), [rawServers, mcpSort]);
|
const displayServers = useMemo(() => sortMcpServers(rawServers, mcpSort), [rawServers, mcpSort]);
|
||||||
const runtimeLabel =
|
const runtimeLabel =
|
||||||
cliStatus?.flavor === 'agent_teams_orchestrator' ? 'multimodel runtime' : 'Claude CLI';
|
cliStatus?.flavor === 'agent_teams_orchestrator' ? 'multimodel runtime' : 'Claude CLI';
|
||||||
const diagnosticsCommand =
|
|
||||||
cliStatus?.flavor === 'agent_teams_orchestrator'
|
|
||||||
? 'claude-multimodel mcp diagnose'
|
|
||||||
: 'claude mcp list';
|
|
||||||
|
|
||||||
// Find selected server (search in both lists to avoid losing selection during search toggle)
|
// Find selected server (search in both lists to avoid losing selection during search toggle)
|
||||||
const selectedServer = useMemo(() => {
|
const selectedServer = useMemo(() => {
|
||||||
|
|
@ -247,10 +243,7 @@ export const McpServersPanel = ({
|
||||||
) : mcpDiagnosticsLastCheckedAt ? (
|
) : mcpDiagnosticsLastCheckedAt ? (
|
||||||
`Last checked ${formatRelativeTime(new Date(mcpDiagnosticsLastCheckedAt).toISOString())}`
|
`Last checked ${formatRelativeTime(new Date(mcpDiagnosticsLastCheckedAt).toISOString())}`
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>Run diagnostics from this page to verify installed MCP connectivity.</>
|
||||||
Run diagnostics (<code>{diagnosticsCommand}</code>) to verify installed MCP
|
|
||||||
connectivity.
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -75,19 +75,14 @@ vi.mock('@renderer/components/ui/select', () => ({
|
||||||
SelectTrigger: ({ children }: React.PropsWithChildren) =>
|
SelectTrigger: ({ children }: React.PropsWithChildren) =>
|
||||||
React.createElement('button', { type: 'button' }, children),
|
React.createElement('button', { type: 'button' }, children),
|
||||||
SelectValue: () => React.createElement('span', null, 'select-value'),
|
SelectValue: () => React.createElement('span', null, 'select-value'),
|
||||||
SelectContent: ({ children }: React.PropsWithChildren) => React.createElement('div', null, children),
|
SelectContent: ({ children }: React.PropsWithChildren) =>
|
||||||
|
React.createElement('div', null, children),
|
||||||
SelectItem: ({ children }: React.PropsWithChildren<{ value: string }>) =>
|
SelectItem: ({ children }: React.PropsWithChildren<{ value: string }>) =>
|
||||||
React.createElement('button', { type: 'button' }, children),
|
React.createElement('button', { type: 'button' }, children),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock('@renderer/components/extensions/common/SearchInput', () => ({
|
vi.mock('@renderer/components/extensions/common/SearchInput', () => ({
|
||||||
SearchInput: ({
|
SearchInput: ({ value, onChange }: { value: string; onChange: (value: string) => void }) =>
|
||||||
value,
|
|
||||||
onChange,
|
|
||||||
}: {
|
|
||||||
value: string;
|
|
||||||
onChange: (value: string) => void;
|
|
||||||
}) =>
|
|
||||||
React.createElement('input', {
|
React.createElement('input', {
|
||||||
value,
|
value,
|
||||||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => onChange(event.target.value),
|
onChange: (event: React.ChangeEvent<HTMLInputElement>) => onChange(event.target.value),
|
||||||
|
|
@ -96,7 +91,11 @@ vi.mock('@renderer/components/extensions/common/SearchInput', () => ({
|
||||||
|
|
||||||
vi.mock('@renderer/components/extensions/mcp/McpServerCard', () => ({
|
vi.mock('@renderer/components/extensions/mcp/McpServerCard', () => ({
|
||||||
McpServerCard: ({ server }: { server: { id: string; name: string } }) =>
|
McpServerCard: ({ server }: { server: { id: string; name: string } }) =>
|
||||||
React.createElement('div', { 'data-testid': 'mcp-card', 'data-server-id': server.id }, server.name),
|
React.createElement(
|
||||||
|
'div',
|
||||||
|
{ 'data-testid': 'mcp-card', 'data-server-id': server.id },
|
||||||
|
server.name
|
||||||
|
),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock('@renderer/components/extensions/mcp/McpServerDetailDialog', () => ({
|
vi.mock('@renderer/components/extensions/mcp/McpServerDetailDialog', () => ({
|
||||||
|
|
@ -224,4 +223,48 @@ describe('McpServersPanel initial browse loading', () => {
|
||||||
await Promise.resolve();
|
await Promise.resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('uses truthful diagnostics copy instead of suggesting a hard-coded CLI command', async () => {
|
||||||
|
storeState.mcpBrowseCatalog = [
|
||||||
|
{
|
||||||
|
id: 'context7',
|
||||||
|
name: 'Context7',
|
||||||
|
description: 'Docs MCP',
|
||||||
|
source: 'official',
|
||||||
|
installSpec: null,
|
||||||
|
envVars: [],
|
||||||
|
tools: [],
|
||||||
|
requiresAuth: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const host = document.createElement('div');
|
||||||
|
document.body.appendChild(host);
|
||||||
|
const root = createRoot(host);
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
root.render(
|
||||||
|
React.createElement(McpServersPanel, {
|
||||||
|
projectPath: null,
|
||||||
|
mcpSearchQuery: '',
|
||||||
|
mcpSearch: vi.fn(),
|
||||||
|
mcpSearchResults: [],
|
||||||
|
mcpSearchLoading: false,
|
||||||
|
mcpSearchWarnings: [],
|
||||||
|
selectedMcpServerId: null,
|
||||||
|
setSelectedMcpServerId: vi.fn(),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
await Promise.resolve();
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(host.textContent).toContain('Run diagnostics from this page');
|
||||||
|
expect(host.textContent).not.toContain('claude-multimodel mcp diagnose');
|
||||||
|
expect(host.textContent).not.toContain('claude mcp list');
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
root.unmount();
|
||||||
|
await Promise.resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue