@comate/zulu
v0.8.3
Published
AI Coding Agent
Readme
Zulu CLI
环境
- nodejs >= 18
- ripgrep >= 12 需要手动安装该库
安装
安装 Zulu-CLI
npm install -g @comate/zulu安装 ripgrep
以下是在不同操作系统和包管理器中安装ripgrep的常见命令:
MacOS
brew install ripgrepWindows
winget install BurntSushi.ripgrep.MSVCUbuntu/Debian
sudo apt update
sudo apt install ripgrepCentOS
sudo yum install epel-release
sudo yum install ripgrep验证安装
安装完成后,可以使用以下命令验证:
rg --version选择适合你操作系统和包管理器的命令即可。推荐使用系统自带的包管理器,这样更容易管理和更新。
网络
默认请求https://comate.baidu.com,如果环境未知,请执行zulu --ping测试连通性,如果不通:
- 厂内用户可以使用export HTTP_HOST="https://comate-saas-proxy.now.baidu-int.com"修改默认请求的域名
- 私有服务或者其他特殊场景可以设置export HTTP_HOST="xxxx"其他zulu支持的域名
使用
zulu run --query="你好" --license=xxxx命令执行后会以STDOUT形式返回模型完整的JSON数据日志,文件操作直接应用到文件
Command
| command | 是否必须 | option | 描述 | |:---|:---|:---|:---| | run | 是 | --license | license的值 | | run | 是 | --query | 问题的内容 | | run | | --cwd | 工作路径,默认执行时所在地址 | | run | | --ripgrep | ripgrep的绝对路径 | | run | | --max | max模式的模型id。注意,指定模型只能在首轮对话生效,中途无法更换模型| | run | | --normal | normal模式的模型id。注意,指定模型只能在首轮对话生效,中途无法更换模型| | run | | --conversation | conversation id,如果需要多轮对话,将上一轮对话的id传入此参数,详情见下文 | | run | | --delay | 模型调用的延迟时间,单位毫秒 | | run | | --rules | 指定规则文件路径(路径为基于当前目录的相对路径,可通过 list 指令查看可用项), 支持指定多个规则文件路径,使用逗号(,)分隔 | | run | | --agent | agent的ID或名称,用于指定特定的 agent 进行对话 | | run | | --command | 指令的ID或名称,用于指定特定的指令进行对话 | | list | 是 | --license | license的值 | | list | | --max | 获取max模式支持的模型信息 | | list | | --normal | 获取normal模式支持的模型信息 | | list | | --rules | 列举当前目录下可用规则列表 | | list | | --mcp | 列举当前目录下可用mcp列表 | | list | | --agents | 列举可用agent列表 | | list | | --command | 列举可用指令列表 | | | | --ping | 测试网络连通性 | | | | --help | 帮助 | | | | --version | 版本号 |
Env
| key | value | 描述 | |:---|:---|:---| | HTTP_PROXY | string | 设置代理 | | http_proxy | string | 设置代理 | | HTTPS_PROXY | string | 设置代理 | | https_proxy | string | 设置代理 | | HTTP_HOST | string | 设置服务地址,默认是 https://comate.baidu.com | | DEBUG | boolean | 打开调试日志 |
多轮对话 Conversation 使用注意事项
- 以一次普通的生成结果为例,
conversation的值为conversationInfo.id
{
"type": "partial-message-data",
"conversationInfo": {
"id": "12af9af4-xxxxxx", // 这里就是 conversation id
"status": "Running",
"type": "E2EBotConversation",
"utime": 1755840911964,
"ctime": 1755840911957
},
"messages": [
{
"id": "e884b828-xxxxxx",
"userMessageId": "50039910",
"role": "assistant",
"status": "completed",
"content": {},
"elements": [
{
"id": "1f89ded8-xxxxxxx",
"type": "TEXT",
"status": "success",
"content": "我是Zulu,专注软件工程的智能体,助力实现从需求到代码的全流程开发。请问有什么具体的开发任务需要我协助您完成吗?例如代码开发、问题调试或性能优化等。",
"composer": {
"markdown": "",
"tasks": []
},
"isErrorMessage": false
}
]
}
]
}conversation指定的历史轮次必须在本地存在。历史记录在~/.comate-engine/store,以chat_session_开头,结尾即conversation多轮对话中途无法变更模型
调试
- 使用环境变量
DEBUG=true,STDOUT会显示debug级别的日志 ~/.comate-engine/store中获取对应轮次对话的详细日志
最佳实践
- 请注意,
Zulu CLI使用Turbo模式,黑名单是空,这也意味着Zulu会默认执行所以指令,请注意安全风险 - 目前版本只支持单轮次对话,请尽量准确描述任务
Dockerfile
FROM node:current-alpine3.22
# 安装 ripgrep
RUN apk add --no-cache ripgrep
# 全局安装 @comate/zulu-cli
RUN npm install -g @comate/zulu
WORKDIR /app
CMD ["zulu", "--help"]