caa9c01228
ext-vscode-test-e2e / Detect Changes (push) Has been cancelled
ext-vscode-test / Detect Changes (push) Has been cancelled
ext-vscode-test / test (push) Has been cancelled
ext-vscode-test-e2e / matrix_prep (push) Has been cancelled
ext-vscode-test-e2e / e2e (push) Has been cancelled
ext-vscode-test / qlty (push) Has been cancelled
ext-vscode-test / Quality Checks (push) Has been cancelled
ext-vscode-test / vscode test (push) Has been cancelled
ext-vscode-test / vscode test (windows-latest) (push) Has been cancelled
ext-vscode-test / test-platform-integration (push) Has been cancelled
240 lines
9.1 KiB
Markdown
240 lines
9.1 KiB
Markdown
<!-- WEHUB_ZH_README -->
|
||
> [!NOTE]
|
||
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
|
||
> [English](./README.en.md) · [原始项目](https://github.com/cline/cline) · [上游 README](https://github.com/cline/cline/blob/HEAD/README.md)
|
||
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
|
||
|
||
<p align="center">
|
||
<img src="assets/icons/icon.png" width="80" alt="Cline" />
|
||
</p>
|
||
|
||
<h1 align="center">Cline</h1>
|
||
|
||
<p align="center">
|
||
在你的 IDE 和终端中运行的开源编码智能体。
|
||
</p>
|
||
|
||
<div align="center">
|
||
|
||
<div align="center">
|
||
<table>
|
||
<tbody>
|
||
<td align="center">
|
||
<a href="https://docs.cline.bot" target="_blank"><strong>文档</strong></a>
|
||
</td>
|
||
<td align="center">
|
||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||
</td>
|
||
<td align="center">
|
||
<a href="https://www.reddit.com/r/cline/" target="_blank"><strong>r/cline</strong></a>
|
||
</td>
|
||
<td align="center">
|
||
<a href="https://github.com/cline/cline/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop" target="_blank"><strong>功能请求</strong></a>
|
||
</td>
|
||
<td align="center">
|
||
<a href="https://cline.bot/join-us" target="_blank"><strong>加入我们!</strong></a>
|
||
</td>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<br>
|
||
|
||
<div align="center">
|
||
<table>
|
||
<tr>
|
||
<td align="center" width="50%">
|
||
|
||
### CLI
|
||
|
||
在终端中运行 Cline。
|
||
支持交互式聊天,也可在 CI/CD 和脚本中完全无头(headless)运行。
|
||
|
||
```
|
||
npm i -g cline
|
||
```
|
||
|
||
<a href="./apps/cli/README.md">了解更多</a>
|
||
<br><br>
|
||
|
||
</td>
|
||
<td align="center" width="50%">
|
||
|
||
### Kanban
|
||
|
||
通过基于 Web 的任务看板并行运行多个智能体。每张卡片拥有独立的工作树(worktree)、自动提交和依赖链。
|
||
|
||
```
|
||
npm i -g kanban
|
||
```
|
||
|
||
<a href="https://github.com/cline/kanban">了解更多</a>
|
||
<br><br>
|
||
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td align="center" width="50%">
|
||
|
||
### VS Code Extension
|
||
|
||
编辑器中的 AI 编程助手。
|
||
创建文件、运行命令、浏览网页,并在人机协同(human-in-the-loop)审批下使用工具。
|
||
|
||
<a href="https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev">从 VS Marketplace 安装</a>
|
||
<br><br>
|
||
|
||
</td>
|
||
<td align="center" width="50%">
|
||
|
||
### JetBrains Plugin
|
||
|
||
在 IntelliJ IDEA、PyCharm、WebStorm、GoLand 及整个 JetBrains 产品家族中享受相同的 Cline 体验。
|
||
|
||
<a href="https://plugins.jetbrains.com/plugin/28247-cline">从 JetBrains Marketplace 安装</a>
|
||
<br><br>
|
||
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div align="center">
|
||
<table>
|
||
<tr>
|
||
<td align="center">
|
||
|
||
### SDK
|
||
|
||
基于驱动 CLI、Kanban、VS Code 扩展和 JetBrains 插件的同一引擎,构建你自己的 AI 智能体与集成。支持自定义工具、多智能体团队、连接器、定时自动化等更多能力。
|
||
|
||
```
|
||
npm install @cline/sdk
|
||
```
|
||
|
||
<a href="https://docs.cline.bot/cline-sdk/overview">文档</a>
|
||
<br><br>
|
||
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
---
|
||
|
||
## 索引
|
||
|
||
| 产品 | 描述 | 位置 | CHANGELOG |
|
||
|---------|------------|--------------|--------------|
|
||
| **SDK** | Node.js 程序化智能体 API 与扩展导出。 | [`sdk/`](https://github.com/cline/cline/tree/main/sdk) | [CHANGELOG.md](https://github.com/cline/cline/blob/main/sdk/CHANGELOG.md) |
|
||
| **CLI** | 终端 UI、无头模式、Shell 命令及 CLI 专属流程。 | [`apps/cli/`](https://github.com/cline/cline/tree/main/apps/cli) | [CHANGELOG.md](https://github.com/cline/cline/blob/main/apps/cli/CHANGELOG.md) |
|
||
| **VS Code Extension** | Marketplace 扩展及扩展宿主集成。 | [`/`](https://github.com/cline/cline/tree/main) (WIP migrating) | [CHANGELOG.md](https://github.com/cline/cline/blob/main/CHANGELOG.md) |
|
||
| **JetBrains Plugin** | 与共享智能体核心通信的 JetBrains 托管客户端。 | 目前我们尚未开源 JetBrains 插件 | - |
|
||
| **Kanban** | 基于 Web 的多智能体任务看板。 | [`cline/kanban`](https://github.com/cline/kanban) | [CHANGELOG.md](https://github.com/cline/kanban/blob/main/CHANGELOG.md) |
|
||
| **Docs site** | 公开文档页面。 | [`docs/`](https://docs.cline.bot/) | - |
|
||
|
||
## 跨项目编辑代码
|
||
|
||
Cline 会读取你的项目结构,理解文件之间的关系,并在整个代码库中进行协同修改。它在工作时监控 linter 和编译器错误,在你察觉之前就修复缺失导入、类型不匹配和语法错误等问题。在 VS Code 和 JetBrains 中,每次编辑都会以 diff 形式呈现,供你审阅、修改或撤销。所有更改都通过检查点(checkpoint)追踪,因此你可以轻松撤销智能体的工作。
|
||
|
||
## 运行 Bash 命令
|
||
|
||
Cline 会直接在你的终端中执行命令并实时监视输出。安装软件包、运行构建脚本、执行测试、部署应用、管理数据库。对于开发服务器等长时间运行的进程,Cline 会在后台继续工作,并在新输出出现时作出响应,及时捕获编译错误、测试失败和服务器崩溃。
|
||
|
||
## 规划与执行
|
||
|
||
在 Plan 模式与 Act 模式之间切换。在 Plan 模式下,Cline 会探索你的代码库、提出澄清问题并制定策略。双方达成一致后,切换到 Act 模式,Cline 便会执行计划。每次文件编辑和终端命令都需要你的批准,因此你始终掌控实际发生的变化。也可以开启自动批准,让 Cline 自主运行。
|
||
|
||
## 规则与技能(Skills)
|
||
|
||
在 `.clinerules` 文件中定义项目专属规则,指导 Cline 在你的代码库中如何工作:编码标准、架构约定、部署流程、测试要求等。CLI、VS Code 扩展和 JetBrains 插件会自动加载这些规则。使用 skills 让模型在需要时加载特定规则。
|
||
|
||
## 适配各类模型
|
||
|
||
Cline 不绑定单一 AI 提供商。可选用最适合你工作流的模型:
|
||
|
||
| 提供商 | 模型 |
|
||
|----------|--------|
|
||
| Anthropic | Claude Opus, Sonnet, Haiku |
|
||
| OpenAI | GPT 系列模型 |
|
||
| Google | Gemini 系列模型 |
|
||
| OpenRouter | 来自各提供商的 200+ 款模型 |
|
||
| Vercel AI Gateway | 通过单一网关路由至多个提供商 |
|
||
| AWS Bedrock | Claude、Llama 等 |
|
||
| Azure / GCP Vertex | 全部托管模型 |
|
||
| Cerebras / Groq | 高速推理模型 |
|
||
| Ollama / LM Studio | 在本地机器上运行本地模型 |
|
||
| Any OpenAI-compatible API | 自托管或第三方端点 |
|
||
|
||
## 通过插件或 MCP 服务器扩展
|
||
|
||
通过插件扩展 Cline 的能力。借助 SDK,可通过插件系统以编程方式注册工具和生命周期钩子,用于日志记录、审计、策略强制执行或添加领域特定能力。示例如下。
|
||
|
||
```typescript
|
||
import { Agent, createTool } from "@cline/sdk"
|
||
|
||
const deployTool = createTool({
|
||
name: "deploy",
|
||
description: "Deploy the current branch to staging.",
|
||
inputSchema: { type: "object", properties: { env: { type: "string" } }, required: ["env"] },
|
||
execute: async (input) => {
|
||
// your deployment logic
|
||
},
|
||
})
|
||
|
||
const agent = new Agent({ tools: [deployTool], /* ... */ })
|
||
```
|
||
……或通过 [MCP 服务器](https://github.com/modelcontextprotocol) 连接数据库、查询 API、管理云基础设施并与外部系统交互。使用[社区构建的服务器](https://github.com/modelcontextprotocol/servers),或让 Cline 即时创建自定义工具。在 CLI 中,使用 `cline mcp` 管理服务器。
|
||
|
||
## 多智能体团队
|
||
|
||
协调多个智能体协同处理复杂任务。协调者智能体将工作拆分为子任务并委派给专家智能体,各自拥有独立的工具与上下文。团队状态在会话间持久保存,可随时从中断处继续。
|
||
|
||
```bash
|
||
cline --team-name auth-sprint "Plan and implement user authentication with tests"
|
||
```
|
||
|
||
## 定时智能体
|
||
|
||
按 cron 计划运行智能体,实现周期性自动化:每日 PR 摘要、每周依赖检查、代码库健康报告等。计划在重启后仍然保留,且不依赖任何终端会话独立运行。
|
||
|
||
```bash
|
||
cline schedule create "PR summary" \
|
||
--cron "0 9 * * MON-FRI" \
|
||
--prompt "List all open PRs and their review status" \
|
||
--workspace /path/to/repo
|
||
```
|
||
|
||
## 连接 Slack、Telegram、Discord 等
|
||
|
||
从任意消息平台与你的智能体对话:Telegram、Slack、Discord、Google Chat、WhatsApp 和 Linear。每个对话线程对应一个具备完整上下文的智能体会话。可配置访问控制,限制谁可与你的智能体交互。
|
||
|
||
```bash
|
||
# Connect to Telegram
|
||
cline connect telegram -k $BOT_TOKEN
|
||
# Connect to Slack through webhook
|
||
cline connect slack --bot-token $SLACK_TOKEN --signing-secret $SECRET --base-url $URL
|
||
# Connect to Slack using socket mode
|
||
cline connect slack --bot-token $SLACK_TOKEN --app-token $SLACK_APP_TOKEN
|
||
```
|
||
|
||
## 适用于 CI/CD 的无头 CLI
|
||
|
||
以零交互方式运行 Cline,用于脚本编写与自动化。管道输入、获取 JSON 输出、串联命令,并集成到 CI/CD 流水线中。
|
||
|
||
```bash
|
||
cline "Run tests and fix any failures"
|
||
git diff origin/main | cline "Review these changes for issues"
|
||
cline --json "List all TODO comments" | jq -r 'select(.type == "agent_event" and .event.text) | .event.text'
|
||
```
|
||
|
||
## 贡献
|
||
|
||
请先阅读[贡献指南](CONTRIBUTING.md)。加入我们的 [Discord](https://discord.gg/cline),前往 `#contributors` 频道与其他贡献者交流。查看我们的[招聘页面](https://cline.bot/join-us),了解全职岗位。
|
||
|
||
## 许可证
|
||
|
||
[Apache 2.0 © 2026 Cline Bot Inc.](./LICENSE)
|