mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 08:15:53 +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,211 +1,142 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import React from 'react';
|
||||
import { Box, Text } from '../../ink.js';
|
||||
import { extractMcpToolDisplayName, getMcpDisplayName } from '../../services/mcp/mcpStringUtils.js';
|
||||
import type { Tool } from '../../Tool.js';
|
||||
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js';
|
||||
import { Dialog } from '../design-system/Dialog.js';
|
||||
import type { ServerInfo } from './types.js';
|
||||
import React from 'react'
|
||||
import { Box, Text } from '../../ink.js'
|
||||
import {
|
||||
extractMcpToolDisplayName,
|
||||
getMcpDisplayName,
|
||||
} from '../../services/mcp/mcpStringUtils.js'
|
||||
import type { Tool } from '../../Tool.js'
|
||||
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js'
|
||||
import { Dialog } from '../design-system/Dialog.js'
|
||||
import type { ServerInfo } from './types.js'
|
||||
|
||||
type Props = {
|
||||
tool: Tool;
|
||||
server: ServerInfo;
|
||||
onBack: () => void;
|
||||
};
|
||||
export function MCPToolDetailView(t0) {
|
||||
const $ = _c(44);
|
||||
const {
|
||||
tool,
|
||||
server,
|
||||
onBack
|
||||
} = t0;
|
||||
const [toolDescription, setToolDescription] = React.useState("");
|
||||
let t1;
|
||||
let toolName;
|
||||
if ($[0] !== server.name || $[1] !== tool) {
|
||||
toolName = getMcpDisplayName(tool.name, server.name);
|
||||
const fullDisplayName = tool.userFacingName ? tool.userFacingName({}) : toolName;
|
||||
t1 = extractMcpToolDisplayName(fullDisplayName);
|
||||
$[0] = server.name;
|
||||
$[1] = tool;
|
||||
$[2] = t1;
|
||||
$[3] = toolName;
|
||||
} else {
|
||||
t1 = $[2];
|
||||
toolName = $[3];
|
||||
}
|
||||
const displayName = t1;
|
||||
let t2;
|
||||
if ($[4] !== tool) {
|
||||
t2 = tool.isReadOnly?.({}) ?? false;
|
||||
$[4] = tool;
|
||||
$[5] = t2;
|
||||
} else {
|
||||
t2 = $[5];
|
||||
}
|
||||
const isReadOnly = t2;
|
||||
let t3;
|
||||
if ($[6] !== tool) {
|
||||
t3 = tool.isDestructive?.({}) ?? false;
|
||||
$[6] = tool;
|
||||
$[7] = t3;
|
||||
} else {
|
||||
t3 = $[7];
|
||||
}
|
||||
const isDestructive = t3;
|
||||
let t4;
|
||||
if ($[8] !== tool) {
|
||||
t4 = tool.isOpenWorld?.({}) ?? false;
|
||||
$[8] = tool;
|
||||
$[9] = t4;
|
||||
} else {
|
||||
t4 = $[9];
|
||||
}
|
||||
const isOpenWorld = t4;
|
||||
let t5;
|
||||
let t6;
|
||||
if ($[10] !== tool) {
|
||||
t5 = () => {
|
||||
const loadDescription = async function loadDescription() {
|
||||
try {
|
||||
const desc = await tool.description({}, {
|
||||
tool: Tool
|
||||
server: ServerInfo
|
||||
onBack: () => void
|
||||
}
|
||||
|
||||
export function MCPToolDetailView({
|
||||
tool,
|
||||
server,
|
||||
onBack,
|
||||
}: Props): React.ReactNode {
|
||||
const [toolDescription, setToolDescription] = React.useState<string>('')
|
||||
|
||||
const toolName = getMcpDisplayName(tool.name, server.name)
|
||||
const fullDisplayName = tool.userFacingName
|
||||
? tool.userFacingName({})
|
||||
: toolName
|
||||
const displayName = extractMcpToolDisplayName(fullDisplayName)
|
||||
|
||||
const isReadOnly = tool.isReadOnly?.({}) ?? false
|
||||
const isDestructive = tool.isDestructive?.({}) ?? false
|
||||
const isOpenWorld = tool.isOpenWorld?.({}) ?? false
|
||||
|
||||
React.useEffect(() => {
|
||||
async function loadDescription() {
|
||||
try {
|
||||
const desc = await tool.description(
|
||||
{},
|
||||
{
|
||||
isNonInteractiveSession: false,
|
||||
toolPermissionContext: {
|
||||
mode: "default" as const,
|
||||
mode: 'default' as const,
|
||||
additionalWorkingDirectories: new Map(),
|
||||
alwaysAllowRules: {},
|
||||
alwaysDenyRules: {},
|
||||
alwaysAskRules: {},
|
||||
isBypassPermissionsModeAvailable: false
|
||||
isBypassPermissionsModeAvailable: false,
|
||||
},
|
||||
tools: []
|
||||
});
|
||||
setToolDescription(desc);
|
||||
} catch {
|
||||
setToolDescription("Failed to load description");
|
||||
}
|
||||
};
|
||||
loadDescription();
|
||||
};
|
||||
t6 = [tool];
|
||||
$[10] = tool;
|
||||
$[11] = t5;
|
||||
$[12] = t6;
|
||||
} else {
|
||||
t5 = $[11];
|
||||
t6 = $[12];
|
||||
}
|
||||
React.useEffect(t5, t6);
|
||||
let t7;
|
||||
if ($[13] !== isReadOnly) {
|
||||
t7 = isReadOnly && <Text color="success"> [read-only]</Text>;
|
||||
$[13] = isReadOnly;
|
||||
$[14] = t7;
|
||||
} else {
|
||||
t7 = $[14];
|
||||
}
|
||||
let t8;
|
||||
if ($[15] !== isDestructive) {
|
||||
t8 = isDestructive && <Text color="error"> [destructive]</Text>;
|
||||
$[15] = isDestructive;
|
||||
$[16] = t8;
|
||||
} else {
|
||||
t8 = $[16];
|
||||
}
|
||||
let t9;
|
||||
if ($[17] !== isOpenWorld) {
|
||||
t9 = isOpenWorld && <Text dimColor={true}> [open-world]</Text>;
|
||||
$[17] = isOpenWorld;
|
||||
$[18] = t9;
|
||||
} else {
|
||||
t9 = $[18];
|
||||
}
|
||||
let t10;
|
||||
if ($[19] !== displayName || $[20] !== t7 || $[21] !== t8 || $[22] !== t9) {
|
||||
t10 = <>{displayName}{t7}{t8}{t9}</>;
|
||||
$[19] = displayName;
|
||||
$[20] = t7;
|
||||
$[21] = t8;
|
||||
$[22] = t9;
|
||||
$[23] = t10;
|
||||
} else {
|
||||
t10 = $[23];
|
||||
}
|
||||
const titleContent = t10;
|
||||
let t11;
|
||||
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t11 = <Text bold={true}>Tool name: </Text>;
|
||||
$[24] = t11;
|
||||
} else {
|
||||
t11 = $[24];
|
||||
}
|
||||
let t12;
|
||||
if ($[25] !== toolName) {
|
||||
t12 = <Box>{t11}<Text dimColor={true}>{toolName}</Text></Box>;
|
||||
$[25] = toolName;
|
||||
$[26] = t12;
|
||||
} else {
|
||||
t12 = $[26];
|
||||
}
|
||||
let t13;
|
||||
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t13 = <Text bold={true}>Full name: </Text>;
|
||||
$[27] = t13;
|
||||
} else {
|
||||
t13 = $[27];
|
||||
}
|
||||
let t14;
|
||||
if ($[28] !== tool.name) {
|
||||
t14 = <Box>{t13}<Text dimColor={true}>{tool.name}</Text></Box>;
|
||||
$[28] = tool.name;
|
||||
$[29] = t14;
|
||||
} else {
|
||||
t14 = $[29];
|
||||
}
|
||||
let t15;
|
||||
if ($[30] !== toolDescription) {
|
||||
t15 = toolDescription && <Box flexDirection="column" marginTop={1}><Text bold={true}>Description:</Text><Text wrap="wrap">{toolDescription}</Text></Box>;
|
||||
$[30] = toolDescription;
|
||||
$[31] = t15;
|
||||
} else {
|
||||
t15 = $[31];
|
||||
}
|
||||
let t16;
|
||||
if ($[32] !== tool.inputJSONSchema) {
|
||||
t16 = tool.inputJSONSchema && tool.inputJSONSchema.properties && Object.keys(tool.inputJSONSchema.properties).length > 0 && <Box flexDirection="column" marginTop={1}><Text bold={true}>Parameters:</Text><Box marginLeft={2} flexDirection="column">{Object.entries(tool.inputJSONSchema.properties).map(t17 => {
|
||||
const [key, value] = t17;
|
||||
const required = tool.inputJSONSchema?.required as string[] | undefined;
|
||||
const isRequired = required?.includes(key);
|
||||
return <Text key={key}>• {key}{isRequired && <Text dimColor={true}> (required)</Text>}:{" "}<Text dimColor={true}>{typeof value === "object" && value && "type" in value ? String(value.type) : "unknown"}</Text>{typeof value === "object" && value && "description" in value && <Text dimColor={true}> - {String(value.description)}</Text>}</Text>;
|
||||
})}</Box></Box>;
|
||||
$[32] = tool.inputJSONSchema;
|
||||
$[33] = t16;
|
||||
} else {
|
||||
t16 = $[33];
|
||||
}
|
||||
let t17;
|
||||
if ($[34] !== t12 || $[35] !== t14 || $[36] !== t15 || $[37] !== t16) {
|
||||
t17 = <Box flexDirection="column">{t12}{t14}{t15}{t16}</Box>;
|
||||
$[34] = t12;
|
||||
$[35] = t14;
|
||||
$[36] = t15;
|
||||
$[37] = t16;
|
||||
$[38] = t17;
|
||||
} else {
|
||||
t17 = $[38];
|
||||
}
|
||||
let t18;
|
||||
if ($[39] !== onBack || $[40] !== server.name || $[41] !== t17 || $[42] !== titleContent) {
|
||||
t18 = <Dialog title={titleContent} subtitle={server.name} onCancel={onBack} inputGuide={_temp}>{t17}</Dialog>;
|
||||
$[39] = onBack;
|
||||
$[40] = server.name;
|
||||
$[41] = t17;
|
||||
$[42] = titleContent;
|
||||
$[43] = t18;
|
||||
} else {
|
||||
t18 = $[43];
|
||||
}
|
||||
return t18;
|
||||
}
|
||||
function _temp(exitState) {
|
||||
return exitState.pending ? <Text>Press {exitState.keyName} again to exit</Text> : <ConfigurableShortcutHint action="confirm:no" context="Confirmation" fallback="Esc" description="go back" />;
|
||||
tools: [],
|
||||
},
|
||||
)
|
||||
setToolDescription(desc)
|
||||
} catch {
|
||||
setToolDescription('Failed to load description')
|
||||
}
|
||||
}
|
||||
void loadDescription()
|
||||
}, [tool])
|
||||
|
||||
const titleContent = (
|
||||
<>
|
||||
{displayName}
|
||||
{isReadOnly && <Text color="success"> [read-only]</Text>}
|
||||
{isDestructive && <Text color="error"> [destructive]</Text>}
|
||||
{isOpenWorld && <Text dimColor> [open-world]</Text>}
|
||||
</>
|
||||
)
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
title={titleContent}
|
||||
subtitle={server.name}
|
||||
onCancel={onBack}
|
||||
inputGuide={exitState =>
|
||||
exitState.pending ? (
|
||||
<Text>Press {exitState.keyName} again to exit</Text>
|
||||
) : (
|
||||
<ConfigurableShortcutHint
|
||||
action="confirm:no"
|
||||
context="Confirmation"
|
||||
fallback="Esc"
|
||||
description="go back"
|
||||
/>
|
||||
)
|
||||
}
|
||||
>
|
||||
<Box flexDirection="column">
|
||||
<Box>
|
||||
<Text bold>Tool name: </Text>
|
||||
<Text dimColor>{toolName}</Text>
|
||||
</Box>
|
||||
|
||||
<Box>
|
||||
<Text bold>Full name: </Text>
|
||||
<Text dimColor>{tool.name}</Text>
|
||||
</Box>
|
||||
|
||||
{toolDescription && (
|
||||
<Box flexDirection="column" marginTop={1}>
|
||||
<Text bold>Description:</Text>
|
||||
<Text wrap="wrap">{toolDescription}</Text>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{tool.inputJSONSchema &&
|
||||
tool.inputJSONSchema.properties &&
|
||||
Object.keys(tool.inputJSONSchema.properties).length > 0 && (
|
||||
<Box flexDirection="column" marginTop={1}>
|
||||
<Text bold>Parameters:</Text>
|
||||
<Box marginLeft={2} flexDirection="column">
|
||||
{Object.entries(tool.inputJSONSchema.properties).map(
|
||||
([key, value]) => {
|
||||
const required = tool.inputJSONSchema?.required as
|
||||
| string[]
|
||||
| undefined
|
||||
const isRequired = required?.includes(key)
|
||||
return (
|
||||
<Text key={key}>
|
||||
• {key}
|
||||
{isRequired && <Text dimColor> (required)</Text>}:{' '}
|
||||
<Text dimColor>
|
||||
{typeof value === 'object' && value && 'type' in value
|
||||
? String(value.type)
|
||||
: 'unknown'}
|
||||
</Text>
|
||||
{typeof value === 'object' &&
|
||||
value &&
|
||||
'description' in value && (
|
||||
<Text dimColor> - {String(value.description)}</Text>
|
||||
)}
|
||||
</Text>
|
||||
)
|
||||
},
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user