Skip to content

Commit 34ffd4b

Browse files
authored
feat(adapters): add cline_cli acp (#2931)
1 parent e010179 commit 34ffd4b

4 files changed

Lines changed: 76 additions & 1 deletion

File tree

doc/configuration/adapters-acp.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,15 @@ require("codecompanion").setup({
308308
})
309309
```
310310

311+
## Setup: Cline CLI
312+
313+
To use [Cline CLI](https://cline.bot/cli) within CodeCompanion, you'll need to take the following steps:
314+
315+
1. [Install](https://docs.cline.bot/getting-started/installing-cline#cli) Cline CLI.
316+
2. Authenticate by running `cline auth`.
317+
3. Select the `cline_cli` adapter in your chat buffer
318+
319+
311320
## Setup: Codex
312321

313322
To use OpenAI's [Codex](https://openai.com/codex/), install an ACP-compatible adapter like [this](https://github.com/zed-industries/codex-acp) one from [Zed](https://zed.dev).

doc/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CodeCompanion is a Neovim plugin which enables you to code with AI, using LLMs a
2121
- :speech_balloon: [Copilot Chat](https://github.com/features/copilot) meets [Zed AI](https://zed.dev/blog/zed-ai), in Neovim
2222
- :zap: Integrates Neovim with LLMs and Agents in the CLI
2323
- :electric_plug: Support for LLMs from Anthropic, Copilot, GitHub Models, DeepSeek, Gemini, Mistral AI, Novita, Ollama, OpenAI, Azure OpenAI, HuggingFace and xAI out of the box (or bring your own!)
24-
- :robot: Support for [Agent Client Protocol](https://agentclientprotocol.com/overview/introduction), enabling coding with agents like [Augment Code](https://docs.augmentcode.com/cli/overview), [Cagent](https://github.com/docker/cagent) from Docker, [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview), [Codex](https://openai.com/codex), [Copilot CLI](https://github.com/features/copilot/cli), [Gemini CLI](https://github.com/google-gemini/gemini-cli), [Goose](https://block.github.io/goose/), [Cursor CLI](https://cursor.com/docs/cli/overview), [Kimi CLI](https://github.com/MoonshotAI/kimi-cli), [Kiro](https://kiro.dev/cli/), [Mistral Vibe](https://github.com/mistralai/mistral-vibe) and [OpenCode](https://opencode.ai)
24+
- :robot: Support for [Agent Client Protocol](https://agentclientprotocol.com/overview/introduction), enabling coding with agents like [Augment Code](https://docs.augmentcode.com/cli/overview), [Cagent](https://github.com/docker/cagent) from Docker, [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview), [Cline CLI](https://docs.cline.bot/home), [Codex](https://openai.com/codex), [Copilot CLI](https://github.com/features/copilot/cli), [Gemini CLI](https://github.com/google-gemini/gemini-cli), [Goose](https://block.github.io/goose/), [Cursor CLI](https://cursor.com/docs/cli/overview), [Kimi CLI](https://github.com/MoonshotAI/kimi-cli), [Kiro](https://kiro.dev/cli/), [Mistral Vibe](https://github.com/mistralai/mistral-vibe) and [OpenCode](https://opencode.ai)
2525
- :heart_hands: User contributed and supported [adapters](/configuration/adapters-http#community-adapters)
2626
- :battery: Support for [Model Context Protocol (MCP)](/model-context-protocol)
2727
- :rocket: [Inline transformations](/usage/inline.html), code creation and refactoring
@@ -47,6 +47,7 @@ CodeCompanion uses [HTTP](configuration/adapters-http) and [ACP](configuration/a
4747
- Augment Code (`auggie_cli`) - Requires an API key
4848
- Cagent (`cagent`)
4949
- Claude Code (`claude_code`) - Requires an API key or a Claude Pro subscription
50+
- Cline CLI (`cline_cli`)
5051
- Codex (`codex`) - Requires an API key
5152
- Copilot (`copilot`) - Requires a token which is created via `:Copilot setup` in [Copilot.vim](https://github.com/github/copilot.vim)
5253
- Gemini CLI (`gemini_cli`) - Requires an API key or a Gemini Pro subscription
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
local helpers = require("codecompanion.adapters.acp.helpers")
2+
3+
---@class CodeCompanion.ACPAdapter.ClineCLI: CodeCompanion.ACPAdapter
4+
return {
5+
name = "cline_cli",
6+
formatted_name = "Cline CLI",
7+
type = "acp",
8+
roles = {
9+
llm = "assistant",
10+
user = "user",
11+
},
12+
opts = {
13+
vision = true,
14+
},
15+
commands = {
16+
default = {
17+
"cline",
18+
"--acp",
19+
},
20+
},
21+
defaults = {
22+
mcpServers = {},
23+
timeout = 20000, -- 20 seconds
24+
-- mode = "plan", -- Optional: Set default agent mode (e.g., "plan", "act")
25+
},
26+
parameters = {
27+
protocolVersion = 1,
28+
clientCapabilities = {
29+
fs = { readTextFile = true, writeTextFile = true },
30+
},
31+
clientInfo = {
32+
name = "CodeCompanion.nvim",
33+
version = "1.0.0",
34+
},
35+
},
36+
handlers = {
37+
---@param self CodeCompanion.ACPAdapter
38+
---@return boolean
39+
setup = function(self)
40+
return true
41+
end,
42+
43+
---Manually handle authentication
44+
---@param self CodeCompanion.ACPAdapter
45+
---@return boolean
46+
auth = function(self)
47+
return true
48+
end,
49+
50+
---@param self CodeCompanion.ACPAdapter
51+
---@param messages table
52+
---@param capabilities table
53+
---@return table
54+
form_messages = function(self, messages, capabilities)
55+
return helpers.form_messages(self, messages, capabilities)
56+
end,
57+
58+
---Function to run when the request has completed. Useful to catch errors
59+
---@param self CodeCompanion.ACPAdapter
60+
---@param code number
61+
---@return nil
62+
on_exit = function(self, code) end,
63+
},
64+
}

lua/codecompanion/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ local defaults = {
3939
auggie_cli = "auggie_cli",
4040
cagent = "cagent",
4141
claude_code = "claude_code",
42+
cline_cli = "cline_cli",
4243
codex = "codex",
4344
cursor_cli = "cursor_cli",
4445
copilot_acp = "copilot_acp",

0 commit comments

Comments
 (0)