mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +00:00
feat: 工具层及 mcp 大重构 (#252)
* feat: 第一版大重构 * fix: 修复类型问题 * chore: 更新版本到 1.3.2 * Add brave as alternative WebSearchTool * fix: 修正顺序 * fix: 修复对穷鬼模式的 auto dream 和 session memory 越过 * feat: 穷鬼模式去除 session-summary * feat: 创建 builtin-tools 包,搬运所有工具实现 将 src/tools/ 下的全部 60 个工具目录迁移至 packages/builtin-tools/src/tools/, 内部导入路径已更新为 src/ alias 模式。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: 更新 src/ 中所有工具引用至 builtin-tools 包,删除 src/tools/ - src/tools.ts 及 178 个 src/ 文件的 import 路径从 ./tools/ 改为 builtin-tools/tools/ - 删除 src/tools/ 整个目录(已迁移至 packages/builtin-tools/) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: 添加 builtin-tools 路径别名至 tsconfig,更新 bun.lock - tsconfig.json 新增 builtin-tools/* 和 builtin-tools 路径映射 - 新增 packages/builtin-tools/src 至 include Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: 为 builtin-tools、mcp-client、agent-tools 添加 @claude-code-best 作用域前缀 所有包名及 import 路径统一添加 @claude-code-best/ 前缀: - builtin-tools → @claude-code-best/builtin-tools - mcp-client → @claude-code-best/mcp-client - agent-tools → @claude-code-best/agent-tools Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: 修复 node 环境没有 bun 的问题 --------- Co-authored-by: Eric-Guo <eric.guocz@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,13 +3,13 @@ import * as React from 'react'
|
||||
import { type KeyboardEvent, Box, Text } from '@anthropic/ink'
|
||||
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 { getAgentColor } from '@claude-code-best/builtin-tools/tools/AgentTool/agentColorManager.js'
|
||||
import { getMemoryScopeDisplay } from '@claude-code-best/builtin-tools/tools/AgentTool/agentMemory.js'
|
||||
import { resolveAgentTools } from '@claude-code-best/builtin-tools/tools/AgentTool/agentToolUtils.js'
|
||||
import {
|
||||
type AgentDefinition,
|
||||
isBuiltInAgent,
|
||||
} from '../../tools/AgentTool/loadAgentsDir.js'
|
||||
} from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import { getAgentModelDisplay } from '../../utils/model/agent.js'
|
||||
import { Markdown } from '../Markdown.js'
|
||||
import { getActualRelativeAgentFilePath } from './agentFileUtils.js'
|
||||
|
||||
@@ -9,13 +9,13 @@ import type { Tools } from '../../Tool.js'
|
||||
import {
|
||||
type AgentColorName,
|
||||
setAgentColor,
|
||||
} from '../../tools/AgentTool/agentColorManager.js'
|
||||
} from '@claude-code-best/builtin-tools/tools/AgentTool/agentColorManager.js'
|
||||
import {
|
||||
type AgentDefinition,
|
||||
getActiveAgentsFromList,
|
||||
isCustomAgent,
|
||||
isPluginAgent,
|
||||
} from '../../tools/AgentTool/loadAgentsDir.js'
|
||||
} from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import { editFileInEditor } from '../../utils/promptEditor.js'
|
||||
import { getActualAgentFilePath, updateAgentFile } from './agentFileUtils.js'
|
||||
import { ColorPicker } from './ColorPicker.js'
|
||||
|
||||
@@ -2,14 +2,14 @@ import figures from 'figures'
|
||||
import * as React from 'react'
|
||||
import type { SettingSource } from 'src/utils/settings/constants.js'
|
||||
import { type KeyboardEvent, Box, Text } from '@anthropic/ink'
|
||||
import type { ResolvedAgent } from '../../tools/AgentTool/agentDisplay.js'
|
||||
import type { ResolvedAgent } from '@claude-code-best/builtin-tools/tools/AgentTool/agentDisplay.js'
|
||||
import {
|
||||
AGENT_SOURCE_GROUPS,
|
||||
compareAgentsByName,
|
||||
getOverrideSourceLabel,
|
||||
resolveAgentModelDisplay,
|
||||
} from '../../tools/AgentTool/agentDisplay.js'
|
||||
import type { AgentDefinition } from '../../tools/AgentTool/loadAgentsDir.js'
|
||||
} from '@claude-code-best/builtin-tools/tools/AgentTool/agentDisplay.js'
|
||||
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import { count } from '../../utils/array.js'
|
||||
import { Dialog, Divider } from '@anthropic/ink'
|
||||
import { getAgentSourceDisplayName } from './utils.js'
|
||||
|
||||
@@ -11,11 +11,11 @@ import type { Tools } from '../../Tool.js'
|
||||
import {
|
||||
type ResolvedAgent,
|
||||
resolveAgentOverrides,
|
||||
} from '../../tools/AgentTool/agentDisplay.js'
|
||||
} from '@claude-code-best/builtin-tools/tools/AgentTool/agentDisplay.js'
|
||||
import {
|
||||
type AgentDefinition,
|
||||
getActiveAgentsFromList,
|
||||
} from '../../tools/AgentTool/loadAgentsDir.js'
|
||||
} from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import { toError } from '../../utils/errors.js'
|
||||
import { logError } from '../../utils/log.js'
|
||||
import { Select } from '../CustomSelect/select.js'
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
AGENT_COLOR_TO_THEME_COLOR,
|
||||
AGENT_COLORS,
|
||||
type AgentColorName,
|
||||
} from '../../tools/AgentTool/agentColorManager.js'
|
||||
} from '@claude-code-best/builtin-tools/tools/AgentTool/agentColorManager.js'
|
||||
import { capitalize } from '../../utils/stringUtils.js'
|
||||
|
||||
type ColorOption = AgentColorName | 'automatic'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Auto-generated stub — replace with real implementation
|
||||
import type React from 'react';
|
||||
import type { AgentMemoryScope } from '../../tools/AgentTool/agentMemory.js';
|
||||
import type { AgentMemoryScope } from '@claude-code-best/builtin-tools/tools/AgentTool/agentMemory.js';
|
||||
|
||||
export {};
|
||||
export const SnapshotUpdateDialog: React.FC<{
|
||||
|
||||
@@ -3,24 +3,24 @@ import React, { useCallback, useMemo, useState } from 'react'
|
||||
import { mcpInfoFromString } from 'src/services/mcp/mcpStringUtils.js'
|
||||
import { isMcpTool } from 'src/services/mcp/utils.js'
|
||||
import type { Tool, Tools } from 'src/Tool.js'
|
||||
import { filterToolsForAgent } from 'src/tools/AgentTool/agentToolUtils.js'
|
||||
import { AGENT_TOOL_NAME } from 'src/tools/AgentTool/constants.js'
|
||||
import { BashTool } from 'src/tools/BashTool/BashTool.js'
|
||||
import { ExitPlanModeV2Tool } from 'src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js'
|
||||
import { FileEditTool } from 'src/tools/FileEditTool/FileEditTool.js'
|
||||
import { FileReadTool } from 'src/tools/FileReadTool/FileReadTool.js'
|
||||
import { FileWriteTool } from 'src/tools/FileWriteTool/FileWriteTool.js'
|
||||
import { GlobTool } from 'src/tools/GlobTool/GlobTool.js'
|
||||
import { GrepTool } from 'src/tools/GrepTool/GrepTool.js'
|
||||
import { ListMcpResourcesTool } from 'src/tools/ListMcpResourcesTool/ListMcpResourcesTool.js'
|
||||
import { NotebookEditTool } from 'src/tools/NotebookEditTool/NotebookEditTool.js'
|
||||
import { ReadMcpResourceTool } from 'src/tools/ReadMcpResourceTool/ReadMcpResourceTool.js'
|
||||
import { TaskOutputTool } from 'src/tools/TaskOutputTool/TaskOutputTool.js'
|
||||
import { TaskStopTool } from 'src/tools/TaskStopTool/TaskStopTool.js'
|
||||
import { TodoWriteTool } from 'src/tools/TodoWriteTool/TodoWriteTool.js'
|
||||
import { TungstenTool } from 'src/tools/TungstenTool/TungstenTool.js'
|
||||
import { WebFetchTool } from 'src/tools/WebFetchTool/WebFetchTool.js'
|
||||
import { WebSearchTool } from 'src/tools/WebSearchTool/WebSearchTool.js'
|
||||
import { filterToolsForAgent } from '@claude-code-best/builtin-tools/tools/AgentTool/agentToolUtils.js'
|
||||
import { AGENT_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/AgentTool/constants.js'
|
||||
import { BashTool } from '@claude-code-best/builtin-tools/tools/BashTool/BashTool.js'
|
||||
import { ExitPlanModeV2Tool } from '@claude-code-best/builtin-tools/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js'
|
||||
import { FileEditTool } from '@claude-code-best/builtin-tools/tools/FileEditTool/FileEditTool.js'
|
||||
import { FileReadTool } from '@claude-code-best/builtin-tools/tools/FileReadTool/FileReadTool.js'
|
||||
import { FileWriteTool } from '@claude-code-best/builtin-tools/tools/FileWriteTool/FileWriteTool.js'
|
||||
import { GlobTool } from '@claude-code-best/builtin-tools/tools/GlobTool/GlobTool.js'
|
||||
import { GrepTool } from '@claude-code-best/builtin-tools/tools/GrepTool/GrepTool.js'
|
||||
import { ListMcpResourcesTool } from '@claude-code-best/builtin-tools/tools/ListMcpResourcesTool/ListMcpResourcesTool.js'
|
||||
import { NotebookEditTool } from '@claude-code-best/builtin-tools/tools/NotebookEditTool/NotebookEditTool.js'
|
||||
import { ReadMcpResourceTool } from '@claude-code-best/builtin-tools/tools/ReadMcpResourceTool/ReadMcpResourceTool.js'
|
||||
import { TaskOutputTool } from '@claude-code-best/builtin-tools/tools/TaskOutputTool/TaskOutputTool.js'
|
||||
import { TaskStopTool } from '@claude-code-best/builtin-tools/tools/TaskStopTool/TaskStopTool.js'
|
||||
import { TodoWriteTool } from '@claude-code-best/builtin-tools/tools/TodoWriteTool/TodoWriteTool.js'
|
||||
import { TungstenTool } from '@claude-code-best/builtin-tools/tools/TungstenTool/TungstenTool.js'
|
||||
import { WebFetchTool } from '@claude-code-best/builtin-tools/tools/WebFetchTool/WebFetchTool.js'
|
||||
import { WebSearchTool } from '@claude-code-best/builtin-tools/tools/WebSearchTool/WebSearchTool.js'
|
||||
import { type KeyboardEvent, Box, Text } from '@anthropic/ink'
|
||||
import { useKeybinding } from '../../keybindings/useKeybinding.js'
|
||||
import { count } from '../../utils/array.js'
|
||||
|
||||
@@ -2,12 +2,12 @@ import { mkdir, open, unlink } from 'fs/promises'
|
||||
import { join } from 'path'
|
||||
import type { SettingSource } from 'src/utils/settings/constants.js'
|
||||
import { getManagedFilePath } from 'src/utils/settings/managedPath.js'
|
||||
import type { AgentMemoryScope } from '../../tools/AgentTool/agentMemory.js'
|
||||
import type { AgentMemoryScope } from '@claude-code-best/builtin-tools/tools/AgentTool/agentMemory.js'
|
||||
import {
|
||||
type AgentDefinition,
|
||||
isBuiltInAgent,
|
||||
isPluginAgent,
|
||||
} from '../../tools/AgentTool/loadAgentsDir.js'
|
||||
} from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import { getCwd } from '../../utils/cwd.js'
|
||||
import type { EffortValue } from '../../utils/effort.js'
|
||||
import { getClaudeConfigHomeDir } from '../../utils/envUtils.js'
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { ContentBlock } from '@anthropic-ai/sdk/resources/index.mjs'
|
||||
import { getUserContext } from 'src/context.js'
|
||||
import { queryModelWithoutStreaming } from 'src/services/api/claude.js'
|
||||
import { getEmptyToolPermissionContext } from 'src/Tool.js'
|
||||
import { AGENT_TOOL_NAME } from 'src/tools/AgentTool/constants.js'
|
||||
import { AGENT_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/AgentTool/constants.js'
|
||||
import { prependUserContext } from 'src/utils/api.js'
|
||||
import {
|
||||
createUserMessage,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { type ReactNode } from 'react'
|
||||
import { isAutoMemoryEnabled } from '../../../memdir/paths.js'
|
||||
import type { Tools } from '../../../Tool.js'
|
||||
import type { AgentDefinition } from '../../../tools/AgentTool/loadAgentsDir.js'
|
||||
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import { WizardProvider } from '../../wizard/index.js'
|
||||
import type { WizardStepComponent } from '../../wizard/types.js'
|
||||
import type { AgentWizardData } from './types.js'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { type ReactNode } from 'react'
|
||||
import { Box, Byline, KeyboardShortcutHint } from '@anthropic/ink'
|
||||
import { useKeybinding } from '../../../../keybindings/useKeybinding.js'
|
||||
import type { AgentColorName } from '../../../../tools/AgentTool/agentColorManager.js'
|
||||
import type { AgentColorName } from '@claude-code-best/builtin-tools/tools/AgentTool/agentColorManager.js'
|
||||
import { ConfigurableShortcutHint } from '../../../ConfigurableShortcutHint.js'
|
||||
import { useWizard } from '../../../wizard/index.js'
|
||||
import { WizardDialogLayout } from '../../../wizard/WizardDialogLayout.js'
|
||||
|
||||
@@ -3,8 +3,8 @@ import { type KeyboardEvent, Box, Byline, KeyboardShortcutHint, Text } from '@an
|
||||
import { useKeybinding } from '../../../../keybindings/useKeybinding.js'
|
||||
import { isAutoMemoryEnabled } from '../../../../memdir/paths.js'
|
||||
import type { Tools } from '../../../../Tool.js'
|
||||
import { getMemoryScopeDisplay } from '../../../../tools/AgentTool/agentMemory.js'
|
||||
import type { AgentDefinition } from '../../../../tools/AgentTool/loadAgentsDir.js'
|
||||
import { getMemoryScopeDisplay } from '@claude-code-best/builtin-tools/tools/AgentTool/agentMemory.js'
|
||||
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import { truncateToWidth } from '../../../../utils/format.js'
|
||||
import { getAgentModelDisplay } from '../../../../utils/model/agent.js'
|
||||
import { ConfigurableShortcutHint } from '../../../ConfigurableShortcutHint.js'
|
||||
|
||||
@@ -6,8 +6,8 @@ import {
|
||||
} from 'src/services/analytics/index.js'
|
||||
import { useSetAppState } from 'src/state/AppState.js'
|
||||
import type { Tools } from '../../../../Tool.js'
|
||||
import type { AgentDefinition } from '../../../../tools/AgentTool/loadAgentsDir.js'
|
||||
import { getActiveAgentsFromList } from '../../../../tools/AgentTool/loadAgentsDir.js'
|
||||
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import { getActiveAgentsFromList } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import { editFileInEditor } from '../../../../utils/promptEditor.js'
|
||||
import { useWizard } from '../../../wizard/index.js'
|
||||
import { getNewAgentFilePath, saveAgentToFile } from '../../agentFileUtils.js'
|
||||
|
||||
@@ -5,7 +5,7 @@ import { isAutoMemoryEnabled } from '../../../../memdir/paths.js'
|
||||
import {
|
||||
type AgentMemoryScope,
|
||||
loadAgentMemoryPrompt,
|
||||
} from '../../../../tools/AgentTool/agentMemory.js'
|
||||
} from '@claude-code-best/builtin-tools/tools/AgentTool/agentMemory.js'
|
||||
import { ConfigurableShortcutHint } from '../../../ConfigurableShortcutHint.js'
|
||||
import { Select } from '../../../CustomSelect/select.js'
|
||||
import { useWizard } from '../../../wizard/index.js'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { type ReactNode, useState } from 'react'
|
||||
import { Box, Byline, KeyboardShortcutHint, Text } from '@anthropic/ink'
|
||||
import { useKeybinding } from '../../../../keybindings/useKeybinding.js'
|
||||
import type { AgentDefinition } from '../../../../tools/AgentTool/loadAgentsDir.js'
|
||||
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import { ConfigurableShortcutHint } from '../../../ConfigurableShortcutHint.js'
|
||||
import TextInput from '../../../TextInput.js'
|
||||
import { useWizard } from '../../../wizard/index.js'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { SettingSource } from 'src/utils/settings/constants.js'
|
||||
import type { AgentDefinition } from '../../tools/AgentTool/loadAgentsDir.js'
|
||||
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
|
||||
export const AGENT_PATHS = {
|
||||
FOLDER_NAME: '.claude',
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { Tools } from '../../Tool.js'
|
||||
import { resolveAgentTools } from '../../tools/AgentTool/agentToolUtils.js'
|
||||
import { resolveAgentTools } from '@claude-code-best/builtin-tools/tools/AgentTool/agentToolUtils.js'
|
||||
import type {
|
||||
AgentDefinition,
|
||||
CustomAgentDefinition,
|
||||
} from '../../tools/AgentTool/loadAgentsDir.js'
|
||||
} from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import { getAgentSourceDisplayName } from './utils.js'
|
||||
|
||||
export type AgentValidationResult = {
|
||||
|
||||
Reference in New Issue
Block a user