Browse Source

docs: add CLI uninstall instructions (#203)

DanielWalnut 2 tháng trước cách đây
mục cha
commit
a5639bcc61
3 tập tin đã thay đổi với 109 bổ sung và 1 xóa
  1. 54 0
      README.md
  2. 54 0
      README_ZH.md
  3. 1 1
      docs/installation.md

+ 54 - 0
README.md

@@ -45,6 +45,8 @@ curl -fsSL https://filecdn.minimax.chat/public/install.sh | bash
 irm https://filecdn.minimax.chat/public/install.ps1 | iex
 irm https://filecdn.minimax.chat/public/install.ps1 | iex
 ```
 ```
 
 
+The scripts install into `~/.minimax-code` on macOS / Linux / WSL and `%USERPROFILE%\.minimax-code` on Windows. The launchers are `bin/mcode` and `bin/mcode-tools` on POSIX, or `mcode.cmd` / `mcode.ps1` and `mcode-tools.cmd` / `mcode-tools.ps1` on Windows. Set `MCODE_INSTALL_DIR` before installation to choose a different location. See [Uninstall](#uninstall) to remove the CLI.
+
 **npm** — if you already have **Node.js 22.19+ (22.x), 24.2+ (24.x), 25, or 26**:
 **npm** — if you already have **Node.js 22.19+ (22.x), 24.2+ (24.x), 25, or 26**:
 
 
 ```bash
 ```bash
@@ -143,6 +145,58 @@ Inside the TUI, use `/sessions` to find previous sessions and `/help` to see all
 | Switch permission modes | `Alt+M` |
 | Switch permission modes | `Alt+M` |
 | Close a panel or interrupt a running task | `Esc` |
 | Close a panel or interrupt a running task | `Esc` |
 
 
+## Uninstall
+
+Close running MCode sessions, including editor integrations, before uninstalling. First locate the command with `command -v mcode` (macOS / Linux / WSL) or `Get-Command mcode -All` (PowerShell), then follow the matching installation method below. The current official install scripts do **not** provide an uninstall flag.
+
+### Installed with the script
+
+The commands below remove the default installation directory, including both launchers, downloaded releases, and any installer-managed Node.js runtime. If you used `MCODE_INSTALL_DIR`, substitute the actual installation directory. Inspect it first: earlier source builds used `~/.minimax-code` for user data, and a custom data directory can overlap the installation. Back up any configuration or sessions you want to keep before deleting it.
+
+**macOS / Linux / WSL**
+
+```bash
+rm -rf -- "$HOME/.minimax-code"
+```
+
+Remove the `# MiniMax Code CLI` comment and its following PATH line from the shell file the installer updated: `~/.zshrc` for zsh; the first existing file among `~/.bashrc`, `~/.bash_profile`, and `~/.profile` for bash (or a newly created `~/.bashrc`); `~/.config/fish/config.fish` for fish; or `~/.profile` for other shells. The line is `export PATH="/absolute/install/path/bin:$PATH"`, or `fish_add_path -g "/absolute/install/path/bin"` for fish. Remove only the MCode entry, preserving other PATH settings. The installer skips this edit when `MCODE_NO_MODIFY_PATH` is set or the path is already present.
+
+**Windows (PowerShell)**
+
+```powershell
+Remove-Item -LiteralPath "$env:USERPROFILE\.minimax-code" -Recurse -Force
+```
+
+Open **Edit environment variables for your account**, edit the user **Path**, and remove only the installation directory entry (by default `%USERPROFILE%\.minimax-code`, which may appear as an expanded absolute path). The Windows installer updates the user Path, not the PowerShell profile; `MCODE_NO_MODIFY_PATH` skips that persistent update.
+
+### Installed with npm or from source
+
+For a global npm installation, use the same npm installation/prefix you used to install MCode:
+
+```bash
+npm uninstall -g @minimax-ai/code
+```
+
+For a source build, save any work and remove only the checkout you created; see [Update or remove](docs/installation.md#update-or-remove).
+
+After uninstalling, reopen your terminal (fully restart the editor for integrated terminals) and run `command -v mcode` or `Get-Command mcode -All` again. No result means the command is no longer on PATH. If another copy appears, identify its installation method before removing it.
+
+### Optional: delete user data
+
+Removing the program leaves separately stored user data in place. To also delete local login state, provider configuration, caches, and sessions, first confirm the selected directory using [Accounts and data](docs/installation.md#accounts-and-data) and back up anything you need. Other MCode installations can share this directory. For the default `~/.minimax` directory only:
+
+```bash
+# macOS / Linux / WSL — permanently deletes the default user data
+rm -rf -- "$HOME/.minimax"
+```
+
+```powershell
+# Windows — permanently deletes the default user data
+Remove-Item -LiteralPath "$env:USERPROFILE\.minimax" -Recurse -Force
+```
+
+A profile uses `~/.minimax-<profile>`; `MINIMAX_DATA_DIR` or `MAVIS_DATA_DIR` can select a different location. Remove only the specific directories you intend to discard, without wildcard deletion. Remove any MCode-specific environment variable assignments you added to shell profiles or user environment settings if you no longer need them.
+
 ## What you can do
 ## What you can do
 
 
 | Task | Capabilities |
 | Task | Capabilities |

+ 54 - 0
README_ZH.md

@@ -45,6 +45,8 @@ curl -fsSL https://filecdn.minimax.chat/public/install.sh | bash
 irm https://filecdn.minimax.chat/public/install.ps1 | iex
 irm https://filecdn.minimax.chat/public/install.ps1 | iex
 ```
 ```
 
 
+脚本在 macOS / Linux / WSL 上默认安装到 `~/.minimax-code`,在 Windows 上默认安装到 `%USERPROFILE%\.minimax-code`。POSIX 启动器为 `bin/mcode` 和 `bin/mcode-tools`;Windows 启动器为 `mcode.cmd` / `mcode.ps1` 和 `mcode-tools.cmd` / `mcode-tools.ps1`。安装前设置 `MCODE_INSTALL_DIR` 可更改安装位置。移除 CLI 的方法见[卸载](#卸载)。
+
 **npm**:适用于已安装 **Node.js 22.19+(22.x)、24.2+(24.x)、25 或 26** 的环境。
 **npm**:适用于已安装 **Node.js 22.19+(22.x)、24.2+(24.x)、25 或 26** 的环境。
 
 
 ```bash
 ```bash
@@ -143,6 +145,58 @@ mcode --session
 | 切换权限模式 | `Alt+M` |
 | 切换权限模式 | `Alt+M` |
 | 关闭面板或中断正在运行的任务 | `Esc` |
 | 关闭面板或中断正在运行的任务 | `Esc` |
 
 
+## 卸载
+
+卸载前请关闭正在运行的 MCode 会话,包括编辑器中的集成。先通过 `command -v mcode`(macOS / Linux / WSL)或 `Get-Command mcode -All`(PowerShell)定位命令,再按对应的安装方式操作。当前官方安装脚本**不提供卸载参数**。
+
+### 通过脚本安装
+
+以下命令会删除默认安装目录,包括两个启动器、下载的版本,以及安装器管理的 Node.js 运行时。如果使用过 `MCODE_INSTALL_DIR`,请替换为实际安装目录。删除前请先检查:早期源码构建曾将用户数据保存在 `~/.minimax-code`,自定义数据目录也可能与安装目录重合。请先备份需要保留的配置和会话。
+
+**macOS / Linux / WSL**
+
+```bash
+rm -rf -- "$HOME/.minimax-code"
+```
+
+从安装器修改的 shell 配置文件中删除 `# MiniMax Code CLI` 注释及其下一行 PATH 配置:zsh 使用 `~/.zshrc`;bash 依次选择 `~/.bashrc`、`~/.bash_profile`、`~/.profile` 中第一个已存在的文件,均不存在时创建 `~/.bashrc`;fish 使用 `~/.config/fish/config.fish`;其他 shell 使用 `~/.profile`。对应配置为 `export PATH="/absolute/install/path/bin:$PATH"`,fish 则为 `fish_add_path -g "/absolute/install/path/bin"`。只移除 MCode 对应的条目,保留其他 PATH 设置。如果设置了 `MCODE_NO_MODIFY_PATH` 或路径已存在,安装器会跳过此修改。
+
+**Windows(PowerShell)**
+
+```powershell
+Remove-Item -LiteralPath "$env:USERPROFILE\.minimax-code" -Recurse -Force
+```
+
+打开“编辑账户的环境变量”,编辑用户 **Path**,仅删除安装目录对应的条目(默认为 `%USERPROFILE%\.minimax-code`,也可能显示为展开后的绝对路径)。Windows 安装器修改的是用户 Path,不是 PowerShell 配置文件;设置 `MCODE_NO_MODIFY_PATH` 会跳过此持久化修改。
+
+### 通过 npm 或源码安装
+
+全局 npm 安装请使用当初安装 MCode 时的同一套 npm 和安装前缀:
+
+```bash
+npm uninstall -g @minimax-ai/code
+```
+
+源码构建请先保存工作,再仅删除自己创建的源码目录,详见[更新或移除](docs/installation.md#update-or-remove)。
+
+卸载后重新打开终端(编辑器集成终端需要完全重启编辑器),再次运行 `command -v mcode` 或 `Get-Command mcode -All`。没有结果表示 PATH 中已找不到该命令。如果出现另一份安装,请先确认它的安装方式再移除。
+
+### 可选:删除用户数据
+
+移除程序会保留单独存储的用户数据。如果还要删除本地登录状态、提供方配置、缓存和会话,请先按[账号与数据](docs/installation.md#accounts-and-data)确认实际数据目录,并备份需要保留的内容。其他 MCode 安装可能共用该目录。以下命令仅适用于默认的 `~/.minimax`:
+
+```bash
+# macOS / Linux / WSL — 永久删除默认用户数据
+rm -rf -- "$HOME/.minimax"
+```
+
+```powershell
+# Windows — 永久删除默认用户数据
+Remove-Item -LiteralPath "$env:USERPROFILE\.minimax" -Recurse -Force
+```
+
+profile 使用 `~/.minimax-<profile>`;`MINIMAX_DATA_DIR` 或 `MAVIS_DATA_DIR` 可以指定其他位置。只删除确定不再需要的具体目录,不要使用通配符批量删除。如果不再需要自行添加的 MCode 环境变量,也请从 shell 配置或用户环境变量设置中移除对应赋值。
+
 ## 可以做什么
 ## 可以做什么
 
 
 | 场景 | 使用方式 |
 | 场景 | 使用方式 |

+ 1 - 1
docs/installation.md

@@ -64,4 +64,4 @@ For tests, explicitly set `MINIMAX_DATA_DIR` to a temporary directory to keep no
 
 
 Save your changes, fetch a reviewed revision with Git, then repeat the frozen install and build. A source installation does not automatically become an official npm installation.
 Save your changes, fetch a reviewed revision with Git, then repeat the frozen install and build. A source installation does not automatically become an official npm installation.
 
 
-To uninstall, remove the source directory you created. User data is separate and remains in place. Delete that directory only when you no longer need its account configuration or sessions.
+To uninstall a source build, save any work and remove the source directory you created. Separately stored user data remains in place. See [Uninstall](../README.md#uninstall) for official installer and npm removal, shell PATH cleanup, and optional user-data deletion.