> ## Documentation Index
> Fetch the complete documentation index at: https://docs.olostep.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 安装和更新 Olostep CLI

> 安装 olostep 命令，保持其更新，并移除它。

## 要求

* macOS 或 Linux，带有 POSIX shell。
* [Node.js](https://nodejs.org) 20.19 或更新版本，以及 `npm`（Node.js 自带）。
* `curl` 或 `wget`。

检查你的 Node.js 版本：

```bash theme={null}
node -v
```

## 安装

```bash theme={null}
curl -fsSL https://cli.olostep.com | sh
```

该脚本：

1. 检查 Node.js 20.19+ 和 `npm`。
2. 下载 CLI 包并检查其 SHA-256 校验和。如果校验和不同，则不安装任何内容。
3. 将包安装到 `~/.olostep`。不需要 `sudo`。
4. 将 `olostep` 链接到已在你的 `PATH` 中的可写目录。如果没有，则链接到 `~/.local/bin` 并将该目录添加到你的 shell 启动文件（`~/.zshrc`、`~/.bashrc` 或 `~/.bash_profile`，fish 的 `conf.d`，或 `~/.profile`）。

完成后，它会打印 `Installed olostep <version> in ~/.olostep/bin`。如果它必须更改你的 `PATH`，请先打开一个新的终端。然后运行：

```bash theme={null}
olostep
```

### 安装到其他位置

设置 `OLOSTEP_HOME` 为一个绝对路径，以便安装到该位置而不是 `~/.olostep`：

```bash theme={null}
curl -fsSL https://cli.olostep.com | OLOSTEP_HOME="$HOME/tools/olostep" sh
```

> [!NOTE]
>
> 如果另一个 `olostep` 命令已经在你的 `PATH` 中并且不是由此脚本安装的，脚本将停止。先移除另一个，然后再次运行脚本。较旧的 npm 包 `olostep-cli` 是一个单独的旧工具，不在这些文档的范围内。

## 更新

运行：

```bash theme={null}
olostep update
```

`olostep update` 会再次运行安装脚本：`curl -fsSL https://cli.olostep.com | sh`。你自己运行脚本也是一样的效果。

当有新版本发布时，CLI 会在命令完成后通知你：

```text theme={null}
A new version of olostep is out: <version> (you have <version>). Run olostep update to get it.
```

该通知仅在终端中显示给人。它不会显示给代码代理，当设置了 `CI` 或使用 `--json` 时。

## 卸载

**1. 登出**

```bash theme={null}
olostep logout
```

Olostep 撤销此计算机的连接，CLI 忘记其登录。若你从未登录，可以跳过此步骤。

**2. 移除链接的命令**

```bash theme={null}
rm "$(command -v olostep)"
```

这将移除安装程序放在你 `PATH` 中的 `olostep` 链接。

**3. 移除安装**

```bash theme={null}
rm -rf ~/.olostep
```

如果你设置了 `OLOSTEP_HOME` 路径，请使用它。

**4. 移除 CLI 的设置**

```bash theme={null}
rm -rf "${XDG_CONFIG_HOME:-$HOME/.config}/olostep"
```

该文件夹保存了已登录信息和 `olostep chat` 对话引用。

如果安装程序在你的 shell 启动文件中添加了一行 `PATH`，它位于注释 `# olostep CLI` 下方。删除这两行。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.