mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 06:15:51 +00:00
* 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>
149 lines
3.9 KiB
TypeScript
149 lines
3.9 KiB
TypeScript
import figures from 'figures'
|
|
import * as React from 'react'
|
|
import type { KeyboardEvent } from '../../ink/events/keyboard-event.js'
|
|
import { Box, Text } from '../../ink.js'
|
|
import { useKeybinding } from '../../keybindings/useKeybinding.js'
|
|
import type { Tools } from '../../Tool.js'
|
|
import { getAgentColor } from '../../tools/AgentTool/agentColorManager.js'
|
|
import { getMemoryScopeDisplay } from '../../tools/AgentTool/agentMemory.js'
|
|
import { resolveAgentTools } from '../../tools/AgentTool/agentToolUtils.js'
|
|
import {
|
|
type AgentDefinition,
|
|
isBuiltInAgent,
|
|
} from '../../tools/AgentTool/loadAgentsDir.js'
|
|
import { getAgentModelDisplay } from '../../utils/model/agent.js'
|
|
import { Markdown } from '../Markdown.js'
|
|
import { getActualRelativeAgentFilePath } from './agentFileUtils.js'
|
|
|
|
type Props = {
|
|
agent: AgentDefinition
|
|
tools: Tools
|
|
allAgents?: AgentDefinition[]
|
|
onBack: () => void
|
|
}
|
|
|
|
export function AgentDetail({ agent, tools, onBack }: Props): React.ReactNode {
|
|
const resolvedTools = resolveAgentTools(agent, tools, false)
|
|
const filePath = getActualRelativeAgentFilePath(agent)
|
|
const backgroundColor = getAgentColor(agent.agentType)
|
|
|
|
// Handle Esc to go back
|
|
useKeybinding('confirm:no', onBack, { context: 'Confirmation' })
|
|
|
|
// Handle Enter to go back
|
|
const handleKeyDown = (e: KeyboardEvent) => {
|
|
if (e.key === 'return') {
|
|
e.preventDefault()
|
|
onBack()
|
|
}
|
|
}
|
|
|
|
function renderToolsList(): React.ReactNode {
|
|
if (resolvedTools.hasWildcard) {
|
|
return <Text>All tools</Text>
|
|
}
|
|
|
|
if (!agent.tools || agent.tools.length === 0) {
|
|
return <Text>None</Text>
|
|
}
|
|
|
|
return (
|
|
<>
|
|
{resolvedTools.validTools.length > 0 && (
|
|
<Text>{resolvedTools.validTools.join(', ')}</Text>
|
|
)}
|
|
{resolvedTools.invalidTools.length > 0 && (
|
|
<Text color="warning">
|
|
{figures.warning} Unrecognized:{' '}
|
|
{resolvedTools.invalidTools.join(', ')}
|
|
</Text>
|
|
)}
|
|
</>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Box
|
|
flexDirection="column"
|
|
gap={1}
|
|
tabIndex={0}
|
|
autoFocus
|
|
onKeyDown={handleKeyDown}
|
|
>
|
|
<Text dimColor>{filePath}</Text>
|
|
|
|
<Box flexDirection="column">
|
|
<Text>
|
|
<Text bold>Description</Text> (tells Claude when to use this agent):
|
|
</Text>
|
|
<Box marginLeft={2}>
|
|
<Text>{agent.whenToUse}</Text>
|
|
</Box>
|
|
</Box>
|
|
|
|
<Box>
|
|
<Text>
|
|
<Text bold>Tools</Text>:{' '}
|
|
</Text>
|
|
{renderToolsList()}
|
|
</Box>
|
|
|
|
<Text>
|
|
<Text bold>Model</Text>: {getAgentModelDisplay(agent.model)}
|
|
</Text>
|
|
|
|
{agent.permissionMode && (
|
|
<Text>
|
|
<Text bold>Permission mode</Text>: {agent.permissionMode}
|
|
</Text>
|
|
)}
|
|
|
|
{agent.memory && (
|
|
<Text>
|
|
<Text bold>Memory</Text>: {getMemoryScopeDisplay(agent.memory)}
|
|
</Text>
|
|
)}
|
|
|
|
{agent.hooks && Object.keys(agent.hooks).length > 0 && (
|
|
<Text>
|
|
<Text bold>Hooks</Text>: {Object.keys(agent.hooks).join(', ')}
|
|
</Text>
|
|
)}
|
|
|
|
{agent.skills && agent.skills.length > 0 && (
|
|
<Text>
|
|
<Text bold>Skills</Text>:{' '}
|
|
{agent.skills.length > 10
|
|
? `${agent.skills.length} skills`
|
|
: agent.skills.join(', ')}
|
|
</Text>
|
|
)}
|
|
|
|
{backgroundColor && (
|
|
<Box>
|
|
<Text>
|
|
<Text bold>Color</Text>:{' '}
|
|
<Text backgroundColor={backgroundColor} color="inverseText">
|
|
{' '}
|
|
{agent.agentType}{' '}
|
|
</Text>
|
|
</Text>
|
|
</Box>
|
|
)}
|
|
|
|
{!isBuiltInAgent(agent) && (
|
|
<>
|
|
<Box>
|
|
<Text>
|
|
<Text bold>System prompt</Text>:
|
|
</Text>
|
|
</Box>
|
|
<Box marginLeft={2} marginRight={2}>
|
|
<Markdown>{agent.getSystemPrompt()}</Markdown>
|
|
</Box>
|
|
</>
|
|
)}
|
|
</Box>
|
|
)
|
|
}
|