# 在 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` 交給使用者；輪詢金鑰儲存在本機。連結過期後可以重複啟動指令取得新連結。
