mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-23 08:45:50 +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,212 +1,147 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import React, { useMemo } from 'react';
|
||||
import { getMcpConfigsByScope } from 'src/services/mcp/config.js';
|
||||
import type { ConfigScope } from 'src/services/mcp/types.js';
|
||||
import { describeMcpConfigFilePath, getScopeLabel } from 'src/services/mcp/utils.js';
|
||||
import type { ValidationError } from 'src/utils/settings/validation.js';
|
||||
import { Box, Link, Text } from '../../ink.js';
|
||||
function McpConfigErrorSection(t0) {
|
||||
const $ = _c(26);
|
||||
const {
|
||||
scope,
|
||||
parsingErrors,
|
||||
warnings
|
||||
} = t0;
|
||||
const hasErrors = parsingErrors.length > 0;
|
||||
const hasWarnings = warnings.length > 0;
|
||||
import React, { useMemo } from 'react'
|
||||
import { getMcpConfigsByScope } from 'src/services/mcp/config.js'
|
||||
import type { ConfigScope } from 'src/services/mcp/types.js'
|
||||
import {
|
||||
describeMcpConfigFilePath,
|
||||
getScopeLabel,
|
||||
} from 'src/services/mcp/utils.js'
|
||||
import type { ValidationError } from 'src/utils/settings/validation.js'
|
||||
import { Box, Link, Text } from '../../ink.js'
|
||||
|
||||
function McpConfigErrorSection({
|
||||
scope,
|
||||
parsingErrors,
|
||||
warnings,
|
||||
}: {
|
||||
scope: ConfigScope
|
||||
parsingErrors: ValidationError[]
|
||||
warnings: ValidationError[]
|
||||
}): React.ReactNode {
|
||||
const hasErrors = parsingErrors.length > 0
|
||||
const hasWarnings = warnings.length > 0
|
||||
|
||||
if (!hasErrors && !hasWarnings) {
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
let t1;
|
||||
if ($[0] !== hasErrors || $[1] !== hasWarnings) {
|
||||
t1 = (hasErrors || hasWarnings) && <Text color={hasErrors ? "error" : "warning"}>[{hasErrors ? "Failed to parse" : "Contains warnings"}]{" "}</Text>;
|
||||
$[0] = hasErrors;
|
||||
$[1] = hasWarnings;
|
||||
$[2] = t1;
|
||||
} else {
|
||||
t1 = $[2];
|
||||
}
|
||||
let t2;
|
||||
if ($[3] !== scope) {
|
||||
t2 = getScopeLabel(scope);
|
||||
$[3] = scope;
|
||||
$[4] = t2;
|
||||
} else {
|
||||
t2 = $[4];
|
||||
}
|
||||
let t3;
|
||||
if ($[5] !== t2) {
|
||||
t3 = <Text>{t2}</Text>;
|
||||
$[5] = t2;
|
||||
$[6] = t3;
|
||||
} else {
|
||||
t3 = $[6];
|
||||
}
|
||||
let t4;
|
||||
if ($[7] !== t1 || $[8] !== t3) {
|
||||
t4 = <Box>{t1}{t3}</Box>;
|
||||
$[7] = t1;
|
||||
$[8] = t3;
|
||||
$[9] = t4;
|
||||
} else {
|
||||
t4 = $[9];
|
||||
}
|
||||
let t5;
|
||||
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t5 = <Text dimColor={true}>Location: </Text>;
|
||||
$[10] = t5;
|
||||
} else {
|
||||
t5 = $[10];
|
||||
}
|
||||
let t6;
|
||||
if ($[11] !== scope) {
|
||||
t6 = describeMcpConfigFilePath(scope);
|
||||
$[11] = scope;
|
||||
$[12] = t6;
|
||||
} else {
|
||||
t6 = $[12];
|
||||
}
|
||||
let t7;
|
||||
if ($[13] !== t6) {
|
||||
t7 = <Box>{t5}<Text dimColor={true}>{t6}</Text></Box>;
|
||||
$[13] = t6;
|
||||
$[14] = t7;
|
||||
} else {
|
||||
t7 = $[14];
|
||||
}
|
||||
let t8;
|
||||
if ($[15] !== parsingErrors) {
|
||||
t8 = parsingErrors.map(_temp);
|
||||
$[15] = parsingErrors;
|
||||
$[16] = t8;
|
||||
} else {
|
||||
t8 = $[16];
|
||||
}
|
||||
let t9;
|
||||
if ($[17] !== warnings) {
|
||||
t9 = warnings.map(_temp2);
|
||||
$[17] = warnings;
|
||||
$[18] = t9;
|
||||
} else {
|
||||
t9 = $[18];
|
||||
}
|
||||
let t10;
|
||||
if ($[19] !== t8 || $[20] !== t9) {
|
||||
t10 = <Box marginLeft={1} flexDirection="column">{t8}{t9}</Box>;
|
||||
$[19] = t8;
|
||||
$[20] = t9;
|
||||
$[21] = t10;
|
||||
} else {
|
||||
t10 = $[21];
|
||||
}
|
||||
let t11;
|
||||
if ($[22] !== t10 || $[23] !== t4 || $[24] !== t7) {
|
||||
t11 = <Box flexDirection="column" marginTop={1}>{t4}{t7}{t10}</Box>;
|
||||
$[22] = t10;
|
||||
$[23] = t4;
|
||||
$[24] = t7;
|
||||
$[25] = t11;
|
||||
} else {
|
||||
t11 = $[25];
|
||||
}
|
||||
return t11;
|
||||
|
||||
return (
|
||||
<Box flexDirection="column" marginTop={1}>
|
||||
<Box>
|
||||
{(hasErrors || hasWarnings) && (
|
||||
<Text color={hasErrors ? 'error' : 'warning'}>
|
||||
[{hasErrors ? 'Failed to parse' : 'Contains warnings'}]{' '}
|
||||
</Text>
|
||||
)}
|
||||
<Text>{getScopeLabel(scope)}</Text>
|
||||
</Box>
|
||||
<Box>
|
||||
<Text dimColor>Location: </Text>
|
||||
<Text dimColor>{describeMcpConfigFilePath(scope)}</Text>
|
||||
</Box>
|
||||
<Box marginLeft={1} flexDirection="column">
|
||||
{parsingErrors.map((error, i) => {
|
||||
const serverName = error.mcpErrorMetadata?.serverName
|
||||
return (
|
||||
<Box key={`error-${i}`}>
|
||||
<Text>
|
||||
<Text dimColor>└ </Text>
|
||||
<Text color="error">[Error]</Text>
|
||||
<Text dimColor>
|
||||
{' '}
|
||||
{serverName && `[${serverName}] `}
|
||||
{error.path && error.path !== '' ? `${error.path}: ` : ''}
|
||||
{error.message}
|
||||
</Text>
|
||||
</Text>
|
||||
</Box>
|
||||
)
|
||||
})}
|
||||
{warnings.map((warning, i) => {
|
||||
const serverName = warning.mcpErrorMetadata?.serverName
|
||||
|
||||
return (
|
||||
<Box key={`warning-${i}`}>
|
||||
<Text>
|
||||
<Text dimColor>└ </Text>
|
||||
<Text color="warning">[Warning]</Text>
|
||||
<Text dimColor>
|
||||
{' '}
|
||||
{serverName && `[${serverName}] `}
|
||||
{warning.path && warning.path !== ''
|
||||
? `${warning.path}: `
|
||||
: ''}
|
||||
{warning.message}
|
||||
</Text>
|
||||
</Text>
|
||||
</Box>
|
||||
)
|
||||
})}
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
function _temp2(warning, i_0) {
|
||||
const serverName_0 = warning.mcpErrorMetadata?.serverName;
|
||||
return <Box key={`warning-${i_0}`}><Text><Text dimColor={true}>└ </Text><Text color="warning">[Warning]</Text><Text dimColor={true}>{" "}{serverName_0 && `[${serverName_0}] `}{warning.path && warning.path !== "" ? `${warning.path}: ` : ""}{warning.message}</Text></Text></Box>;
|
||||
}
|
||||
function _temp(error, i) {
|
||||
const serverName = error.mcpErrorMetadata?.serverName;
|
||||
return <Box key={`error-${i}`}><Text><Text dimColor={true}>└ </Text><Text color="error">[Error]</Text><Text dimColor={true}>{" "}{serverName && `[${serverName}] `}{error.path && error.path !== "" ? `${error.path}: ` : ""}{error.message}</Text></Text></Box>;
|
||||
}
|
||||
export function McpParsingWarnings() {
|
||||
const $ = _c(6);
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t0 = {
|
||||
scope: "user",
|
||||
config: getMcpConfigsByScope("user")
|
||||
};
|
||||
$[0] = t0;
|
||||
} else {
|
||||
t0 = $[0];
|
||||
}
|
||||
let t1;
|
||||
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = {
|
||||
scope: "project",
|
||||
config: getMcpConfigsByScope("project")
|
||||
};
|
||||
$[1] = t1;
|
||||
} else {
|
||||
t1 = $[1];
|
||||
}
|
||||
let t2;
|
||||
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t2 = {
|
||||
scope: "local",
|
||||
config: getMcpConfigsByScope("local")
|
||||
};
|
||||
$[2] = t2;
|
||||
} else {
|
||||
t2 = $[2];
|
||||
}
|
||||
let t3;
|
||||
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t3 = [t0, t1, t2, {
|
||||
scope: "enterprise",
|
||||
config: getMcpConfigsByScope("enterprise")
|
||||
}];
|
||||
$[3] = t3;
|
||||
} else {
|
||||
t3 = $[3];
|
||||
}
|
||||
const scopes = t3 satisfies Array<{
|
||||
scope: ConfigScope;
|
||||
config: {
|
||||
errors: ValidationError[];
|
||||
};
|
||||
}>;
|
||||
const hasParsingErrors = scopes.some(_temp3);
|
||||
const hasWarnings = scopes.some(_temp4);
|
||||
|
||||
export function McpParsingWarnings(): React.ReactNode {
|
||||
// Config files don't change during dialog lifetime; read once on mount
|
||||
// to avoid blocking file IO on every re-render.
|
||||
const scopes = useMemo(
|
||||
() =>
|
||||
[
|
||||
{ scope: 'user', config: getMcpConfigsByScope('user') },
|
||||
{ scope: 'project', config: getMcpConfigsByScope('project') },
|
||||
{ scope: 'local', config: getMcpConfigsByScope('local') },
|
||||
{ scope: 'enterprise', config: getMcpConfigsByScope('enterprise') },
|
||||
] satisfies Array<{
|
||||
scope: ConfigScope
|
||||
config: { errors: ValidationError[] }
|
||||
}>,
|
||||
[],
|
||||
)
|
||||
|
||||
const hasParsingErrors = scopes.some(
|
||||
({ config }) => filterErrors(config.errors, 'fatal').length > 0,
|
||||
)
|
||||
const hasWarnings = scopes.some(
|
||||
({ config }) => filterErrors(config.errors, 'warning').length > 0,
|
||||
)
|
||||
|
||||
if (!hasParsingErrors && !hasWarnings) {
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
let t4;
|
||||
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t4 = <Text bold={true}>MCP Config Diagnostics</Text>;
|
||||
$[4] = t4;
|
||||
} else {
|
||||
t4 = $[4];
|
||||
}
|
||||
let t5;
|
||||
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t5 = <Box flexDirection="column" marginTop={1} marginBottom={1}>{t4}<Box marginTop={1}><Text dimColor={true}>For help configuring MCP servers, see:{" "}<Link url="https://code.claude.com/docs/en/mcp">https://code.claude.com/docs/en/mcp</Link></Text></Box>{scopes.map(_temp5)}</Box>;
|
||||
$[5] = t5;
|
||||
} else {
|
||||
t5 = $[5];
|
||||
}
|
||||
return t5;
|
||||
|
||||
return (
|
||||
<Box flexDirection="column" marginTop={1} marginBottom={1}>
|
||||
<Text bold>MCP Config Diagnostics</Text>
|
||||
<Box marginTop={1}>
|
||||
<Text dimColor>
|
||||
For help configuring MCP servers, see:{' '}
|
||||
<Link url="https://code.claude.com/docs/en/mcp">
|
||||
https://code.claude.com/docs/en/mcp
|
||||
</Link>
|
||||
</Text>
|
||||
</Box>
|
||||
{scopes.map(({ scope, config }) => (
|
||||
<McpConfigErrorSection
|
||||
key={scope}
|
||||
scope={scope}
|
||||
parsingErrors={filterErrors(config.errors, 'fatal')}
|
||||
warnings={filterErrors(config.errors, 'warning')}
|
||||
/>
|
||||
))}
|
||||
{/* TODO: Add additional diagnostic sections:
|
||||
* - Duplicate Server Names (check for servers with same name across scopes)
|
||||
* This section should include:
|
||||
* - File paths where each server is defined
|
||||
* - More detailed location info for user/local scopes
|
||||
* - Approved / disabled status of servers
|
||||
*/}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
function _temp5(t0) {
|
||||
const {
|
||||
scope,
|
||||
config: config_1
|
||||
} = t0;
|
||||
return <McpConfigErrorSection key={scope} scope={scope} parsingErrors={filterErrors(config_1.errors, "fatal")} warnings={filterErrors(config_1.errors, "warning")} />;
|
||||
}
|
||||
function _temp4(t0) {
|
||||
const {
|
||||
config: config_0
|
||||
} = t0;
|
||||
return filterErrors(config_0.errors, "warning").length > 0;
|
||||
}
|
||||
function _temp3(t0) {
|
||||
const {
|
||||
config
|
||||
} = t0;
|
||||
return filterErrors(config.errors, "fatal").length > 0;
|
||||
}
|
||||
function filterErrors(errors: ValidationError[], severity: 'fatal' | 'warning'): ValidationError[] {
|
||||
return errors.filter(e => e.mcpErrorMetadata?.severity === severity);
|
||||
|
||||
function filterErrors(
|
||||
errors: ValidationError[],
|
||||
severity: 'fatal' | 'warning',
|
||||
): ValidationError[] {
|
||||
return errors.filter(e => e.mcpErrorMetadata?.severity === severity)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user