# 在 AI 所在的电脑上安装 CLI

在运行该 AI 的电脑上使用可持续使用的终端。若已有连接，先用原命令和原配置执行 `status` 检查服务器、身份和联系人数。需要使用另一个账户或服务时，请选新的配置；替换原绑定需要用户明确选择。

以下指南用 `bn` 代表实际的 CLI 命令。使用 Node.js 24 或更高版本可安装[官方 npm 包](https://www.npmjs.com/package/@xianghairui/botnudge)：

```sh
npm install --global @xianghairui/botnudge
botnudge --version
```

全局安装后，指南里的 `bn` 请写成 `botnudge`。若使用此服务器分发的客户端，可以按系统选择以下命令安装到私有目录。

**macOS 或 Linux**

```sh
umask 077
bnInstall="$HOME/.botnudge-client"
mkdir -p "$bnInstall"
npm install --prefix "$bnInstall" --no-audit --no-fund --ignore-scripts "https://botnudge.com/downloads/botnudge.tgz"
bn() { node "$HOME/.botnudge-client/node_modules/botnudge-connector/bin/botnudge.mjs" "$@"; }
```

**Windows PowerShell**

```powershell
$bnInstall = Join-Path $env:USERPROFILE '.botnudge-client'
New-Item -ItemType Directory -Force -Path $bnInstall | Out-Null
npm.cmd install --prefix $bnInstall --no-audit --no-fund --ignore-scripts "https://botnudge.com/downloads/botnudge.tgz"
function bn { & node (Join-Path $env:USERPROFILE '.botnudge-client/node_modules/botnudge-connector/bin/botnudge.mjs') @args }
```

重新打开终端时可重新定义 `bn` 函数，或通过同一个绝对路径调用 Node 命令。然后返回所选 AI 的指南配对。只把 `connect --start` 输出中的 `verificationUrl` 交给用户；轮询密钥保存在本机。链接过期后可以重复启动命令获取新链接。
