> ## Documentation Index
> Fetch the complete documentation index at: https://cat.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Cline 工具参考指南

## Cline 能做什么？

Cline 是您的 AI 助手，可以：

* 编辑和创建项目中的文件
* 运行终端命令
* 搜索和分析您的代码
* 帮助调试和修复问题
* 自动化重复性任务
* 与外部工具集成

## 首要步骤

1. **开始一个任务**

   * 在聊天中输入您的请求
   * 示例："创建一个名为 Header 的新 React 组件"

2. **提供上下文**

   * 使用 @ 提及添加文件、文件夹或 URL
   * 示例："@file:src/components/App.tsx"

3. **审查更改**
   * Cline 会在进行更改之前显示差异
   * 您可以编辑或拒绝更改

## 主要功能

1. **文件编辑**

   * 创建新文件
   * 修改现有代码
   * 跨文件搜索和替换

2. **终端命令**

   * 运行 npm 命令
   * 启动开发服务器
   * 安装依赖项

3. **代码分析**

   * 查找和修复错误
   * 重构代码
   * 添加文档

4. **浏览器集成**
   * 测试网页
   * 捕获屏幕截图
   * 检查控制台日志

## 可用工具

有关最新的实现详细信息，您可以在 [Cline 存储库](https://github.com/cline/cline/blob/main/src/core/Cline.ts) 中查看完整的源代码。

Cline 可以访问以下工具来执行各种任务：

1. **文件操作**

   * `write_to_file`：创建或覆盖文件
   * `read_file`：读取文件内容
   * `replace_in_file`：对文件进行有针对性的编辑
   * `search_files`：使用正则表达式搜索文件
   * `list_files`：列出目录内容

2. **终端操作**

   * `execute_command`：运行 CLI 命令
   * `list_code_definition_names`：列出代码定义

3. **MCP 工具**

   * `use_mcp_tool`：使用来自 MCP 服务器的工具
   * `access_mcp_resource`：访问 MCP 服务器资源
   * 用户可以创建 Cline 然后可以访问的自定义 MCP 工具
   * 示例：创建一个 Cline 可以用来获取天气预报的天气 API 工具

4. **交互工具**
   * `ask_followup_question`：向用户询问澄清
   * `attempt_completion`：展示最终结果

每个工具都有特定的参数和使用模式。以下是一些示例：

* 创建新文件（write\_to\_file）：

  ```xml
  <write_to_file>
  <path>src/components/Header.tsx</path>
  <content>
  // Header 组件代码
  </content>
  </write_to_file>
  ```

* 搜索模式（search\_files）：

  ```xml
  <search_files>
  <path>src</path>
  <regex>function\s+\w+\(</regex>
  <file_pattern>*.ts</file_pattern>
  </search_files>
  ```

* 运行命令（execute\_command）：
  ```xml
  <execute_command>
  <command>npm install axios</command>
  <requires_approval>false</requires_approval>
  </execute_command>
  ```

## 常见任务

1. **创建新组件**

   * "创建一个名为 Footer 的新 React 组件"

2. **修复错误**

   * "修复 src/utils/format.ts 中的错误"

3. **重构代码**

   * "重构 Button 组件以使用 TypeScript"

4. **运行命令**
   * "运行 npm install 以添加 axios"

## 获得帮助

* [加入 Discord 社区](https://discord.gg/cline)
* 查看文档
* 提供反馈以改进 Cline


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.