refactor(core): 重命名 grep_content 工具为 grep

- 重命名 grep_content.ts 为 grep.ts
- 更新工具名称从 grep_content 改为 grep
- 更新所有引用该工具的代码和测试文件
- 更新描述文件名称
This commit is contained in:
2025-12-16 15:03:33 +08:00
parent 452f19e2a9
commit 30f35a6562
14 changed files with 40 additions and 40 deletions
@@ -49,7 +49,7 @@ export const codeReviewerAgent: Omit<AgentInfo, 'name'> = {
'read_file',
'list_directory',
'search_files',
'grep_content',
'grep',
'git_status',
'git_diff',
],
+1 -1
View File
@@ -46,7 +46,7 @@ export const exploreAgent: Omit<AgentInfo, 'name'> = {
## 可用工具
- **glob**: 文件模式匹配 (*.ts, src/**/*.tsx)
- **grep_content**: 代码内容搜索
- **grep**: 代码内容搜索
- **read_file**: 读取文件内容
- **search_files**: 文件名搜索
- **list_directory**: 目录列表
+2 -2
View File
@@ -5,7 +5,7 @@ import type { AgentInfo } from '../types.js';
*
* 使用 ${variable} 语法支持动态变量替换:
* - ${tools.glob} -> glob
* - ${tools.grep} -> grep_content
* - ${tools.grep} -> grep
* - ${tools.read} -> read_file
* - ${tools.bash} -> bash
* - ${plan.planFilePath} -> 计划文件路径
@@ -92,7 +92,7 @@ export const planAgent: Omit<AgentInfo, 'name'> = {
'list_directory',
'search_files',
'glob',
'grep_content',
'grep',
'get_file_info',
// Git 只读
'git_status',
@@ -242,7 +242,7 @@ export function render(
*/
export const DEFAULT_TOOL_NAMES: ToolNameMapping = {
glob: 'glob',
grep: 'grep_content',
grep: 'grep',
read: 'read_file',
write: 'write_file',
edit: 'edit_file',
@@ -11,11 +11,11 @@ interface GrepMatch {
content: string;
}
export const grepContentTool: ToolWithMetadata = {
name: 'grep_content',
description: loadDescription('grep_content'),
export const grepTool: ToolWithMetadata = {
name: 'grep',
description: loadDescription('grep'),
metadata: {
name: 'grep_content',
name: 'grep',
category: 'filesystem',
description: '在文件内容中搜索文本',
keywords: ['grep', 'search', 'content', 'text', 'find', 'regex', '搜索', '内容', '文本', '查找', '正则'],
+1 -1
View File
@@ -11,7 +11,7 @@ export { createDirectoryTool } from './create_directory.js';
// 搜索
export { searchFilesTool } from './search_files.js';
export { globTool } from './glob.js';
export { grepContentTool } from './grep_content.js';
export { grepTool } from './grep.js';
// 文件信息
export { getFileInfoTool } from './get_file_info.js';
+2 -2
View File
@@ -24,7 +24,7 @@ import {
createDirectoryTool,
searchFilesTool,
globTool,
grepContentTool,
grepTool,
getFileInfoTool,
moveFileTool,
copyFileTool,
@@ -90,7 +90,7 @@ const allToolsWithMetadata: ToolWithMetadata[] = [
createDirectoryTool,
searchFilesTool,
globTool,
grepContentTool,
grepTool,
getFileInfoTool,
moveFileTool,
copyFileTool,
+1 -1
View File
@@ -18,7 +18,7 @@ const TOOL_CATEGORY_MAP: Record<string, string> = {
create_directory: 'filesystem',
search_files: 'filesystem',
glob: 'filesystem',
grep_content: 'filesystem',
grep: 'filesystem',
get_file_info: 'filesystem',
move_file: 'filesystem',
copy_file: 'filesystem',
@@ -45,7 +45,7 @@ export const enterPlanModeTool: ToolWithMetadata = {
计划模式中的限制:
进入后只能使用只读工具:
✅ read_file, list_directory, search_files, grep_content
✅ read_file, list_directory, search_files, grep
✅ web_search, web_extract
✅ task(探索代理)
✅ ask_user_question