【阶段一 · 紧急修复 F1】 - F1-1 file_editor regex 计数 bug:强制 g 标志 + 同一 RegExp 实例做 match+replace - F1-2 code_search 统一 safeResolvePath(含路径遍历 + MEMORY.md 拦截) - F1-3 git_commit amend 模式:message 可选 + --no-edit 防止编辑器 hang - F1-4 write_file append 模式原子化:显式 open(O_APPEND)+write+fsync+close 【阶段二 · 增强现有工具 F2】 - F2-1 read_file 智能编码检测:BOM(UTF-8/UTF-16 LE/BE) + GBK 降级 - F2-2 read_file 支持 tail 模式(读取末尾 N 行,适用日志) - F2-3 search_files 二进制过滤 + 智能编码检测 - F2-4 search_files 多 glob 匹配(逗号分隔,如 *.ts,*.js) - F2-5 file_editor 新增 find_replace 操作(字面量替换,规避正则歧义) - F2-6 file_editor regex 支持跨行匹配(multiline 参数) - F2-7 file_editor 新增 backup 参数(编辑前 .bak 备份) 【阶段三 · 新增工具 F3】 - F3-1 file_move:双路径校验 + overwrite + 自动建父目录 + rename 原子 - F3-2 file_info:大小/时间/类型/编码/二进制/权限位 【阶段四 · 优化 F4】 - F4-1 diff_viewer Uint32Array→Uint16Array(省一半内存)+ safeResolvePath + 智能编码 - F4-2 错误处理统一:diff-viewer/file-editor/code-search catch 块改用 extractErrorMessage 【阶段五 · 验证 F5】 - tsc --noEmit 类型检查通过 - 人工审查通过:路径校验/错误处理/原子性/资源释放/权限策略/导出注册 工具数量:13 → 15(新增 file_move / file_info)
65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
/**
|
|
* 内置工具导出
|
|
*
|
|
* v0.3.3: 从 27 个工具扩展到 29 个工具
|
|
* 新增:file_move, file_info
|
|
*
|
|
* v0.3.2: 从 26 个工具扩展到 27 个工具
|
|
* 新增:delete_file
|
|
*
|
|
* v0.3.1: 从 15 个工具扩展到 26 个工具
|
|
* 新增:git_status, git_diff, git_log, git_commit, lint_code, run_tests,
|
|
* project_info, http_request, todo_write, think, view_image
|
|
*
|
|
* v0.2.0: 从 11 个工具扩展到 15 个工具
|
|
* 新增:file_editor, code_search, task_manager, diff_viewer
|
|
*
|
|
* @see docs/MetonaAI-Desktop 架构与交互设计.html — 9 个基础工具
|
|
*/
|
|
|
|
// 文件系统工具(7 个)
|
|
export { ReadFileTool, WriteFileTool, ListDirectoryTool, SearchFilesTool, DeleteFileTool, FileMoveTool, FileInfoTool } from './filesystem';
|
|
// v0.2.0: 精准文件编辑工具
|
|
export { FileEditorTool } from './file-editor';
|
|
// v0.2.0: ripgrep 代码搜索工具
|
|
export { CodeSearchTool } from './code-search';
|
|
// v0.2.0: 文件差异对比工具
|
|
export { DiffViewerTool } from './diff-viewer';
|
|
|
|
// 网络工具(2 个)
|
|
export { WebSearchTool, WebFetchTool } from './network';
|
|
|
|
// 记忆工具(2 个)
|
|
export { MemoryStoreTool, MemorySearchTool } from './memory';
|
|
|
|
// 命令工具(1 个)
|
|
export { RunCommandTool } from './command';
|
|
|
|
// 浏览器工具(1 个)
|
|
export { WebBrowserTool, cleanupBrowser, getBrowserManager } from './browser';
|
|
|
|
// 委派工具(1 个)
|
|
export { DelegateTaskTool } from './delegate-task';
|
|
|
|
// v0.2.0: 任务管理工具(1 个)
|
|
export { TaskManagerTool } from './task-manager';
|
|
|
|
// v0.3.1: Git 工具集(4 个)
|
|
export { GitStatusTool, GitDiffTool, GitLogTool, GitCommitTool } from './git';
|
|
|
|
// v0.3.1: 开发工具集(3 个)
|
|
export { LintCodeTool, RunTestsTool, ProjectInfoTool } from './dev-tools';
|
|
|
|
// v0.3.1: HTTP 请求工具(1 个)
|
|
export { HttpRequestTool } from './http-request';
|
|
|
|
// v0.3.1: TODO 管理工具(1 个)
|
|
export { TodoWriteTool } from './todo';
|
|
|
|
// v0.3.1: 结构化思考工具(1 个)
|
|
export { ThinkTool } from './think';
|
|
|
|
// v0.3.1: 图片查看工具(1 个)
|
|
export { ViewImageTool } from './view-image';
|
|
|