Skip to content
文档
Chat2DB CLI
安装与状态检查

安装与状态检查

本页覆盖 Chat2DB CLI 的安装、版本检查、状态检查、运行时检查和 shell completion。建议所有 CLI 操作都从 versionstatus 开始。

安装 CLI

macOS shell:

curl -fsSL https://cdn.chat2db-ai.com/install/cli.sh | sh

Windows PowerShell:

iwr https://cdn.chat2db-ai.com/install/cli.ps1 -UseBasicParsing | iex

安装完成后重新打开终端,确认命令可用:

command -v chat2db
chat2db version --json

示例输出:

{"data":{"command":"version","version":"0.1.25"},"ok":true}

检查当前状态

chat2db status --json

status 会同时检查 Chat2DB Pro / Local 的 App、CLI runtime 和 MCP 状态。重点看这些字段:

字段含义
data.cli_version当前 CLI 版本
summary.pro.app.statePro 应用是否运行
summary.pro.cli.statePro CLI runtime 是否运行
summary.pro.mcp.enabledPro MCP 是否已启用
summary.local.*Local 对应状态
next_actionCLI 建议的下一步操作
safe_to_exit当前 edition 是否可以安全退出

常见状态:

状态说明
running对应进程或 runtime 正在运行
stopped未运行
not_installed本机没有安装对应 edition
aliveMCP endpoint 可访问
not_listeningMCP 端口未监听
ambiguous状态不唯一,通常需要先停止另一个 edition 或重新检查

安装 Chat2DB Pro / Local

CLI 可以安装或更新桌面应用。默认安装 Pro:

chat2db install --edition pro --json

安装 Local:

chat2db install --edition local --json

只查看将要执行什么,不下载、不写入:

chat2db install --edition pro --dry-run --json

后台安装:

chat2db install --edition all --background --json

后台安装日志见 更新与排障

启动和停止应用

打开 Pro:

chat2db start --edition pro --json

停止 Pro:

chat2db stop --edition pro --json

停止 Pro 的 App、CLI runtime 和 MCP:

chat2db stop --edition pro --all --json

--all 会影响本机运行状态,适合清理异常进程或准备退出。

CLI runtime

runtime 是 CLI 执行数据源和 SQL 命令时使用的本机 headless runtime。它监听 127.0.0.1,通常会被 db / sql 命令自动启动。

chat2db runtime status --edition pro --json
chat2db runtime start --edition pro --json
chat2db runtime stop --edition pro --json

如果 dbsql 命令失败,先看:

chat2db status --json
chat2db runtime status --edition pro --json

Shell completion

安装当前 shell 的补全:

chat2db completions --install

指定 shell:

chat2db completions --shell zsh
chat2db completions --shell bash
chat2db completions --install --shell fish

--install 会写入本机 shell 配置或 completion 目录。只想预览脚本时,不要加 --install

常见问题

chat2db 命令不存在

重新打开终端,或检查安装目录是否在 PATH 中:

command -v chat2db

如果仍然不存在,重新执行 CLI 安装命令。

App 未安装

status 中如果出现 not_installed,先安装对应 edition:

chat2db install --edition pro --json

状态显示 ambiguous

通常表示端口或进程状态不唯一。先查看两个 edition:

chat2db status --json

如果要清理 Pro:

chat2db stop --edition pro --all --json