mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -1,76 +1,65 @@
|
||||
import React from 'react'
|
||||
import React from 'react';
|
||||
import {
|
||||
type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
logEvent,
|
||||
} from 'src/services/analytics/index.js'
|
||||
import {
|
||||
getSettings_DEPRECATED,
|
||||
updateSettingsForSource,
|
||||
} from '../utils/settings/settings.js'
|
||||
import { Select } from './CustomSelect/index.js'
|
||||
import { Dialog } from '@anthropic/ink'
|
||||
import { MCPServerDialogCopy } from './MCPServerDialogCopy.js'
|
||||
} from 'src/services/analytics/index.js';
|
||||
import { getSettings_DEPRECATED, updateSettingsForSource } from '../utils/settings/settings.js';
|
||||
import { Select } from './CustomSelect/index.js';
|
||||
import { Dialog } from '@anthropic/ink';
|
||||
import { MCPServerDialogCopy } from './MCPServerDialogCopy.js';
|
||||
|
||||
type Props = {
|
||||
serverName: string
|
||||
onDone(): void
|
||||
}
|
||||
serverName: string;
|
||||
onDone(): void;
|
||||
};
|
||||
|
||||
export function MCPServerApprovalDialog({
|
||||
serverName,
|
||||
onDone,
|
||||
}: Props): React.ReactNode {
|
||||
export function MCPServerApprovalDialog({ serverName, onDone }: Props): React.ReactNode {
|
||||
function onChange(value: 'yes' | 'yes_all' | 'no') {
|
||||
logEvent('tengu_mcp_dialog_choice', {
|
||||
choice:
|
||||
value as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
})
|
||||
choice: value as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
});
|
||||
|
||||
switch (value) {
|
||||
case 'yes':
|
||||
case 'yes_all': {
|
||||
// Get current enabled servers from settings
|
||||
const currentSettings = getSettings_DEPRECATED() || {}
|
||||
const enabledServers = currentSettings.enabledMcpjsonServers || []
|
||||
const currentSettings = getSettings_DEPRECATED() || {};
|
||||
const enabledServers = currentSettings.enabledMcpjsonServers || [];
|
||||
|
||||
// Add server if not already enabled
|
||||
if (!enabledServers.includes(serverName)) {
|
||||
updateSettingsForSource('localSettings', {
|
||||
enabledMcpjsonServers: [...enabledServers, serverName],
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
if (value === 'yes_all') {
|
||||
updateSettingsForSource('localSettings', {
|
||||
enableAllProjectMcpServers: true,
|
||||
})
|
||||
});
|
||||
}
|
||||
onDone()
|
||||
break
|
||||
onDone();
|
||||
break;
|
||||
}
|
||||
case 'no': {
|
||||
// Get current disabled servers from settings
|
||||
const currentSettings = getSettings_DEPRECATED() || {}
|
||||
const disabledServers = currentSettings.disabledMcpjsonServers || []
|
||||
const currentSettings = getSettings_DEPRECATED() || {};
|
||||
const disabledServers = currentSettings.disabledMcpjsonServers || [];
|
||||
|
||||
// Add server if not already disabled
|
||||
if (!disabledServers.includes(serverName)) {
|
||||
updateSettingsForSource('localSettings', {
|
||||
disabledMcpjsonServers: [...disabledServers, serverName],
|
||||
})
|
||||
});
|
||||
}
|
||||
onDone()
|
||||
break
|
||||
onDone();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
title={`New MCP server found in .mcp.json: ${serverName}`}
|
||||
color="warning"
|
||||
onCancel={() => onChange('no')}
|
||||
>
|
||||
<Dialog title={`New MCP server found in .mcp.json: ${serverName}`} color="warning" onCancel={() => onChange('no')}>
|
||||
<MCPServerDialogCopy />
|
||||
|
||||
<Select
|
||||
@@ -86,5 +75,5 @@ export function MCPServerApprovalDialog({
|
||||
onCancel={() => onChange('no')}
|
||||
/>
|
||||
</Dialog>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user