mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +00:00
更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121)
* style(B1-1): 格式化 ink/buddy/cli/context/screens/tasks/services/keybindings/state (43 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 修复了 Box.tsx 和 ScrollBox.tsx 中无效的 global.d.ts import。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-2): 格式化 commands (79 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-3): 格式化 components/messages,permissions,mcp,sandbox,shell (104 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-4): 格式化 components/PromptInput,FeedbackSurvey,tasks,agents,skills,design-system,wizard (73 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-5): 格式化 components其余 + hooks + tools (232 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-6): 格式化 main/entrypoints/utils/moreright (21 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: 更新 README,新增 Run.ps1/TODO.md,删除 V6.md - README.md: 大幅重写,更详细版本历史和配置示例 - Run.ps1: 新增 Windows 启动脚本 - TODO.md: 新增包完成清单 - V6.md: 删除(架构重构规划已不适用) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: 修复以前的问题 * fix: 修复 login 面板的问题 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,132 +1,117 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import partition from 'lodash-es/partition.js';
|
||||
import React, { useCallback } from 'react';
|
||||
import { logEvent } from 'src/services/analytics/index.js';
|
||||
import { Box, Text } from '../ink.js';
|
||||
import { getSettings_DEPRECATED, updateSettingsForSource } from '../utils/settings/settings.js';
|
||||
import { ConfigurableShortcutHint } from './ConfigurableShortcutHint.js';
|
||||
import { SelectMulti } from './CustomSelect/SelectMulti.js';
|
||||
import { Byline } from './design-system/Byline.js';
|
||||
import { Dialog } from './design-system/Dialog.js';
|
||||
import { KeyboardShortcutHint } from './design-system/KeyboardShortcutHint.js';
|
||||
import { MCPServerDialogCopy } from './MCPServerDialogCopy.js';
|
||||
import partition from 'lodash-es/partition.js'
|
||||
import React, { useCallback } from 'react'
|
||||
import { logEvent } from 'src/services/analytics/index.js'
|
||||
import { Box, Text } from '../ink.js'
|
||||
import {
|
||||
getSettings_DEPRECATED,
|
||||
updateSettingsForSource,
|
||||
} from '../utils/settings/settings.js'
|
||||
import { ConfigurableShortcutHint } from './ConfigurableShortcutHint.js'
|
||||
import { SelectMulti } from './CustomSelect/SelectMulti.js'
|
||||
import { Byline } from './design-system/Byline.js'
|
||||
import { Dialog } from './design-system/Dialog.js'
|
||||
import { KeyboardShortcutHint } from './design-system/KeyboardShortcutHint.js'
|
||||
import { MCPServerDialogCopy } from './MCPServerDialogCopy.js'
|
||||
|
||||
type Props = {
|
||||
serverNames: string[];
|
||||
onDone(): void;
|
||||
};
|
||||
export function MCPServerMultiselectDialog(t0) {
|
||||
const $ = _c(21);
|
||||
const {
|
||||
serverNames,
|
||||
onDone
|
||||
} = t0;
|
||||
let t1;
|
||||
if ($[0] !== onDone || $[1] !== serverNames) {
|
||||
t1 = function onSubmit(selectedServers) {
|
||||
const currentSettings = getSettings_DEPRECATED() || {};
|
||||
const enabledServers = currentSettings.enabledMcpjsonServers || [];
|
||||
const disabledServers = currentSettings.disabledMcpjsonServers || [];
|
||||
const [approvedServers, rejectedServers] = partition(serverNames, server => selectedServers.includes(server));
|
||||
logEvent("tengu_mcp_multidialog_choice", {
|
||||
approved: approvedServers.length,
|
||||
rejected: rejectedServers.length
|
||||
});
|
||||
if (approvedServers.length > 0) {
|
||||
const newEnabledServers = [...new Set([...enabledServers, ...approvedServers])];
|
||||
updateSettingsForSource("localSettings", {
|
||||
enabledMcpjsonServers: newEnabledServers
|
||||
});
|
||||
}
|
||||
if (rejectedServers.length > 0) {
|
||||
const newDisabledServers = [...new Set([...disabledServers, ...rejectedServers])];
|
||||
updateSettingsForSource("localSettings", {
|
||||
disabledMcpjsonServers: newDisabledServers
|
||||
});
|
||||
}
|
||||
onDone();
|
||||
};
|
||||
$[0] = onDone;
|
||||
$[1] = serverNames;
|
||||
$[2] = t1;
|
||||
} else {
|
||||
t1 = $[2];
|
||||
}
|
||||
const onSubmit = t1;
|
||||
let t2;
|
||||
if ($[3] !== onDone || $[4] !== serverNames) {
|
||||
t2 = () => {
|
||||
const currentSettings_0 = getSettings_DEPRECATED() || {};
|
||||
const disabledServers_0 = currentSettings_0.disabledMcpjsonServers || [];
|
||||
const newDisabledServers_0 = [...new Set([...disabledServers_0, ...serverNames])];
|
||||
updateSettingsForSource("localSettings", {
|
||||
disabledMcpjsonServers: newDisabledServers_0
|
||||
});
|
||||
onDone();
|
||||
};
|
||||
$[3] = onDone;
|
||||
$[4] = serverNames;
|
||||
$[5] = t2;
|
||||
} else {
|
||||
t2 = $[5];
|
||||
}
|
||||
const handleEscRejectAll = t2;
|
||||
const t3 = `${serverNames.length} new MCP servers found in .mcp.json`;
|
||||
let t4;
|
||||
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t4 = <MCPServerDialogCopy />;
|
||||
$[6] = t4;
|
||||
} else {
|
||||
t4 = $[6];
|
||||
}
|
||||
let t5;
|
||||
if ($[7] !== serverNames) {
|
||||
t5 = serverNames.map(_temp);
|
||||
$[7] = serverNames;
|
||||
$[8] = t5;
|
||||
} else {
|
||||
t5 = $[8];
|
||||
}
|
||||
let t6;
|
||||
if ($[9] !== handleEscRejectAll || $[10] !== onSubmit || $[11] !== serverNames || $[12] !== t5) {
|
||||
t6 = <SelectMulti options={t5} defaultValue={serverNames} onSubmit={onSubmit} onCancel={handleEscRejectAll} hideIndexes={true} />;
|
||||
$[9] = handleEscRejectAll;
|
||||
$[10] = onSubmit;
|
||||
$[11] = serverNames;
|
||||
$[12] = t5;
|
||||
$[13] = t6;
|
||||
} else {
|
||||
t6 = $[13];
|
||||
}
|
||||
let t7;
|
||||
if ($[14] !== handleEscRejectAll || $[15] !== t3 || $[16] !== t6) {
|
||||
t7 = <Dialog title={t3} subtitle="Select any you wish to enable." color="warning" onCancel={handleEscRejectAll} hideInputGuide={true}>{t4}{t6}</Dialog>;
|
||||
$[14] = handleEscRejectAll;
|
||||
$[15] = t3;
|
||||
$[16] = t6;
|
||||
$[17] = t7;
|
||||
} else {
|
||||
t7 = $[17];
|
||||
}
|
||||
let t8;
|
||||
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t8 = <Box paddingX={1}><Text dimColor={true} italic={true}><Byline><KeyboardShortcutHint shortcut="Space" action="select" /><KeyboardShortcutHint shortcut="Enter" action="confirm" /><ConfigurableShortcutHint action="confirm:no" context="Confirmation" fallback="Esc" description="reject all" /></Byline></Text></Box>;
|
||||
$[18] = t8;
|
||||
} else {
|
||||
t8 = $[18];
|
||||
}
|
||||
let t9;
|
||||
if ($[19] !== t7) {
|
||||
t9 = <>{t7}{t8}</>;
|
||||
$[19] = t7;
|
||||
$[20] = t9;
|
||||
} else {
|
||||
t9 = $[20];
|
||||
}
|
||||
return t9;
|
||||
serverNames: string[]
|
||||
onDone(): void
|
||||
}
|
||||
function _temp(server_0) {
|
||||
return {
|
||||
label: server_0,
|
||||
value: server_0
|
||||
};
|
||||
|
||||
export function MCPServerMultiselectDialog({
|
||||
serverNames,
|
||||
onDone,
|
||||
}: Props): React.ReactNode {
|
||||
function onSubmit(selectedServers: string[]) {
|
||||
const currentSettings = getSettings_DEPRECATED() || {}
|
||||
const enabledServers = currentSettings.enabledMcpjsonServers || []
|
||||
const disabledServers = currentSettings.disabledMcpjsonServers || []
|
||||
|
||||
// Use partition to separate approved and rejected servers
|
||||
const [approvedServers, rejectedServers] = partition(serverNames, server =>
|
||||
selectedServers.includes(server),
|
||||
)
|
||||
|
||||
logEvent('tengu_mcp_multidialog_choice', {
|
||||
approved: approvedServers.length,
|
||||
rejected: rejectedServers.length,
|
||||
})
|
||||
|
||||
// Update settings with approved servers
|
||||
if (approvedServers.length > 0) {
|
||||
const newEnabledServers = [
|
||||
...new Set([...enabledServers, ...approvedServers]),
|
||||
]
|
||||
updateSettingsForSource('localSettings', {
|
||||
enabledMcpjsonServers: newEnabledServers,
|
||||
})
|
||||
}
|
||||
|
||||
// Update settings with rejected servers
|
||||
if (rejectedServers.length > 0) {
|
||||
const newDisabledServers = [
|
||||
...new Set([...disabledServers, ...rejectedServers]),
|
||||
]
|
||||
updateSettingsForSource('localSettings', {
|
||||
disabledMcpjsonServers: newDisabledServers,
|
||||
})
|
||||
}
|
||||
|
||||
onDone()
|
||||
}
|
||||
|
||||
// Handle ESC to reject all servers
|
||||
const handleEscRejectAll = useCallback(() => {
|
||||
const currentSettings = getSettings_DEPRECATED() || {}
|
||||
const disabledServers = currentSettings.disabledMcpjsonServers || []
|
||||
|
||||
const newDisabledServers = [
|
||||
...new Set([...disabledServers, ...serverNames]),
|
||||
]
|
||||
|
||||
updateSettingsForSource('localSettings', {
|
||||
disabledMcpjsonServers: newDisabledServers,
|
||||
})
|
||||
|
||||
onDone()
|
||||
}, [serverNames, onDone])
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dialog
|
||||
title={`${serverNames.length} new MCP servers found in .mcp.json`}
|
||||
subtitle="Select any you wish to enable."
|
||||
color="warning"
|
||||
onCancel={handleEscRejectAll}
|
||||
hideInputGuide
|
||||
>
|
||||
<MCPServerDialogCopy />
|
||||
|
||||
<SelectMulti
|
||||
options={serverNames.map(server => ({
|
||||
label: server,
|
||||
value: server,
|
||||
}))}
|
||||
defaultValue={serverNames}
|
||||
onSubmit={onSubmit}
|
||||
onCancel={handleEscRejectAll}
|
||||
hideIndexes
|
||||
/>
|
||||
</Dialog>
|
||||
<Box paddingX={1}>
|
||||
<Text dimColor italic>
|
||||
<Byline>
|
||||
<KeyboardShortcutHint shortcut="Space" action="select" />
|
||||
<KeyboardShortcutHint shortcut="Enter" action="confirm" />
|
||||
<ConfigurableShortcutHint
|
||||
action="confirm:no"
|
||||
context="Confirmation"
|
||||
fallback="Esc"
|
||||
description="reject all"
|
||||
/>
|
||||
</Byline>
|
||||
</Text>
|
||||
</Box>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user