codecamp

Ollama Cline CLI

Cline CLI 是 Cline 的命令行版本,面向交互式终端会话的自主编码代理。Cline 在 IDE 里是插件形态(见 12.18 Ollama Cline),CLI 版则完全在终端里工作。

版本基线 v0.40.12,官方 docs.ollama.com/integrations/cline-cli。

一、安装

npm install -g cline

如果没装 Cline CLI 但本机有 npm,直接跑 ollama launch cline 会提示安装 cline@latest,不用手动装。

二、快速启动

ollama launch cline

通过 ollama launch cline 启动时,Ollama 会把 Cline 的 provider 设成 Ollama、指向本地端点、并选中你挑的模型。

只配置不启动:

ollama launch cline --config

三、指定模型

## 本地模型
ollama launch cline --model qwen3.5

## 云端模型
ollama launch cline --model kimi-k2.6:cloud

四、向 Cline 传提示词

-- 之后的参数原样传给 Cline:

## 直接给任务
ollama launch cline -- "summarize this repository"

## 打开 Cline 的看板
ollama launch cline -- kanban

五、手动配置

确认模型就绪

ollama pull qwen3.5

走 Cline 自己的授权流程

cline auth

按提示选 Ollama 作为 provider,base URL 填 http://localhost:11434,模型选 qwen3.5 或 kimi-k2.6:cloud 之类。

查看当前配置

cline config

启动交互会话

cline

六、和 IDE 版 Cline 的区别

维度 Cline CLI Cline(IDE 扩展)
运行位置 终端 VS Code 等编辑器内
安装 npm i -g cline 应用市场装扩展
配置入口 cline auth / cline config 插件设置里的 API Configuration
上下文建议 越大越好 ≥ 32k
适合 服务器、脚本、纯终端流 边写代码边对话

两者共用同一个 Cline 账号体系,但配置各存一份,不会自动同步。

常见问题

现象 原因 处理
cline 命令不存在 未全局安装 npm i -g cline
连不上 Ollama base URL 写错 用 http://localhost:11434
模型下拉为空 本地没有模型 先 ollama pull
改完配置不生效 旧会话缓存 重开终端或 cline config 复核

动手试

## ① 拉模型
ollama pull qwen3.5

## ② 一条命令配好并进入
ollama launch cline

## ③ 或者直接丢个任务
ollama launch cline -- "解释这个项目的目录结构"
Ollama DeepSeek Harness
Ollama Codex CLI
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

Ollama Cloud

Ollama CLI 命令行参考

Ollama Modelfile 参考

Ollama 上下文长度

Ollama 导入自定义模型

Ollama 常见问题

Ollama 硬件支持

Ollama 故障排查

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }